summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Meyer <dev@meh.at>2015-12-21 09:51:42 +0100
committerHarald Meyer <dev@meh.at>2016-01-01 13:16:19 +0000
commitcf6bf74b900db1efd2f2c6d51313505fade267ee (patch)
treeea9e3e68fca7c625cfb0174c59235c0ad9e0ae88
parent9520c488b0a496baccf8d7037f949b8a5708a490 (diff)
downloadqtlocation-cf6bf74b900db1efd2f2c6d51313505fade267ee.tar.gz
Fixed wrong MapPolyline drawing if line point lies on map center
This patch fixes a bug where the transformation from the source path to the screen points of a MapPolyline fails when a source path point lies exactly on the map's center geo coordinate. Change-Id: I5d13f418d3fbb650b927422861769f3e0ab18bee Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
-rw-r--r--src/imports/location/qdeclarativepolylinemapitem.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp
index 280cbdbe..f2373abf 100644
--- a/src/imports/location/qdeclarativepolylinemapitem.cpp
+++ b/src/imports/location/qdeclarativepolylinemapitem.cpp
@@ -199,6 +199,7 @@ void QGeoMapPolylineGeometry::updateSourcePoints(const QGeoMap &map,
QDoubleVector2D origin, lastPoint, lastAddedPoint;
+ const double mapWidthHalf = map.width()/2.0;
double unwrapBelowX = 0;
if (preserveGeometry_)
unwrapBelowX = map.coordinateToItemPosition(geoLeftBound_, false).x();
@@ -219,7 +220,8 @@ void QGeoMapPolylineGeometry::updateSourcePoints(const QGeoMap &map,
// unwrap x to preserve geometry if moved to border of map
if (preserveGeometry_ && point.x() < unwrapBelowX
&& !qFuzzyCompare(geoLeftBound_.longitude(), coord.longitude())
- && !qFuzzyCompare(point.x(), unwrapBelowX))
+ && !qFuzzyCompare(point.x(), unwrapBelowX)
+ && !qFuzzyCompare(mapWidthHalf, point.x()))
point.setX(unwrapBelowX + geoDistanceToScreenWidth(map, geoLeftBound_, coord));
if (!foundValid) {