From bd0bf294bf1e350b184e54a824430c911dd66b9b Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Mon, 15 Jun 2015 18:30:39 -0700 Subject: squash of #1655: shape annotations support for core & iOS --- include/mbgl/util/geo.hpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'include/mbgl/util/geo.hpp') 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); + } }; } -- cgit v1.2.1