summaryrefslogtreecommitdiff
path: root/src/imports
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2016-11-03 09:10:19 +0100
committerAlex Blasche <alexander.blasche@qt.io>2016-11-03 09:10:24 +0100
commit05c6863297249784b1775d78ccd831900b5c44c9 (patch)
tree0d3a506ea8156e9b0dc1851b09bc1e74cfa5aa09 /src/imports
parent2a894c5ff9b57f97f47672139db1955161055530 (diff)
parent219e7b84ac048ff585c36f47a1c783af9ae4e4bc (diff)
downloadqtlocation-05c6863297249784b1775d78ccd831900b5c44c9.tar.gz
Merge remote-tracking branch 'gerrit/5.8' into dev
Change-Id: I3598004c8d947f42c499137c7767cfcb91643082
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/location/qdeclarativegeomap.cpp3
-rw-r--r--src/imports/location/qdeclarativepolygonmapitem.cpp6
-rw-r--r--src/imports/location/qdeclarativepolylinemapitem.cpp17
-rw-r--r--src/imports/location/qgeomapitemgeometry.cpp4
4 files changed, 20 insertions, 10 deletions
diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp
index fafc2f82..6d831f24 100644
--- a/src/imports/location/qdeclarativegeomap.cpp
+++ b/src/imports/location/qdeclarativegeomap.cpp
@@ -967,8 +967,7 @@ void QDeclarativeGeoMap::fitViewportToGeoShape()
bboxHeight / (height() - margins));
// fixme: use log2 with c++11
zoomRatio = std::log(zoomRatio) / std::log(2.0);
- double newZoom = qMax(minimumZoomLevel(), zoomLevel()
- - zoomRatio);
+ double newZoom = qMax<double>(minimumZoomLevel(), zoomLevel() - zoomRatio);
setZoomLevel(newZoom);
m_validRegion = true;
}
diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp
index d997f590..a42892b7 100644
--- a/src/imports/location/qdeclarativepolygonmapitem.cpp
+++ b/src/imports/location/qdeclarativepolygonmapitem.cpp
@@ -431,6 +431,8 @@ void QDeclarativePolygonMapItem::setPath(const QJSValue &value)
path_ = pathList;
geoLeftBound_ = QDeclarativePolylineMapItem::getLeftBound(path_, deltaXs_, minX_);
+ geometry_.setPreserveGeometry(true, geoLeftBound_);
+ borderGeometry_.setPreserveGeometry(true, geoLeftBound_);
geometry_.markSourceDirty();
borderGeometry_.markSourceDirty();
polishAndUpdate();
@@ -449,6 +451,8 @@ void QDeclarativePolygonMapItem::addCoordinate(const QGeoCoordinate &coordinate)
{
path_.append(coordinate);
geoLeftBound_ = QDeclarativePolylineMapItem::getLeftBound(path_, deltaXs_, minX_, geoLeftBound_);
+ geometry_.setPreserveGeometry(true, geoLeftBound_);
+ borderGeometry_.setPreserveGeometry(true, geoLeftBound_);
geometry_.markSourceDirty();
borderGeometry_.markSourceDirty();
polishAndUpdate();
@@ -473,6 +477,8 @@ void QDeclarativePolygonMapItem::removeCoordinate(const QGeoCoordinate &coordina
path_.removeAt(index);
geoLeftBound_ = QDeclarativePolylineMapItem::getLeftBound(path_, deltaXs_, minX_);
+ geometry_.setPreserveGeometry(true, geoLeftBound_);
+ borderGeometry_.setPreserveGeometry(true, geoLeftBound_);
geometry_.markSourceDirty();
borderGeometry_.markSourceDirty();
polishAndUpdate();
diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp
index 32791b29..c4150d2a 100644
--- a/src/imports/location/qdeclarativepolylinemapitem.cpp
+++ b/src/imports/location/qdeclarativepolylinemapitem.cpp
@@ -556,6 +556,7 @@ void QDeclarativePolylineMapItem::setPathFromGeoList(const QList<QGeoCoordinate>
path_ = path;
geoLeftBound_ = getLeftBound(path_, deltaXs_, minX_);
+ geometry_.setPreserveGeometry(true, geoLeftBound_);
geometry_.markSourceDirty();
polishAndUpdate();
emit pathChanged();
@@ -586,6 +587,7 @@ void QDeclarativePolylineMapItem::addCoordinate(const QGeoCoordinate &coordinate
{
path_.append(coordinate);
geoLeftBound_ = getLeftBound(path_, deltaXs_, minX_, geoLeftBound_);
+ geometry_.setPreserveGeometry(true, geoLeftBound_);
geometry_.markSourceDirty();
polishAndUpdate();
emit pathChanged();
@@ -607,6 +609,7 @@ void QDeclarativePolylineMapItem::insertCoordinate(int index, const QGeoCoordina
path_.insert(index, coordinate);
geoLeftBound_ = getLeftBound(path_, deltaXs_, minX_);
+ geometry_.setPreserveGeometry(true, geoLeftBound_);
geometry_.markSourceDirty();
polishAndUpdate();
emit pathChanged();
@@ -629,6 +632,7 @@ void QDeclarativePolylineMapItem::replaceCoordinate(int index, const QGeoCoordin
path_[index] = coordinate;
geoLeftBound_ = getLeftBound(path_, deltaXs_, minX_);
+ geometry_.setPreserveGeometry(true, geoLeftBound_);
geometry_.markSourceDirty();
polishAndUpdate();
emit pathChanged();
@@ -697,6 +701,7 @@ void QDeclarativePolylineMapItem::removeCoordinate(int index)
path_.removeAt(index);
geoLeftBound_ = getLeftBound(path_, deltaXs_, minX_);
+ geometry_.setPreserveGeometry(true, geoLeftBound_);
geometry_.markSourceDirty();
polishAndUpdate();
emit pathChanged();
@@ -762,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);
@@ -786,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();
diff --git a/src/imports/location/qgeomapitemgeometry.cpp b/src/imports/location/qgeomapitemgeometry.cpp
index 513feb2a..c8168f67 100644
--- a/src/imports/location/qgeomapitemgeometry.cpp
+++ b/src/imports/location/qgeomapitemgeometry.cpp
@@ -70,11 +70,11 @@ void QGeoMapItemGeometry::allocateAndFill(QSGGeometry *geom) const
if (isIndexed()) {
geom->allocate(vx.size(), ix.size());
- if (geom->indexType() == QSGGeometry::TypeUnsignedShort) {
+ if (geom->indexType() == QSGGeometry::UnsignedShortType) {
quint16 *its = geom->indexDataAsUShort();
for (int i = 0; i < ix.size(); ++i)
its[i] = ix[i];
- } else if (geom->indexType() == QSGGeometry::TypeUnsignedInt) {
+ } else if (geom->indexType() == QSGGeometry::UnsignedIntType) {
quint32 *its = geom->indexDataAsUInt();
for (int i = 0; i < ix.size(); ++i)
its[i] = ix[i];