summaryrefslogtreecommitdiff
path: root/src/imports
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2016-12-05 12:43:52 +0100
committerAlex Blasche <alexander.blasche@qt.io>2016-12-05 12:43:52 +0100
commit335116ea024f51e1693bba39f78e15131870f1b0 (patch)
tree148ccdb4703b4a35afb1b0e3875573b1eb90d0ce /src/imports
parent5e4bc1fe908896e9b90e8ad9c3896f35b5ec37be (diff)
parentba9b7b9ef674d93680070f6c4bb1053d0d2325dd (diff)
downloadqtlocation-335116ea024f51e1693bba39f78e15131870f1b0.tar.gz
Merge remote-tracking branch 'gerrit/5.8' into dev
Conflicts: src/imports/location/qdeclarativegeomap.cpp src/location/maps/maps.pri src/location/maps/qgeomap_p_p.h src/plugins/geoservices/nokia/qgeocodereply_nokia.cpp src/plugins/geoservices/osm/qgeoroutereplyosm.cpp Change-Id: I18d31cff9233648178fe3e2636ce294026dfaeb7
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/location/qdeclarativecirclemapitem.cpp6
-rw-r--r--src/imports/location/qdeclarativegeomap.cpp17
-rw-r--r--src/imports/location/qdeclarativepolygonmapitem.cpp4
-rw-r--r--src/imports/location/qdeclarativepolylinemapitem.cpp8
-rw-r--r--src/imports/location/qgeomapitemgeometry.cpp4
-rw-r--r--src/imports/location/qquickgeomapgesturearea.cpp6
6 files changed, 23 insertions, 22 deletions
diff --git a/src/imports/location/qdeclarativecirclemapitem.cpp b/src/imports/location/qdeclarativecirclemapitem.cpp
index 5e33a1c5..c440664c 100644
--- a/src/imports/location/qdeclarativecirclemapitem.cpp
+++ b/src/imports/location/qdeclarativecirclemapitem.cpp
@@ -145,7 +145,7 @@ void QGeoMapCircleGeometry::updateScreenPointsInvert(const QGeoMap &map)
if (!screenDirty_)
return;
- if (map.width() == 0 || map.height() == 0) {
+ if (map.viewportWidth() == 0 || map.viewportHeight() == 0) {
clear();
return;
}
@@ -177,7 +177,7 @@ void QGeoMapCircleGeometry::updateScreenPointsInvert(const QGeoMap &map)
geoDistance += 360.0;
double mapWidth = 360.0 / geoDistance;
- qreal leftOffset = origin.x() - (map.width()/2.0 - mapWidth/2.0) - firstPointOffset_.x();
+ qreal leftOffset = origin.x() - (map.viewportWidth()/2.0 - mapWidth/2.0) - firstPointOffset_.x();
qreal topOffset = origin.y() - (midPoint.y() - mapWidth/2.0) - firstPointOffset_.y();
QPainterPath ppiBorder;
ppiBorder.moveTo(QPointF(-leftOffset, -topOffset));
@@ -610,7 +610,7 @@ void QDeclarativeCircleMapItem::updateCirclePathForRendering(QList<QGeoCoordinat
if ( geoDistance < 0 )
geoDistance += 360;
qreal mapWidth = 360.0 / geoDistance;
- mapWidth = qMin(static_cast<int>(mapWidth), map()->width());
+ mapWidth = qMin(static_cast<int>(mapWidth), map()->viewportWidth());
QDoubleVector2D prev = map()->coordinateToItemPosition(path.at(0), false);
// find the points in path where wrapping occurs
for (int i = 1; i <= path.count(); ++i) {
diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp
index 49d6ddd1..d432e776 100644
--- a/src/imports/location/qdeclarativegeomap.cpp
+++ b/src/imports/location/qdeclarativegeomap.cpp
@@ -306,7 +306,7 @@ void QDeclarativeGeoMap::initialize()
// try to keep center change signal in the end
bool centerHasChanged = false;
- setMinimumZoomLevel(m_map->minimumZoomAtMapSize(width(), height()));
+ setMinimumZoomLevel(m_map->minimumZoomAtViewportSize(width(), height()));
// set latitude bundary check
m_maximumViewportLatitude = m_map->maximumCenterLatitudeAtZoom(m_cameraData.zoomLevel());
@@ -573,7 +573,7 @@ void QDeclarativeGeoMap::mappingManagerInitialized()
// after this has been called at least once, after creation.
if (!m_initialized && width() > 0 && height() > 0) {
- m_map->setSize(QSize(width(), height()));
+ m_map->setViewportSize(QSize(width(), height()));
initialize();
}
@@ -634,7 +634,7 @@ void QDeclarativeGeoMap::setMinimumZoomLevel(qreal minimumZoomLevel)
if (m_map) {
minimumZoomLevel = qBound(qreal(m_map->cameraCapabilities().minimumZoomLevel()), minimumZoomLevel, maximumZoomLevel());
- double minimumViewportZoomLevel = m_map->minimumZoomAtMapSize(width(),height());
+ double minimumViewportZoomLevel = m_map->minimumZoomAtViewportSize(width(),height());
if (minimumZoomLevel < minimumViewportZoomLevel)
minimumZoomLevel = minimumViewportZoomLevel;
}
@@ -907,6 +907,9 @@ void QDeclarativeGeoMap::fitViewportToGeoShape()
QGeoRectangle rect = m_region;
topLeft = rect.topLeft();
bottomRight = rect.bottomRight();
+ if (bottomRight.longitude() < topLeft.longitude())
+ bottomRight.setLongitude(bottomRight.longitude() + 360.0);
+
break;
}
case QGeoShape::CircleType:
@@ -1054,8 +1057,8 @@ void QDeclarativeGeoMap::pan(int dx, int dy)
if (dx == 0 && dy == 0)
return;
QGeoCoordinate coord = m_map->itemPositionToCoordinate(
- QDoubleVector2D(m_map->width() / 2 + dx,
- m_map->height() / 2 + dy));
+ QDoubleVector2D(m_map->viewportWidth() / 2 + dx,
+ m_map->viewportHeight() / 2 + dy));
setCenter(coord);
}
@@ -1415,12 +1418,12 @@ void QDeclarativeGeoMap::geometryChanged(const QRectF &newGeometry, const QRectF
if (!m_map || !newGeometry.size().isValid())
return;
- m_map->setSize(newGeometry.size().toSize());
+ m_map->setViewportSize(newGeometry.size().toSize());
if (!m_initialized) {
initialize();
} else {
- setMinimumZoomLevel(m_map->minimumZoomAtMapSize(newGeometry.width(), newGeometry.height()));
+ setMinimumZoomLevel(m_map->minimumZoomAtViewportSize(newGeometry.width(), newGeometry.height()));
// Update the center latitudinal threshold
double maximumCenterLatitudeAtZoom = m_map->maximumCenterLatitudeAtZoom(m_cameraData.zoomLevel());
diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp
index 50dce35f..41196770 100644
--- a/src/imports/location/qdeclarativepolygonmapitem.cpp
+++ b/src/imports/location/qdeclarativepolygonmapitem.cpp
@@ -208,7 +208,7 @@ void QGeoMapPolygonGeometry::updateScreenPoints(const QGeoMap &map)
if (!screenDirty_)
return;
- if (map.width() == 0 || map.height() == 0) {
+ if (map.viewportWidth() == 0 || map.viewportHeight() == 0) {
clear();
return;
}
@@ -217,7 +217,7 @@ void QGeoMapPolygonGeometry::updateScreenPoints(const QGeoMap &map)
// Create the viewport rect in the same coordinate system
// as the actual points
- QRectF viewport(0, 0, map.width(), map.height());
+ QRectF viewport(0, 0, map.viewportWidth(), map.viewportHeight());
viewport.translate(-1 * origin.toPointF());
QPainterPath vpPath;
diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp
index c4150d2a..2153b036 100644
--- a/src/imports/location/qdeclarativepolylinemapitem.cpp
+++ b/src/imports/location/qdeclarativepolylinemapitem.cpp
@@ -200,9 +200,9 @@ void QGeoMapPolylineGeometry::updateSourcePoints(const QGeoMap &map,
srcPointTypes_.clear();
srcPointTypes_.reserve(path.size());
- QDoubleVector2D origin, lastPoint, lastAddedPoint;
+ QDoubleVector2D origin, lastAddedPoint;
- const double mapWidthHalf = map.width()/2.0;
+ const double mapWidthHalf = map.viewportWidth()/2.0;
double unwrapBelowX = 0;
if (preserveGeometry_)
unwrapBelowX = map.coordinateToItemPosition(geoLeftBound_, false).x();
@@ -263,8 +263,6 @@ void QGeoMapPolylineGeometry::updateSourcePoints(const QGeoMap &map,
lastAddedPoint = point;
}
}
-
- lastPoint = point;
}
sourceBounds_ = QRectF(QPointF(minX, minY), QPointF(maxX, maxY));
@@ -402,7 +400,7 @@ void QGeoMapPolylineGeometry::updateScreenPoints(const QGeoMap &map,
// Create the viewport rect in the same coordinate system
// as the actual points
- QRectF viewport(0, 0, map.width(), map.height());
+ QRectF viewport(0, 0, map.viewportWidth(), map.viewportHeight());
viewport.adjust(-strokeWidth, -strokeWidth, strokeWidth, strokeWidth);
viewport.translate(-1 * origin);
diff --git a/src/imports/location/qgeomapitemgeometry.cpp b/src/imports/location/qgeomapitemgeometry.cpp
index c8168f67..a22be0af 100644
--- a/src/imports/location/qgeomapitemgeometry.cpp
+++ b/src/imports/location/qgeomapitemgeometry.cpp
@@ -125,7 +125,7 @@ double QGeoMapItemGeometry::geoDistanceToScreenWidth(const QGeoMap &map,
// Do not wrap around half the globe
Q_ASSERT(!qFuzzyCompare(fromCoord.longitude(), toCoord.longitude()));
- QGeoCoordinate mapMid = map.itemPositionToCoordinate(QDoubleVector2D(map.width()/2.0, 0));
+ QGeoCoordinate mapMid = map.itemPositionToCoordinate(QDoubleVector2D(map.viewportWidth()/2.0, 0));
double halfGeoDist = toCoord.longitude() - fromCoord.longitude();
if (toCoord.longitude() < fromCoord.longitude())
halfGeoDist += 360;
@@ -133,7 +133,7 @@ double QGeoMapItemGeometry::geoDistanceToScreenWidth(const QGeoMap &map,
QGeoCoordinate geoDelta = QGeoCoordinate(0,
QLocationUtils::wrapLong(mapMid.longitude() + halfGeoDist));
QDoubleVector2D halfScreenDist = map.coordinateToItemPosition(geoDelta, false)
- - QDoubleVector2D(map.width()/2.0, 0);
+ - QDoubleVector2D(map.viewportWidth()/2.0, 0);
return halfScreenDist.x() * 2.0;
}
diff --git a/src/imports/location/qquickgeomapgesturearea.cpp b/src/imports/location/qquickgeomapgesturearea.cpp
index c115ce49..3d881ae2 100644
--- a/src/imports/location/qquickgeomapgesturearea.cpp
+++ b/src/imports/location/qquickgeomapgesturearea.cpp
@@ -702,7 +702,7 @@ void QQuickGeoMapGestureArea::handleWheelEvent(QWheelEvent *event)
{
qreal dx = postZoomPoint.x() - preZoomPoint.x();
qreal dy = postZoomPoint.y() - preZoomPoint.y();
- QPointF mapCenterPoint(m_map->width() / 2.0 + dx, m_map->height() / 2.0 + dy);
+ QPointF mapCenterPoint(m_map->viewportWidth() / 2.0 + dx, m_map->viewportHeight() / 2.0 + dy);
QGeoCoordinate mapCenterCoordinate = m_map->itemPositionToCoordinate(QDoubleVector2D(mapCenterPoint), false);
m_declarativeMap->setCenter(mapCenterCoordinate);
@@ -1149,8 +1149,8 @@ void QQuickGeoMapGestureArea::updatePan()
int dx = static_cast<int>(m_sceneCenter.x() - startPoint.x());
int dy = static_cast<int>(m_sceneCenter.y() - startPoint.y());
QPointF mapCenterPoint;
- mapCenterPoint.setY(m_map->height() / 2.0 - dy);
- mapCenterPoint.setX(m_map->width() / 2.0 - dx);
+ mapCenterPoint.setY(m_map->viewportHeight() / 2.0 - dy);
+ mapCenterPoint.setX(m_map->viewportWidth() / 2.0 - dx);
QGeoCoordinate animationStartCoordinate = m_map->itemPositionToCoordinate(QDoubleVector2D(mapCenterPoint), false);
m_declarativeMap->setCenter(animationStartCoordinate);
}