summaryrefslogtreecommitdiff
path: root/src/location/maps/qgeoprojection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/location/maps/qgeoprojection.cpp')
-rw-r--r--src/location/maps/qgeoprojection.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/location/maps/qgeoprojection.cpp b/src/location/maps/qgeoprojection.cpp
index 783193ed..7fefba27 100644
--- a/src/location/maps/qgeoprojection.cpp
+++ b/src/location/maps/qgeoprojection.cpp
@@ -73,6 +73,17 @@ QGeoProjection::~QGeoProjection()
}
+QGeoCoordinate QGeoProjection::anchorCoordinateToPoint(const QGeoCoordinate &coordinate, const QPointF &anchorPoint) const
+{
+ // Approach: find the displacement in (wrapped) mercator space, and apply that to the center
+ QDoubleVector2D centerProj = geoToWrappedMapProjection(cameraData().center());
+ QDoubleVector2D coordProj = geoToWrappedMapProjection(coordinate);
+
+ QDoubleVector2D anchorProj = itemPositionToWrappedMapProjection(QDoubleVector2D(anchorPoint));
+ // Y-clamping done in mercatorToCoord
+ return wrappedMapProjectionToGeo(centerProj + coordProj - anchorProj);
+}
+
/*
* QGeoProjectionWebMercator implementation
*/
@@ -490,6 +501,11 @@ void QGeoProjectionWebMercator::updateVisibleRegion()
m_visibleRegion = QClipperUtils::pathToQList(res[0]); // Intersection between two convex quadrilaterals should always be a single polygon
}
+QGeoCameraData QGeoProjectionWebMercator::cameraData() const
+{
+ return m_cameraData;
+}
+
/*
*
* Line implementation