10 #if !defined(GEOGRAPHICLIB_DMS_HPP) 11 #define GEOGRAPHICLIB_DMS_HPP 1 18 # pragma warning (push) 19 # pragma warning (disable: 4251 4127) 94 static void replace(std::string& s,
const std::string& pat,
char c) {
95 std::string::size_type p = 0;
98 if (p == std::string::npos)
100 s.replace(p, pat.length(), 1, c);
103 static const char*
const hemispheres_;
104 static const char*
const signs_;
105 static const char*
const digits_;
106 static const char*
const dmsindicators_;
107 static const char*
const components_[3];
108 static Math::real NumMatch(
const std::string& s);
109 static Math::real InternalDecode(
const std::string& dmsa,
flag& ind);
224 {
return d + (m + s / 60) / 60; }
249 static void DecodeLatLon(
const std::string& dmsa,
const std::string& dmsb,
250 real& lat, real& lon,
251 bool longfirst =
false);
264 static Math::real DecodeAngle(
const std::string& angstr);
278 static Math::real DecodeAzimuth(
const std::string& azistr);
308 static std::string Encode(real angle,
component trailing,
unsigned prec,
309 flag ind = NONE,
char dmssep =
char(0));
329 static std::string
Encode(real angle,
unsigned prec,
flag ind = NONE,
330 char dmssep =
char(0)) {
333 prec < 2 ? DEGREE : (prec < 4 ? MINUTE : SECOND),
334 prec < 2 ? prec : (prec < 4 ? prec - 2 : prec - 4),
345 static void Encode(real ang, real& d, real& m) {
346 d = int(ang); m = 60 * (ang - d);
357 static void Encode(real ang, real& d, real& m, real& s) {
358 d = int(ang); ang = 60 * (ang - d);
359 m = int(ang); s = 60 * (ang - m);
366 #if defined(_MSC_VER) 367 # pragma warning (pop) 370 #endif // GEOGRAPHICLIB_DMS_HPP
#define GEOGRAPHICLIB_EXPORT
GeographicLib::Math::real real
Header for GeographicLib::Utility class.
static std::string Encode(real angle, unsigned prec, flag ind=NONE, char dmssep=char(0))
Convert between degrees and the DMS representation.
Namespace for GeographicLib.
static std::string str(T x, int p=-1)
static Math::real Decode(real d, real m=0, real s=0)
static void Encode(real ang, real &d, real &m, real &s)
Header for GeographicLib::Constants class.
static void Encode(real ang, real &d, real &m)