summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/geoservices')
-rw-r--r--src/plugins/geoservices/esri/esri.pro3
-rw-r--r--src/plugins/geoservices/esri/geotiledmap_esri.cpp2
-rw-r--r--src/plugins/geoservices/esri/geotiledmap_esri.h8
-rw-r--r--src/plugins/geoservices/itemsoverlay/itemsoverlay.pro3
-rw-r--r--src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp200
-rw-r--r--src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h4
-rw-r--r--src/plugins/geoservices/mapbox/mapbox.pro3
-rw-r--r--src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp8
-rw-r--r--src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp2
-rw-r--r--src/plugins/geoservices/nokia/nokia.pro3
-rw-r--r--src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp2
-rw-r--r--src/plugins/geoservices/nokia/qgeotiledmap_nokia.h8
-rw-r--r--src/plugins/geoservices/osm/osm.pro3
-rw-r--r--src/plugins/geoservices/osm/qgeotiledmaposm.cpp2
-rw-r--r--src/plugins/geoservices/osm/qgeotiledmaposm.h8
15 files changed, 243 insertions, 16 deletions
diff --git a/src/plugins/geoservices/esri/esri.pro b/src/plugins/geoservices/esri/esri.pro
index 3642ddaf..3a4da208 100644
--- a/src/plugins/geoservices/esri/esri.pro
+++ b/src/plugins/geoservices/esri/esri.pro
@@ -2,6 +2,9 @@ TARGET = qtgeoservices_esri
QT += location-private positioning-private network
+QT_FOR_CONFIG += location-private
+qtConfig(location-labs-plugin): DEFINES += LOCATIONLABS
+
HEADERS += \
geocodereply_esri.h \
geocodingmanagerengine_esri.h \
diff --git a/src/plugins/geoservices/esri/geotiledmap_esri.cpp b/src/plugins/geoservices/esri/geotiledmap_esri.cpp
index 9171fc2b..8feb9615 100644
--- a/src/plugins/geoservices/esri/geotiledmap_esri.cpp
+++ b/src/plugins/geoservices/esri/geotiledmap_esri.cpp
@@ -45,7 +45,7 @@
QT_BEGIN_NAMESPACE
GeoTiledMapEsri::GeoTiledMapEsri(GeoTiledMappingManagerEngineEsri *engine, QObject *parent) :
- QGeoTiledMap(engine, parent), m_engine(engine), m_mapId(-1)
+ Map(engine, parent), m_engine(engine), m_mapId(-1)
{
}
diff --git a/src/plugins/geoservices/esri/geotiledmap_esri.h b/src/plugins/geoservices/esri/geotiledmap_esri.h
index e8b26152..7a21af9a 100644
--- a/src/plugins/geoservices/esri/geotiledmap_esri.h
+++ b/src/plugins/geoservices/esri/geotiledmap_esri.h
@@ -41,12 +41,18 @@
#define GEOTILEDMAPESRI_H
#include <QtLocation/private/qgeotiledmap_p.h>
+#ifdef LOCATIONLABS
+#include <QtLocation/private/qgeotiledmaplabs_p.h>
+typedef QGeoTiledMapLabs Map;
+#else
+typedef QGeoTiledMap Map;
+#endif
QT_BEGIN_NAMESPACE
class GeoTiledMappingManagerEngineEsri;
-class GeoTiledMapEsri: public QGeoTiledMap
+class GeoTiledMapEsri: public Map
{
Q_OBJECT
diff --git a/src/plugins/geoservices/itemsoverlay/itemsoverlay.pro b/src/plugins/geoservices/itemsoverlay/itemsoverlay.pro
index 1f45de97..486ed97a 100644
--- a/src/plugins/geoservices/itemsoverlay/itemsoverlay.pro
+++ b/src/plugins/geoservices/itemsoverlay/itemsoverlay.pro
@@ -2,6 +2,9 @@ TARGET = qtgeoservices_itemsoverlay
QT += location-private positioning-private
+QT_FOR_CONFIG += location-private
+qtConfig(location-labs-plugin): DEFINES += LOCATIONLABS
+
HEADERS += \
qgeomapitemsoverlay.h \
qgeomappingmanagerengineitemsoverlay.h \
diff --git a/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp
index 29b84408..99146801 100644
--- a/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp
+++ b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp
@@ -38,6 +38,22 @@
#include "qgeomappingmanagerengineitemsoverlay.h"
#include <QtLocation/private/qgeomap_p_p.h>
#include <QtQuick/qsgnode.h>
+#include <QtQuick/qsgrectanglenode.h>
+#include <QtQuick/qquickwindow.h>
+
+#ifdef LOCATIONLABS
+#include <QtLocation/private/qmappolylineobjectqsg_p_p.h>
+#include <QtLocation/private/qmappolygonobjectqsg_p_p.h>
+#include <QtLocation/private/qmapcircleobjectqsg_p_p.h>
+#include <QtLocation/private/qmaprouteobjectqsg_p_p.h>
+#include <QtLocation/private/qmapiconobjectqsg_p_p.h>
+struct MapObject {
+ MapObject(QPointer<QGeoMapObject> &o, QQSGMapObject *sgo)
+ : object(o), sgObject(sgo) {}
+ QPointer<QGeoMapObject> object;
+ QQSGMapObject *sgObject = nullptr;
+};
+#endif
QT_BEGIN_NAMESPACE
@@ -46,9 +62,20 @@ class QGeoMapItemsOverlayPrivate : public QGeoMapPrivate
Q_DECLARE_PUBLIC(QGeoMapItemsOverlay)
public:
QGeoMapItemsOverlayPrivate(QGeoMappingManagerEngineItemsOverlay *engine);
-
virtual ~QGeoMapItemsOverlayPrivate();
+#ifdef LOCATIONLABS
+ QGeoMapObjectPrivate *createMapObjectImplementation(QGeoMapObject *obj) override;
+ virtual QList<QGeoMapObject *> mapObjects() const override;
+ static int findMapObject(QGeoMapObject *o, const QList<MapObject> &list);
+ void removeMapObject(QGeoMapObject *obj);
+ void updateMapObjects(QSGNode *root, QQuickWindow *window);
+
+ QList<MapObject> m_mapObjects;
+ QList<MapObject> m_pendingMapObjects;
+#endif
+
+ void updateObjectsGeometry();
protected:
void changeViewportSize(const QSize &size) override;
void changeCameraData(const QGeoCameraData &oldCameraData) override;
@@ -65,10 +92,31 @@ QGeoMapItemsOverlay::~QGeoMapItemsOverlay()
{
}
+QGeoMap::Capabilities QGeoMapItemsOverlay::capabilities() const
+{
+ return Capabilities(SupportsVisibleRegion
+ | SupportsSetBearing
+ | SupportsAnchoringCoordinate);
+}
+
QSGNode *QGeoMapItemsOverlay::updateSceneGraph(QSGNode *node, QQuickWindow *window)
{
+#ifndef LOCATIONLABS
Q_UNUSED(window)
return node;
+#else
+ Q_D(QGeoMapItemsOverlay);
+
+ QSGRectangleNode *mapRoot = static_cast<QSGRectangleNode *>(node);
+ if (!mapRoot)
+ mapRoot = window->createRectangleNode();
+
+ mapRoot->setRect(QRect(0, 0, viewportWidth(), viewportHeight()));
+ mapRoot->setColor(QColor(0,0,0,0));
+
+ d->updateMapObjects(mapRoot, window);
+ return mapRoot;
+#endif
}
QGeoMapItemsOverlayPrivate::QGeoMapItemsOverlayPrivate(QGeoMappingManagerEngineItemsOverlay *engine)
@@ -80,19 +128,157 @@ QGeoMapItemsOverlayPrivate::~QGeoMapItemsOverlayPrivate()
{
}
-void QGeoMapItemsOverlayPrivate::changeViewportSize(const QSize &size)
+#ifdef LOCATIONLABS
+QGeoMapObjectPrivate *QGeoMapItemsOverlayPrivate::createMapObjectImplementation(QGeoMapObject *obj)
+{
+ switch (obj->type()) {
+ case QGeoMapObject::PolylineType: {
+ QMapPolylineObjectPrivate &oldImpl = static_cast<QMapPolylineObjectPrivate &>(*obj->implementation());
+ QMapPolylineObjectPrivateQSG *pimpl =
+ new QMapPolylineObjectPrivateQSG(oldImpl);
+ QPointer<QGeoMapObject> p(obj);
+ MapObject mo(p, pimpl);
+ m_pendingMapObjects << mo;
+ return pimpl;
+ }
+ case QGeoMapObject::PolygonType: {
+ QMapPolygonObjectPrivate &oldImpl = static_cast<QMapPolygonObjectPrivate &>(*obj->implementation());
+ QMapPolygonObjectPrivateQSG *pimpl =
+ new QMapPolygonObjectPrivateQSG(oldImpl);
+ QPointer<QGeoMapObject> p(obj);
+ MapObject mo(p, pimpl);
+ m_pendingMapObjects << mo;
+ return pimpl;
+ }
+ case QGeoMapObject::CircleType: {
+ QMapCircleObjectPrivate &oldImpl = static_cast<QMapCircleObjectPrivate &>(*obj->implementation());
+ QMapCircleObjectPrivateQSG *pimpl =
+ new QMapCircleObjectPrivateQSG(oldImpl);
+ QPointer<QGeoMapObject> p(obj);
+ MapObject mo(p, pimpl);
+ m_pendingMapObjects << mo;
+ return pimpl;
+ }
+ case QGeoMapObject::RouteType: {
+ QMapRouteObjectPrivate &oldImpl = static_cast<QMapRouteObjectPrivate &>(*obj->implementation());
+ QMapRouteObjectPrivateQSG *pimpl =
+ new QMapRouteObjectPrivateQSG(oldImpl);
+ QPointer<QGeoMapObject> p(obj);
+ MapObject mo(p, pimpl);
+ m_pendingMapObjects << mo;
+ return pimpl;
+ }
+ case QGeoMapObject::IconType: {
+ QMapIconObjectPrivate &oldImpl = static_cast<QMapIconObjectPrivate &>(*obj->implementation());
+ QMapIconObjectPrivateQSG *pimpl =
+ new QMapIconObjectPrivateQSG(oldImpl);
+ QPointer<QGeoMapObject> p(obj);
+ MapObject mo(p, pimpl);
+ m_pendingMapObjects << mo;
+ return pimpl;
+ }
+ default:
+ qWarning() << "Unsupported object type: " << obj->type();
+ break;
+ }
+ return nullptr;
+}
+
+QList<QGeoMapObject *> QGeoMapItemsOverlayPrivate::mapObjects() const
+{
+ return QList<QGeoMapObject *>();
+}
+
+int QGeoMapItemsOverlayPrivate::findMapObject(QGeoMapObject *o, const QList<MapObject> &list)
+{
+ for (int i = 0; i < list.size(); ++i)
+ {
+ if (list.at(i).object.data() == o)
+ return i;
+ }
+ return -1;
+}
+
+void QGeoMapItemsOverlayPrivate::removeMapObject(QGeoMapObject *obj)
+{
+ int idx = findMapObject(obj, m_mapObjects);
+ if (idx >= 0) {
+ m_mapObjects.removeAt(idx);
+ } else {
+ idx = findMapObject(obj, m_pendingMapObjects);
+ if (idx >= 0) {
+ m_pendingMapObjects.removeAt(idx);
+ } else {
+ // obj not here.
+ }
+ }
+}
+
+void QGeoMapItemsOverlayPrivate::updateMapObjects(QSGNode *root, QQuickWindow *window)
+{
+ for (int i = 0; i < m_mapObjects.size(); ++i) {
+ // already added as node
+ if (!m_mapObjects.at(i).object) {
+ qWarning() << "m_mapObjects at "<<i<< " NULLed!!";
+ continue;
+ }
+
+ QQSGMapObject *sgo = m_mapObjects.at(i).sgObject;
+ QSGNode *oldNode = sgo->node;
+ sgo->node = sgo->updateMapObjectNode(oldNode, root, window);
+ }
+
+ QList<int> toRemove;
+ for (int i = 0; i < m_pendingMapObjects.size(); ++i) {
+ // already added as node
+ QQSGMapObject *sgo = m_pendingMapObjects.at(i).sgObject;
+ QSGNode *oldNode = sgo->node;
+ sgo->updateGeometry(); // or subtree will be blocked
+ sgo->node = sgo->updateMapObjectNode(oldNode, root, window);
+ if (sgo->node) {
+ m_mapObjects << m_pendingMapObjects.at(i);
+ toRemove.push_front(i);
+ } else {
+ // leave it to be processed
+ }
+ }
+
+ for (int i: qAsConst(toRemove))
+ m_pendingMapObjects.removeAt(i);
+}
+#endif
+
+void QGeoMapItemsOverlayPrivate::updateObjectsGeometry()
+{
+#ifdef LOCATIONLABS
+ Q_Q(QGeoMapItemsOverlay);
+ for (int i = 0; i < m_mapObjects.size(); ++i) {
+ // already added as node
+ if (!m_mapObjects.at(i).object) {
+ qWarning() << "m_mapObjects at "<<i<< " NULLed!!";
+ continue;
+ }
+
+ QQSGMapObject *sgo = m_mapObjects.at(i).sgObject;
+ sgo->updateGeometry();
+ }
+ emit q->sgNodeChanged();
+#endif
+}
+
+void QGeoMapItemsOverlayPrivate::changeViewportSize(const QSize &/*size*/)
{
- Q_UNUSED(size)
+ updateObjectsGeometry();
}
-void QGeoMapItemsOverlayPrivate::changeCameraData(const QGeoCameraData &oldCameraData)
+void QGeoMapItemsOverlayPrivate::changeCameraData(const QGeoCameraData &/*oldCameraData*/)
{
- Q_UNUSED(oldCameraData)
+ updateObjectsGeometry();
}
-void QGeoMapItemsOverlayPrivate::changeActiveMapType(const QGeoMapType mapType)
+void QGeoMapItemsOverlayPrivate::changeActiveMapType(const QGeoMapType /*mapType*/)
{
- Q_UNUSED(mapType)
+ updateObjectsGeometry();
}
QT_END_NAMESPACE
diff --git a/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h
index 47249240..42a59f06 100644
--- a/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h
+++ b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h
@@ -51,8 +51,10 @@ class QGeoMapItemsOverlay: public QGeoMap
Q_DECLARE_PRIVATE(QGeoMapItemsOverlay)
public:
QGeoMapItemsOverlay(QGeoMappingManagerEngineItemsOverlay *engine, QObject *parent);
-
virtual ~QGeoMapItemsOverlay();
+
+ QGeoMap::Capabilities capabilities() const override;
+
protected:
QSGNode *updateSceneGraph(QSGNode *node, QQuickWindow *window) override;
diff --git a/src/plugins/geoservices/mapbox/mapbox.pro b/src/plugins/geoservices/mapbox/mapbox.pro
index 25a12795..c4e7f671 100644
--- a/src/plugins/geoservices/mapbox/mapbox.pro
+++ b/src/plugins/geoservices/mapbox/mapbox.pro
@@ -2,6 +2,9 @@ TARGET = qtgeoservices_mapbox
QT += location-private positioning-private network
+QT_FOR_CONFIG += location-private
+qtConfig(location-labs-plugin): DEFINES += LOCATIONLABS
+
HEADERS += \
qgeoserviceproviderpluginmapbox.h \
qgeotiledmappingmanagerenginemapbox.h \
diff --git a/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp b/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp
index 632b2286..f2595d03 100644
--- a/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp
+++ b/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp
@@ -41,6 +41,12 @@
#include <QtLocation/private/qgeomaptype_p.h>
#include <QtLocation/private/qgeotiledmap_p.h>
#include "qgeofiletilecachemapbox.h"
+#ifdef LOCATIONLABS
+#include <QtLocation/private/qgeotiledmaplabs_p.h>
+typedef QGeoTiledMapLabs Map;
+#else
+typedef QGeoTiledMap Map;
+#endif
QT_BEGIN_NAMESPACE
@@ -246,7 +252,7 @@ QGeoTiledMappingManagerEngineMapbox::~QGeoTiledMappingManagerEngineMapbox()
QGeoMap *QGeoTiledMappingManagerEngineMapbox::createMap()
{
- QGeoTiledMap *map = new QGeoTiledMap(this, 0);
+ QGeoTiledMap *map = new Map(this, 0);
map->setPrefetchStyle(m_prefetchStyle);
return map;
}
diff --git a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
index 4835c201..4dae6826 100644
--- a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
+++ b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
@@ -97,7 +97,7 @@ QMapbox::Feature featureFromMapCircle(QDeclarativeCircleMapItem *mapItem)
for (const QGeoCoordinate &c : qAsConst(path))
pathProjected << p.geoToMapProjection(c);
if (QDeclarativeCircleMapItem::crossEarthPole(mapItem->center(), mapItem->radius()))
- mapItem->preserveCircleGeometry(pathProjected, mapItem->center(), mapItem->radius());
+ mapItem->preserveCircleGeometry(pathProjected, mapItem->center(), mapItem->radius(), p);
path.clear();
for (const QDoubleVector2D &c : qAsConst(pathProjected))
path << p.mapProjectionToGeo(c);
diff --git a/src/plugins/geoservices/nokia/nokia.pro b/src/plugins/geoservices/nokia/nokia.pro
index c6dadd86..86a0665c 100644
--- a/src/plugins/geoservices/nokia/nokia.pro
+++ b/src/plugins/geoservices/nokia/nokia.pro
@@ -2,6 +2,9 @@ TARGET = qtgeoservices_nokia
QT += location-private positioning-private network
+QT_FOR_CONFIG += location-private
+qtConfig(location-labs-plugin): DEFINES += LOCATIONLABS
+
HEADERS += \
qgeocodereply_nokia.h \
qgeocodejsonparser.h \
diff --git a/src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp b/src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp
index 90be0ae9..a09899d3 100644
--- a/src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
\a geoMap and makes use of the functionality provided by \a engine.
*/
QGeoTiledMapNokia::QGeoTiledMapNokia(QGeoTiledMappingManagerEngineNokia *engine, QObject *parent /*= 0*/) :
- QGeoTiledMap(engine, parent),
+ Map(engine, parent),
m_logo(":/nokia/logo.png"), // HERE logo image
m_engine(engine)
{}
diff --git a/src/plugins/geoservices/nokia/qgeotiledmap_nokia.h b/src/plugins/geoservices/nokia/qgeotiledmap_nokia.h
index 9651cc80..487f6f49 100644
--- a/src/plugins/geoservices/nokia/qgeotiledmap_nokia.h
+++ b/src/plugins/geoservices/nokia/qgeotiledmap_nokia.h
@@ -40,12 +40,18 @@
#include "qgeotiledmap_p.h"
#include <QtGui/QImage>
#include <QtCore/QPointer>
+#ifdef LOCATIONLABS
+#include <QtLocation/private/qgeotiledmaplabs_p.h>
+typedef QGeoTiledMapLabs Map;
+#else
+typedef QGeoTiledMap Map;
+#endif
QT_BEGIN_NAMESPACE
class QGeoTiledMappingManagerEngineNokia;
-class QGeoTiledMapNokia: public QGeoTiledMap
+class QGeoTiledMapNokia: public Map
{
Q_OBJECT
public:
diff --git a/src/plugins/geoservices/osm/osm.pro b/src/plugins/geoservices/osm/osm.pro
index 86a62744..74e27dc9 100644
--- a/src/plugins/geoservices/osm/osm.pro
+++ b/src/plugins/geoservices/osm/osm.pro
@@ -2,6 +2,9 @@ TARGET = qtgeoservices_osm
QT += location-private positioning-private network concurrent
+QT_FOR_CONFIG += location-private
+qtConfig(location-labs-plugin): DEFINES += LOCATIONLABS
+
HEADERS += \
qgeoserviceproviderpluginosm.h \
qgeotiledmappingmanagerengineosm.h \
diff --git a/src/plugins/geoservices/osm/qgeotiledmaposm.cpp b/src/plugins/geoservices/osm/qgeotiledmaposm.cpp
index 16799dc2..372d1a31 100644
--- a/src/plugins/geoservices/osm/qgeotiledmaposm.cpp
+++ b/src/plugins/geoservices/osm/qgeotiledmaposm.cpp
@@ -46,7 +46,7 @@
QT_BEGIN_NAMESPACE
QGeoTiledMapOsm::QGeoTiledMapOsm(QGeoTiledMappingManagerEngineOsm *engine, QObject *parent)
-: QGeoTiledMap(engine, parent), m_mapId(-1), m_engine(engine)
+: Map(engine, parent), m_mapId(-1), m_engine(engine)
{
// Needed because evaluateCopyrights() is only triggered if visible tiles change in the map.
// It fails the first time it gets called if providers aren't resolved, and subsequent calls
diff --git a/src/plugins/geoservices/osm/qgeotiledmaposm.h b/src/plugins/geoservices/osm/qgeotiledmaposm.h
index b2af5d89..cc349793 100644
--- a/src/plugins/geoservices/osm/qgeotiledmaposm.h
+++ b/src/plugins/geoservices/osm/qgeotiledmaposm.h
@@ -43,11 +43,17 @@
#include "qgeotileproviderosm.h"
#include <QtLocation/private/qgeotiledmap_p.h>
+#ifdef LOCATIONLABS
+#include <QtLocation/private/qgeotiledmaplabs_p.h>
+typedef QGeoTiledMapLabs Map;
+#else
+typedef QGeoTiledMap Map;
+#endif
QT_BEGIN_NAMESPACE
class QGeoTiledMappingManagerEngineOsm;
-class QGeoTiledMapOsm: public QGeoTiledMap
+class QGeoTiledMapOsm: public Map
{
Q_OBJECT