diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-10-18 12:12:57 +0300 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-10-19 08:11:41 +0300 |
commit | 2188d68b6c09dec676c294223aa7d1a4c24c85f0 (patch) | |
tree | 8b2d18726e7e3bc3990536e29a2500a9889fd006 /src/mbgl/map/transform.cpp | |
parent | f01a829dc9e076abeb7df90259e8e5c7d9cfbad6 (diff) | |
download | qtlocation-mapboxgl-2188d68b6c09dec676c294223aa7d1a4c24c85f0.tar.gz |
[core] Move TransformState::{un,}project() to Projection
Diffstat (limited to 'src/mbgl/map/transform.cpp')
-rw-r--r-- | src/mbgl/map/transform.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp index 71e7739b5a..85805a109d 100644 --- a/src/mbgl/map/transform.cpp +++ b/src/mbgl/map/transform.cpp @@ -113,8 +113,8 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim // Find the shortest path otherwise. else startLatLng.unwrapForShortestPath(latLng); - const Point<double> startPoint = state.project(startLatLng); - const Point<double> endPoint = state.project(latLng); + const Point<double> startPoint = Projection::project(startLatLng, state.scale); + const Point<double> endPoint = Projection::project(latLng, state.scale); ScreenCoordinate center = getScreenCoordinate(padding); center.y = state.height - center.y; @@ -133,7 +133,6 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim Duration duration = animation.duration ? *animation.duration : Duration::zero(); const double startScale = state.scale; - const double startWorldSize = Projection::worldSize(startScale); const double startAngle = state.angle; const double startPitch = state.pitch; state.panning = latLng != startLatLng; @@ -142,7 +141,7 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim startTransition(camera, animation, [=](double t) { Point<double> framePoint = util::interpolate(startPoint, endPoint, t); - LatLng frameLatLng = state.unproject(framePoint, startWorldSize); + LatLng frameLatLng = Projection::unproject(framePoint, startScale); double frameScale = util::interpolate(startScale, scale, t); state.setLatLngZoom(frameLatLng, state.scaleZoom(frameScale)); @@ -184,8 +183,8 @@ void Transform::flyTo(const CameraOptions &camera, const AnimationOptions &anima LatLng startLatLng = getLatLng(padding).wrapped(); startLatLng.unwrapForShortestPath(latLng); - const Point<double> startPoint = state.project(startLatLng); - const Point<double> endPoint = state.project(latLng); + const Point<double> startPoint = Projection::project(startLatLng, state.scale); + const Point<double> endPoint = Projection::project(latLng, state.scale); ScreenCoordinate center = getScreenCoordinate(padding); center.y = state.height - center.y; @@ -289,7 +288,7 @@ void Transform::flyTo(const CameraOptions &camera, const AnimationOptions &anima return; } - const double startWorldSize = Projection::worldSize(state.scale); + const double startScale = state.scale; state.panning = true; state.scaling = true; state.rotating = angle != startAngle; @@ -305,7 +304,7 @@ void Transform::flyTo(const CameraOptions &camera, const AnimationOptions &anima double frameZoom = startZoom + state.scaleZoom(1 / w(s)); // Convert to geographic coordinates and set the new viewpoint. - LatLng frameLatLng = state.unproject(framePoint, startWorldSize); + LatLng frameLatLng = Projection::unproject(framePoint, startScale); state.setLatLngZoom(frameLatLng, frameZoom); if (angle != startAngle) { |