summaryrefslogtreecommitdiff
path: root/include/mbgl/util/geo.hpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2015-11-17 17:02:12 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2015-11-18 09:37:27 +0200
commitcb9b397985b98a75aa9fa5e6f2b135c205f7cafd (patch)
tree2cd3a2f2ba4e5c8972663313d21a5c81078311d4 /include/mbgl/util/geo.hpp
parent711d41f91b41f471c26ff9de6274ab66e0a83176 (diff)
downloadqtlocation-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/mbgl/util/geo.hpp')
-rw-r--r--include/mbgl/util/geo.hpp13
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;
}