summaryrefslogtreecommitdiff
path: root/include/mbgl/util/geo.hpp
diff options
context:
space:
mode:
authorJustin R. Miller <incanus@codesorcery.net>2015-06-15 18:30:39 -0700
committerJustin R. Miller <incanus@codesorcery.net>2015-06-15 18:30:39 -0700
commitbd0bf294bf1e350b184e54a824430c911dd66b9b (patch)
treed7c643cf197a8263fb1880ce73d034da253efe4c /include/mbgl/util/geo.hpp
parente75e538ddbb1dad0baad02576df86f6b8eb1510f (diff)
downloadqtlocation-mapboxgl-bd0bf294bf1e350b184e54a824430c911dd66b9b.tar.gz
squash of #1655: shape annotations support for core & iOS
Diffstat (limited to 'include/mbgl/util/geo.hpp')
-rw-r--r--include/mbgl/util/geo.hpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp
index ff13726803..1f073ded8f 100644
--- a/include/mbgl/util/geo.hpp
+++ b/include/mbgl/util/geo.hpp
@@ -41,12 +41,24 @@ struct LatLngBounds {
if (point.longitude > ne.longitude) ne.longitude = point.longitude;
}
- inline bool contains(const LatLng& point) {
+ inline void extend(const LatLngBounds& bounds) {
+ extend(bounds.sw);
+ extend(bounds.ne);
+ }
+
+ inline bool contains(const LatLng& point) const {
return (point.latitude >= sw.latitude &&
point.latitude <= ne.latitude &&
point.longitude >= sw.longitude &&
point.longitude <= ne.longitude);
}
+
+ inline bool intersects(const LatLngBounds area) const {
+ return (area.ne.latitude > sw.latitude &&
+ area.sw.latitude < ne.latitude &&
+ area.ne.longitude > sw.longitude &&
+ area.sw.longitude < ne.longitude);
+ }
};
}