summaryrefslogtreecommitdiff
path: root/src/location/labs
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2018-02-14 18:20:15 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2018-04-17 13:02:53 +0000
commit2782765e20ba3bc6af92375574456fd54d4243f7 (patch)
tree9a70096fdddcc7d28224d6749dd0c7b0da5bcdbb /src/location/labs
parent05edc644337a33e3e72d993b8114efc755a4320a (diff)
downloadqtlocation-2782765e20ba3bc6af92375574456fd54d4243f7.tar.gz
Introduce map objects reference implementation
This patch introduces a reference implementation for the QGeoMapObject subclasses in the locationlabs module. If this module is built, all current plugins, with the exception of mapboxgl, will also be able to render map objects. The current reference implementation of map objects is not optimized, but it can be useful for both testing and feature parity (so that switching between plugins will give the same result). Change-Id: I830ebb3813f219e42c085f450952a2b4327361cd Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/labs')
-rw-r--r--src/location/labs/labs.pri4
-rw-r--r--src/location/labs/qgeotiledmaplabs.cpp295
-rw-r--r--src/location/labs/qgeotiledmaplabs_p.h90
-rw-r--r--src/location/labs/qsg/qmapcircleobjectqsg.cpp218
-rw-r--r--src/location/labs/qsg/qmapcircleobjectqsg_p_p.h98
-rw-r--r--src/location/labs/qsg/qmapiconobjectqsg.cpp226
-rw-r--r--src/location/labs/qsg/qmapiconobjectqsg_p_p.h94
-rw-r--r--src/location/labs/qsg/qmappolygonobjectqsg.cpp212
-rw-r--r--src/location/labs/qsg/qmappolygonobjectqsg_p_p.h100
-rw-r--r--src/location/labs/qsg/qmappolylineobjectqsg.cpp160
-rw-r--r--src/location/labs/qsg/qmappolylineobjectqsg_p_p.h96
-rw-r--r--src/location/labs/qsg/qmaprouteobjectqsg.cpp99
-rw-r--r--src/location/labs/qsg/qmaprouteobjectqsg_p_p.h87
-rw-r--r--src/location/labs/qsg/qqsgmapobject.cpp64
-rw-r--r--src/location/labs/qsg/qqsgmapobject_p.h61
15 files changed, 1902 insertions, 2 deletions
diff --git a/src/location/labs/labs.pri b/src/location/labs/labs.pri
index de2fd820..2da5e90d 100644
--- a/src/location/labs/labs.pri
+++ b/src/location/labs/labs.pri
@@ -1,4 +1,4 @@
INCLUDEPATH += labs
-PRIVATE_HEADERS += $$files($$PWD/*.h)
-SOURCES += $$files($$PWD/*.cpp)
+PRIVATE_HEADERS += $$files($$PWD/*.h) $$files($$PWD/qsg/*.h)
+SOURCES += $$files($$PWD/*.cpp) $$files($$PWD/qsg/*.cpp)
diff --git a/src/location/labs/qgeotiledmaplabs.cpp b/src/location/labs/qgeotiledmaplabs.cpp
new file mode 100644
index 00000000..2e4b2c16
--- /dev/null
+++ b/src/location/labs/qgeotiledmaplabs.cpp
@@ -0,0 +1,295 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeotiledmaplabs_p.h"
+#include <QtLocation/private/qgeotiledmap_p_p.h>
+#include <QtLocation/private/qgeomapobject_p.h>
+#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>
+
+QT_BEGIN_NAMESPACE
+
+struct MapObject {
+ MapObject(QPointer<QGeoMapObject> &o, QQSGMapObject *sgo)
+ : object(o), sgObject(sgo) {}
+ QPointer<QGeoMapObject> object;
+ QQSGMapObject *sgObject = nullptr;
+};
+
+class QGeoTiledMapLabsPrivate : public QGeoTiledMapPrivate
+{
+ Q_DECLARE_PUBLIC(QGeoTiledMapLabs)
+public:
+ QGeoTiledMapLabsPrivate(QGeoTiledMappingManagerEngine *engine);
+ virtual ~QGeoTiledMapLabsPrivate();
+
+ 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);
+ void updateObjectsGeometry();
+
+protected:
+ void changeViewportSize(const QSize &size) override;
+ void changeCameraData(const QGeoCameraData &oldCameraData) override;
+ void changeActiveMapType(const QGeoMapType mapType) override;
+
+ QList<MapObject> m_mapObjects;
+ QList<MapObject> m_pendingMapObjects;
+};
+
+QGeoTiledMapLabsPrivate::QGeoTiledMapLabsPrivate(QGeoTiledMappingManagerEngine *engine)
+ : QGeoTiledMapPrivate(engine)
+{
+
+}
+
+QGeoTiledMapLabsPrivate::~QGeoTiledMapLabsPrivate()
+{
+
+}
+
+QGeoMapObjectPrivate *QGeoTiledMapLabsPrivate::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 *> QGeoTiledMapLabsPrivate::mapObjects() const
+{
+ return QList<QGeoMapObject *>();
+}
+
+int QGeoTiledMapLabsPrivate::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 QGeoTiledMapLabsPrivate::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 QGeoTiledMapLabsPrivate::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);
+}
+
+void QGeoTiledMapLabsPrivate::updateObjectsGeometry()
+{
+ Q_Q(QGeoTiledMapLabs);
+ 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();
+}
+
+void QGeoTiledMapLabsPrivate::changeViewportSize(const QSize &size)
+{
+ updateObjectsGeometry();
+ QGeoTiledMapPrivate::changeViewportSize(size);
+}
+
+void QGeoTiledMapLabsPrivate::changeCameraData(const QGeoCameraData &oldCameraData)
+{
+ updateObjectsGeometry();
+ QGeoTiledMapPrivate::changeCameraData(oldCameraData);
+}
+
+void QGeoTiledMapLabsPrivate::changeActiveMapType(const QGeoMapType mapType)
+{
+ updateObjectsGeometry();
+ QGeoTiledMapPrivate::changeActiveMapType(mapType);
+}
+
+
+/*
+ QGeoTiledMapLabs
+*/
+
+
+
+QGeoTiledMapLabs::QGeoTiledMapLabs(QGeoTiledMappingManagerEngine *engine, QObject *parent)
+ : QGeoTiledMap(*new QGeoTiledMapLabsPrivate(engine), engine, parent)
+{
+
+}
+
+QGeoTiledMapLabs::~QGeoTiledMapLabs()
+{
+
+}
+
+bool QGeoTiledMapLabs::createMapObjectImplementation(QGeoMapObject *obj)
+{
+ Q_D(QGeoTiledMapLabs);
+ QExplicitlySharedDataPointer<QGeoMapObjectPrivate> pimpl =
+ QExplicitlySharedDataPointer<QGeoMapObjectPrivate>(d->createMapObjectImplementation(obj));
+ if (pimpl.constData()) {
+ bool res = obj->setImplementation(pimpl);
+ if (res)
+ emit sgNodeChanged();
+ return res;
+ }
+ return false;
+}
+
+QSGNode *QGeoTiledMapLabs::updateSceneGraph(QSGNode *node, QQuickWindow *window)
+{
+ Q_D(QGeoTiledMapLabs);
+ QSGNode *root = QGeoTiledMap::updateSceneGraph(node, window);
+ d->updateMapObjects(root, window);
+ return root;
+}
+
+void QGeoTiledMapLabs::removeMapObject(QGeoMapObject *obj)
+{
+ Q_D(QGeoTiledMapLabs);
+ d->removeMapObject(obj);
+}
+
+QGeoTiledMapLabs::QGeoTiledMapLabs(QGeoTiledMapLabsPrivate &dd, QGeoTiledMappingManagerEngine *engine, QObject *parent)
+ : QGeoTiledMap(dd, engine, parent)
+{
+
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/location/labs/qgeotiledmaplabs_p.h b/src/location/labs/qgeotiledmaplabs_p.h
new file mode 100644
index 00000000..f6499784
--- /dev/null
+++ b/src/location/labs/qgeotiledmaplabs_p.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOTILEDMAPLABS_P_H
+#define QGEOTILEDMAPLABS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtLocation/private/qlocationglobal_p.h>
+#include <QtQml/qqml.h>
+#include <QPointer>
+#include <QtLocation/private/qgeotiledmap_p.h>
+#include <QtQuick/qsgsimplerectnode.h>
+#include <QtLocation/private/qqsgmapobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeGeoServiceProvider;
+class QDeclarativeGeoMap;
+class QMapRouteObject;
+class QNavigationManager;
+class QGeoTiledMapLabsPrivate;
+class Q_LOCATION_PRIVATE_EXPORT QGeoTiledMapLabs : public QGeoTiledMap
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QGeoTiledMapLabs)
+public:
+ QGeoTiledMapLabs(QGeoTiledMappingManagerEngine *engine, QObject *parent);
+ virtual ~QGeoTiledMapLabs();
+
+ bool createMapObjectImplementation(QGeoMapObject *obj) override;
+
+protected:
+ QSGNode *updateSceneGraph(QSGNode *node, QQuickWindow *window) override;
+ void removeMapObject(QGeoMapObject *obj) override;
+
+ QSGClipNode *m_clip = nullptr;
+ QSGSimpleRectNode *m_simpleRectNode = nullptr;
+
+ // From QGeoTiledMap
+ QGeoTiledMapLabs(QGeoTiledMapLabsPrivate &dd, QGeoTiledMappingManagerEngine *engine, QObject *parent);
+private:
+ Q_DISABLE_COPY(QGeoTiledMapLabs)
+};
+
+QT_END_NAMESPACE
+
+#endif // QGEOTILEDMAPLABS_P_H
diff --git a/src/location/labs/qsg/qmapcircleobjectqsg.cpp b/src/location/labs/qsg/qmapcircleobjectqsg.cpp
new file mode 100644
index 00000000..10110eab
--- /dev/null
+++ b/src/location/labs/qsg/qmapcircleobjectqsg.cpp
@@ -0,0 +1,218 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmapcircleobjectqsg_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+static const int CircleSamples = 128;
+
+QMapCircleObjectPrivateQSG::QMapCircleObjectPrivateQSG(QGeoMapObject *q)
+ : QMapCircleObjectPrivateDefault(q)
+{
+
+}
+
+QMapCircleObjectPrivateQSG::QMapCircleObjectPrivateQSG(const QMapCircleObjectPrivate &other)
+ : QMapCircleObjectPrivateDefault(other)
+{
+ // Data already cloned by the *Default copy constructor, but necessary
+ // update operations triggered by setters overrides
+ setCenter(center());
+ setRadius(radius());
+ setColor(color());
+ setBorderColor(borderColor());
+ setBorderWidth(borderWidth());
+}
+
+QMapCircleObjectPrivateQSG::~QMapCircleObjectPrivateQSG()
+{
+
+}
+
+void QMapCircleObjectPrivateQSG::updateCirclePath()
+{
+ const QGeoProjectionWebMercator &p = static_cast<const QGeoProjectionWebMercator&>(m_map->geoProjection());
+ QList<QGeoCoordinate> path;
+ QDeclarativeCircleMapItem::calculatePeripheralPoints(path, center(), radius(), CircleSamples, m_leftBound);
+ m_circlePath.clear();
+ for (const QGeoCoordinate &c : path)
+ m_circlePath << p.geoToMapProjection(c);
+}
+
+void QMapCircleObjectPrivateQSG::updateGeometry()
+{
+ if (!m_map || m_map->geoProjection().projectionType() != QGeoProjection::ProjectionWebMercator
+ || !qIsFinite(m_radius) || !m_center.isValid())
+ return;
+
+ const QGeoProjectionWebMercator &p = static_cast<const QGeoProjectionWebMercator&>(m_map->geoProjection());
+ QScopedValueRollback<bool> rollback(m_updatingGeometry);
+ m_updatingGeometry = true;
+
+ updateCirclePath();
+ QList<QDoubleVector2D> circlePath = m_circlePath;
+
+ int pathCount = circlePath.size();
+ bool preserve = QDeclarativeCircleMapItem::preserveCircleGeometry(circlePath, center(), radius(), p);
+ // using leftBound_ instead of the analytically calculated circle_.boundingGeoRectangle().topLeft());
+ // to fix QTBUG-62154
+ m_geometry.markSourceDirty();
+ m_geometry.setPreserveGeometry(true, m_leftBound); // to set the geoLeftBound_
+ m_geometry.setPreserveGeometry(preserve, m_leftBound);
+
+ bool invertedCircle = false;
+ if (QDeclarativeCircleMapItem::crossEarthPole(center(), radius()) && circlePath.size() == pathCount) {
+ m_geometry.updateScreenPointsInvert(circlePath, *m_map); // invert fill area for really huge circles
+ invertedCircle = true;
+ } else {
+ m_geometry.updateSourcePoints(*m_map, circlePath);
+ m_geometry.updateScreenPoints(*m_map);
+ }
+
+ m_borderGeometry.clear();
+
+ //if (borderColor() != Qt::transparent && borderWidth() > 0)
+ {
+ QList<QDoubleVector2D> closedPath = circlePath;
+ closedPath << closedPath.first();
+
+ if (invertedCircle) {
+ closedPath = m_circlePath;
+ closedPath << closedPath.first();
+ std::reverse(closedPath.begin(), closedPath.end());
+ }
+
+ m_borderGeometry.markSourceDirty();
+ m_borderGeometry.setPreserveGeometry(true, m_leftBound);
+ m_borderGeometry.setPreserveGeometry(preserve, m_leftBound);
+
+ // Use srcOrigin_ from fill geometry after clipping to ensure that translateToCommonOrigin won't fail.
+ const QGeoCoordinate &geometryOrigin = m_geometry.origin();
+
+ m_borderGeometry.clearSource();
+
+ QDoubleVector2D borderLeftBoundWrapped;
+ QList<QList<QDoubleVector2D > > clippedPaths =
+ m_borderGeometry.clipPath(*m_map, closedPath, borderLeftBoundWrapped);
+ if (clippedPaths.size()) {
+ borderLeftBoundWrapped = p.geoToWrappedMapProjection(geometryOrigin);
+ m_borderGeometry.pathToScreen(*m_map, clippedPaths, borderLeftBoundWrapped);
+ m_borderGeometry.updateScreenPoints(*m_map, borderWidth());
+ } else {
+ m_borderGeometry.clear();
+ }
+ }
+
+ QPointF origin = m_map->geoProjection().coordinateToItemPosition(m_geometry.origin(), false).toPointF();
+ m_geometry.translate(origin - m_geometry.firstPointOffset());
+ m_borderGeometry.translate(origin - m_borderGeometry.firstPointOffset());
+}
+
+QGeoMapObjectPrivate *QMapCircleObjectPrivateQSG::clone()
+{
+ return new QMapCircleObjectPrivateQSG(static_cast<QMapCircleObjectPrivate &>(*this));
+}
+
+QSGNode *QMapCircleObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow * /*window*/)
+{
+ MapPolygonNode *node = static_cast<MapPolygonNode *>(oldNode);
+
+ bool created = false;
+ if (!node) {
+ node = new MapPolygonNode();
+ created = true;
+ }
+
+ //TODO: update only material
+ if (m_geometry.isScreenDirty() || !m_borderGeometry.isScreenDirty() || !oldNode || created) {
+ //QMapPolygonObject *p = static_cast<QMapPolygonObject *>(q);
+ node->update(color(), borderColor(), &m_geometry, &m_borderGeometry);
+ m_geometry.setPreserveGeometry(false);
+ m_borderGeometry.setPreserveGeometry(false);
+ m_geometry.markClean();
+ m_borderGeometry.markClean();
+ }
+
+ if (created)
+ root->appendChildNode(node);
+
+ return node;
+}
+
+
+void QMapCircleObjectPrivateQSG::setCenter(const QGeoCoordinate &center)
+{
+ m_center = center;
+ updateGeometry();
+ if (m_map)
+ emit m_map->sgNodeChanged();
+}
+
+void QMapCircleObjectPrivateQSG::setRadius(qreal radius)
+{
+ m_radius = radius;
+ updateGeometry();
+ if (m_map)
+ emit m_map->sgNodeChanged();
+}
+
+void QMapCircleObjectPrivateQSG::setColor(const QColor &color)
+{
+ m_fillColor = color;
+ updateGeometry();
+ if (m_map)
+ emit m_map->sgNodeChanged();
+}
+
+void QMapCircleObjectPrivateQSG::setBorderColor(const QColor &color)
+{
+ m_borderColor = color;
+ updateGeometry();
+ if (m_map)
+ emit m_map->sgNodeChanged();
+}
+
+void QMapCircleObjectPrivateQSG::setBorderWidth(qreal width)
+{
+ m_borderWidth = width;
+ updateGeometry();
+ if (m_map)
+ emit m_map->sgNodeChanged();
+}
+
+
+QT_END_NAMESPACE
diff --git a/src/location/labs/qsg/qmapcircleobjectqsg_p_p.h b/src/location/labs/qsg/qmapcircleobjectqsg_p_p.h
new file mode 100644
index 00000000..17d8568a
--- /dev/null
+++ b/src/location/labs/qsg/qmapcircleobjectqsg_p_p.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMAPCIRCLEOBJECTQSG_P_H
+#define QMAPCIRCLEOBJECTQSG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtLocation/private/qlocationglobal_p.h>
+#include <QtLocation/private/qgeomapobject_p_p.h>
+#include <QtLocation/private/qdeclarativecirclemapitem_p.h>
+#include <QtLocation/private/qdeclarativepolygonmapitem_p.h>
+#include <QtLocation/private/qmapcircleobject_p.h>
+#include <QtLocation/private/qmapcircleobject_p_p.h>
+#include <QtLocation/private/qqsgmapobject_p.h>
+#include <QtCore/qscopedvaluerollback.h>
+#include <QGeoCoordinate>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+class Q_LOCATION_PRIVATE_EXPORT QMapCircleObjectPrivateQSG : public QMapCircleObjectPrivateDefault, public QQSGMapObject
+{
+public:
+ QMapCircleObjectPrivateQSG(QGeoMapObject *q);
+ QMapCircleObjectPrivateQSG(const QMapCircleObjectPrivate &other);
+ ~QMapCircleObjectPrivateQSG() override;
+
+ void updateCirclePath();
+
+ // QQSGMapObject
+ void updateGeometry() override;
+ QSGNode *updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow *window) override;
+
+ // QGeoMapCirclePrivate interface
+ void setCenter(const QGeoCoordinate &center) override;
+ void setRadius(qreal radius) override;
+ void setColor(const QColor &color) override;
+ void setBorderColor(const QColor &color) override;
+ void setBorderWidth(qreal width) override;
+
+ // QGeoMapObjectPrivate
+ QGeoMapObjectPrivate *clone() override;
+
+public:
+ // Data Members
+ QList<QDoubleVector2D> m_circlePath;
+ QGeoCoordinate m_leftBound;
+ QGeoMapCircleGeometry m_geometry;
+ QGeoMapPolylineGeometry m_borderGeometry;
+ bool m_updatingGeometry = false;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMAPCIRCLEOBJECT_P_P_H
diff --git a/src/location/labs/qsg/qmapiconobjectqsg.cpp b/src/location/labs/qsg/qmapiconobjectqsg.cpp
new file mode 100644
index 00000000..53d16179
--- /dev/null
+++ b/src/location/labs/qsg/qmapiconobjectqsg.cpp
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmapiconobjectqsg_p_p.h"
+#include <QtQuick/qsgimagenode.h>
+#include <QtQuick/qsgnode.h>
+#include <QtQuick/private/qquickimage_p.h>
+#include <QtQuick/qquickimageprovider.h>
+#include <QtQuick/qquickwindow.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqml.h>
+#include <QtNetwork/qnetworkaccessmanager.h>
+
+QT_BEGIN_NAMESPACE
+
+class RootNode : public QSGTransformNode
+{
+public:
+ RootNode() : QSGTransformNode()
+ { }
+
+ bool isSubtreeBlocked() const override
+ {
+ return m_blocked;
+ }
+
+ void setSubtreeBlocked(bool blocked)
+ {
+ m_blocked = blocked;
+ }
+
+ bool m_blocked = false;
+};
+
+QMapIconObjectPrivateQSG::QMapIconObjectPrivateQSG(QGeoMapObject *q)
+ : QMapIconObjectPrivateDefault(q)
+{
+
+}
+
+QMapIconObjectPrivateQSG::QMapIconObjectPrivateQSG(const QMapIconObjectPrivate &other)
+ : QMapIconObjectPrivateDefault(other)
+{
+ setContent(content());
+ setCoordinate(coordinate());
+}
+
+QMapIconObjectPrivateQSG::~QMapIconObjectPrivateQSG()
+{
+
+}
+
+void QMapIconObjectPrivateQSG::updateGeometry()
+{
+ if (!m_map)
+ return;
+
+ m_geometryDirty = true;
+ const QGeoProjectionWebMercator &p = static_cast<const QGeoProjectionWebMercator&>(m_map->geoProjection());
+
+ m_itemPosition = p.coordinateToItemPosition(coordinate());
+ if (m_itemPosition.isFinite()) {
+ m_transformation.setToIdentity();
+ m_transformation.translate(QVector3D(m_itemPosition.x(), m_itemPosition.y(), 0));
+ }
+
+ // TODO: support and test for zoomLevel
+}
+
+QSGNode *QMapIconObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode, QSGNode * root, QQuickWindow *window)
+{
+ bool created = false;
+ RootNode *node = static_cast<RootNode *>(oldNode);
+ if (!node) {
+ node = new RootNode();
+ m_imageNode = window->createImageNode();
+ m_imageNode->setOwnsTexture(true);
+ node->appendChildNode(m_imageNode);
+ created = true;
+ }
+
+ if (m_imageDirty) {
+ m_imageDirty = false;
+ m_imageNode->setTexture(window->createTextureFromImage(m_image));
+ QRect rect = m_image.rect();
+ m_imageNode->setSourceRect(rect);
+ m_imageNode->setRect(QRectF(QPointF(0,0), m_size));
+ }
+
+ if (m_geometryDirty) {
+ m_geometryDirty = false;
+ if (!m_itemPosition.isFinite()) {
+ node->setSubtreeBlocked(true);
+ } else {
+ node->setSubtreeBlocked(false);
+ node->setMatrix(m_transformation);
+ }
+ }
+
+ if (created)
+ root->appendChildNode(node);
+
+ return node;
+}
+
+void QMapIconObjectPrivateQSG::setCoordinate(const QGeoCoordinate &coordinate)
+{
+ QMapIconObjectPrivateDefault::setCoordinate(coordinate);
+ updateGeometry();
+}
+
+template<typename T>
+static T *getContent(const QVariant &content)
+{
+ QObject *obj = qvariant_cast<QObject *>(content);
+ return qobject_cast<T *>(obj);
+}
+
+static inline QString imageId(const QUrl &url)
+{
+ return url.toString(QUrl::RemoveScheme | QUrl::RemoveAuthority).mid(1);
+}
+
+void QMapIconObjectPrivateQSG::clearContent()
+{
+ m_image = QImage();
+}
+
+void QMapIconObjectPrivateQSG::setContent(const QVariant &content)
+{
+ // First reset all local containers
+ clearContent();
+ QQmlEngine *engine = qmlEngine(q);
+
+ // Then pull the new content
+ QMapIconObjectPrivateDefault::setContent(content);
+ switch (content.type()) {
+ case QVariant::UserType: {
+ // TODO: Handle QObject subclasses -- first decide which ones
+ break;
+ }
+ case QVariant::String:
+ case QVariant::Url: {
+ // URL, including image/texture providers
+ // Supporting only image providers for now
+ const QUrl url = content.toUrl();
+ if (!url.isValid()) {
+ m_image = QImage(content.toString());
+ m_imageDirty = true;
+ updateGeometry();
+ } else if (url.scheme().isEmpty() || url.scheme() == QLatin1String("file")) {
+ m_image = QImage(url.toString(QUrl::RemoveScheme));
+ m_imageDirty = true;
+ updateGeometry();
+ } else if (url.scheme() == QLatin1String("image")) {
+ QQuickImageProvider *provider = static_cast<QQuickImageProvider *>(engine->imageProvider(url.host()));
+ QSize outSize;
+ m_image = provider->requestImage(imageId(url), &outSize, QSize());
+ if (outSize.isEmpty())
+ break;
+ m_imageDirty = true;
+ updateGeometry();
+ } else { // ToDo: Use QNAM
+
+ }
+
+ break;
+ }
+ case QVariant::ByteArray: {
+ // ToDo: Build the image from bytearray
+ break;
+ }
+ default:
+ qWarning() << "Unsupported parameter type: " << content.type();
+ break;
+ }
+
+ if (m_map && m_imageDirty)
+ emit m_map->sgNodeChanged();
+}
+
+void QMapIconObjectPrivateQSG::setSize(const QSizeF &size)
+{
+ QMapIconObjectPrivateDefault::setSize(size);
+ updateGeometry();
+}
+
+QGeoMapObjectPrivate *QMapIconObjectPrivateQSG::clone()
+{
+ return new QMapIconObjectPrivateQSG(static_cast<QMapIconObjectPrivate &>(*this));
+}
+
+QT_END_NAMESPACE
diff --git a/src/location/labs/qsg/qmapiconobjectqsg_p_p.h b/src/location/labs/qsg/qmapiconobjectqsg_p_p.h
new file mode 100644
index 00000000..a2f7cf40
--- /dev/null
+++ b/src/location/labs/qsg/qmapiconobjectqsg_p_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMAPICONOBJECTQSG_P_P_H
+#define QMAPICONOBJECTQSG_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtLocation/private/qlocationglobal_p.h>
+#include <QtLocation/private/qmapiconobject_p.h>
+#include <QtLocation/private/qmapiconobject_p_p.h>
+#include <QtLocation/private/qqsgmapobject_p.h>
+#include <QtCore/qscopedvaluerollback.h>
+#include <QtGui/qimage.h>
+
+QT_BEGIN_NAMESPACE
+
+class QSGImageNode;
+class Q_LOCATION_PRIVATE_EXPORT QMapIconObjectPrivateQSG : public QMapIconObjectPrivateDefault, public QQSGMapObject
+{
+public:
+ QMapIconObjectPrivateQSG(QGeoMapObject *q);
+ QMapIconObjectPrivateQSG(const QMapIconObjectPrivate &other);
+ ~QMapIconObjectPrivateQSG() override;
+
+ void clearContent();
+
+ // QQSGMapObject
+ void updateGeometry() override;
+ QSGNode *updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow *window) override;
+
+ // QGeoMapIconPrivate interface
+ void setCoordinate(const QGeoCoordinate &coordinate) override;
+ void setContent(const QVariant &content) override;
+ void setSize(const QSizeF &size) override;
+
+ // QGeoMapObjectPrivate
+ QGeoMapObjectPrivate *clone() override;
+
+public:
+ // Data Members
+ bool m_imageDirty = false;
+ bool m_geometryDirty = false;
+ QImage m_image;
+ QSGImageNode *m_imageNode = nullptr;
+ QDoubleVector2D m_itemPosition;
+ QMatrix4x4 m_transformation;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMAPICONOBJECTQSG_P_P_H
diff --git a/src/location/labs/qsg/qmappolygonobjectqsg.cpp b/src/location/labs/qsg/qmappolygonobjectqsg.cpp
new file mode 100644
index 00000000..4000c08f
--- /dev/null
+++ b/src/location/labs/qsg/qmappolygonobjectqsg.cpp
@@ -0,0 +1,212 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmappolygonobjectqsg_p_p.h"
+#include <QtQuick/qsgnode.h>
+#include <QtQuick/qsgsimplerectnode.h>
+
+QT_BEGIN_NAMESPACE
+
+QMapPolygonObjectPrivateQSG::QMapPolygonObjectPrivateQSG(QGeoMapObject *q)
+ : QMapPolygonObjectPrivate(q)
+{
+
+}
+
+QMapPolygonObjectPrivateQSG::QMapPolygonObjectPrivateQSG(const QMapPolygonObjectPrivate &other)
+ : QMapPolygonObjectPrivate(other.q)
+{
+ setPath(other.path());
+ setFillColor(other.fillColor());
+ setBorderColor(other.borderColor());
+ setBorderWidth(other.borderWidth());
+}
+
+QMapPolygonObjectPrivateQSG::~QMapPolygonObjectPrivateQSG()
+{
+
+}
+
+QList<QDoubleVector2D> QMapPolygonObjectPrivateQSG::projectPath()
+{
+ QList<QDoubleVector2D> geopathProjected_;
+ if (!m_map || m_map->geoProjection().projectionType() != QGeoProjection::ProjectionWebMercator)
+ return geopathProjected_;
+
+ const QGeoProjectionWebMercator &p =
+ static_cast<const QGeoProjectionWebMercator&>(m_map->geoProjection());
+ geopathProjected_.reserve(m_geoPath.path().size());
+ for (const QGeoCoordinate &c : m_geoPath.path())
+ geopathProjected_ << p.geoToMapProjection(c);
+ return geopathProjected_;
+}
+
+QSGNode *QMapPolygonObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow * /*window*/)
+{
+ MapPolygonNode *node = static_cast<MapPolygonNode *>(oldNode);
+
+ bool created = false;
+ if (!node) {
+ node = new MapPolygonNode();
+ created = true;
+ }
+
+ //TODO: update only material
+ if (m_geometry.isScreenDirty() || !m_borderGeometry.isScreenDirty() || !oldNode || created) {
+ node->update(fillColor(), borderColor(), &m_geometry, &m_borderGeometry);
+ m_geometry.setPreserveGeometry(false);
+ m_borderGeometry.setPreserveGeometry(false);
+ m_geometry.markClean();
+ m_borderGeometry.markClean();
+ }
+
+ if (created)
+ root->appendChildNode(node);
+
+ return node;
+}
+
+QList<QGeoCoordinate> QMapPolygonObjectPrivateQSG::path() const
+{
+ return m_geoPath.path();
+}
+
+QColor QMapPolygonObjectPrivateQSG::fillColor() const
+{
+ return m_fillColor;
+}
+
+QColor QMapPolygonObjectPrivateQSG::borderColor() const
+{
+ return m_borderColor;
+}
+
+qreal QMapPolygonObjectPrivateQSG::borderWidth() const
+{
+ return m_borderWidth;
+}
+
+void QMapPolygonObjectPrivateQSG::setPath(const QList<QGeoCoordinate> &path)
+{
+ m_geoPath.setPath(path);
+ updateGeometry();
+
+ if (m_map)
+ emit m_map->sgNodeChanged();
+}
+
+void QMapPolygonObjectPrivateQSG::setFillColor(const QColor &color)
+{
+ m_fillColor = color;
+ updateGeometry();
+
+ if (m_map)
+ emit m_map->sgNodeChanged();
+}
+
+void QMapPolygonObjectPrivateQSG::setBorderColor(const QColor &color)
+{
+ m_borderColor = color;
+ updateGeometry();
+
+ if (m_map)
+ emit m_map->sgNodeChanged();
+}
+
+void QMapPolygonObjectPrivateQSG::setBorderWidth(qreal width)
+{
+ m_borderWidth = width;
+ updateGeometry();
+
+ if (m_map)
+ emit m_map->sgNodeChanged();
+}
+
+QGeoMapObjectPrivate *QMapPolygonObjectPrivateQSG::clone()
+{
+ return new QMapPolygonObjectPrivateQSG(static_cast<QMapPolygonObjectPrivate &>(*this));
+}
+
+void QMapPolygonObjectPrivateQSG::updateGeometry()
+{
+ if (!m_map || m_geoPath.path().length() == 0
+ || m_map->geoProjection().projectionType() != QGeoProjection::ProjectionWebMercator)
+ return;
+
+ QScopedValueRollback<bool> rollback(m_updatingGeometry);
+ m_updatingGeometry = true;
+
+ const QList<QDoubleVector2D> &geopathProjected = projectPath();
+
+ m_geometry.markSourceDirty();
+ m_geometry.setPreserveGeometry(true, m_geoPath.boundingGeoRectangle().topLeft());
+ m_geometry.updateSourcePoints(*m_map, geopathProjected);
+ m_geometry.updateScreenPoints(*m_map);
+
+ m_borderGeometry.clear();
+
+ //if (border_.color() != Qt::transparent && border_.width() > 0)
+ {
+ const QGeoProjectionWebMercator &p = static_cast<const QGeoProjectionWebMercator&>(m_map->geoProjection());
+ QList<QDoubleVector2D> closedPath = geopathProjected;
+ closedPath << closedPath.first();
+
+ m_borderGeometry.markSourceDirty();
+ m_borderGeometry.setPreserveGeometry(true, m_geoPath.boundingGeoRectangle().topLeft());
+
+ const QGeoCoordinate &geometryOrigin = m_geometry.origin();
+
+ m_borderGeometry.clearSource();
+
+ QDoubleVector2D borderLeftBoundWrapped;
+ QList<QList<QDoubleVector2D > > clippedPaths =
+ m_borderGeometry.clipPath(*m_map.data(), closedPath, borderLeftBoundWrapped);
+
+ if (clippedPaths.size()) {
+ borderLeftBoundWrapped = p.geoToWrappedMapProjection(geometryOrigin);
+ m_borderGeometry.pathToScreen(*m_map.data(), clippedPaths, borderLeftBoundWrapped);
+ m_borderGeometry.updateScreenPoints(*m_map.data(), borderWidth());
+ } else {
+ m_borderGeometry.clear();
+ }
+ }
+
+ QPointF origin = m_map->geoProjection().coordinateToItemPosition(m_geometry.origin(), false).toPointF();
+ m_geometry.translate(origin - m_geometry.firstPointOffset());
+ m_borderGeometry.translate(origin - m_borderGeometry.firstPointOffset());
+}
+
+QT_END_NAMESPACE
diff --git a/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h b/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h
new file mode 100644
index 00000000..bd5efcff
--- /dev/null
+++ b/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMAPPOLYGONOBJECTQSG_P_P_H
+#define QMAPPOLYGONOBJECTQSG_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtLocation/private/qlocationglobal_p.h>
+#include <QtLocation/private/qmappolygonobject_p.h>
+#include <QtLocation/private/qmappolygonobject_p_p.h>
+#include <QtLocation/private/qqsgmapobject_p.h>
+#include <QtLocation/private/qdeclarativepolygonmapitem_p.h>
+#include <QtCore/qscopedvaluerollback.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_LOCATION_PRIVATE_EXPORT QMapPolygonObjectPrivateQSG : public QMapPolygonObjectPrivate, public QQSGMapObject
+{
+public:
+ QMapPolygonObjectPrivateQSG(QGeoMapObject *q);
+ QMapPolygonObjectPrivateQSG(const QMapPolygonObjectPrivate &other);
+ ~QMapPolygonObjectPrivateQSG() override;
+
+ QList<QDoubleVector2D> projectPath();
+
+ // QQSGMapObject
+ void updateGeometry() override;
+ QSGNode *updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow *window) override;
+
+ // QGeoMapPolylinePrivate interface
+ QList<QGeoCoordinate> path() const override;
+ QColor fillColor() const override;
+ QColor borderColor() const override;
+ qreal borderWidth() const override;
+
+ void setPath(const QList<QGeoCoordinate> &path) override;
+ void setFillColor(const QColor &color) override;
+ void setBorderColor(const QColor &color) override;
+ void setBorderWidth(qreal width) override;
+
+ // QGeoMapObjectPrivate
+ QGeoMapObjectPrivate *clone() override;
+
+ // Data Members
+ QGeoMapPolygonGeometry m_geometry;
+ QGeoMapPolylineGeometry m_borderGeometry;
+ QGeoPath m_geoPath;
+
+ QColor m_fillColor;
+ QColor m_borderColor;
+ qreal m_borderWidth = 0;
+ bool m_updatingGeometry = false;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMAPPOLYGONOBJECTQSG_P_P_H
diff --git a/src/location/labs/qsg/qmappolylineobjectqsg.cpp b/src/location/labs/qsg/qmappolylineobjectqsg.cpp
new file mode 100644
index 00000000..fe6fbec6
--- /dev/null
+++ b/src/location/labs/qsg/qmappolylineobjectqsg.cpp
@@ -0,0 +1,160 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmappolylineobjectqsg_p_p.h"
+#include <QtQuick/qsgnode.h>
+#include <QtQuick/qsgsimplerectnode.h>
+
+QT_BEGIN_NAMESPACE
+
+/*
+ Note: never use q, since this class is also used inside QMapRouteObjectPrivateQSG!
+*/
+
+QMapPolylineObjectPrivateQSG::QMapPolylineObjectPrivateQSG(QGeoMapObject *q)
+ : QMapPolylineObjectPrivate(q)
+{
+
+}
+
+QMapPolylineObjectPrivateQSG::QMapPolylineObjectPrivateQSG(const QMapPolylineObjectPrivate &other)
+ : QMapPolylineObjectPrivate(other.q)
+{
+ // do the appropriate internal update and trigger map repaint
+ setPath(other.path());
+ setColor(other.color());
+ setWidth(other.width());
+}
+
+QMapPolylineObjectPrivateQSG::~QMapPolylineObjectPrivateQSG()
+{
+
+}
+
+QList<QDoubleVector2D> QMapPolylineObjectPrivateQSG::projectPath()
+{
+ QList<QDoubleVector2D> geopathProjected_;
+ if (!m_map || m_map->geoProjection().projectionType() != QGeoProjection::ProjectionWebMercator)
+ return geopathProjected_;
+
+ const QGeoProjectionWebMercator &p =
+ static_cast<const QGeoProjectionWebMercator&>(m_map->geoProjection());
+ geopathProjected_.reserve(m_geoPath.path().size());
+ for (const QGeoCoordinate &c : m_geoPath.path())
+ geopathProjected_ << p.geoToMapProjection(c);
+ return geopathProjected_;
+}
+
+void QMapPolylineObjectPrivateQSG::updateGeometry()
+{
+ if (!m_map || m_geoPath.path().length() == 0
+ || m_map->geoProjection().projectionType() != QGeoProjection::ProjectionWebMercator)
+ return;
+
+ QScopedValueRollback<bool> rollback(m_updatingGeometry);
+ m_updatingGeometry = true;
+ m_geometry.markSourceDirty();
+ const QList<QDoubleVector2D> &geopathProjected = projectPath();
+ m_geometry.setPreserveGeometry(true, m_geoPath.boundingGeoRectangle().topLeft());
+ m_geometry.updateSourcePoints(*m_map.data(), geopathProjected, m_geoPath.boundingGeoRectangle().topLeft());
+ m_geometry.updateScreenPoints(*m_map.data(), width());
+
+ QPointF origin = m_map->geoProjection().coordinateToItemPosition(m_geometry.origin(), false).toPointF();
+ m_geometry.translate(origin - m_geometry.firstPointOffset());
+}
+
+QSGNode *QMapPolylineObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow * /*window*/)
+{
+ MapPolylineNode *node = static_cast<MapPolylineNode *>(oldNode);
+
+ bool created = false;
+ if (!node) {
+ node = new MapPolylineNode();
+ created = true;
+ }
+
+ //TODO: update only material
+ if (m_geometry.isScreenDirty() || !oldNode || created) {
+ node->update(color(), &m_geometry);
+ m_geometry.setPreserveGeometry(false);
+ m_geometry.markClean();
+ }
+
+ if (created)
+ root->appendChildNode(node);
+
+ return node;
+}
+
+QList<QGeoCoordinate> QMapPolylineObjectPrivateQSG::path() const { return m_geoPath.path(); }
+
+QColor QMapPolylineObjectPrivateQSG::color() const { return m_color; }
+
+qreal QMapPolylineObjectPrivateQSG::width() const { return m_width; }
+
+void QMapPolylineObjectPrivateQSG::setPath(const QList<QGeoCoordinate> &path)
+{
+ m_geoPath.setPath(path);
+ updateGeometry();
+
+ if (m_map)
+ emit m_map->sgNodeChanged();
+}
+
+void QMapPolylineObjectPrivateQSG::setColor(const QColor &color)
+{
+ m_color = color;
+ updateGeometry();
+
+ if (m_map)
+ emit m_map->sgNodeChanged();
+}
+
+void QMapPolylineObjectPrivateQSG::setWidth(qreal width)
+{
+ m_width = width;
+ updateGeometry();
+
+ if (m_map)
+ emit m_map->sgNodeChanged();
+}
+
+QGeoMapObjectPrivate *QMapPolylineObjectPrivateQSG::clone()
+{
+ return new QMapPolylineObjectPrivateQSG(static_cast<QMapPolylineObjectPrivate &>(*this));
+}
+
+QT_END_NAMESPACE
diff --git a/src/location/labs/qsg/qmappolylineobjectqsg_p_p.h b/src/location/labs/qsg/qmappolylineobjectqsg_p_p.h
new file mode 100644
index 00000000..52b5e89a
--- /dev/null
+++ b/src/location/labs/qsg/qmappolylineobjectqsg_p_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMAPPOLYLINEOBJECTOBJECTSOVERLAY_H
+#define QMAPPOLYLINEOBJECTOBJECTSOVERLAY_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtLocation/private/qlocationglobal_p.h>
+#include <QtLocation/private/qmappolylineobject_p_p.h>
+#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
+#include <QtLocation/private/qmappolylineobject_p.h>
+#include <QtLocation/private/qqsgmapobject_p.h>
+#include <QtCore/qscopedvaluerollback.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_LOCATION_PRIVATE_EXPORT QMapPolylineObjectPrivateQSG : public QMapPolylineObjectPrivate, public QQSGMapObject
+{
+public:
+ QMapPolylineObjectPrivateQSG(QGeoMapObject *q);
+ QMapPolylineObjectPrivateQSG(const QMapPolylineObjectPrivate &other);
+ ~QMapPolylineObjectPrivateQSG() override;
+
+ QList<QDoubleVector2D> projectPath();
+
+ // QQSGMapObject
+ void updateGeometry() override;
+ QSGNode *updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow *window) override;
+
+ // QGeoMapPolylinePrivate interface
+ QList<QGeoCoordinate> path() const override;
+ QColor color() const override;
+ qreal width() const override;
+
+ void setPath(const QList<QGeoCoordinate> &path) override;
+ void setColor(const QColor &color) override;
+ void setWidth(qreal width) override;
+
+ // QGeoMapObjectPrivate
+ QGeoMapObjectPrivate *clone() override;
+
+ // Data Members
+ QGeoMapPolylineGeometry m_geometry;
+ QGeoPath m_geoPath;
+
+ QColor m_color;
+ qreal m_width = 0;
+ bool m_updatingGeometry = false;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMAPPOLYLINEOBJECTOBJECTSOVERLAY_H
diff --git a/src/location/labs/qsg/qmaprouteobjectqsg.cpp b/src/location/labs/qsg/qmaprouteobjectqsg.cpp
new file mode 100644
index 00000000..a8728e08
--- /dev/null
+++ b/src/location/labs/qsg/qmaprouteobjectqsg.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmaprouteobjectqsg_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QMapRouteObjectPrivateQSG::QMapRouteObjectPrivateQSG(QGeoMapObject *q)
+ : QMapRouteObjectPrivate(q)
+{
+ QScopedPointer<QMapPolylineObjectPrivateQSG> poly(new QMapPolylineObjectPrivateQSG(q));
+ m_polyline.swap(poly);
+ m_polyline->m_componentCompleted = true;
+}
+
+QMapRouteObjectPrivateQSG::QMapRouteObjectPrivateQSG(const QMapRouteObjectPrivate &other)
+ : QMapRouteObjectPrivate(other)
+{
+ QScopedPointer<QMapPolylineObjectPrivateQSG> poly(new QMapPolylineObjectPrivateQSG(other.q));
+ m_polyline.swap(poly);
+ m_polyline->m_componentCompleted = true;
+ setRoute(other.declarativeGeoRoute());
+}
+
+QMapRouteObjectPrivateQSG::~QMapRouteObjectPrivateQSG()
+{
+
+}
+
+void QMapRouteObjectPrivateQSG::updateGeometry()
+{
+ m_polyline->updateGeometry();
+}
+
+QSGNode *QMapRouteObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow * window)
+{
+ return m_polyline->updateMapObjectNode(oldNode, root, window);
+}
+
+void QMapRouteObjectPrivateQSG::setRoute(const QDeclarativeGeoRoute *route)
+{
+ const QList<QGeoCoordinate> &path = route->route().path();
+ m_polyline->setColor(QColor("deepskyblue")); // ToDo: support MapParameters for this
+ m_polyline->setWidth(4);
+ m_polyline->setPath(path); // SGNodeChanged emitted by m_polyline
+}
+
+QGeoMapObjectPrivate *QMapRouteObjectPrivateQSG::clone()
+{
+ return new QMapRouteObjectPrivateQSG(static_cast<QMapRouteObjectPrivate &>(*this));
+}
+
+void QMapRouteObjectPrivateQSG::setMap(QGeoMap *map)
+{
+ QGeoMapObjectPrivate::setMap(map);
+ m_polyline->setMap(map);
+}
+
+
+void QMapRouteObjectPrivateQSG::setVisible(bool visible)
+{
+ m_visible = visible;
+ m_polyline->setVisible(visible);
+}
+
+QT_END_NAMESPACE
diff --git a/src/location/labs/qsg/qmaprouteobjectqsg_p_p.h b/src/location/labs/qsg/qmaprouteobjectqsg_p_p.h
new file mode 100644
index 00000000..1c612532
--- /dev/null
+++ b/src/location/labs/qsg/qmaprouteobjectqsg_p_p.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMAPROUTEOBJECTQSG_P_P_H
+#define QMAPROUTEOBJECTQSG_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtLocation/private/qlocationglobal_p.h>
+#include <QtLocation/private/qmappolylineobjectqsg_p_p.h>
+#include <QtLocation/private/qmaprouteobject_p_p.h>
+#include <QtLocation/private/qdeclarativegeoroute_p.h>
+#include <QtLocation/private/qmaprouteobject_p.h>
+#include <QtLocation/private/qqsgmapobject_p.h>
+#include <QtCore/qscopedvaluerollback.h>
+#include <QtCore/qscopedpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_LOCATION_PRIVATE_EXPORT QMapRouteObjectPrivateQSG : public QMapRouteObjectPrivate, public QQSGMapObject
+{
+public:
+ QMapRouteObjectPrivateQSG(QGeoMapObject *q);
+ QMapRouteObjectPrivateQSG(const QMapRouteObjectPrivate &other);
+ ~QMapRouteObjectPrivateQSG() override;
+
+ // QQSGMapObject
+ void updateGeometry() override;
+ QSGNode *updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow *window) override;
+
+ // QMapRouteObjectPrivate interface
+ void setRoute(const QDeclarativeGeoRoute *route) override;
+
+ // QGeoMapObjectPrivate interface
+ QGeoMapObjectPrivate *clone() override;
+ void setMap(QGeoMap *map) override;
+ void setVisible(bool visible) override;
+
+ // Data Members
+ QScopedPointer<QMapPolylineObjectPrivateQSG> m_polyline;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMAPROUTEOBJECTQSG_P_P_H
diff --git a/src/location/labs/qsg/qqsgmapobject.cpp b/src/location/labs/qsg/qqsgmapobject.cpp
new file mode 100644
index 00000000..5b4f7dbf
--- /dev/null
+++ b/src/location/labs/qsg/qqsgmapobject.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqsgmapobject_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QQSGMapObject::QQSGMapObject()
+{
+
+}
+
+QQSGMapObject::~QQSGMapObject()
+{
+
+}
+
+QSGNode *QQSGMapObject::updateMapObjectNode(QSGNode *oldNode, QSGNode * /*root*/, QQuickWindow * /*window*/)
+{
+ delete oldNode;
+ return 0;
+}
+
+void QQSGMapObject::updateGeometry()
+{
+
+}
+
+QT_END_NAMESPACE
+
+
diff --git a/src/location/labs/qsg/qqsgmapobject_p.h b/src/location/labs/qsg/qqsgmapobject_p.h
new file mode 100644
index 00000000..d3e54a68
--- /dev/null
+++ b/src/location/labs/qsg/qqsgmapobject_p.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQSGMAPOBJECT_H
+#define QQSGMAPOBJECT_H
+
+#include <QtLocation/private/qlocationglobal_p.h>
+#include <QtQuick/QSGOpacityNode>
+#include <QtLocation/private/qgeomapobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWindow;
+class Q_LOCATION_PRIVATE_EXPORT QQSGMapObject
+{
+public:
+ QQSGMapObject();
+ virtual ~QQSGMapObject();
+
+ virtual QSGNode *updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow *window);
+ virtual void updateGeometry();
+
+ QSGNode *node = nullptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQSGMAPOBJECT_H