summaryrefslogtreecommitdiff
path: root/include/mbgl/util
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/util')
-rw-r--r--include/mbgl/util/constants.hpp3
-rw-r--r--include/mbgl/util/geo.hpp15
2 files changed, 18 insertions, 0 deletions
diff --git a/include/mbgl/util/constants.hpp b/include/mbgl/util/constants.hpp
index 069e6e41ae..9e0856b68a 100644
--- a/include/mbgl/util/constants.hpp
+++ b/include/mbgl/util/constants.hpp
@@ -2,6 +2,7 @@
#define MBGL_UTIL_CONSTANTS
#include <cmath>
+#include <string>
namespace mbgl {
@@ -15,6 +16,8 @@ extern const double M2PI;
extern const double EARTH_RADIUS_M;
extern const double LATITUDE_MAX;
+extern const std::string ANNOTATIONS_POINTS_LAYER_ID;
+
}
namespace debug {
diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp
index 1d9986bd91..b99a6e6614 100644
--- a/include/mbgl/util/geo.hpp
+++ b/include/mbgl/util/geo.hpp
@@ -19,6 +19,21 @@ struct ProjectedMeters {
: northing(n), easting(e) {}
};
+struct LatLngBounds {
+ LatLng sw = {90, 180};
+ LatLng ne = {-90, -180};
+
+ inline LatLngBounds(LatLng sw_ = {90, 180}, LatLng ne_ = {-90, -180})
+ : sw(sw_), ne(ne_) {}
+
+ inline void extend(const LatLng& point) {
+ if (point.latitude < sw.latitude) sw.latitude = point.latitude;
+ if (point.latitude > ne.latitude) ne.latitude = point.latitude;
+ if (point.longitude < sw.longitude) sw.longitude = point.longitude;
+ if (point.longitude > ne.longitude) ne.longitude = point.longitude;
+ }
+};
+
}
#endif