diff options
author | Justin R. Miller <incanus@codesorcery.net> | 2015-03-17 17:30:24 -0700 |
---|---|---|
committer | Justin R. Miller <incanus@codesorcery.net> | 2015-03-17 17:30:24 -0700 |
commit | e049ce6df13c3ad77e9e2ecb2e1afe2992384a35 (patch) | |
tree | 17c21487d53639e3cdf3d6fa9cf78a249a8a67a1 /include/mbgl/util/geo.hpp | |
parent | 1ce51a17e7de5d6a02346efce1539ff7f36e0a6d (diff) | |
download | qtlocation-mapboxgl-e049ce6df13c3ad77e9e2ecb2e1afe2992384a35.tar.gz |
refs #893 #992: point annotations API
Diffstat (limited to 'include/mbgl/util/geo.hpp')
-rw-r--r-- | include/mbgl/util/geo.hpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp index 1d9986bd91..b99a6e6614 100644 --- a/include/mbgl/util/geo.hpp +++ b/include/mbgl/util/geo.hpp @@ -19,6 +19,21 @@ struct ProjectedMeters { : northing(n), easting(e) {} }; +struct LatLngBounds { + LatLng sw = {90, 180}; + LatLng ne = {-90, -180}; + + inline LatLngBounds(LatLng sw_ = {90, 180}, LatLng ne_ = {-90, -180}) + : sw(sw_), ne(ne_) {} + + inline void extend(const LatLng& point) { + if (point.latitude < sw.latitude) sw.latitude = point.latitude; + if (point.latitude > ne.latitude) ne.latitude = point.latitude; + if (point.longitude < sw.longitude) sw.longitude = point.longitude; + if (point.longitude > ne.longitude) ne.longitude = point.longitude; + } +}; + } #endif |