diff options
author | rosecodym <rosecodym@gmail.com> | 2016-07-15 16:35:01 -0700 |
---|---|---|
committer | rosecodym <rosecodym@gmail.com> | 2016-07-15 16:44:34 -0700 |
commit | a31c7506b29ffdd284fa5341284d3a9cab3ab5ac (patch) | |
tree | dbc498a9106e1d6e8c02e0a3bb04dbd5f483fd0a | |
parent | 2d1e798954d9681d44d6d2d4e7d4d2decf7202ac (diff) | |
download | qtlocation-mapboxgl-a31c7506b29ffdd284fa5341284d3a9cab3ab5ac.tar.gz |
[core] add TileCoordinate::toLatLng
This inverse of fromLatLng will be used later to test the polygon tile cover code.
-rw-r--r-- | src/mbgl/util/tile_coordinate.hpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mbgl/util/tile_coordinate.hpp b/src/mbgl/util/tile_coordinate.hpp index df240a50e0..b054b5456d 100644 --- a/src/mbgl/util/tile_coordinate.hpp +++ b/src/mbgl/util/tile_coordinate.hpp @@ -16,6 +16,11 @@ public: const double scale = std::pow(2, zoom - state.getZoom()); return { state.project(latLng) * scale / double(util::tileSize), zoom }; } + + LatLng toLatLng(const TransformState& state) const { + const double scale = std::pow(2, z - state.getZoom()); + return state.unproject(p * double(util::tileSize) / scale); + } static TileCoordinate fromScreenCoordinate(const TransformState& state, double zoom, const ScreenCoordinate& point) { return fromLatLng(state, zoom, state.screenCoordinateToLatLng(point)); |