diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2015-11-17 17:02:12 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2015-11-18 09:37:27 +0200 |
commit | cb9b397985b98a75aa9fa5e6f2b135c205f7cafd (patch) | |
tree | 2cd3a2f2ba4e5c8972663313d21a5c81078311d4 /include | |
parent | 711d41f91b41f471c26ff9de6274ab66e0a83176 (diff) | |
download | qtlocation-mapboxgl-cb9b397985b98a75aa9fa5e6f2b135c205f7cafd.tar.gz |
[core] Fix LatLngBounds default coordinates
LatLngBounds southwest and northeast coordinate points were inverted, so
they could be extended via LatLngBounds::extend(). However, this looks
confusing and error-prone.
A static LatLngBounds::getExtendable() is added to address cases when we
want to extend LatLngBounds.
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/util/geo.hpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp index 98b5daa6f5..4112b183b2 100644 --- a/include/mbgl/util/geo.hpp +++ b/include/mbgl/util/geo.hpp @@ -41,12 +41,19 @@ struct ProjectedMeters { }; struct LatLngBounds { - LatLng sw = {90, 180}; - LatLng ne = {-90, -180}; + LatLng sw = {-90, -180}; + LatLng ne = {90, 180}; - inline LatLngBounds(const LatLng& sw_ = {90, 180}, const LatLng& ne_ = {-90, -180}) + inline LatLngBounds() {} + + inline LatLngBounds(const LatLng& sw_, const LatLng& ne_) : sw(sw_), ne(ne_) {} + static inline LatLngBounds getExtendable() { + LatLngBounds bounds; + return { bounds.ne, bounds.sw }; + } + inline operator bool() const { return sw && ne; } |