diff options
author | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2018-04-26 07:43:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-26 07:43:38 -0700 |
commit | 4344812ef5ef3b5b67e9f313e0c3cc87b3e95c46 (patch) | |
tree | 188ce1c5762acc3dc5dd2c19c71251f9fbfc958d /include | |
parent | c04cf57a74fb17eb33893fb097a9c7e96bf24bcf (diff) | |
download | qtlocation-mapboxgl-4344812ef5ef3b5b67e9f313e0c3cc87b3e95c46.tar.gz |
[core] Streaming TileCover for polygonal regions (#11267)
A per-tile streaming algorithm for tile cover on points, lines, and polygons. Works for individual zoom levels, and not zoom ranges.
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/util/projection.hpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/include/mbgl/util/projection.hpp b/include/mbgl/util/projection.hpp index b4a34521a4..65a84d8dc2 100644 --- a/include/mbgl/util/projection.hpp +++ b/include/mbgl/util/projection.hpp @@ -78,8 +78,9 @@ public: return project_(latLng, worldSize(scale)); } - static Point<double> project(const LatLng& latLng, uint8_t zoom) { - return project_(latLng, std::pow(2.0, zoom)); + //Returns point on tile + static Point<double> project(const LatLng& latLng, int32_t zoom) { + return project_(latLng, 1 << zoom); } static LatLng unproject(const Point<double>& p, double scale, LatLng::WrapMode wrapMode = LatLng::Unwrapped) { @@ -90,16 +91,7 @@ public: wrapMode }; } - - // Project lat, lon to point in a zoom-dependent world size - static Point<double> project(const LatLng& point, uint8_t zoom, uint16_t tileSize) { - const double t2z = tileSize * std::pow(2, zoom); - Point<double> pt = project_(point, t2z); - // Flip y coordinate - auto x = ::round(std::min(pt.x, t2z)); - auto y = ::round(std::min(t2z - pt.y, t2z)); - return { x, y }; - } + private: static Point<double> project_(const LatLng& latLng, double worldSize) { return Point<double> { |