summaryrefslogtreecommitdiffstats
path: root/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/location/declarativemaps/qdeclarativerectanglemapitem.cpp')
-rw-r--r--src/location/declarativemaps/qdeclarativerectanglemapitem.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp b/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp
index 79750416..0206ac96 100644
--- a/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp
@@ -41,6 +41,7 @@
#include <qnumeric.h>
#include <QRectF>
#include <QPointF>
+#include <QtPositioning/private/qwebmercator_p.h>
#include <QtLocation/private/qgeomap_p.h>
#include <QtPositioning/private/qdoublevector2d_p.h>
#include <QtCore/QScopedValueRollback>
@@ -272,9 +273,12 @@ QSGNode *QDeclarativeRectangleMapItem::updateMapItemPaintNode(QSGNode *oldNode,
*/
void QDeclarativeRectangleMapItem::updatePolish()
{
- if (!map() || !topLeft().isValid() || !bottomRight().isValid())
+ if (!map() || !topLeft().isValid() || !bottomRight().isValid()
+ || map()->geoProjection().projectionType() != QGeoProjection::ProjectionWebMercator)
return;
+ const QGeoProjectionWebMercator &p = static_cast<const QGeoProjectionWebMercator&>(map()->geoProjection());
+
QScopedValueRollback<bool> rollback(updatingGeometry_);
updatingGeometry_ = true;
@@ -299,7 +303,7 @@ void QDeclarativeRectangleMapItem::updatePolish()
QDoubleVector2D borderLeftBoundWrapped;
QList<QList<QDoubleVector2D > > clippedPaths = borderGeometry_.clipPath(*map(), closedPath, borderLeftBoundWrapped);
if (clippedPaths.size()) {
- borderLeftBoundWrapped = map()->geoProjection().geoToWrappedMapProjection(geometryOrigin);
+ borderLeftBoundWrapped = p.geoToWrappedMapProjection(geometryOrigin);
borderGeometry_.pathToScreen(*map(), clippedPaths, borderLeftBoundWrapped);
borderGeometry_.updateScreenPoints(*map(), border_.width());
@@ -355,11 +359,11 @@ void QDeclarativeRectangleMapItem::updatePath()
if (!map())
return;
pathMercator_.clear();
- pathMercator_ << map()->geoProjection().geoToMapProjection(rectangle_.topLeft());
- pathMercator_ << map()->geoProjection().geoToMapProjection(
+ pathMercator_ << QWebMercator::coordToMercator(rectangle_.topLeft());
+ pathMercator_ << QWebMercator::coordToMercator(
QGeoCoordinate(rectangle_.topLeft().latitude(), rectangle_.bottomRight().longitude()));
- pathMercator_ << map()->geoProjection().geoToMapProjection(rectangle_.bottomRight());
- pathMercator_ << map()->geoProjection().geoToMapProjection(
+ pathMercator_ << QWebMercator::coordToMercator(rectangle_.bottomRight());
+ pathMercator_ << QWebMercator::coordToMercator(
QGeoCoordinate(rectangle_.bottomRight().latitude(), rectangle_.topLeft().longitude()));
}