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 std::string hemispheres_;
104 static const std::string signs_;
105 static const std::string digits_;
106 static const std::string dmsindicators_;
107 static const std::string components_[3];
108 static Math::real NumMatch(
const std::string& s);
109 static Math::real InternalDecode(
const std::string& dmsa, flag& ind);
199 static Math::real Decode(
const std::string& dms, flag& ind);
214 {
return d + (m + s / 60) / 60; }
225 static Math::real Decode(
const std::string& str)
226 {
return Utility::num<real>(str); }
237 static Math::real DecodeFraction(
const std::string& str)
238 {
return Utility::fract<real>(str); }
267 static void DecodeLatLon(
const std::string& dmsa,
const std::string& dmsb,
268 real& lat, real& lon,
bool swaplatlong =
false);
281 static Math::real DecodeAngle(
const std::string& angstr);
297 static Math::real DecodeAzimuth(
const std::string& azistr);
327 static std::string Encode(real angle, component trailing,
unsigned prec,
328 flag ind = NONE,
char dmssep =
char(0));
348 static std::string
Encode(real angle,
unsigned prec,
flag ind = NONE,
349 char dmssep =
char(0)) {
352 prec < 2 ? DEGREE : (prec < 4 ? MINUTE : SECOND),
353 prec < 2 ? prec : (prec < 4 ? prec - 2 : prec - 4),
364 static void Encode(real ang, real& d, real& m) {
365 d = int(ang); m = 60 * (ang - d);
376 static void Encode(real ang, real& d, real& m, real& s) {
377 d = int(ang); ang = 60 * (ang - d);
378 m = int(ang); s = 60 * (ang - m);
385 #if defined(_MSC_VER)
386 # pragma warning (pop)
389 #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)