[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.
This commit is contained in:
Bruno de Oliveira Abinader
2015-11-17 17:02:12 +02:00
parent 711d41f91b
commit cb9b397985
6 changed files with 20 additions and 12 deletions

View File

@@ -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;
}