diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-06-08 16:12:01 -0400 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-06-08 16:13:37 -0400 |
commit | f85889dc75a96b022bedbbfc15be6fc246ae5c6d (patch) | |
tree | 3191057129e72a2620fc5051ff2644fc2f627108 /include/mbgl/util/geo.hpp | |
parent | 5e661f76176dd95d65d9e1d2478342971e7fd91d (diff) | |
download | qtlocation-mapboxgl-f85889dc75a96b022bedbbfc15be6fc246ae5c6d.tar.gz |
allow constructing LatLng/LatLngBounds objects from TileIDs
Diffstat (limited to 'include/mbgl/util/geo.hpp')
-rw-r--r-- | include/mbgl/util/geo.hpp | 8 |
1 files changed, 8 insertions, 0 deletions
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; |