diff options
Diffstat (limited to 'include')
-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; } |