From f85889dc75a96b022bedbbfc15be6fc246ae5c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 8 Jun 2015 16:12:01 -0400 Subject: allow constructing LatLng/LatLngBounds objects from TileIDs --- include/mbgl/util/geo.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/mbgl/util/geo.hpp') diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp index 6ece6d4de9..ff13726803 100644 --- a/include/mbgl/util/geo.hpp +++ b/include/mbgl/util/geo.hpp @@ -3,12 +3,17 @@ namespace mbgl { +class TileID; + struct LatLng { double latitude = 0; double longitude = 0; inline LatLng(double lat = 0, double lon = 0) : latitude(lat), longitude(lon) {} + + // Constructs a LatLng object with the top left position of the specified tile. + LatLng(const TileID& id); }; struct ProjectedMeters { @@ -26,6 +31,9 @@ struct LatLngBounds { inline LatLngBounds(LatLng sw_ = {90, 180}, LatLng ne_ = {-90, -180}) : sw(sw_), ne(ne_) {} + // Constructs a LatLngBounds object with the tile's exact boundaries. + LatLngBounds(const TileID& id); + inline void extend(const LatLng& point) { if (point.latitude < sw.latitude) sw.latitude = point.latitude; if (point.latitude > ne.latitude) ne.latitude = point.latitude; -- cgit v1.2.1