From cb9b397985b98a75aa9fa5e6f2b135c205f7cafd Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Tue, 17 Nov 2015 17:02:12 +0200 Subject: [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. --- include/mbgl/util/geo.hpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'include/mbgl/util/geo.hpp') 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; } -- cgit v1.2.1