diff options
author | Justin R. Miller <incanus@codesorcery.net> | 2015-06-15 18:30:39 -0700 |
---|---|---|
committer | Justin R. Miller <incanus@codesorcery.net> | 2015-06-15 18:30:39 -0700 |
commit | bd0bf294bf1e350b184e54a824430c911dd66b9b (patch) | |
tree | d7c643cf197a8263fb1880ce73d034da253efe4c /include/mbgl/util/geo.hpp | |
parent | e75e538ddbb1dad0baad02576df86f6b8eb1510f (diff) | |
download | qtlocation-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.hpp | 14 |
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); + } }; } |