summaryrefslogtreecommitdiff
path: root/include/mbgl/util
diff options
context:
space:
mode:
authorJustin R. Miller <incanus@codesorcery.net>2015-03-17 17:30:24 -0700
committerJustin R. Miller <incanus@codesorcery.net>2015-03-17 17:30:24 -0700
commite049ce6df13c3ad77e9e2ecb2e1afe2992384a35 (patch)
tree17c21487d53639e3cdf3d6fa9cf78a249a8a67a1 /include/mbgl/util
parent1ce51a17e7de5d6a02346efce1539ff7f36e0a6d (diff)
downloadqtlocation-mapboxgl-e049ce6df13c3ad77e9e2ecb2e1afe2992384a35.tar.gz
refs #893 #992: point annotations API
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