summaryrefslogtreecommitdiff
path: root/src/imports
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/location/qdeclarativegeomap.cpp29
-rw-r--r--src/imports/location/qdeclarativegeomap_p.h2
-rw-r--r--src/imports/location/qdeclarativepolygonmapitem.cpp2
-rw-r--r--src/imports/location/qdeclarativepolylinemapitem.cpp2
-rw-r--r--src/imports/location/qgeomapitemgeometry.cpp4
5 files changed, 15 insertions, 24 deletions
diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp
index 9b5c658f..9bb8a17a 100644
--- a/src/imports/location/qdeclarativegeomap.cpp
+++ b/src/imports/location/qdeclarativegeomap.cpp
@@ -45,7 +45,7 @@
#include <QtPositioning/QGeoCircle>
#include <QtPositioning/QGeoRectangle>
#include <QtQuick/QQuickWindow>
-#include <QtQuick/QSGSimpleRectNode>
+#include <QtQuick/QSGRectangleNode>
#include <QtQuick/private/qquickwindow_p.h>
#include <QtQml/qqmlinfo.h>
#include <cmath>
@@ -306,10 +306,10 @@ void QDeclarativeGeoMap::initialize()
// try to keep center change signal in the end
bool centerHasChanged = false;
- setMinimumZoomLevel(m_map->minimumZoomForMapSize(width(), height()));
+ setMinimumZoomLevel(m_map->minimumZoomAtMapSize(width(), height()));
// set latitude bundary check
- m_maximumViewportLatitude = m_map->maximumLatitudeForZoom(m_cameraData.zoomLevel());
+ m_maximumViewportLatitude = m_map->maximumCenterLatitudeAtZoom(m_cameraData.zoomLevel());
QGeoCoordinate center = m_cameraData.center();
center.setLatitude(qBound(-m_maximumViewportLatitude, center.latitude(), m_maximumViewportLatitude));
@@ -476,13 +476,12 @@ QSGNode *QDeclarativeGeoMap::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa
return 0;
}
- QSGSimpleRectNode *root = static_cast<QSGSimpleRectNode *>(oldNode);
+ QSGRectangleNode *root = static_cast<QSGRectangleNode *>(oldNode);
if (!root)
- root = new QSGSimpleRectNode(boundingRect(), m_color);
- else {
- root->setRect(boundingRect());
- root->setColor(m_color);
- }
+ root = window()->createRectangleNode();
+
+ root->setRect(boundingRect());
+ root->setColor(m_color);
QSGNode *content = root->childCount() ? root->firstChild() : 0;
content = m_map->updateSceneGraph(content, window());
@@ -616,7 +615,7 @@ void QDeclarativeGeoMap::setMinimumZoomLevel(qreal minimumZoomLevel)
if (m_map) {
minimumZoomLevel = qBound(qreal(m_map->cameraCapabilities().minimumZoomLevel()), minimumZoomLevel, maximumZoomLevel());
- double minimumViewportZoomLevel = m_map->minimumZoomForMapSize(width(),height());
+ double minimumViewportZoomLevel = m_map->minimumZoomAtMapSize(width(),height());
if (minimumZoomLevel < minimumViewportZoomLevel)
minimumZoomLevel = minimumViewportZoomLevel;
}
@@ -715,7 +714,7 @@ void QDeclarativeGeoMap::setZoomLevel(qreal zoomLevel)
if (m_initialized) {
m_cameraData.setZoomLevel(qBound(minimumZoomLevel(), zoomLevel, maximumZoomLevel()));
- m_maximumViewportLatitude = m_map->maximumLatitudeForZoom(m_cameraData.zoomLevel());
+ m_maximumViewportLatitude = m_map->maximumCenterLatitudeAtZoom(m_cameraData.zoomLevel());
QGeoCoordinate coord = m_cameraData.center();
coord.setLatitude(qBound(-m_maximumViewportLatitude, coord.latitude(), m_maximumViewportLatitude));
if (coord != m_cameraData.center()) {
@@ -1205,13 +1204,11 @@ void QDeclarativeGeoMap::addMapItem(QDeclarativeGeoMapItemBase *item)
{
if (!item || item->quickMap())
return;
- m_updateMutex.lock();
item->setParentItem(this);
if (m_map)
item->setMap(this, m_map);
m_mapItems.append(item);
emit mapItemsChanged();
- m_updateMutex.unlock();
}
/*!
@@ -1251,13 +1248,11 @@ void QDeclarativeGeoMap::removeMapItem(QDeclarativeGeoMapItemBase *ptr)
QPointer<QDeclarativeGeoMapItemBase> item(ptr);
if (!m_mapItems.contains(item))
return;
- m_updateMutex.lock();
item.data()->setParentItem(0);
item.data()->setMap(0, 0);
// these can be optimized for perf, as we already check the 'contains' above
m_mapItems.removeOne(item);
emit mapItemsChanged();
- m_updateMutex.unlock();
}
/*!
@@ -1271,7 +1266,6 @@ void QDeclarativeGeoMap::clearMapItems()
{
if (m_mapItems.isEmpty())
return;
- m_updateMutex.lock();
for (int i = 0; i < m_mapItems.count(); ++i) {
if (m_mapItems.at(i)) {
m_mapItems.at(i).data()->setParentItem(0);
@@ -1280,7 +1274,6 @@ void QDeclarativeGeoMap::clearMapItems()
}
m_mapItems.clear();
emit mapItemsChanged();
- m_updateMutex.unlock();
}
/*!
@@ -1324,7 +1317,7 @@ void QDeclarativeGeoMap::geometryChanged(const QRectF &newGeometry, const QRectF
if (!m_initialized)
initialize();
else
- setMinimumZoomLevel(m_map->minimumZoomForMapSize(newGeometry.width(), newGeometry.height()));
+ setMinimumZoomLevel(m_map->minimumZoomAtMapSize(newGeometry.width(), newGeometry.height()));
/*!
The fitViewportTo*() functions depend on a valid map geometry.
diff --git a/src/imports/location/qdeclarativegeomap_p.h b/src/imports/location/qdeclarativegeomap_p.h
index d1d69656..262314ed 100644
--- a/src/imports/location/qdeclarativegeomap_p.h
+++ b/src/imports/location/qdeclarativegeomap_p.h
@@ -54,7 +54,6 @@
#include "qgeocameradata_p.h"
#include <QtQuick/QQuickItem>
#include <QtCore/QPointer>
-#include <QtCore/QMutex>
#include <QtGui/QColor>
#include <QtPositioning/qgeoshape.h>
@@ -193,7 +192,6 @@ private:
QGeoMap *m_map;
QPointer<QDeclarativeGeoMapCopyrightNotice> m_copyrights;
QList<QPointer<QDeclarativeGeoMapItemBase> > m_mapItems;
- QMutex m_updateMutex;
QString m_errorString;
QGeoServiceProvider::Error m_error;
QGeoShape m_region;
diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp
index 361c554d..d997f590 100644
--- a/src/imports/location/qdeclarativepolygonmapitem.cpp
+++ b/src/imports/location/qdeclarativepolygonmapitem.cpp
@@ -661,7 +661,7 @@ MapPolygonNode::MapPolygonNode() :
geometry_(QSGGeometry::defaultAttributes_Point2D(), 0),
blocked_(true)
{
- geometry_.setDrawingMode(GL_TRIANGLES);
+ geometry_.setDrawingMode(QSGGeometry::DrawTriangles);
QSGGeometryNode::setMaterial(&fill_material_);
QSGGeometryNode::setGeometry(&geometry_);
diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp
index 2899d839..a85bbc76 100644
--- a/src/imports/location/qdeclarativepolylinemapitem.cpp
+++ b/src/imports/location/qdeclarativepolylinemapitem.cpp
@@ -958,7 +958,7 @@ MapPolylineNode::MapPolylineNode() :
geometry_(QSGGeometry::defaultAttributes_Point2D(),0),
blocked_(true)
{
- geometry_.setDrawingMode(GL_TRIANGLE_STRIP);
+ geometry_.setDrawingMode(QSGGeometry::DrawTriangleStrip);
QSGGeometryNode::setMaterial(&fill_material_);
QSGGeometryNode::setGeometry(&geometry_);
}
diff --git a/src/imports/location/qgeomapitemgeometry.cpp b/src/imports/location/qgeomapitemgeometry.cpp
index e9c490d5..513feb2a 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() == GL_UNSIGNED_SHORT) {
+ if (geom->indexType() == QSGGeometry::TypeUnsignedShort) {
quint16 *its = geom->indexDataAsUShort();
for (int i = 0; i < ix.size(); ++i)
its[i] = ix[i];
- } else if (geom->indexType() == GL_UNSIGNED_INT) {
+ } else if (geom->indexType() == QSGGeometry::TypeUnsignedInt) {
quint32 *its = geom->indexDataAsUInt();
for (int i = 0; i < ix.size(); ++i)
its[i] = ix[i];