Georef.hpp
Go to the documentation of this file.
1 
10 #if !defined(GEOGRAPHICLIB_GEOREF_HPP)
11 #define GEOGRAPHICLIB_GEOREF_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 lontile_;
43  static const char* const lattile_;
44  static const char* const degrees_;
45  enum {
46  tile_ = 15, // The size of tile in degrees
47  lonorig_ = -180, // Origin for longitude
48  latorig_ = -90, // Origin for latitude
49  base_ = 10, // Base for minutes
50  baselen_ = 4,
51  maxprec_ = 11, // approximately equivalent to MGRS class
52  maxlen_ = baselen_ + 2 * maxprec_,
53  };
54  Georef(); // Disable constructor
55 
56  public:
57 
82  static void Forward(real lat, real lon, int prec, std::string& georef);
83 
110  static void Reverse(const std::string& georef, real& lat, real& lon,
111  int& prec, bool centerp = true);
112 
121  static Math::real Resolution(int prec) {
122  if (prec < 1)
123  return real(prec < 0 ? 15 : 1);
124  else {
125  using std::pow;
126  // Treat prec = 1 as 2.
127  prec = (std::max)(2, (std::min)(int(maxprec_), prec));
128  // Need extra real because, since C++11, pow(float, int) returns double
129  return 1/(60 * real(pow(real(base_), prec - 2)));
130  }
131  }
132 
142  static int Precision(real res) {
143  using std::abs; res = abs(res);
144  for (int prec = 0; prec < maxprec_; ++prec) {
145  if (prec == 1)
146  continue;
147  if (Resolution(prec) <= res)
148  return prec;
149  }
150  return maxprec_;
151  }
152 
153  };
154 
155 } // namespace GeographicLib
156 
157 #if defined(_MSC_VER)
158 # pragma warning (pop)
159 #endif
160 
161 #endif // GEOGRAPHICLIB_GEOREF_HPP
Eigen::Forward
@ Forward
Definition: NumericalDiff.h:19
GeographicLib::Georef::Resolution
static Math::real Resolution(int prec)
Definition: Georef.hpp:121
gtsam.examples.DogLegOptimizerExample.int
int
Definition: DogLegOptimizerExample.py:111
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
GeographicLib::Georef::lattile_
static const char *const lattile_
Definition: Georef.hpp:43
GeographicLib::Georef::degrees_
static const char *const degrees_
Definition: Georef.hpp:44
GeographicLib::Georef::lontile_
static const char *const lontile_
Definition: Georef.hpp:42
real
float real
Definition: datatypes.h:10
GEOGRAPHICLIB_EXPORT
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:91
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::Georef
Conversions for the World Geographic Reference System (georef)
Definition: Georef.hpp:38
ceres::pow
Jet< T, N > pow(const Jet< T, N > &f, double g)
Definition: jet.h:570
GeographicLib::Georef::digits_
static const char *const digits_
Definition: Georef.hpp:41
Constants.hpp
Header for GeographicLib::Constants class.
GeographicLib::Georef::real
Math::real real
Definition: Georef.hpp:40
min
#define min(a, b)
Definition: datatypes.h:19
GeographicLib::Georef::Precision
static int Precision(real res)
Definition: Georef.hpp:142
abs
#define abs(x)
Definition: datatypes.h:17
lon
static const double lon
Definition: testGeographicLib.cpp:34
max
#define max(a, b)
Definition: datatypes.h:20
real
Definition: main.h:100
lat
static const double lat
Definition: testGeographicLib.cpp:34


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:37