summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-05-02 18:31:33 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-05-03 16:42:30 +0000
commitacb1f42d21b94c4c783433c2e7d67646c905afb7 (patch)
tree30d4f2ac3c4b7408a0b73097795c1a74d9109b23
parent18f7e6dc9f59159b70cb7e6a8745738f42d4f46f (diff)
downloadqtlocation-acb1f42d21b94c4c783433c2e7d67646c905afb7.tar.gz
Fix QDeclarativeGeoMap::visibleRegion when map is rotated/tilted
This patch attempts to return something meaningful from that method also when the map is rotated/tilted, while waiting for QGeoPolygon. Change-Id: Id14853f2078ed399cf7f2c603ae7442489c07829 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/location/declarativemaps/qdeclarativegeomap.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp
index 4df884d5..9e679afb 100644
--- a/src/location/declarativemaps/qdeclarativegeomap.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomap.cpp
@@ -45,6 +45,7 @@
#include "qdeclarativegeomapparameter_p.h"
#include <QtPositioning/QGeoCircle>
#include <QtPositioning/QGeoRectangle>
+#include <QtPositioning/QGeoPath>
#include <QtQuick/QQuickWindow>
#include <QtQuick/QSGRectangleNode>
#include <QtQuick/private/qquickwindow_p.h>
@@ -1310,10 +1311,12 @@ QGeoShape QDeclarativeGeoMap::visibleRegion() const
if (!m_map || !width() || !height())
return m_visibleRegion;
- QGeoCoordinate tl = m_map->geoProjection().itemPositionToCoordinate(QDoubleVector2D(0, 0));
- QGeoCoordinate br = m_map->geoProjection().itemPositionToCoordinate(QDoubleVector2D(width(), height()));
+ const QList<QDoubleVector2D> &visibleRegion = m_map->geoProjection().visibleRegion();
+ QGeoPath path;
+ for (const QDoubleVector2D &c: visibleRegion)
+ path.addCoordinate(m_map->geoProjection().wrappedMapProjectionToGeo(c));
- return QGeoRectangle(tl, br);
+ return path.boundingGeoRectangle();
}
/*!