summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2018-04-17 13:31:54 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2018-04-19 11:45:58 +0000
commitecc8182f6c6c8b1448a35de46c3f5598bbf35150 (patch)
treea20d08677dd7365b2eb61ddf9307d160d2277928
parentf9b9f578f6e7e1ba572a7f098d53d3a0b0fd4a97 (diff)
downloadqtlocation-ecc8182f6c6c8b1448a35de46c3f5598bbf35150.tar.gz
Fix MapPolyline being drawn misplaced and moving when clipped
Regression introduced in f0bc0db15ed262a8f31bb07b3b46a5cdf9277e79 Change-Id: I4c4a3cb2302daeb825be21f9e2f6c235d2cb7c93 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r--src/location/declarativemaps/qdeclarativepolylinemapitem.cpp8
-rw-r--r--src/location/declarativemaps/qdeclarativepolylinemapitem_p.h3
-rw-r--r--src/location/labs/qsg/qmapcircleobjectqsg.cpp2
-rw-r--r--src/location/labs/qsg/qmappolygonobjectqsg.cpp2
-rw-r--r--src/location/labs/qsg/qmappolylineobjectqsg.cpp2
5 files changed, 10 insertions, 7 deletions
diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
index 44f9b3a1..2f045121 100644
--- a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
@@ -519,7 +519,8 @@ void QGeoMapPolylineGeometry::updateSourcePoints(const QGeoMap &map,
\internal
*/
void QGeoMapPolylineGeometry::updateScreenPoints(const QGeoMap &map,
- qreal strokeWidth)
+ qreal strokeWidth,
+ bool adjustTranslation)
{
if (!screenDirty_)
return;
@@ -583,7 +584,8 @@ void QGeoMapPolylineGeometry::updateScreenPoints(const QGeoMap &map,
}
screenBounds_ = bb;
- this->translate( -1 * sourceBounds_.topLeft() + QPointF(strokeWidth, strokeWidth));
+ const QPointF strokeOffset = (adjustTranslation) ? QPointF(strokeWidth, strokeWidth) : QPointF();
+ this->translate( -1 * sourceBounds_.topLeft() + strokeOffset);
}
void QGeoMapPolylineGeometry::clearSource()
@@ -948,7 +950,7 @@ void QDeclarativePolylineMapItem::updatePolish()
setWidth(geometry_.sourceBoundingBox().width() + 2 * line_.width());
setHeight(geometry_.sourceBoundingBox().height() + 2 * line_.width());
- setPositionOnMap(geometry_.origin(), -1 * geometry_.sourceBoundingBox().topLeft());
+ setPositionOnMap(geometry_.origin(), -1 * geometry_.sourceBoundingBox().topLeft() + QPointF(line_.width(), line_.width()));
}
void QDeclarativePolylineMapItem::markSourceDirtyAndUpdate()
diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h b/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h
index 61439097..a34acad4 100644
--- a/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h
+++ b/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h
@@ -95,7 +95,8 @@ public:
const QGeoCoordinate geoLeftBound);
void updateScreenPoints(const QGeoMap &map,
- qreal strokeWidth);
+ qreal strokeWidth,
+ bool adjustTranslation = true);
void clearSource();
diff --git a/src/location/labs/qsg/qmapcircleobjectqsg.cpp b/src/location/labs/qsg/qmapcircleobjectqsg.cpp
index 10110eab..9fe3ee0a 100644
--- a/src/location/labs/qsg/qmapcircleobjectqsg.cpp
+++ b/src/location/labs/qsg/qmapcircleobjectqsg.cpp
@@ -131,7 +131,7 @@ void QMapCircleObjectPrivateQSG::updateGeometry()
if (clippedPaths.size()) {
borderLeftBoundWrapped = p.geoToWrappedMapProjection(geometryOrigin);
m_borderGeometry.pathToScreen(*m_map, clippedPaths, borderLeftBoundWrapped);
- m_borderGeometry.updateScreenPoints(*m_map, borderWidth());
+ m_borderGeometry.updateScreenPoints(*m_map, borderWidth(), false);
} else {
m_borderGeometry.clear();
}
diff --git a/src/location/labs/qsg/qmappolygonobjectqsg.cpp b/src/location/labs/qsg/qmappolygonobjectqsg.cpp
index 4000c08f..27dcc80f 100644
--- a/src/location/labs/qsg/qmappolygonobjectqsg.cpp
+++ b/src/location/labs/qsg/qmappolygonobjectqsg.cpp
@@ -198,7 +198,7 @@ void QMapPolygonObjectPrivateQSG::updateGeometry()
if (clippedPaths.size()) {
borderLeftBoundWrapped = p.geoToWrappedMapProjection(geometryOrigin);
m_borderGeometry.pathToScreen(*m_map.data(), clippedPaths, borderLeftBoundWrapped);
- m_borderGeometry.updateScreenPoints(*m_map.data(), borderWidth());
+ m_borderGeometry.updateScreenPoints(*m_map.data(), borderWidth(), false);
} else {
m_borderGeometry.clear();
}
diff --git a/src/location/labs/qsg/qmappolylineobjectqsg.cpp b/src/location/labs/qsg/qmappolylineobjectqsg.cpp
index fe6fbec6..c0c3854e 100644
--- a/src/location/labs/qsg/qmappolylineobjectqsg.cpp
+++ b/src/location/labs/qsg/qmappolylineobjectqsg.cpp
@@ -90,7 +90,7 @@ void QMapPolylineObjectPrivateQSG::updateGeometry()
const QList<QDoubleVector2D> &geopathProjected = projectPath();
m_geometry.setPreserveGeometry(true, m_geoPath.boundingGeoRectangle().topLeft());
m_geometry.updateSourcePoints(*m_map.data(), geopathProjected, m_geoPath.boundingGeoRectangle().topLeft());
- m_geometry.updateScreenPoints(*m_map.data(), width());
+ m_geometry.updateScreenPoints(*m_map.data(), width(), false);
QPointF origin = m_map->geoProjection().coordinateToItemPosition(m_geometry.origin(), false).toPointF();
m_geometry.translate(origin - m_geometry.firstPointOffset());