diff options
author | Lev Dragunov <l.dragunov@corp.mail.ru> | 2015-10-27 16:25:30 +0300 |
---|---|---|
committer | Lev Dragunov <l.dragunov@corp.mail.ru> | 2015-10-27 16:25:30 +0300 |
commit | 17f7099da64a8e0a891dbcbfc516218deecbef86 (patch) | |
tree | 12dd3273f5400c670f0b7f01906e5f70fc31cf9d /geometry | |
parent | ba3db415505896e05a45c0daa6a0fef1678c9a86 (diff) |
Using LatLon for WGS coordinates in cross routing.
Diffstat (limited to 'geometry')
-rw-r--r-- | geometry/latlon.hpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/geometry/latlon.hpp b/geometry/latlon.hpp index d5512993f6..4d5d105c29 100644 --- a/geometry/latlon.hpp +++ b/geometry/latlon.hpp @@ -1,5 +1,7 @@ #pragma once +#include "base/math.hpp" + #include "std/string.hpp" namespace ms @@ -9,8 +11,29 @@ namespace ms class LatLon { public: - LatLon(double lat, double lon) : lat(lat), lon(lon) {} double lat, lon; + + LatLon(double lat, double lon) : lat(lat), lon(lon) {} + + static LatLon Zero() { return LatLon(0., 0.); } + + bool operator == (ms::LatLon const & p) const + { + return lat == p.lat && lon == p.lon; + } + + bool EqualDxDy(LatLon const & p, double eps) const + { + return ((fabs(lat - p.lat) < eps) && (fabs(lon - p.lon) < eps)); + } + + struct Hash + { + size_t operator()(ms::LatLon const & p) const + { + return my::Hash(p.lat, p.lon); + } + }; }; string DebugPrint(LatLon const & t); |