diff options
author | Paolo Angelelli <paolo.angelelli@theqtcompany.com> | 2016-08-25 15:29:16 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@theqtcompany.com> | 2016-09-19 15:15:04 +0000 |
commit | 42372ce4c4114f7e38fc5ac681e9199869b4619f (patch) | |
tree | f60e4deed5558557c3c6c2cbb09be9fb42b5d292 /src/imports | |
parent | b33d8c905e5b89a391d465d4bb1210401b3d336b (diff) | |
download | qtlocation-42372ce4c4114f7e38fc5ac681e9199869b4619f.tar.gz |
Fix for Map polygon not working on zoom
This patch fixes a bug in the calculation of the geoleftbound of
map polylines/polygons
Task-number: QTBUG-55535
Change-Id: I11c2d2cecfdb183944d2f2766180938efa3deef6
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/location/qdeclarativepolylinemapitem.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp index e349b287..3c29ad2b 100644 --- a/src/imports/location/qdeclarativepolylinemapitem.cpp +++ b/src/imports/location/qdeclarativepolylinemapitem.cpp @@ -767,15 +767,15 @@ QGeoCoordinate QDeclarativePolylineMapItem::updateLeftBound(const QList<QGeoCoor QGeoCoordinate currentLeftBound) { if (path.isEmpty()) { + deltaXs.clear(); minX = qInf(); return QGeoCoordinate(); } else if (path.size() == 1) { - deltaXs.clear(); - minX = 0.0; + deltaXs.resize(1); + deltaXs[0] = minX = 0.0; return path.last(); - } else if ( path.size() != deltaXs.size() + 2 ) { // this case should not happen - minX = qInf(); - return QGeoCoordinate(); + } else if ( path.size() != deltaXs.size() + 1 ) { // something went wrong. This case should not happen + return computeLeftBound(path, deltaXs, minX); } const QGeoCoordinate &geoFrom = path.at(path.size()-2); @@ -791,7 +791,7 @@ QGeoCoordinate QDeclarativePolylineMapItem::updateLeftBound(const QList<QGeoCoor deltaLongi = longiTo - longiFrom; } - deltaXs.push_back((deltaXs.isEmpty()) ? 0.0 : deltaXs.last() + deltaLongi); + deltaXs.push_back(deltaXs.last() + deltaLongi); if (deltaXs.last() < minX) { minX = deltaXs.last(); return path.last(); |