GARS.hpp
Go to the documentation of this file.
1 
10 #if !defined(GEOGRAPHICLIB_GARS_HPP)
11 #define GEOGRAPHICLIB_GARS_HPP 1
12 
14 
15 #if defined(_MSC_VER)
16 // Squelch warnings about dll vs string
17 # pragma warning (push)
18 # pragma warning (disable: 4251)
19 #endif
20 
21 namespace GeographicLib {
22 
39  private:
40  typedef Math::real real;
41  static const char* const digits_;
42  static const char* const letters_;
43  enum {
44  lonorig_ = -180, // Origin for longitude
45  latorig_ = -90, // Origin for latitude
46  baselon_ = 10, // Base for longitude tiles
47  baselat_ = 24, // Base for latitude tiles
48  lonlen_ = 3,
49  latlen_ = 2,
50  baselen_ = lonlen_ + latlen_,
51  mult1_ = 2, // base precision = 1/2 degree
52  mult2_ = 2, // 6th char gives 2x more precision
53  mult3_ = 3, // 7th char gives 3x more precision
54  m_ = mult1_ * mult2_ * mult3_,
55  maxprec_ = 2,
56  maxlen_ = baselen_ + maxprec_,
57  };
58  GARS(); // Disable constructor
59 
60  public:
61 
80  static void Forward(real lat, real lon, int prec, std::string& gars);
81 
102  static void Reverse(const std::string& gars, real& lat, real& lon,
103  int& prec, bool centerp = true);
104 
113  static Math::real Resolution(int prec) {
114  return 1/real(prec <= 0 ? mult1_ : (prec == 1 ? mult1_ * mult2_ :
115  mult1_ * mult2_ * mult3_));
116  }
117 
127  static int Precision(real res) {
128  using std::abs; res = abs(res);
129  for (int prec = 0; prec < maxprec_; ++prec)
130  if (Resolution(prec) <= res)
131  return prec;
132  return maxprec_;
133  }
134 
135  };
136 
137 } // namespace GeographicLib
138 
139 #if defined(_MSC_VER)
140 # pragma warning (pop)
141 #endif
142 
143 #endif // GEOGRAPHICLIB_GARS_HPP
Eigen::Forward
@ Forward
Definition: NumericalDiff.h:19
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
GeographicLib::GARS::digits_
static const char *const digits_
Definition: GARS.hpp:41
real
float real
Definition: datatypes.h:10
GEOGRAPHICLIB_EXPORT
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:91
GeographicLib::GARS
Conversions for the Global Area Reference System (GARS)
Definition: GARS.hpp:38
res
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition: PartialRedux_count.cpp:3
GeographicLib::Math::real
double real
Definition: Math.hpp:129
GeographicLib::GARS::letters_
static const char *const letters_
Definition: GARS.hpp:42
GeographicLib::GARS::Resolution
static Math::real Resolution(int prec)
Definition: GARS.hpp:113
GeographicLib::GARS::real
Math::real real
Definition: GARS.hpp:40
Constants.hpp
Header for GeographicLib::Constants class.
abs
#define abs(x)
Definition: datatypes.h:17
GeographicLib::GARS::Precision
static int Precision(real res)
Definition: GARS.hpp:127
lon
static const double lon
Definition: testGeographicLib.cpp:34
real
Definition: main.h:100
lat
static const double lat
Definition: testGeographicLib.cpp:34


gtsam
Author(s):
autogenerated on Tue Jun 25 2024 03:00:53