diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-02-23 13:22:45 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-02-26 21:17:31 +0200 |
commit | e5ed9d9ddfaf0fe48d2bb987127b69c42ce49ae0 (patch) | |
tree | b61a4ee7ddc30554eda2afb2faa599de92914399 /include/mbgl/util/geo.hpp | |
parent | 7d407175e03c129e4361af871ed4d43f138ab337 (diff) | |
download | qtlocation-mapboxgl-e5ed9d9ddfaf0fe48d2bb987127b69c42ce49ae0.tar.gz |
[core] Use unwrapped longitude for bounds check
Diffstat (limited to 'include/mbgl/util/geo.hpp')
-rw-r--r-- | include/mbgl/util/geo.hpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp index 2df32a7b26..0943c64d5f 100644 --- a/include/mbgl/util/geo.hpp +++ b/include/mbgl/util/geo.hpp @@ -127,15 +127,7 @@ public: (sw.longitude() + ne.longitude()) / 2); } - LatLng constrain(const LatLng& p) const { - if (contains(p)) { - return p; - } - return LatLng { - util::clamp(p.latitude(), sw.latitude(), ne.latitude()), - util::clamp(p.longitude(), sw.longitude(), ne.longitude()) - }; - } + LatLng constrain(const LatLng& p) const; void extend(const LatLng& point) { sw = LatLng(std::min(point.latitude(), sw.latitude()), @@ -171,6 +163,9 @@ private: LatLngBounds(LatLng sw_, LatLng ne_) : sw(std::move(sw_)), ne(std::move(ne_)) {} + bool containsLatitude(double latitude) const; + bool containsLongitude(double longitude, LatLng::WrapMode wrap) const; + friend bool operator==(const LatLngBounds& a, const LatLngBounds& b) { return a.sw == b.sw && a.ne == b.ne; } |