summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2018-04-17 18:23:31 +0200
committerLiang Qi <liang.qi@qt.io>2018-04-17 16:46:02 +0000
commit3d2281ccf7400a782f69b7b74cb45d0889708bcc (patch)
tree049703e99771e8cdb19abc33797fcb366d4b2df1
parent572957bb1326190672ea138ccf475c0cf1893192 (diff)
parentf57956599925dd9eefe70d1b0cc31cb033414a33 (diff)
downloadqtlocation-3d2281ccf7400a782f69b7b74cb45d0889708bcc.tar.gz
Merge remote-tracking branch 'origin/wip/navigation' into 5.11
Conflicts: src/location/declarativemaps/qgeomapobject.cpp src/location/declarativemaps/qgeomapobject_p_p.h src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h Change-Id: Iab847e16011b2095d307e2a3610bf9157ae7b92d
-rw-r--r--src/imports/imports.pro6
-rw-r--r--src/imports/locationlabs/locationlabs.cpp24
-rw-r--r--src/imports/locationlabs/locationlabs.pro2
-rw-r--r--src/location/declarativemaps/qdeclarativecirclemapitem.cpp9
-rw-r--r--src/location/declarativemaps/qdeclarativecirclemapitem_p.h10
-rw-r--r--src/location/declarativemaps/qdeclarativegeomapitembase_p.h2
-rw-r--r--src/location/declarativemaps/qdeclarativepolygonmapitem_p.h4
-rw-r--r--src/location/declarativemaps/qdeclarativepolylinemapitem.cpp6
-rw-r--r--src/location/declarativemaps/qdeclarativepolylinemapitem_p.h7
-rw-r--r--src/location/declarativemaps/qgeomapitemgeometry_p.h5
-rw-r--r--src/location/declarativemaps/qgeomapobject.cpp19
-rw-r--r--src/location/declarativemaps/qgeomapobject_p_p.h1
-rw-r--r--src/location/labs/labs.pri4
-rw-r--r--src/location/labs/qdeclarativenavigator.cpp395
-rw-r--r--src/location/labs/qdeclarativenavigator_p.h146
-rw-r--r--src/location/labs/qdeclarativenavigator_p_p.h86
-rw-r--r--src/location/labs/qgeotiledmaplabs.cpp295
-rw-r--r--src/location/labs/qgeotiledmaplabs_p.h90
-rw-r--r--src/location/labs/qmapcircleobject.cpp287
-rw-r--r--src/location/labs/qmapcircleobject_p.h93
-rw-r--r--src/location/labs/qmapcircleobject_p_p.h117
-rw-r--r--src/location/labs/qmapiconobject.cpp245
-rw-r--r--src/location/labs/qmapiconobject_p.h88
-rw-r--r--src/location/labs/qmapiconobject_p_p.h105
-rw-r--r--src/location/labs/qmapobjectview.cpp (renamed from src/locationlabs/qmapobjectview.cpp)51
-rw-r--r--src/location/labs/qmapobjectview_p.h (renamed from src/locationlabs/qmapobjectview_p.h)4
-rw-r--r--src/location/labs/qmapobjectview_p_p.h (renamed from src/locationlabs/qmapobjectview_p_p.h)6
-rw-r--r--src/location/labs/qmappolygonobject.cpp255
-rw-r--r--src/location/labs/qmappolygonobject_p.h90
-rw-r--r--src/location/labs/qmappolygonobject_p_p.h112
-rw-r--r--src/location/labs/qmappolylineobject.cpp218
-rw-r--r--src/location/labs/qmappolylineobject_p.h85
-rw-r--r--src/location/labs/qmappolylineobject_p_p.h107
-rw-r--r--src/location/labs/qmaprouteobject.cpp (renamed from src/locationlabs/qmaprouteobject.cpp)18
-rw-r--r--src/location/labs/qmaprouteobject_p.h (renamed from src/locationlabs/qmaprouteobject_p.h)4
-rw-r--r--src/location/labs/qmaprouteobject_p_p.h (renamed from src/locationlabs/qmaprouteobject_p_p.h)4
-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
-rw-r--r--src/location/location.pro2
-rw-r--r--src/location/maps/qgeomap.cpp7
-rw-r--r--src/location/maps/qgeomap_p.h2
-rw-r--r--src/location/maps/qnavigationmanager.cpp42
-rw-r--r--src/location/maps/qnavigationmanager_p.h27
-rw-r--r--src/location/maps/qnavigationmanagerengine.cpp8
-rw-r--r--src/location/maps/qnavigationmanagerengine_p.h14
-rw-r--r--src/locationlabs/locationlabs.pro11
-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.cpp193
-rw-r--r--src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h5
-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/nokia/qgeouriprovider.cpp4
-rw-r--r--src/plugins/geoservices/nokia/qgeouriprovider.h2
-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
-rw-r--r--src/positioning/qdoublevector2d_p.h6
-rw-r--r--src/src.pro6
-rw-r--r--sync.profile1
76 files changed, 4801 insertions, 99 deletions
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index 2fd8dbd0..b640c791 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -1,5 +1,7 @@
TEMPLATE = subdirs
-qtHaveModule(positioning): SUBDIRS += positioning
+QT_FOR_CONFIG += location-private
+
+qtHaveModule(positioningquick): SUBDIRS += positioning
qtHaveModule(location): SUBDIRS += location
-qtHaveModule(locationlabs): SUBDIRS += locationlabs
+qtHaveModule(location):qtConfig(location-labs-plugin): SUBDIRS += locationlabs
diff --git a/src/imports/locationlabs/locationlabs.cpp b/src/imports/locationlabs/locationlabs.cpp
index 4b77a2ae..56924b80 100644
--- a/src/imports/locationlabs/locationlabs.cpp
+++ b/src/imports/locationlabs/locationlabs.cpp
@@ -34,10 +34,13 @@
**
****************************************************************************/
-//#include <QtLocationLabs/private/qmapiconobject_p.h>
-#include <QtLocationLabs/private/qmapobjectview_p.h>
-#include <QtLocationLabs/private/qmaprouteobject_p.h>
-//#include <QtLocationLabs/private/qdeclarativenavigator_p.h>
+#include <QtLocation/private/qmapiconobject_p.h>
+#include <QtLocation/private/qmapobjectview_p.h>
+#include <QtLocation/private/qmaprouteobject_p.h>
+#include <QtLocation/private/qmapcircleobject_p.h>
+#include <QtLocation/private/qmappolygonobject_p.h>
+#include <QtLocation/private/qmappolylineobject_p.h>
+#include <QtLocation/private/qdeclarativenavigator_p.h>
#include <QtQml/qqmlextensionplugin.h>
#include <QtQml/qqml.h>
@@ -67,14 +70,17 @@ public:
if (QLatin1String(uri) == QLatin1String("Qt.labs.location")) {
// @uri QtLocationLabs
- int major = 5;
- int minor = 11;
+ int major = 1;
+ int minor = 0;
- // Register the 5.11 types
-// qmlRegisterType<QDeclarativeNavigator>(uri, major, minor, "Navigator");
-// qmlRegisterType<QMapIconObject>(uri, major, minor, "MapIconObject");
+ // Register the 1.0 labs types
+ qmlRegisterType<QMapIconObject>(uri, major, minor, "MapIconObject");
qmlRegisterType<QMapObjectView>(uri, major, minor, "MapObjectView");
qmlRegisterType<QMapRouteObject>(uri, major, minor, "MapRouteObject");
+ qmlRegisterType<QMapCircleObject>(uri, major, minor, "MapCircleObject");
+ qmlRegisterType<QMapPolygonObject>(uri, major, minor, "MapPolygonObject");
+ qmlRegisterType<QMapPolylineObject>(uri, major, minor, "MapPolylineObject");
+ qmlRegisterType<QDeclarativeNavigator>(uri, major, minor, "Navigator");
// Register the latest Qt version as QML type version
qmlRegisterModule(uri, QT_VERSION_MAJOR, QT_VERSION_MINOR);
diff --git a/src/imports/locationlabs/locationlabs.pro b/src/imports/locationlabs/locationlabs.pro
index 618e1492..db7f5ec2 100644
--- a/src/imports/locationlabs/locationlabs.pro
+++ b/src/imports/locationlabs/locationlabs.pro
@@ -1,4 +1,4 @@
-QT += quick-private network positioning-private location-private locationlabs-private qml-private core-private gui-private
+QT += quick-private network positioning-private location-private qml-private core-private gui-private
TARGET = locationlabsplugin
CXX_MODULE = $$TARGET
diff --git a/src/location/declarativemaps/qdeclarativecirclemapitem.cpp b/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
index 03a6b9e6..a30b7b30 100644
--- a/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
@@ -501,7 +501,7 @@ void QDeclarativeCircleMapItem::updatePolish()
QList<QDoubleVector2D> circlePath = circlePath_;
int pathCount = circlePath.size();
- bool preserve = preserveCircleGeometry(circlePath, circle_.center(), circle_.radius());
+ bool preserve = preserveCircleGeometry(circlePath, circle_.center(), circle_.radius(), p);
// using leftBound_ instead of the analytically calculated circle_.boundingGeoRectangle().topLeft());
// to fix QTBUG-62154
geometry_.setPreserveGeometry(true, leftBound_); // to set the geoLeftBound_
@@ -623,11 +623,11 @@ void QDeclarativeCircleMapItem::geometryChanged(const QRectF &newGeometry, const
}
bool QDeclarativeCircleMapItem::preserveCircleGeometry (QList<QDoubleVector2D> &path,
- const QGeoCoordinate &center, qreal distance)
+ const QGeoCoordinate &center, qreal distance, const QGeoProjectionWebMercator &p)
{
// if circle crosses north/south pole, then don't preserve circular shape,
if ( crossEarthPole(center, distance)) {
- updateCirclePathForRendering(path, center, distance);
+ updateCirclePathForRendering(path, center, distance, p);
return false;
}
return true;
@@ -653,9 +653,8 @@ bool QDeclarativeCircleMapItem::preserveCircleGeometry (QList<QDoubleVector2D> &
*/
void QDeclarativeCircleMapItem::updateCirclePathForRendering(QList<QDoubleVector2D> &path,
const QGeoCoordinate &center,
- qreal distance)
+ qreal distance, const QGeoProjectionWebMercator &p)
{
- const QGeoProjectionWebMercator &p = static_cast<const QGeoProjectionWebMercator&>(map()->geoProjection());
const qreal poleLat = 90;
const qreal distanceToNorthPole = center.distanceTo(QGeoCoordinate(poleLat, 0));
const qreal distanceToSouthPole = center.distanceTo(QGeoCoordinate(-poleLat, 0));
diff --git a/src/location/declarativemaps/qdeclarativecirclemapitem_p.h b/src/location/declarativemaps/qdeclarativecirclemapitem_p.h
index bb359ee3..2e8c56f8 100644
--- a/src/location/declarativemaps/qdeclarativecirclemapitem_p.h
+++ b/src/location/declarativemaps/qdeclarativecirclemapitem_p.h
@@ -58,7 +58,7 @@
QT_BEGIN_NAMESPACE
-class QGeoMapCircleGeometry : public QGeoMapPolygonGeometry
+class Q_LOCATION_PRIVATE_EXPORT QGeoMapCircleGeometry : public QGeoMapPolygonGeometry
{
public:
QGeoMapCircleGeometry();
@@ -99,8 +99,10 @@ public:
static bool crossEarthPole(const QGeoCoordinate &center, qreal distance);
static void calculatePeripheralPoints(QList<QGeoCoordinate> &path, const QGeoCoordinate &center,
qreal distance, int steps, QGeoCoordinate &leftBound);
- bool preserveCircleGeometry(QList<QDoubleVector2D> &path, const QGeoCoordinate &center,
- qreal distance);
+ static bool preserveCircleGeometry(QList<QDoubleVector2D> &path, const QGeoCoordinate &center,
+ qreal distance, const QGeoProjectionWebMercator &p);
+ static void updateCirclePathForRendering(QList<QDoubleVector2D> &path, const QGeoCoordinate &center,
+ qreal distance, const QGeoProjectionWebMercator &p);
Q_SIGNALS:
void centerChanged(const QGeoCoordinate &center);
@@ -117,8 +119,6 @@ protected Q_SLOTS:
private:
void updateCirclePath();
- void updateCirclePathForRendering(QList<QDoubleVector2D> &path, const QGeoCoordinate &center,
- qreal distance);
private:
QGeoCircle circle_;
diff --git a/src/location/declarativemaps/qdeclarativegeomapitembase_p.h b/src/location/declarativemaps/qdeclarativegeomapitembase_p.h
index 162c6d71..603bcafd 100644
--- a/src/location/declarativemaps/qdeclarativegeomapitembase_p.h
+++ b/src/location/declarativemaps/qdeclarativegeomapitembase_p.h
@@ -149,7 +149,7 @@ private Q_SLOTS:
void baseCameraDataChanged(const QGeoCameraData &camera);
private:
- QGeoMap *map_;
+ QPointer<QGeoMap> map_;
QDeclarativeGeoMap *quickMap_;
QSizeF lastSize_;
diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem_p.h b/src/location/declarativemaps/qdeclarativepolygonmapitem_p.h
index 72bfd856..1e2a91c9 100644
--- a/src/location/declarativemaps/qdeclarativepolygonmapitem_p.h
+++ b/src/location/declarativemaps/qdeclarativepolygonmapitem_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
class MapPolygonNode;
-class QGeoMapPolygonGeometry : public QGeoMapItemGeometry
+class Q_LOCATION_PRIVATE_EXPORT QGeoMapPolygonGeometry : public QGeoMapItemGeometry
{
public:
QGeoMapPolygonGeometry();
@@ -137,7 +137,7 @@ private:
//////////////////////////////////////////////////////////////////////
-class MapPolygonNode : public QSGGeometryNode
+class Q_LOCATION_PRIVATE_EXPORT MapPolygonNode : public QSGGeometryNode
{
public:
diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
index 5e843dd1..44f9b3a1 100644
--- a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
@@ -586,6 +586,12 @@ void QGeoMapPolylineGeometry::updateScreenPoints(const QGeoMap &map,
this->translate( -1 * sourceBounds_.topLeft() + QPointF(strokeWidth, strokeWidth));
}
+void QGeoMapPolylineGeometry::clearSource()
+{
+ srcPoints_.clear();
+ srcPointTypes_.clear();
+}
+
QDeclarativePolylineMapItem::QDeclarativePolylineMapItem(QQuickItem *parent)
: QDeclarativeGeoMapItemBase(parent), line_(this), dirtyMaterial_(true), updatingGeometry_(false)
{
diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h b/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h
index 03fba636..61439097 100644
--- a/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h
+++ b/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h
@@ -85,7 +85,7 @@ private:
QColor color_;
};
-class QGeoMapPolylineGeometry : public QGeoMapItemGeometry
+class Q_LOCATION_PRIVATE_EXPORT QGeoMapPolylineGeometry : public QGeoMapItemGeometry
{
public:
QGeoMapPolylineGeometry();
@@ -97,7 +97,8 @@ public:
void updateScreenPoints(const QGeoMap &map,
qreal strokeWidth);
-protected:
+ void clearSource();
+
QList<QList<QDoubleVector2D> > clipPath(const QGeoMap &map,
const QList<QDoubleVector2D> &path,
QDoubleVector2D &leftBoundWrapped);
@@ -177,7 +178,7 @@ private:
//////////////////////////////////////////////////////////////////////
-class MapPolylineNode : public QSGGeometryNode
+class Q_LOCATION_PRIVATE_EXPORT MapPolylineNode : public QSGGeometryNode
{
public:
diff --git a/src/location/declarativemaps/qgeomapitemgeometry_p.h b/src/location/declarativemaps/qgeomapitemgeometry_p.h
index 595107ae..5149a7c0 100644
--- a/src/location/declarativemaps/qgeomapitemgeometry_p.h
+++ b/src/location/declarativemaps/qgeomapitemgeometry_p.h
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
class QSGGeometry;
class QGeoMap;
-class QGeoMapItemGeometry
+class Q_LOCATION_PRIVATE_EXPORT QGeoMapItemGeometry
{
public:
QGeoMapItemGeometry();
@@ -124,6 +124,9 @@ public:
static QRectF translateToCommonOrigin(const QList<QGeoMapItemGeometry *> &geoms);
+private:
+ QGeoMapItemGeometry(const QGeoMapItemGeometry &other); // Or else it may crash on copy
+ QGeoMapItemGeometry &operator= (const QGeoMapItemGeometry & other); // Or else it may crash on copy
protected:
bool sourceDirty_;
diff --git a/src/location/declarativemaps/qgeomapobject.cpp b/src/location/declarativemaps/qgeomapobject.cpp
index 9c97dd57..391ac04c 100644
--- a/src/location/declarativemaps/qgeomapobject.cpp
+++ b/src/location/declarativemaps/qgeomapobject.cpp
@@ -190,16 +190,28 @@ void QGeoMapObject::setMap(QGeoMap *map)
if (d_ptr->m_map == map)
return;
- d_ptr->m_map = map;
if (map) {
+ bool oldVisible = d_ptr->m_visible;
+ bool oldCmponentCompleted = d_ptr->m_componentCompleted;
if (!map->createMapObjectImplementation(this))
qWarning() << "Unsupported type " << type();
// old implementation gets destroyed if/when d_ptr gets replaced
+ d_ptr->m_componentCompleted = oldCmponentCompleted;
+ d_ptr->setVisible(oldVisible);
}
+ d_ptr->setMap(map);
const QList<QGeoMapObject *> kids = geoMapObjectChildren();
for (auto kid : kids)
kid->setMap(map);
+
+ // Each subclass is in charge to do the equivalent of
+ // if (!map) {
+ // // Map was set, now it has ben re-set to NULL
+ // d_ptr = new QMapCircleObjectPrivateDefault(*d);
+ // // Old pimpl deleted implicitly by QExplicitlySharedDataPointer
+ // }
+ // After this method is called.
}
QGeoMap *QGeoMapObject::map() const
@@ -276,4 +288,9 @@ void QGeoMapObjectPrivate::setParentVisibility(bool visible)
m_parentVisible = visible;
}
+void QGeoMapObjectPrivate::setMap(QGeoMap *map)
+{
+ m_map = map;
+}
+
QT_END_NAMESPACE
diff --git a/src/location/declarativemaps/qgeomapobject_p_p.h b/src/location/declarativemaps/qgeomapobject_p_p.h
index 3ecd4c5c..242a93ce 100644
--- a/src/location/declarativemaps/qgeomapobject_p_p.h
+++ b/src/location/declarativemaps/qgeomapobject_p_p.h
@@ -73,6 +73,7 @@ public:
virtual bool visible() const;
virtual void setVisible(bool visible);
virtual void setParentVisibility(bool visible);
+ virtual void setMap(QGeoMap *map);
virtual QGeoMapObjectPrivate *clone() = 0; // to allow proper detaching
QGeoMapObject *q = nullptr;
diff --git a/src/location/labs/labs.pri b/src/location/labs/labs.pri
new file mode 100644
index 00000000..2da5e90d
--- /dev/null
+++ b/src/location/labs/labs.pri
@@ -0,0 +1,4 @@
+INCLUDEPATH += labs
+
+PRIVATE_HEADERS += $$files($$PWD/*.h) $$files($$PWD/qsg/*.h)
+SOURCES += $$files($$PWD/*.cpp) $$files($$PWD/qsg/*.cpp)
diff --git a/src/location/labs/qdeclarativenavigator.cpp b/src/location/labs/qdeclarativenavigator.cpp
new file mode 100644
index 00000000..475cb650
--- /dev/null
+++ b/src/location/labs/qdeclarativenavigator.cpp
@@ -0,0 +1,395 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdeclarativenavigator_p.h"
+#include "qdeclarativenavigator_p_p.h"
+#include <QtLocation/private/qdeclarativegeomap_p.h>
+#include <QtLocation/private/qdeclarativegeoserviceprovider_p.h>
+#include <QtLocation/private/qnavigationmanager_p.h>
+#include <QtLocation/private/qnavigationmanagerengine_p.h>
+#include <QtLocation/private/qgeomapparameter_p.h>
+#include <QtLocation/private/qdeclarativegeoroute_p.h>
+#include <QtLocation/private/qdeclarativegeoroutemodel_p.h>
+#include <QtLocation/private/qdeclarativegeoroutesegment_p.h>
+#include <QtQml/qqmlinfo.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Navigator
+ \instantiates QDeclarativeNavigator
+ \inqmlmodule Qt.labs.location
+ \ingroup qml-QtLocation5-maps
+
+ \brief The Navigator type offers functionalities to perform turn-by-turn navigation.
+
+ The Navigator purpose is to use a plugin's turn-by-turn navigation implementation in a QML
+ application in a seamless manner.
+ This object may take control of the map position, orientation, tilting and zoom, as well as changing
+ the map style, elements on the map such as direction information.
+ In certain cases, it may also restrict user interaction with the Map and with the items on it.
+*/
+
+/*!
+ \qmlproperty Plugin Qt.labs.location::Navigator::plugin
+
+ This property holds the plugin which provides the navigation functionality.
+
+ This is a write-once property. Once the Navigator has a plugin associated with
+ it, any attempted modifications of the plugin property will be ignored.
+
+ \sa Plugin
+*/
+
+/*!
+ \qmlproperty Map Qt.labs.location::Navigator::map
+
+ This property holds the Map that the navigator is in charge of controlling.
+
+ This is a write-once property. Once the Navigator has a Map associated with
+ it, any attempted modifications of the map property will be ignored.
+
+ \sa Map
+*/
+
+/*!
+ \qmlproperty Route Qt.labs.location::Navigator::route
+
+ This property holds the Route that the navigator is supposed to use
+ to perform the navigation.
+
+ \note
+ This property is not necessarily the same as \l currentRoute.
+ currentRoute may differ, during routing, for various reasons.
+ It is reasonable to assume, however, that currentRoute's destination
+ will be the same as route's destination.
+ Setting this property while a navigation session is ongoing will
+ stop the navigation.
+
+ \sa Route
+*/
+
+/*!
+ \qmlproperty PositionSource Qt.labs.location::Navigator::positionSource
+
+ This property holds the PositionSource that the navigator will receive position
+ updates from to perform the navigation.
+
+ This is a write-once property. Once the Navigator has a PositionSource associated with
+ it, any attempted modifications of the positionSource property will be ignored.
+
+ \sa PositionSource
+*/
+
+/*!
+ \qmlproperty bool Qt.labs.location::Navigator::active
+
+ This property tells whether the Navigator is navigating or not.
+ Set this property to \c true to start the navigation.
+ Set it to \c false to stop an active navigation session.
+*/
+
+/*!
+ \qmlproperty bool Qt.labs.location::Navigator::navigatorReady
+
+ This read-only property tells whether the navigator is ready
+ to start the navigation or not.
+ A Navigator becomes ready once the plugin is attached and a navigation engine has been
+ instantiated, and the other required properties are set to valid values.
+*/
+
+/*!
+ \qmlproperty Route Qt.labs.location::Navigator::currentRoute
+
+ This read-only property holds the current route the navigator following.
+ This can be the same as \l route, or can be different, if the navigator
+ cannot follow the user-specified route.
+ For example if the position coming from \l positionSource is considerably
+ off route, the navigation engine might recalculate and start following a
+ new route.
+
+ \sa Route
+*/
+
+/*!
+ \qmlproperty int Qt.labs.location::Navigator::currentSegment
+
+ This read-only property holds the index of the current RouteSegment in the \l currentRoute.
+
+ \sa RouteSegment
+*/
+
+/*!
+ \qmlsignal Qt.labs.location::Navigator::waypointReached(Waypoint waypoint)
+
+ This signal is emitted when the waypoint \e waypoint has been reached.
+
+ \sa Waypoint
+*/
+
+/*!
+ \qmlsignal Qt.labs.location::Navigator::destinationReached()
+
+ This signal is emitted when the last waypoint of the route, the destination,
+ has been reached.
+*/
+
+QDeclarativeNavigatorPrivate::QDeclarativeNavigatorPrivate(QParameterizableObject *q_)
+ : q(q_)
+{
+}
+
+
+QDeclarativeNavigator::QDeclarativeNavigator(QObject *parent)
+ : QParameterizableObject(parent), d_ptr(new QDeclarativeNavigatorPrivate(this))
+{
+}
+
+QDeclarativeNavigator::~QDeclarativeNavigator()
+{
+}
+
+void QDeclarativeNavigator::classBegin()
+{
+}
+
+void QDeclarativeNavigator::componentComplete()
+{
+ d_ptr->m_completed = true;
+ // Children have been completed
+ d_ptr->m_parameters = quickChildren<QGeoMapParameter>();
+ if (d_ptr->m_plugin && d_ptr->m_plugin->isAttached())
+ pluginReady();
+}
+
+QDeclarativeGeoServiceProvider *QDeclarativeNavigator::plugin() const
+{
+ return d_ptr->m_plugin;
+}
+
+void QDeclarativeNavigator::setMap(QDeclarativeGeoMap *map)
+{
+ if (d_ptr->m_map) // set once prop
+ return;
+
+ d_ptr->m_map = map;
+ emit mapChanged();
+ updateReadyState();
+}
+
+QDeclarativeGeoMap *QDeclarativeNavigator::map() const
+{
+ return d_ptr->m_map;
+}
+
+void QDeclarativeNavigator::setRoute(QDeclarativeGeoRoute *route)
+{
+ if (d_ptr->m_route == route) // This isn't set-once
+ return;
+
+ const bool isReady = d_ptr->m_navigationManager && d_ptr->m_navigationManager->ready();
+ const bool isActive = active();
+ if (isReady && isActive)
+ setActive(false); // Stop current session
+
+ d_ptr->m_route = route;
+ emit routeChanged();
+ updateReadyState();
+}
+
+QDeclarativeGeoRoute *QDeclarativeNavigator::route() const
+{
+ return d_ptr->m_route;
+}
+
+void QDeclarativeNavigator::setPositionSource(QDeclarativePositionSource *positionSource)
+{
+ if (d_ptr->m_positionSource) // set once prop
+ return;
+
+ d_ptr->m_positionSource = positionSource;
+ emit positionSourceChanged();
+ updateReadyState();
+}
+
+QDeclarativePositionSource *QDeclarativeNavigator::positionSource() const
+{
+ return d_ptr->m_positionSource;
+}
+
+QNavigationManager *QDeclarativeNavigator::navigationManager() const
+{
+ return d_ptr->m_navigationManager;
+}
+
+bool QDeclarativeNavigator::navigatorReady() const
+{
+ if (d_ptr->m_navigationManager)
+ return d_ptr->m_navigationManager->ready();
+ return d_ptr->m_ready;
+}
+
+QDeclarativeGeoRoute *QDeclarativeNavigator::currentRoute() const
+{
+ if (!d_ptr->m_ready || !d_ptr->m_navigationManager->active())
+ return d_ptr->m_route;
+ return d_ptr->m_currentRoute;
+}
+
+int QDeclarativeNavigator::currentSegment() const
+{
+ if (!d_ptr->m_ready || !d_ptr->m_navigationManager->active())
+ return 0;
+ return d_ptr->m_currentSegment;
+}
+
+bool QDeclarativeNavigator::active() const
+{
+ return d_ptr->m_active;
+}
+
+void QDeclarativeNavigator::setPlugin(QDeclarativeGeoServiceProvider *plugin)
+{
+ if (d_ptr->m_plugin)
+ return; // set once property.
+
+ d_ptr->m_plugin = plugin;
+ emit pluginChanged();
+
+ if (d_ptr->m_plugin->isAttached()) {
+ pluginReady();
+ } else {
+ connect(d_ptr->m_plugin, &QDeclarativeGeoServiceProvider::attached,
+ this, &QDeclarativeNavigator::pluginReady);
+ }
+}
+
+void QDeclarativeNavigator::setActive(bool active)
+{
+ if (d_ptr->m_active == active)
+ return;
+
+ d_ptr->m_active = active;
+ if (!d_ptr->m_plugin)
+ return;
+
+ if (active)
+ start();
+ else
+ stop();
+}
+
+void QDeclarativeNavigator::start()
+{
+ if (!d_ptr->m_ready) {
+ qmlWarning(this) << QStringLiteral("Navigation manager not ready.");
+ return;
+ }
+
+ if (d_ptr->m_active)
+ return;
+
+ d_ptr->m_active = d_ptr->m_navigationManager->start();
+}
+
+void QDeclarativeNavigator::stop()
+{
+ if (!ensureEngine()) { // If somebody re-set route to null or something, this may become !d_ptr->m_ready
+ qmlWarning(this) << QStringLiteral("Navigation manager not ready.");
+ return;
+ }
+
+ if (!d_ptr->m_active)
+ return;
+
+ d_ptr->m_active = d_ptr->m_navigationManager->stop();
+}
+
+void QDeclarativeNavigator::pluginReady()
+{
+ if (!d_ptr->m_completed)
+ return;
+
+ ensureEngine();
+ updateReadyState();
+ if (d_ptr->m_active)
+ start();
+}
+
+bool QDeclarativeNavigator::ensureEngine()
+{
+ if (d_ptr->m_navigationManager)
+ return true;
+ if (!d_ptr->m_completed || !d_ptr->m_plugin->isAttached())
+ return false;
+
+ d_ptr->m_navigationManager = d_ptr->m_plugin->sharedGeoServiceProvider()->navigationManager();
+ if (d_ptr->m_navigationManager) {
+ d_ptr->m_navigationManager->setNavigator(d_ptr.data());
+ d_ptr->m_navigationManager->setParameters(d_ptr->m_parameters);
+ connect(d_ptr->m_navigationManager, &QNavigationManager::waypointReached, this, &QDeclarativeNavigator::waypointReached);
+ connect(d_ptr->m_navigationManager, &QNavigationManager::destinationReached, this, &QDeclarativeNavigator::destinationReached);
+ connect(d_ptr->m_navigationManager, &QNavigationManager::currentRouteChanged, this, &QDeclarativeNavigator::onCurrentRouteChanged);
+ connect(d_ptr->m_navigationManager, &QNavigationManager::currentSegmentChanged, this, &QDeclarativeNavigator::onCurrentSegmentChanged);
+ connect(d_ptr->m_navigationManager, &QNavigationManager::activeChanged, this, [this](bool active){
+ d_ptr->m_active = active;
+ emit activeChanged(active);
+ });
+ emit navigatorReadyChanged(true);
+ return true;
+ }
+ return false;
+}
+
+void QDeclarativeNavigator::updateReadyState() {
+ const bool oldReady = d_ptr->m_ready;
+ if (!d_ptr->m_navigationManager)
+ d_ptr->m_ready = false;
+ else
+ d_ptr->m_ready = d_ptr->m_navigationManager->ready();
+
+ if (oldReady != d_ptr->m_ready)
+ emit navigatorReadyChanged(d_ptr->m_ready);
+}
+
+void QDeclarativeNavigator::onCurrentRouteChanged(const QGeoRoute &route)
+{
+ if (d_ptr->m_currentRoute)
+ d_ptr->m_currentRoute->deleteLater();
+ d_ptr->m_currentRoute = new QDeclarativeGeoRoute(route, this);
+ emit currentRouteChanged();
+}
+
+void QDeclarativeNavigator::onCurrentSegmentChanged(int segment)
+{
+ d_ptr->m_currentSegment = segment;
+ emit currentSegmentChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/location/labs/qdeclarativenavigator_p.h b/src/location/labs/qdeclarativenavigator_p.h
new file mode 100644
index 00000000..3c9a4653
--- /dev/null
+++ b/src/location/labs/qdeclarativenavigator_p.h
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** 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 QDECLARATIVENAVIGATOR_P_H
+#define QDECLARATIVENAVIGATOR_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 <QSharedPointer>
+#include <QtLocation/private/qparameterizableobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeGeoServiceProvider;
+class QDeclarativeGeoMap;
+class QNavigationManager;
+class QDeclarativeGeoRoute;
+class QDeclarativePositionSource;
+class QDeclarativeGeoWaypoint;
+class QGeoRoute;
+class QGeoRouteSegment;
+class QDeclarativeNavigatorPrivate;
+class QDeclarativeGeoRouteSegment;
+
+class Q_LOCATION_PRIVATE_EXPORT QDeclarativeNavigator : public QParameterizableObject, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_PROPERTY(QDeclarativeGeoServiceProvider *plugin READ plugin WRITE setPlugin NOTIFY pluginChanged)
+ Q_PROPERTY(QDeclarativeGeoMap *map READ map WRITE setMap NOTIFY mapChanged)
+ Q_PROPERTY(QDeclarativeGeoRoute *route READ route WRITE setRoute NOTIFY routeChanged)
+ Q_PROPERTY(QDeclarativePositionSource *positionSource READ positionSource WRITE setPositionSource NOTIFY positionSourceChanged)
+ Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
+ Q_PROPERTY(bool navigatorReady READ navigatorReady NOTIFY navigatorReadyChanged)
+ Q_PROPERTY(QDeclarativeGeoRoute *currentRoute READ currentRoute NOTIFY currentRouteChanged)
+ Q_PROPERTY(int currentSegment READ currentSegment NOTIFY currentSegmentChanged)
+ Q_INTERFACES(QQmlParserStatus)
+
+public:
+ explicit QDeclarativeNavigator(QObject *parent = nullptr);
+ ~QDeclarativeNavigator();
+
+ // QQmlParserStatus interface
+ void classBegin() override;
+ void componentComplete() override;
+
+ // QDeclarativeNavigator
+ void start();
+ void stop();
+
+ void setActive(bool active);
+ bool active() const;
+
+ void setPlugin(QDeclarativeGeoServiceProvider * plugin);
+ QDeclarativeGeoServiceProvider *plugin() const;
+
+ void setMap(QDeclarativeGeoMap *map);
+ QDeclarativeGeoMap * map() const;
+
+ void setRoute(QDeclarativeGeoRoute *route);
+ QDeclarativeGeoRoute *route() const;
+
+ void setPositionSource(QDeclarativePositionSource *positionSource);
+ QDeclarativePositionSource *positionSource() const;
+
+ QNavigationManager *navigationManager() const;
+ bool navigatorReady() const;
+
+ QDeclarativeGeoRoute *currentRoute() const;
+ int currentSegment() const;
+
+signals:
+ void navigatorReadyChanged(bool ready);
+ void activeChanged(bool active);
+ void waypointReached(const QDeclarativeGeoWaypoint *pos);
+ void destinationReached();
+
+ void pluginChanged();
+ void mapChanged();
+ void routeChanged();
+ void positionSourceChanged();
+ void currentRouteChanged();
+ void currentSegmentChanged();
+
+private:
+ void pluginReady();
+ bool ensureEngine();
+ void updateReadyState();
+
+private slots:
+ void onCurrentRouteChanged(const QGeoRoute &route);
+ void onCurrentSegmentChanged(int segment);
+
+private:
+ QScopedPointer<QDeclarativeNavigatorPrivate> d_ptr;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QDeclarativeNavigator)
+
+
+#endif // QDECLARATIVENAVIGATOR_P_H
diff --git a/src/location/labs/qdeclarativenavigator_p_p.h b/src/location/labs/qdeclarativenavigator_p_p.h
new file mode 100644
index 00000000..0485ee69
--- /dev/null
+++ b/src/location/labs/qdeclarativenavigator_p_p.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** 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 QDECLARATIVENAVIGATOR_P_P_H
+#define QDECLARATIVENAVIGATOR_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 <QtCore/qlist.h>
+#include <QtLocation/private/qlocationglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeGeoServiceProvider;
+class QDeclarativeGeoMap;
+class QNavigationManager;
+class QDeclarativeGeoRoute;
+class QDeclarativePositionSource;
+class QGeoMapParameter;
+class QDeclarativeGeoRouteSegment;
+class QParameterizableObject;
+
+class Q_LOCATION_PRIVATE_EXPORT QDeclarativeNavigatorPrivate
+{
+public:
+ QDeclarativeNavigatorPrivate(QParameterizableObject *q_);
+
+ QParameterizableObject *q = nullptr;
+ QNavigationManager *m_navigationManager = nullptr;
+ QDeclarativeGeoServiceProvider *m_plugin = nullptr;
+ QDeclarativeGeoMap *m_map = nullptr;
+ QDeclarativeGeoRoute *m_route = nullptr;
+ QDeclarativePositionSource *m_positionSource = nullptr;
+ QDeclarativeGeoRoute *m_currentRoute = nullptr;
+ QList<QGeoMapParameter *> m_parameters;
+ int m_currentSegment = 0;
+ bool m_active = false;
+ bool m_completed = false;
+ bool m_ready = false;
+};
+
+QT_END_NAMESPACE
+
+#endif // QDECLARATIVENAVIGATOR_P_P_H
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/qmapcircleobject.cpp b/src/location/labs/qmapcircleobject.cpp
new file mode 100644
index 00000000..735ece5c
--- /dev/null
+++ b/src/location/labs/qmapcircleobject.cpp
@@ -0,0 +1,287 @@
+/****************************************************************************
+**
+** 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 "qmapcircleobject_p.h"
+#include "qmapcircleobject_p_p.h"
+#include <QExplicitlySharedDataPointer>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype MapCircleObject
+ \instantiates QMapCircleObject
+ \inqmlmodule Qt.labs.location
+ \ingroup qml-QtLocation5-maps
+ \inherits QGeoMapObject
+
+ \brief The MapCircleObject displays a circle on a Map.
+
+ The MapCircleObject displays a circle on a Map.
+ The MapIconObject type only makes sense when contained in a Map or in a \l MapObjectView.
+*/
+
+QMapCircleObjectPrivate::QMapCircleObjectPrivate(QGeoMapObject *q) : QGeoMapObjectPrivate(q)
+{
+
+}
+
+QMapCircleObjectPrivate::~QMapCircleObjectPrivate()
+{
+
+}
+
+QGeoMapObject::Type QMapCircleObjectPrivate::type() const
+{
+ return QGeoMapObject::CircleType;
+}
+
+
+
+//
+// QMapCircleObjectPrivate default implementation
+//
+
+QMapCircleObjectPrivateDefault::QMapCircleObjectPrivateDefault(QGeoMapObject *q) : QMapCircleObjectPrivate(q)
+{
+
+}
+
+QMapCircleObjectPrivateDefault::QMapCircleObjectPrivateDefault(const QMapCircleObjectPrivate &other) : QMapCircleObjectPrivate(other.q)
+{
+ m_center = other.center();
+ m_radius = other.radius();
+ m_fillColor = other.color();
+ m_borderColor = other.borderColor();
+ m_borderWidth = other.borderWidth();
+}
+
+QMapCircleObjectPrivateDefault::~QMapCircleObjectPrivateDefault()
+{
+
+}
+
+QGeoCoordinate QMapCircleObjectPrivateDefault::center() const
+{
+ return m_center;
+}
+
+void QMapCircleObjectPrivateDefault::setCenter(const QGeoCoordinate &center)
+{
+ m_center = center;
+}
+
+qreal QMapCircleObjectPrivateDefault::radius() const
+{
+ return m_radius;
+}
+
+void QMapCircleObjectPrivateDefault::setRadius(qreal radius)
+{
+ m_radius = radius;
+}
+
+QColor QMapCircleObjectPrivateDefault::color() const
+{
+ return m_fillColor;
+}
+
+void QMapCircleObjectPrivateDefault::setColor(const QColor &color)
+{
+ m_fillColor = color;
+}
+
+QColor QMapCircleObjectPrivateDefault::borderColor() const
+{
+ return m_borderColor;
+}
+
+void QMapCircleObjectPrivateDefault::setBorderColor(const QColor &color)
+{
+ m_borderColor = color;
+}
+
+qreal QMapCircleObjectPrivateDefault::borderWidth() const
+{
+ return m_borderWidth;
+}
+
+void QMapCircleObjectPrivateDefault::setBorderWidth(qreal width)
+{
+ m_borderWidth = width;
+}
+
+bool QMapCircleObjectPrivate::equals(const QGeoMapObjectPrivate &other) const
+{
+ if (other.type() != type()) // This check might be unnecessary, depending on how equals gets used
+ return false;
+
+ const QMapCircleObjectPrivate &o = static_cast<const QMapCircleObjectPrivate &>(other);
+ return (QGeoMapObjectPrivate::equals(o)
+ && center() == o.center()
+ && radius() == o.radius()
+ && color() == o.color()
+ && borderColor() == o.borderColor()
+ && borderWidth() == o.borderWidth());
+}
+
+QGeoMapObjectPrivate *QMapCircleObjectPrivateDefault::clone()
+{
+ return new QMapCircleObjectPrivateDefault(static_cast<QMapCircleObjectPrivate &>(*this));
+}
+
+
+
+QMapCircleObject::QMapCircleObject(QObject *parent)
+ : QGeoMapObject(QExplicitlySharedDataPointer<QGeoMapObjectPrivate>(new QMapCircleObjectPrivateDefault(this)), parent)
+
+{
+ QMapCircleObjectPrivate *d = static_cast<QMapCircleObjectPrivate*>(d_ptr.data());
+ d->setBorderColor(QColor(Qt::black)); // These are QDeclarativeMapLineProperties defaults
+ d->setBorderWidth(1.0);
+}
+
+QMapCircleObject::~QMapCircleObject()
+{
+
+}
+
+/*!
+ \qmlproperty coordinate Qt.labs.location::MapCircleObject::center
+
+ This property holds the central point about which the circle is defined.
+
+ \sa radius
+*/
+QGeoCoordinate QMapCircleObject::center() const
+{
+ return static_cast<const QMapCircleObjectPrivate*>(d_ptr.data())->center();
+}
+
+/*!
+ \qmlproperty real Qt.labs.location::MapCircleObject::radius
+
+ This property holds the radius of the circle, in meters on the ground.
+
+ \sa center
+*/
+qreal QMapCircleObject::radius() const
+{
+ return static_cast<const QMapCircleObjectPrivate*>(d_ptr.data())->radius();
+}
+
+/*!
+ \qmlproperty color Qt.labs.location::MapCircleObject::color
+
+ This property holds the fill color of the circle when drawn. For no fill,
+ use a transparent color.
+*/
+QColor QMapCircleObject::color() const
+{
+ return static_cast<const QMapCircleObjectPrivate*>(d_ptr.data())->color();
+}
+
+/*!
+ \qmlpropertygroup Qt.labs.location::MapCircleObject::border
+ \qmlproperty int MapCircleObject::border.width
+ \qmlproperty color MapCircleObject::border.color
+
+ This property is part of the border group property.
+ The border property holds the width and color used to draw the border of the circle.
+ The width is in pixels and is independent of the zoom level of the map.
+
+ The default values correspond to a black border with a width of 1 pixel.
+ For no line, use a width of 0 or a transparent color.
+*/
+QDeclarativeMapLineProperties *QMapCircleObject::border()
+{
+ if (!m_border) {
+ m_border = new QDeclarativeMapLineProperties;
+ connect(m_border, &QDeclarativeMapLineProperties::colorChanged, this, [this](const QColor &color){
+ static_cast<QMapCircleObjectPrivate*>(d_ptr.data())->setBorderColor(color);
+ });
+ connect(m_border, &QDeclarativeMapLineProperties::widthChanged, this, [this](qreal width){
+ static_cast<QMapCircleObjectPrivate*>(d_ptr.data())->setBorderWidth(width);
+ });
+ }
+ return m_border;
+}
+
+void QMapCircleObject::setCenter(const QGeoCoordinate &center)
+{
+ auto ptr = static_cast<QMapCircleObjectPrivate*>(d_ptr.data());
+ if (ptr->center() == center)
+ return;
+
+ ptr->setCenter(center);
+ emit centerChanged();
+}
+
+void QMapCircleObject::setRadius(qreal radius)
+{
+ auto d = static_cast<QMapCircleObjectPrivate*>(d_ptr.data());
+ if (d->radius() == radius)
+ return;
+
+ d->setRadius(radius);
+ emit radiusChanged();
+}
+
+void QMapCircleObject::setColor(const QColor &color)
+{
+ auto d = static_cast<QMapCircleObjectPrivate*>(d_ptr.data());
+ if (d->color() == color)
+ return;
+
+ d->setColor(color);
+ emit colorChanged();
+}
+
+void QMapCircleObject::setMap(QGeoMap *map)
+{
+ QMapCircleObjectPrivate *d = static_cast<QMapCircleObjectPrivate *>(d_ptr.data());
+ if (d->m_map == map)
+ return;
+
+ QGeoMapObject::setMap(map); // This is where the specialized pimpl gets created and injected
+
+ if (!map) {
+ // Map was set, now it has ben re-set to NULL
+ d_ptr = new QMapCircleObjectPrivateDefault(*d);
+ // Old pimpl deleted implicitly by QExplicitlySharedDataPointer
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/location/labs/qmapcircleobject_p.h b/src/location/labs/qmapcircleobject_p.h
new file mode 100644
index 00000000..9393047e
--- /dev/null
+++ b/src/location/labs/qmapcircleobject_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** 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 QMAPCIRCLEOBJECT_P_H
+#define QMAPCIRCLEOBJECT_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.h>
+#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
+#include <QtCore/QUrl>
+#include <QGeoCoordinate>
+
+QT_BEGIN_NAMESPACE
+
+class Q_LOCATION_PRIVATE_EXPORT QMapCircleObject : public QGeoMapObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter NOTIFY centerChanged)
+ Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QDeclarativeMapLineProperties *border READ border CONSTANT)
+
+public:
+ QMapCircleObject(QObject *parent = nullptr);
+ ~QMapCircleObject() override;
+
+ QGeoCoordinate center() const;
+ qreal radius() const;
+ QColor color() const;
+
+ void setCenter(const QGeoCoordinate &center);
+ void setRadius(qreal radius);
+ void setColor(const QColor &color);
+
+ QDeclarativeMapLineProperties * border();
+ void setMap(QGeoMap *map) override;
+
+signals:
+ void centerChanged();
+ void radiusChanged();
+ void colorChanged();
+
+protected:
+ QDeclarativeMapLineProperties *m_border = nullptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMAPCIRCLEOBJECT_P_H
diff --git a/src/location/labs/qmapcircleobject_p_p.h b/src/location/labs/qmapcircleobject_p_p.h
new file mode 100644
index 00000000..b3353b62
--- /dev/null
+++ b/src/location/labs/qmapcircleobject_p_p.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** 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 QMAPCIRCLEOBJECT_P_P_H
+#define QMAPCIRCLEOBJECT_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/qgeomapobject_p_p.h>
+#include <QGeoCoordinate>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+class Q_LOCATION_PRIVATE_EXPORT QMapCircleObjectPrivate : public QGeoMapObjectPrivate
+{
+public:
+ QMapCircleObjectPrivate(QGeoMapObject *q);
+ ~QMapCircleObjectPrivate() override;
+
+ virtual QGeoMapObject::Type type() const override final;
+
+ virtual QGeoCoordinate center() const = 0;
+ virtual void setCenter(const QGeoCoordinate &center) = 0;
+ virtual qreal radius() const = 0;
+ virtual void setRadius(qreal radius) = 0;
+ virtual QColor color() const = 0;
+ virtual void setColor(const QColor &color) = 0;
+ virtual QColor borderColor() const = 0;
+ virtual void setBorderColor(const QColor &color) = 0;
+ virtual qreal borderWidth() const = 0;
+ virtual void setBorderWidth(qreal width) = 0;
+
+ // QGeoMapObjectPrivate interface
+ bool equals(const QGeoMapObjectPrivate &other) const override;
+};
+
+
+class Q_LOCATION_PRIVATE_EXPORT QMapCircleObjectPrivateDefault : public QMapCircleObjectPrivate
+{
+public:
+ QMapCircleObjectPrivateDefault(QGeoMapObject *q);
+ QMapCircleObjectPrivateDefault(const QMapCircleObjectPrivate &other);
+ ~QMapCircleObjectPrivateDefault() override;
+
+ // QMapCircleObjectPrivate interface
+ QGeoCoordinate center() const override;
+ void setCenter(const QGeoCoordinate &center) override;
+ qreal radius() const override;
+ void setRadius(qreal radius) override;
+ QColor color() const override;
+ void setColor(const QColor &color) override;
+ QColor borderColor() const override;
+ void setBorderColor(const QColor &color) override;
+ qreal borderWidth() const override;
+ void setBorderWidth(qreal width) override;
+
+ // QGeoMapObjectPrivate interface
+ QGeoMapObjectPrivate *clone() override;
+
+public:
+ QGeoCoordinate m_center;
+ qreal m_radius = 0;
+ QColor m_fillColor = Qt::transparent;
+ QColor m_borderColor;
+ qreal m_borderWidth = 1.0;
+
+private:
+ QMapCircleObjectPrivateDefault(const QMapCircleObjectPrivateDefault &other) = delete;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMAPCIRCLEOBJECT_P_P_H
diff --git a/src/location/labs/qmapiconobject.cpp b/src/location/labs/qmapiconobject.cpp
new file mode 100644
index 00000000..507492d2
--- /dev/null
+++ b/src/location/labs/qmapiconobject.cpp
@@ -0,0 +1,245 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 "qmapiconobject_p.h"
+#include "qmapiconobject_p_p.h"
+#include <QExplicitlySharedDataPointer>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype MapIconObject
+ \instantiates QMapIconObject
+ \inqmlmodule Qt.labs.location
+ \ingroup qml-QtLocation5-maps
+ \inherits QGeoMapObject
+
+ \brief The MapIconObject displays an icon on a Map.
+
+ The MapIconObject displays an icon on a Map.
+ The MapIconObject type only makes sense when contained in a Map or in a \l MapObjectView.
+*/
+
+QMapIconObjectPrivate::~QMapIconObjectPrivate()
+{
+
+}
+
+QMapIconObjectPrivate::QMapIconObjectPrivate(QGeoMapObject *q) : QGeoMapObjectPrivate(q)
+{
+
+}
+
+QGeoMapObject::Type QMapIconObjectPrivate::type() const
+{
+ return QGeoMapObject::IconType;
+}
+
+bool QMapIconObjectPrivate::equals(const QGeoMapObjectPrivate &other) const
+{
+ if (other.type() != type()) // This check might be unnecessary, depending on how equals gets used
+ return false;
+
+ const QMapIconObjectPrivate &o = static_cast<const QMapIconObjectPrivate &>(other);
+ return (QGeoMapObjectPrivate::equals(o)
+ && content() == o.content()
+ && coordinate() == o.coordinate());
+}
+
+//
+// QGeoMapIconPrivate default implementation
+//
+
+QMapIconObjectPrivateDefault::QMapIconObjectPrivateDefault(QGeoMapObject *q) : QMapIconObjectPrivate(q)
+{
+
+}
+QMapIconObjectPrivateDefault::QMapIconObjectPrivateDefault(const QMapIconObjectPrivate &other) : QMapIconObjectPrivate(other.q)
+{
+ m_coordinate = other.coordinate();
+ m_content = other.content();
+ m_size = other.size();
+}
+
+QMapIconObjectPrivateDefault::~QMapIconObjectPrivateDefault()
+{
+
+}
+
+QGeoCoordinate QMapIconObjectPrivateDefault::coordinate() const
+{
+ return m_coordinate;
+}
+
+void QMapIconObjectPrivateDefault::setCoordinate(const QGeoCoordinate &center)
+{
+ m_coordinate = center;
+}
+
+QVariant QMapIconObjectPrivateDefault::content() const
+{
+ return m_content;
+}
+
+void QMapIconObjectPrivateDefault::setContent(const QVariant &content)
+{
+ m_content = content;
+}
+
+QSizeF QMapIconObjectPrivateDefault::size() const
+{
+ return m_size;
+}
+
+void QMapIconObjectPrivateDefault::setSize(const QSizeF &size)
+{
+ m_size = size;
+}
+
+QGeoMapObjectPrivate *QMapIconObjectPrivateDefault::clone()
+{
+ return new QMapIconObjectPrivateDefault(static_cast<QMapIconObjectPrivate &>(*this));
+}
+
+
+/*
+
+ QGeoMapIconPrivate default implementation
+
+*/
+
+
+QMapIconObject::QMapIconObject(QObject *parent)
+ : QGeoMapObject(QExplicitlySharedDataPointer<QGeoMapObjectPrivate>(new QMapIconObjectPrivateDefault(this)), parent)
+{}
+
+QMapIconObject::~QMapIconObject()
+{
+
+}
+
+/*!
+ \qmlproperty Variant Qt.labs.location::MapIconObject::content
+
+ This property holds the content to be used for the icon. The actual content of this property is somehow
+ backend-dependent. The implementation for the raster engine accepts local urls or paths.
+ Other implementations may accept additional content types.
+*/
+QVariant QMapIconObject::content() const
+{
+ const QMapIconObjectPrivate *d = static_cast<const QMapIconObjectPrivate *>(d_ptr.data());
+ return d->content();
+}
+
+/*!
+ \qmlproperty Variant Qt.labs.location::MapIconObject::coordinate
+
+ The coordinate where the icon is going to be shown.
+ What pixel of the icon matches the coordinate is somehow backend-dependent.
+ For example, due to limitations, some backends might associate the center of the icon with the
+ coordinate, others one of the corners.
+ If there is a choice, backend developers should use the center of the icon as the default anchor
+ point.
+
+ The behavior is also intended to be customizable with a \l DynamicParameter, when
+ using backends that support anchoring arbitrary points of the icon to the coordinate.
+ What kind of parameter to use and how to achieve this behavior is intended to be
+ documented per-backend.
+*/
+QGeoCoordinate QMapIconObject::coordinate() const
+{
+ const QMapIconObjectPrivate *d = static_cast<const QMapIconObjectPrivate *>(d_ptr.data());
+ return d->coordinate();
+}
+
+void QMapIconObject::setContent(QVariant content)
+{
+ QMapIconObjectPrivate *d = static_cast<QMapIconObjectPrivate *>(d_ptr.data());
+ if (d->content() == content)
+ return;
+
+ d->setContent(content);
+ emit contentChanged(content);
+}
+
+void QMapIconObject::setCoordinate(const QGeoCoordinate &center)
+{
+ QMapIconObjectPrivate *d = static_cast<QMapIconObjectPrivate*>(d_ptr.data());
+ if (d->coordinate() == center)
+ return;
+
+ d->setCoordinate(center);
+ emit coordinateChanged(center);
+}
+
+/*!
+ \qmlproperty Variant Qt.labs.location::MapIconObject::size
+
+ The size of the icon as it will be shown on the map.
+*/
+QSizeF QMapIconObject::size() const
+{
+ const QMapIconObjectPrivate *d = static_cast<const QMapIconObjectPrivate *>(d_ptr.data());
+ return d->size();
+}
+
+
+void QMapIconObject::setSize(const QSizeF &size)
+{
+ QMapIconObjectPrivate *d = static_cast<QMapIconObjectPrivate*>(d_ptr.data());
+ if (d->size() == size)
+ return;
+
+ d->setSize(size);
+ emit sizeChanged();
+}
+
+void QMapIconObject::setMap(QGeoMap *map)
+{
+ QMapIconObjectPrivate *d = static_cast<QMapIconObjectPrivate *>(d_ptr.data());
+ if (d->m_map == map)
+ return;
+
+ QGeoMapObject::setMap(map); // This is where the specialized pimpl gets created and injected
+
+ if (!map) {
+ // Map was set, now it has ben re-set to NULL
+ d_ptr = new QMapIconObjectPrivateDefault(*d);
+ // Old pimpl deleted implicitly by QExplicitlySharedDataPointer
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/location/labs/qmapiconobject_p.h b/src/location/labs/qmapiconobject_p.h
new file mode 100644
index 00000000..16b00d04
--- /dev/null
+++ b/src/location/labs/qmapiconobject_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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 QGEOMAPICON_P_H
+#define QGEOMAPICON_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.h>
+#include <QtCore/QUrl>
+#include <QGeoCoordinate>
+#include <QtCore/qsize.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_LOCATION_PRIVATE_EXPORT QMapIconObject : public QGeoMapObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged)
+ Q_PROPERTY(QVariant content READ content WRITE setContent NOTIFY contentChanged)
+ Q_PROPERTY(QSizeF size READ size WRITE setSize NOTIFY sizeChanged)
+
+public:
+ QMapIconObject(QObject *parent = nullptr);
+ ~QMapIconObject() override;
+
+ QVariant content() const;
+ QGeoCoordinate coordinate() const;
+ QSizeF size() const;
+
+ void setContent(QVariant content);
+ void setCoordinate(const QGeoCoordinate &coordinate);
+ void setSize(const QSizeF &size);
+
+ void setMap(QGeoMap *map) override;
+
+signals:
+ void contentChanged(QVariant content);
+ void coordinateChanged(QGeoCoordinate coordinate);
+ void sizeChanged();
+};
+
+QT_END_NAMESPACE
+
+#endif // QGEOMAPICON_P_H
diff --git a/src/location/labs/qmapiconobject_p_p.h b/src/location/labs/qmapiconobject_p_p.h
new file mode 100644
index 00000000..08a1a893
--- /dev/null
+++ b/src/location/labs/qmapiconobject_p_p.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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 QGEOMAPICON_P_P_H
+#define QGEOMAPICON_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/qgeomapobject_p_p.h>
+#include <QGeoCoordinate>
+
+QT_BEGIN_NAMESPACE
+
+class Q_LOCATION_PRIVATE_EXPORT QMapIconObjectPrivate : public QGeoMapObjectPrivate
+{
+public:
+ QMapIconObjectPrivate(QGeoMapObject *q);
+ ~QMapIconObjectPrivate() override;
+
+ virtual QGeoMapObject::Type type() const override final;
+
+ virtual QGeoCoordinate coordinate() const = 0;
+ virtual void setCoordinate(const QGeoCoordinate &coordinate) = 0;
+ virtual QVariant content() const = 0;
+ virtual void setContent(const QVariant &content) = 0;
+ virtual QSizeF size() const = 0;
+ virtual void setSize(const QSizeF &size) = 0;
+
+ // QGeoMapObjectPrivate interface
+ bool equals(const QGeoMapObjectPrivate &other) const override;
+};
+
+class Q_LOCATION_PRIVATE_EXPORT QMapIconObjectPrivateDefault : public QMapIconObjectPrivate
+{
+public:
+ QMapIconObjectPrivateDefault(QGeoMapObject *q);
+ QMapIconObjectPrivateDefault(const QMapIconObjectPrivate &other);
+ ~QMapIconObjectPrivateDefault() override;
+
+ // QGeoMapIconPrivate interface
+ QGeoCoordinate coordinate() const override;
+ void setCoordinate(const QGeoCoordinate &coordinate) override;
+ QVariant content() const override;
+ void setContent(const QVariant &content) override;
+ virtual QSizeF size() const override;
+ virtual void setSize(const QSizeF &size) override;
+
+ // QMapIconObjectPrivate interface
+ QGeoMapObjectPrivate *clone() override;
+
+public:
+ QVariant m_content;
+ QGeoCoordinate m_coordinate;
+ QSizeF m_size;
+
+private:
+ QMapIconObjectPrivateDefault(const QMapIconObjectPrivateDefault &other) = delete;
+};
+
+QT_END_NAMESPACE
+
+#endif // QGEOMAPICON_P_P_H
diff --git a/src/locationlabs/qmapobjectview.cpp b/src/location/labs/qmapobjectview.cpp
index 59db7b95..e1161acd 100644
--- a/src/locationlabs/qmapobjectview.cpp
+++ b/src/location/labs/qmapobjectview.cpp
@@ -41,12 +41,30 @@
QT_BEGIN_NAMESPACE
+/*!
+ \qmltype MapObjectView
+ \instantiates QMapObjectView
+ \inqmlmodule Qt.labs.location
+ \ingroup qml-QtLocation5-maps
+ \inherits QGeoMapObject
+
+ \brief The MapObjectView is used to populate Map with map objects from a model.
+
+ The MapObjectView is used to populate Map with map objects, either from a model or via
+ \l addMapObject or \l removeMapObject.
+
+ The MapObjectView type only makes sense when contained in a Map, meaning that it will not work when added inside
+ other QML elements.
+ This can also be intended as an object layer on top of a Map.
+*/
+
/*
- QGeoMapLayerPrivate
+ QMapObjectViewPrivate
*/
+static const QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::Asynchronous;
QMapObjectViewPrivate::QMapObjectViewPrivate(QGeoMapObject *q)
: QGeoMapObjectPrivate(q)
@@ -66,7 +84,7 @@ QGeoMapObject::Type QMapObjectViewPrivate::type() const
/*
- QGeoMapLayerPrivateDefault
+ QMapObjectViewPrivateDefault
*/
@@ -180,11 +198,24 @@ void QMapObjectView::componentComplete()
m_delegateModel->componentComplete();
}
+/*!
+ \qmlproperty Variant Qt.labs.location::MapObjectView::model
+
+ This property holds the model that provides data used for creating the map items defined by the
+ delegate. Only QAbstractItemModel based models are supported.
+*/
QVariant QMapObjectView::model() const
{
return m_model;
}
+/*!
+ \qmlproperty Component Qt.labs.location::MapObjectView::delegate
+
+ This property holds the delegate which defines how each item in the
+ model should be displayed. The Component must contain exactly one
+ QGeoMapObject -derived object as the root object.
+*/
QQmlComponent *QMapObjectView::delegate() const
{
return m_delegate;
@@ -281,7 +312,7 @@ void QMapObjectView::modelUpdated(const QQmlChangeSet &changeSet, bool reset)
for (const QQmlChangeSet::Change &c: changeSet.inserts()) {
for (int idx = c.start(); idx < c.end(); idx++) {
m_instantiatedMapObjects.insert(idx, nullptr);
- QGeoMapObject *mo = qobject_cast<QGeoMapObject *>(m_delegateModel->object(idx, QQmlIncubator::Asynchronous));
+ QGeoMapObject *mo = qobject_cast<QGeoMapObject *>(m_delegateModel->object(idx, incubationMode));
if (mo) // if not, a createdItem signal will be emitted.
addMapObjectToMap(mo, idx);
}
@@ -320,13 +351,15 @@ void QMapObjectView::removeMapObjectFromMap(int index)
// See QObject *QQmlDelegateModel::object(int index, QQmlIncubator::IncubationMode incubationMode) doc
// for explanation on when createdItem is emitted.
-void QMapObjectView::createdItem(int index, QObject *object)
+void QMapObjectView::createdItem(int index, QObject * /*object*/)
{
- // According to the documentation above, object() should be called again for index.
- // However, this seem to result in too many references for index, which will prevent destruction with
- // one single release()
- // QGeoMapObject *mo = qobject_cast<QGeoMapObject *>(m_delegateModel->object(index, QQmlIncubator::Asynchronous));
- QGeoMapObject *mo = qobject_cast<QGeoMapObject *>(object);
+ if (m_instantiatedMapObjects.at(index))
+ return; // The first call to object() apparently returned a valid item. Don't call it again.
+
+ // If here, according to the documentation above, object() should be called again for index,
+ // or else, it will be destroyed exiting this scope
+ QGeoMapObject *mo = nullptr;
+ mo = qobject_cast<QGeoMapObject *>(m_delegateModel->object(index, incubationMode));
if (mo)
addMapObjectToMap(mo, index);
}
diff --git a/src/locationlabs/qmapobjectview_p.h b/src/location/labs/qmapobjectview_p.h
index cfdc6702..49b80883 100644
--- a/src/locationlabs/qmapobjectview_p.h
+++ b/src/location/labs/qmapobjectview_p.h
@@ -48,7 +48,7 @@
// We mean it.
//
-#include <QtLocationLabs/private/qlocationlabsglobal_p.h>
+#include <QtLocation/private/qlocationglobal_p.h>
#include <QtLocation/private/qgeomapobject_p.h>
#include <QQmlComponent>
#include <QVector>
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
class QQmlDelegateModel;
class QMapObjectViewPrivate;
class QQmlChangeSet;
-class Q_LOCATIONLABS_PRIVATE_EXPORT QMapObjectView : public QGeoMapObject
+class Q_LOCATION_PRIVATE_EXPORT QMapObjectView : public QGeoMapObject
{
Q_OBJECT
Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
diff --git a/src/locationlabs/qmapobjectview_p_p.h b/src/location/labs/qmapobjectview_p_p.h
index 5c0cdf82..7550e209 100644
--- a/src/locationlabs/qmapobjectview_p_p.h
+++ b/src/location/labs/qmapobjectview_p_p.h
@@ -49,7 +49,7 @@
// We mean it.
//
-#include <QtLocationLabs/private/qlocationlabsglobal_p.h>
+#include <QtLocation/private/qlocationglobal_p.h>
#include <QtLocation/private/qgeomapobject_p_p.h>
#include <QPointer>
#include <QVector>
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
class QQmlDelegateModel;
class QGeoMap;
-class Q_LOCATIONLABS_PRIVATE_EXPORT QMapObjectViewPrivate : public QGeoMapObjectPrivate
+class Q_LOCATION_PRIVATE_EXPORT QMapObjectViewPrivate : public QGeoMapObjectPrivate
{
public:
QMapObjectViewPrivate(QGeoMapObject *q);
@@ -68,7 +68,7 @@ public:
virtual QGeoMapObject::Type type() const override final;
};
-class Q_LOCATIONLABS_PRIVATE_EXPORT QMapObjectViewPrivateDefault : public QMapObjectViewPrivate
+class Q_LOCATION_PRIVATE_EXPORT QMapObjectViewPrivateDefault : public QMapObjectViewPrivate
{
public:
QMapObjectViewPrivateDefault(QGeoMapObject *q);
diff --git a/src/location/labs/qmappolygonobject.cpp b/src/location/labs/qmappolygonobject.cpp
new file mode 100644
index 00000000..adc3259f
--- /dev/null
+++ b/src/location/labs/qmappolygonobject.cpp
@@ -0,0 +1,255 @@
+/****************************************************************************
+**
+** 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 "qmappolygonobject_p.h"
+#include "qmappolygonobject_p_p.h"
+#include <QtLocation/private/locationvaluetypehelper_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype MapPolygonObject
+ \instantiates QMapPolygonObject
+ \inqmlmodule Qt.labs.location
+ \ingroup qml-QtLocation5-maps
+ \inherits QGeoMapObject
+
+ \brief The MapPolygonObject displays a polygon on a Map.
+
+ The MapPolygonObject displays a polygon on a Map.
+ The MapPolygonObject type only makes sense when contained in a Map or in a \l MapObjectView.
+*/
+
+QMapPolygonObjectPrivate::QMapPolygonObjectPrivate(QGeoMapObject *q) : QGeoMapObjectPrivate(q)
+{
+
+}
+
+QMapPolygonObjectPrivate::~QMapPolygonObjectPrivate()
+{
+
+}
+
+QMapPolygonObjectPrivateDefault::QMapPolygonObjectPrivateDefault(QGeoMapObject *q) : QMapPolygonObjectPrivate(q)
+{
+
+}
+
+QMapPolygonObjectPrivateDefault::QMapPolygonObjectPrivateDefault(const QMapPolygonObjectPrivate &other) : QMapPolygonObjectPrivate(other.q)
+{
+ m_path = other.path();
+ m_borderColor = other.borderColor();
+ m_fillColor = other.fillColor();
+ m_borderWidth = other.borderWidth();
+}
+
+QMapPolygonObjectPrivateDefault::~QMapPolygonObjectPrivateDefault()
+{
+
+}
+
+QGeoMapObject::Type QMapPolygonObjectPrivate::type() const
+{
+ return QGeoMapObject::PolygonType;
+}
+
+QList<QGeoCoordinate> QMapPolygonObjectPrivateDefault::path() const
+{
+ return m_path;
+}
+
+void QMapPolygonObjectPrivateDefault::setPath(const QList<QGeoCoordinate> &path)
+{
+ m_path = path;
+}
+
+QColor QMapPolygonObjectPrivateDefault::fillColor() const
+{
+ return m_fillColor;
+}
+
+void QMapPolygonObjectPrivateDefault::setFillColor(const QColor &color)
+{
+ m_fillColor = color;
+}
+
+QColor QMapPolygonObjectPrivateDefault::borderColor() const
+{
+ return m_borderColor;
+}
+
+void QMapPolygonObjectPrivateDefault::setBorderColor(const QColor &color)
+{
+ m_borderColor = color;
+}
+
+qreal QMapPolygonObjectPrivateDefault::borderWidth() const
+{
+ return m_borderWidth;
+}
+
+void QMapPolygonObjectPrivateDefault::setBorderWidth(qreal width)
+{
+ m_borderWidth = width;
+}
+
+QGeoMapObjectPrivate *QMapPolygonObjectPrivateDefault::clone()
+{
+ return new QMapPolygonObjectPrivateDefault(static_cast<QMapPolygonObjectPrivate &>(*this));
+}
+
+bool QMapPolygonObjectPrivate::equals(const QGeoMapObjectPrivate &other) const
+{
+ if (other.type() != type()) // This check might be unnecessary, depending on how equals gets used
+ return false;
+
+ const QMapPolygonObjectPrivate &o = static_cast<const QMapPolygonObjectPrivate &>(other);
+ return (QGeoMapObjectPrivate::equals(o)
+ && path() == o.path()
+ && borderColor() == o.borderColor()
+ && fillColor() == o.fillColor()
+ && borderWidth() == o.borderWidth());
+}
+
+
+
+
+QMapPolygonObject::QMapPolygonObject(QObject *parent)
+ : QGeoMapObject(QExplicitlySharedDataPointer<QGeoMapObjectPrivate>(new QMapPolygonObjectPrivateDefault(this)), parent)
+{
+ QMapPolygonObjectPrivate *d = static_cast<QMapPolygonObjectPrivate*>(d_ptr.data());
+ d->setBorderColor(QColor(Qt::black)); // These are QDeclarativeMapLineProperties defaults
+ d->setBorderWidth(1.0);
+}
+
+QMapPolygonObject::~QMapPolygonObject()
+{}
+
+/*!
+ \qmlproperty VariantList Qt.labs.location::MapPolygonObject::path
+
+ This property holds the ordered list of coordinates which
+ define the polygon border.
+*/
+QVariantList QMapPolygonObject::path() const
+{
+ QVariantList p;
+ for (const QGeoCoordinate &c: static_cast<const QMapPolygonObjectPrivate *>(d_ptr.data())->path())
+ p << QVariant::fromValue(c);
+ return p;
+}
+
+void QMapPolygonObject::setPath(const QVariantList &path)
+{
+ QList<QGeoCoordinate> p;
+ bool ok = false;
+ for (const auto &c: path) {
+ const QGeoCoordinate coord = parseCoordinate(c, &ok);
+ if (ok)
+ p << coord;
+ }
+ auto pimpl = static_cast<QMapPolygonObjectPrivate *>(d_ptr.data());
+ if (p != pimpl->path()) {
+ pimpl->setPath(p);
+ emit pathChanged();
+ }
+}
+
+/*!
+ \qmlproperty color Qt.labs.location::MapPolygonObject::color
+
+ This property holds the fill color of the polygon when drawn. For no fill,
+ use a transparent color.
+*/
+QColor QMapPolygonObject::color() const
+{
+ return static_cast<const QMapPolygonObjectPrivate*>(d_ptr.data())->fillColor();
+}
+
+/*!
+ \qmlpropertygroup Qt.labs.location::MapPolygonObject::border
+ \qmlproperty int MapPolygonObject::border.width
+ \qmlproperty color MapPolygonObject::border.color
+
+ This property is part of the border property group. The border
+ property group holds the width and color used to draw the border.
+
+ The width is in pixels and is independent of the zoom level of the map.
+ The default values correspond to a black border with a width of 1 pixel.
+
+ For no border, use a width of 0 or a transparent color.
+*/
+QDeclarativeMapLineProperties *QMapPolygonObject::border()
+{
+ if (!m_border) {
+ m_border = new QDeclarativeMapLineProperties;
+ connect(m_border, &QDeclarativeMapLineProperties::colorChanged, this, [this](const QColor &color){
+ static_cast<QMapPolygonObjectPrivate*>(d_ptr.data())->setBorderColor(color);
+ });
+ connect(m_border, &QDeclarativeMapLineProperties::widthChanged, this, [this](qreal width){
+ static_cast<QMapPolygonObjectPrivate*>(d_ptr.data())->setBorderWidth(width);
+ });
+ }
+ return m_border;
+}
+
+void QMapPolygonObject::setColor(const QColor &fillColor)
+{
+ auto ptr = static_cast<QMapPolygonObjectPrivate*>(d_ptr.data());
+
+ if (ptr->fillColor() == fillColor)
+ return;
+
+ ptr->setFillColor(fillColor);
+ emit colorChanged();
+}
+
+void QMapPolygonObject::setMap(QGeoMap *map)
+{
+ QMapPolygonObjectPrivate *d = static_cast<QMapPolygonObjectPrivate *>(d_ptr.data());
+ if (d->m_map == map)
+ return;
+
+ QGeoMapObject::setMap(map); // This is where the specialized pimpl gets created and injected
+
+ if (!map) {
+ // Map was set, now it has ben re-set to NULL
+ d_ptr = new QMapPolygonObjectPrivateDefault(*d);
+ // Old pimpl deleted implicitly by QExplicitlySharedDataPointer
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/location/labs/qmappolygonobject_p.h b/src/location/labs/qmappolygonobject_p.h
new file mode 100644
index 00000000..03eef587
--- /dev/null
+++ b/src/location/labs/qmappolygonobject_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 QMAPPOLYGONOBJECT_P_H
+#define QMAPPOLYGONOBJECT_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.h>
+#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
+
+#include <QJSValue>
+
+QT_BEGIN_NAMESPACE
+
+class Q_LOCATION_PRIVATE_EXPORT QMapPolygonObject : public QGeoMapObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QVariantList path READ path WRITE setPath NOTIFY pathChanged)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QDeclarativeMapLineProperties *border READ border CONSTANT)
+
+public:
+ QMapPolygonObject(QObject *parent = nullptr);
+ ~QMapPolygonObject() override;
+
+ QVariantList path() const;
+ void setPath(const QVariantList &path);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ QDeclarativeMapLineProperties *border();
+ void setMap(QGeoMap *map) override;
+
+signals:
+ void pathChanged();
+ void colorChanged();
+
+protected:
+ QDeclarativeMapLineProperties *m_border;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMAPPOLYGONOBJECT_P_H
diff --git a/src/location/labs/qmappolygonobject_p_p.h b/src/location/labs/qmappolygonobject_p_p.h
new file mode 100644
index 00000000..d7e95d49
--- /dev/null
+++ b/src/location/labs/qmappolygonobject_p_p.h
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** 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 QMAPPOLYGONOBJECT_P_P_H
+#define QMAPPOLYGONOBJECT_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/qgeomapobject_p_p.h>
+#include <QGeoCoordinate>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+class Q_LOCATION_PRIVATE_EXPORT QMapPolygonObjectPrivate : public QGeoMapObjectPrivate
+{
+public:
+ QMapPolygonObjectPrivate(QGeoMapObject *q);
+ ~QMapPolygonObjectPrivate() override;
+
+ virtual QGeoMapObject::Type type() const override final;
+
+ virtual QList<QGeoCoordinate> path() const = 0;
+ virtual void setPath(const QList<QGeoCoordinate> &path) = 0;
+ virtual QColor fillColor() const = 0;
+ virtual void setFillColor(const QColor &color) = 0;
+ virtual QColor borderColor() const = 0;
+ virtual void setBorderColor(const QColor &color) = 0;
+ virtual qreal borderWidth() const = 0;
+ virtual void setBorderWidth(qreal width) = 0;
+
+ // QGeoMapObjectPrivate interface
+ bool equals(const QGeoMapObjectPrivate &other) const override;
+};
+
+class Q_LOCATION_PRIVATE_EXPORT QMapPolygonObjectPrivateDefault : public QMapPolygonObjectPrivate
+{
+public:
+ QMapPolygonObjectPrivateDefault(QGeoMapObject *q);
+ QMapPolygonObjectPrivateDefault(const QMapPolygonObjectPrivate &other);
+ ~QMapPolygonObjectPrivateDefault() override;
+
+ // QMapPolygonObjectPrivate interface
+ QList<QGeoCoordinate> path() const override;
+ void setPath(const QList<QGeoCoordinate> &path) override;
+ QColor fillColor() const override;
+ void setFillColor(const QColor &color) override;
+ QColor borderColor() const override;
+ void setBorderColor(const QColor &color) override;
+ qreal borderWidth() const override;
+ void setBorderWidth(qreal width) override;
+
+ // QGeoMapObjectPrivate interface
+ QGeoMapObjectPrivate *clone() override;
+
+public:
+ QList<QGeoCoordinate> m_path;
+ QColor m_borderColor;
+ QColor m_fillColor = Qt::transparent;
+ qreal m_borderWidth = 0;
+
+private:
+ QMapPolygonObjectPrivateDefault(const QMapPolygonObjectPrivateDefault &other) = delete;
+};
+
+QT_END_NAMESPACE
+
+
+#endif // QMAPPOLYGONOBJECT_P_P_H
diff --git a/src/location/labs/qmappolylineobject.cpp b/src/location/labs/qmappolylineobject.cpp
new file mode 100644
index 00000000..bea79327
--- /dev/null
+++ b/src/location/labs/qmappolylineobject.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 "qmappolylineobject_p.h"
+#include "qmappolylineobject_p_p.h"
+#include <QtLocation/private/locationvaluetypehelper_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype MapPolylineObject
+ \instantiates QMapPolylineObject
+ \inqmlmodule Qt.labs.location
+ \ingroup qml-QtLocation5-maps
+ \inherits QGeoMapObject
+
+ \brief The MapPolylineObject displays a polyline on a Map.
+
+ The MapPolylineObject displays a polyline on a Map.
+ The MapPolylineObject type only makes sense when contained in a Map or in a \l MapObjectView.
+*/
+
+QMapPolylineObjectPrivate::QMapPolylineObjectPrivate(QGeoMapObject *q) : QGeoMapObjectPrivate(q)
+{
+
+}
+
+QMapPolylineObjectPrivate::~QMapPolylineObjectPrivate()
+{
+
+}
+
+QGeoMapObject::Type QMapPolylineObjectPrivate::type() const
+{
+ return QGeoMapObject::PolylineType;
+}
+
+QMapPolylineObjectPrivateDefault::QMapPolylineObjectPrivateDefault(QGeoMapObject *q) : QMapPolylineObjectPrivate(q)
+{
+
+}
+
+QMapPolylineObjectPrivateDefault::QMapPolylineObjectPrivateDefault(const QMapPolylineObjectPrivate &other) : QMapPolylineObjectPrivate(other.q)
+{
+ m_path = other.path();
+ m_color = other.color();
+ m_width = other.width();
+}
+
+QMapPolylineObjectPrivateDefault::~QMapPolylineObjectPrivateDefault()
+{
+
+}
+
+QList<QGeoCoordinate> QMapPolylineObjectPrivateDefault::path() const
+{
+ return m_path;
+}
+
+void QMapPolylineObjectPrivateDefault::setPath(const QList<QGeoCoordinate> &path)
+{
+ m_path = path;
+}
+
+QColor QMapPolylineObjectPrivateDefault::color() const
+{
+ return m_color;
+}
+
+void QMapPolylineObjectPrivateDefault::setColor(const QColor &color)
+{
+ m_color = color;
+}
+
+qreal QMapPolylineObjectPrivateDefault::width() const
+{
+ return m_width;
+}
+
+void QMapPolylineObjectPrivateDefault::setWidth(qreal width)
+{
+ m_width = width;
+}
+
+bool QMapPolylineObjectPrivate::equals(const QGeoMapObjectPrivate &other) const
+{
+ if (other.type() != type()) // This check might be unnecessary, depending on how equals gets used
+ return false;
+
+ const QMapPolylineObjectPrivate &o = static_cast<const QMapPolylineObjectPrivate &>(other);
+ return (QGeoMapObjectPrivate::equals(o)
+ && path() == o.path()
+ && color() == o.color()
+ && width() == o.width());
+}
+
+QGeoMapObjectPrivate *QMapPolylineObjectPrivateDefault::clone()
+{
+ return new QMapPolylineObjectPrivateDefault(static_cast<QMapPolylineObjectPrivate &>(*this));
+}
+
+QMapPolylineObject::QMapPolylineObject(QObject *parent)
+ : QGeoMapObject(QExplicitlySharedDataPointer<QGeoMapObjectPrivate>(new QMapPolylineObjectPrivateDefault(this)), parent)
+{
+ QMapPolylineObjectPrivate *d = static_cast<QMapPolylineObjectPrivate*>(d_ptr.data());
+ d->setColor(QColor(Qt::black)); // These are QDeclarativeMapLineProperties defaults
+ d->setWidth(1.0);
+}
+
+QMapPolylineObject::~QMapPolylineObject()
+{}
+
+/*!
+ \qmlproperty VariantList Qt.labs.location::MapPolylineObject::path
+
+ This property holds the ordered list of coordinates which
+ define the polyline.
+*/
+QVariantList QMapPolylineObject::path() const
+{
+ QVariantList p;
+ for (const QGeoCoordinate &c: static_cast<const QMapPolylineObjectPrivate*>(d_ptr.data())->path())
+ p << QVariant::fromValue(c);
+ return p;
+}
+
+/*!
+ \qmlpropertygroup Qt.labs.location::MapPolylineObject::line
+ \qmlproperty int MapPolylineObject::line.width
+ \qmlproperty color MapPolylineObject::line.color
+
+ This property is part of the line property group. The line
+ property group holds the width and color used to draw the line.
+
+ The width is in pixels and is independent of the zoom level of the map.
+ The default values correspond to a black border with a width of 1 pixel.
+
+ For no line, use a width of 0 or a transparent color.
+*/
+QDeclarativeMapLineProperties *QMapPolylineObject::border()
+{
+ if (!m_border) {
+ m_border = new QDeclarativeMapLineProperties;
+ connect(m_border, &QDeclarativeMapLineProperties::colorChanged, this, [this](const QColor &color){
+ static_cast<QMapPolylineObjectPrivate*>(d_ptr.data())->setColor(color);
+ });
+ connect(m_border, &QDeclarativeMapLineProperties::widthChanged, this, [this](qreal width){
+ static_cast<QMapPolylineObjectPrivate*>(d_ptr.data())->setWidth(width);
+ });
+ }
+ return m_border;
+}
+
+void QMapPolylineObject::setPath(const QVariantList &path)
+{
+ QList<QGeoCoordinate> p;
+ bool ok = false;
+ for (const auto &c: path) {
+ const QGeoCoordinate coord = parseCoordinate(c, &ok);
+ if (ok)
+ p << coord;
+ }
+ auto pimpl = static_cast<QMapPolylineObjectPrivate *>(d_ptr.data());
+ if (p != pimpl->path()) {
+ pimpl->setPath(p);
+ emit pathChanged();
+ }
+}
+
+void QMapPolylineObject::setMap(QGeoMap *map)
+{
+ QMapPolylineObjectPrivate *d = static_cast<QMapPolylineObjectPrivate *>(d_ptr.data());
+ if (d->m_map == map)
+ return;
+
+ QGeoMapObject::setMap(map); // This is where the specialized pimpl gets created and injected
+
+ if (!map) {
+ // Map was set, now it has ben re-set to NULL
+ d_ptr = new QMapPolylineObjectPrivateDefault(*d);
+ // Old pimpl deleted implicitly by QExplicitlySharedDataPointer
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/location/labs/qmappolylineobject_p.h b/src/location/labs/qmappolylineobject_p.h
new file mode 100644
index 00000000..68312fb8
--- /dev/null
+++ b/src/location/labs/qmappolylineobject_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** 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 QMAPPOLYLINEOBJECT_P_H
+#define QMAPPOLYLINEOBJECT_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.h>
+#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
+
+#include <QJSValue>
+
+QT_BEGIN_NAMESPACE
+
+class Q_LOCATION_PRIVATE_EXPORT QMapPolylineObject : public QGeoMapObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QVariantList path READ path WRITE setPath NOTIFY pathChanged)
+ Q_PROPERTY(QDeclarativeMapLineProperties *line READ border CONSTANT)
+
+public:
+ QMapPolylineObject(QObject *parent = nullptr);
+ ~QMapPolylineObject() override;
+
+ QVariantList path() const;
+ void setPath(const QVariantList &path);
+
+ QDeclarativeMapLineProperties *border();
+ void setMap(QGeoMap *map) override;
+
+signals:
+ void pathChanged();
+
+protected:
+ QDeclarativeMapLineProperties *m_border = nullptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMAPPOLYLINEOBJECT_P_H
diff --git a/src/location/labs/qmappolylineobject_p_p.h b/src/location/labs/qmappolylineobject_p_p.h
new file mode 100644
index 00000000..1d5919d2
--- /dev/null
+++ b/src/location/labs/qmappolylineobject_p_p.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** 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 QMAPPOLYLINEOBJECT_P_P_H
+#define QMAPPOLYLINEOBJECT_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/qgeomapobject_p_p.h>
+#include <QGeoCoordinate>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+class Q_LOCATION_PRIVATE_EXPORT QMapPolylineObjectPrivate : public QGeoMapObjectPrivate
+{
+public:
+ QMapPolylineObjectPrivate(QGeoMapObject *q);
+ ~QMapPolylineObjectPrivate() override;
+
+ virtual QGeoMapObject::Type type() const override final;
+
+ virtual QList<QGeoCoordinate> path() const = 0;
+ virtual void setPath(const QList<QGeoCoordinate> &path) = 0;
+ virtual QColor color() const = 0;
+ virtual void setColor(const QColor &color) = 0;
+ virtual qreal width() const = 0;
+ virtual void setWidth(qreal width) = 0;
+
+ // QGeoMapObjectPrivate interface
+ bool equals(const QGeoMapObjectPrivate &other) const override;
+};
+
+class Q_LOCATION_PRIVATE_EXPORT QMapPolylineObjectPrivateDefault : public QMapPolylineObjectPrivate
+{
+public:
+ QMapPolylineObjectPrivateDefault(QGeoMapObject *q);
+ QMapPolylineObjectPrivateDefault(const QMapPolylineObjectPrivate &other);
+ ~QMapPolylineObjectPrivateDefault() override;
+
+ // QGeoMapPolylinePrivate interface
+ QList<QGeoCoordinate> path() const override;
+ void setPath(const QList<QGeoCoordinate> &path) override;
+ QColor color() const override;
+ void setColor(const QColor &color) override;
+ qreal width() const override;
+ void setWidth(qreal width) override;
+
+ // QGeoMapObjectPrivate interface
+ QGeoMapObjectPrivate *clone() override;
+
+public:
+ QList<QGeoCoordinate> m_path;
+ QColor m_color;
+ qreal m_width = 0;
+
+private:
+ QMapPolylineObjectPrivateDefault(const QMapPolylineObjectPrivateDefault &other) = delete;
+};
+
+QT_END_NAMESPACE
+
+
+#endif // QMAPPOLYLINEOBJECT_P_P_H
diff --git a/src/locationlabs/qmaprouteobject.cpp b/src/location/labs/qmaprouteobject.cpp
index 724bdb73..7e36322c 100644
--- a/src/locationlabs/qmaprouteobject.cpp
+++ b/src/location/labs/qmaprouteobject.cpp
@@ -40,6 +40,19 @@
QT_BEGIN_NAMESPACE
+/*!
+ \qmltype MapRouteObject
+ \instantiates QMapRouteObject
+ \inqmlmodule Qt.labs.location
+ \ingroup qml-QtLocation5-maps
+ \inherits QGeoMapObject
+
+ \brief The MapRouteObject displays a geographical route on a Map.
+
+ The MapRouteObject type displays a Route obtained through a RouteModel or
+ other means, on the Map as a Polyline following the path of the Route.
+*/
+
/*
QGeoMapRoutePrivate
@@ -72,6 +85,11 @@ QDeclarativeGeoRoute *QMapRouteObjectPrivate::declarativeGeoRoute() const
return r->m_route;
}
+/*!
+ \qmlproperty Route Qt.labs.location::MapRouteObject::route
+
+ This property holds the route to be drawn.
+*/
QGeoRoute QMapRouteObjectPrivate::route() const
{
const QDeclarativeGeoRoute *r = declarativeGeoRoute();
diff --git a/src/locationlabs/qmaprouteobject_p.h b/src/location/labs/qmaprouteobject_p.h
index 8fca325c..dcc35807 100644
--- a/src/locationlabs/qmaprouteobject_p.h
+++ b/src/location/labs/qmaprouteobject_p.h
@@ -48,7 +48,7 @@
// We mean it.
//
-#include <QtLocationLabs/private/qlocationlabsglobal_p.h>
+#include <QtLocation/private/qlocationglobal_p.h>
#include <QtQml/qqml.h>
#include <QtLocation/private/qgeomapobject_p.h>
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
class QDeclarativeGeoRoute;
class QGeoRoute;
class QMapRouteObjectPrivate;
-class Q_LOCATIONLABS_PRIVATE_EXPORT QMapRouteObject : public QGeoMapObject
+class Q_LOCATION_PRIVATE_EXPORT QMapRouteObject : public QGeoMapObject
{
Q_OBJECT
Q_PROPERTY(QDeclarativeGeoRoute *route READ route WRITE setRoute NOTIFY routeChanged)
diff --git a/src/locationlabs/qmaprouteobject_p_p.h b/src/location/labs/qmaprouteobject_p_p.h
index 8dbfc6b4..e01b1cc6 100644
--- a/src/locationlabs/qmaprouteobject_p_p.h
+++ b/src/location/labs/qmaprouteobject_p_p.h
@@ -48,14 +48,14 @@
// We mean it.
//
-#include <QtLocationLabs/private/qlocationlabsglobal_p.h>
+#include <QtLocation/private/qlocationglobal_p.h>
#include <QtLocation/private/qgeomapobject_p_p.h>
#include <QtLocation/private/qdeclarativegeoroute_p.h>
QT_BEGIN_NAMESPACE
class QGeoRoute;
-class Q_LOCATIONLABS_PRIVATE_EXPORT QMapRouteObjectPrivate : public QGeoMapObjectPrivate
+class Q_LOCATION_PRIVATE_EXPORT QMapRouteObjectPrivate : public QGeoMapObjectPrivate
{
public:
QMapRouteObjectPrivate(QGeoMapObject *q);
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
diff --git a/src/location/location.pro b/src/location/location.pro
index 199c5bd2..89c1fdd5 100644
--- a/src/location/location.pro
+++ b/src/location/location.pro
@@ -6,6 +6,7 @@ android {
}
CONFIG += simd optimize_full
+QT_FOR_CONFIG += location-private
# 3rdparty headers produce warnings with MSVC
msvc: CONFIG -= warning_clean
@@ -38,6 +39,7 @@ include(maps/maps.pri)
include(places/places.pri)
include(declarativemaps/declarativemaps.pri)
include(declarativeplaces/declarativeplaces.pri)
+qtConfig(location-labs-plugin):include(labs/labs.pri)
HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
diff --git a/src/location/maps/qgeomap.cpp b/src/location/maps/qgeomap.cpp
index 58657143..5f125169 100644
--- a/src/location/maps/qgeomap.cpp
+++ b/src/location/maps/qgeomap.cpp
@@ -290,6 +290,13 @@ bool QGeoMap::createMapObjectImplementation(QGeoMapObject *obj)
return false;
}
+/*!
+ To be called in ~QGeoMapObjectPrivate overrides, if needed
+*/
+void QGeoMap::removeMapObject(QGeoMapObject * /*obj*/)
+{
+}
+
QList<QGeoMapObject *> QGeoMap::mapObjects() const
{
Q_D(const QGeoMap);
diff --git a/src/location/maps/qgeomap_p.h b/src/location/maps/qgeomap_p.h
index 8e4a8839..e67340be 100644
--- a/src/location/maps/qgeomap_p.h
+++ b/src/location/maps/qgeomap_p.h
@@ -157,6 +157,7 @@ protected:
void setCameraData(const QGeoCameraData &cameraData);
void setCameraCapabilities(const QGeoCameraCapabilities &cameraCapabilities);
virtual QSGNode *updateSceneGraph(QSGNode *node, QQuickWindow *window) = 0;
+ virtual void removeMapObject(QGeoMapObject *obj);
Q_SIGNALS:
void cameraDataChanged(const QGeoCameraData &cameraData);
@@ -170,6 +171,7 @@ Q_SIGNALS:
private:
Q_DISABLE_COPY(QGeoMap)
friend class QDeclarativeGeoMap; //updateSceneGraph
+ friend class QGeoMapPrivate;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoMap::ItemTypes)
diff --git a/src/location/maps/qnavigationmanager.cpp b/src/location/maps/qnavigationmanager.cpp
index 1e83b2c9..5372e3a5 100644
--- a/src/location/maps/qnavigationmanager.cpp
+++ b/src/location/maps/qnavigationmanager.cpp
@@ -46,6 +46,8 @@ public:
~QNavigationManagerPrivate();
QNavigationManagerEngine *engine = nullptr;
+ QDeclarativeNavigatorPrivate *navigator = nullptr;
+ QList<QGeoMapParameter *> parameters;
private:
Q_DISABLE_COPY(QNavigationManagerPrivate)
@@ -87,6 +89,16 @@ bool QNavigationManager::isInitialized() const
return d_ptr->engine->isInitialized();
}
+void QNavigationManager::setNavigator(QDeclarativeNavigatorPrivate *navigator)
+{
+ d_ptr->navigator = navigator;
+}
+
+QDeclarativeNavigatorPrivate *QNavigationManager::declarativeNavigator() const
+{
+ return d_ptr->navigator;
+}
+
void QNavigationManager::setLocale(const QLocale &locale)
{
d_ptr->engine->setLocale(locale);
@@ -97,6 +109,36 @@ QLocale QNavigationManager::locale() const
return d_ptr->engine->locale();
}
+void QNavigationManager::setParameters(const QList<QGeoMapParameter *> &parameters)
+{
+ d_ptr->parameters = parameters;
+}
+
+QList<QGeoMapParameter *> QNavigationManager::parameters() const
+{
+ return d_ptr->parameters;
+}
+
+bool QNavigationManager::ready() const
+{
+ return d_ptr->engine->ready(*d_ptr->navigator, d_ptr->parameters);
+}
+
+bool QNavigationManager::start()
+{
+ return d_ptr->engine->start(*d_ptr->navigator, d_ptr->parameters);
+}
+
+bool QNavigationManager::stop()
+{
+ return d_ptr->engine->stop(*d_ptr->navigator);
+}
+
+bool QNavigationManager::active() const
+{
+ return d_ptr->engine->active(*d_ptr->navigator);
+}
+
QNavigationManager::QNavigationManager(QNavigationManagerEngine *engine, QObject *parent) : QObject(parent),
d_ptr(new QNavigationManagerPrivate)
{
diff --git a/src/location/maps/qnavigationmanager_p.h b/src/location/maps/qnavigationmanager_p.h
index e461bcf1..1d8c1722 100644
--- a/src/location/maps/qnavigationmanager_p.h
+++ b/src/location/maps/qnavigationmanager_p.h
@@ -52,11 +52,17 @@
#include <QSize>
#include <QPair>
#include <QtLocation/private/qlocationglobal_p.h>
+#include <QtLocation/private/qgeomapparameter_p.h>
QT_BEGIN_NAMESPACE
class QNavigationManagerEngine;
class QNavigationManagerPrivate;
+class QDeclarativeNavigatorPrivate;
+class QDeclarativeGeoWaypoint;
+class QGeoRoute;
+class QGeoRouteSegment;
+
class Q_LOCATION_PRIVATE_EXPORT QNavigationManager : public QObject
{
Q_OBJECT
@@ -66,16 +72,33 @@ public:
QString managerName() const;
int managerVersion() const;
-
QNavigationManagerEngine *engine();
-
bool isInitialized() const;
+
+ void setNavigator(QDeclarativeNavigatorPrivate *navigator);
+ QDeclarativeNavigatorPrivate *declarativeNavigator() const;
+
void setLocale(const QLocale &locale);
QLocale locale() const;
+ void setParameters(const QList<QGeoMapParameter *> &parameters);
+ QList<QGeoMapParameter *> parameters() const;
+
+ bool ready() const;
+ bool start();
+ bool stop();
+ bool active() const;
+
Q_SIGNALS:
void initialized();
+ // These must be emitted by the engine
+ void activeChanged(bool active);
+ void waypointReached(const QDeclarativeGeoWaypoint *pos);
+ void destinationReached();
+ void currentRouteChanged(const QGeoRoute &route);
+ void currentSegmentChanged(int segment);
+
protected:
QNavigationManager(QNavigationManagerEngine *engine, QObject *parent = 0);
diff --git a/src/location/maps/qnavigationmanagerengine.cpp b/src/location/maps/qnavigationmanagerengine.cpp
index 265237ee..b9191e74 100644
--- a/src/location/maps/qnavigationmanagerengine.cpp
+++ b/src/location/maps/qnavigationmanagerengine.cpp
@@ -105,14 +105,14 @@ bool QNavigationManagerEngine::isInitialized() const
return d_ptr->initialized;
}
-bool QNavigationManagerEngine::start(const QList<QGeoMapParameter*> &navigationParams, const QMapRouteObject &route)
+// Subclasses are supposed to emit activeChanged from here.
+bool QNavigationManagerEngine::start(QDeclarativeNavigatorPrivate & /*navigator*/, const QList<QGeoMapParameter*> & /*navigationParams*/)
{
- Q_UNUSED(navigationParams);
- Q_UNUSED(route);
+
return false;
}
-bool QNavigationManagerEngine::stop()
+bool QNavigationManagerEngine::stop(QDeclarativeNavigatorPrivate & /*navigator*/) // navigator needed to find the right navi session to stop.
{
return false;
}
diff --git a/src/location/maps/qnavigationmanagerengine_p.h b/src/location/maps/qnavigationmanagerengine_p.h
index 0aa5509e..803050c5 100644
--- a/src/location/maps/qnavigationmanagerengine_p.h
+++ b/src/location/maps/qnavigationmanagerengine_p.h
@@ -59,6 +59,7 @@ class QGeoMap;
class QGeoMapParameter;
class QMapRouteObject;
class QNavigationManagerEnginePrivate;
+class QDeclarativeNavigatorPrivate;
class Q_LOCATION_PRIVATE_EXPORT QNavigationManagerEngine : public QObject
{
@@ -76,17 +77,16 @@ public:
virtual QLocale locale() const;
virtual void setMeasurementSystem(QLocale::MeasurementSystem system);
virtual QLocale::MeasurementSystem measurementSystem() const;
- bool isInitialized() const;
+ virtual bool isInitialized() const;
+ virtual bool ready(const QDeclarativeNavigatorPrivate &navigator, const QList<QGeoMapParameter*> &navigationParams) = 0;
+ virtual bool active(const QDeclarativeNavigatorPrivate &navigator) = 0;
signals:
- void activeChanged(bool active);
- void waypointReached(const QGeoCoordinate &pos);
- void destinationReached();
void initialized();
public slots:
- virtual bool start(const QList<QGeoMapParameter*> &navigationParams, const QMapRouteObject &route);
- virtual bool stop();
+ virtual bool start(QDeclarativeNavigatorPrivate &navigator, const QList<QGeoMapParameter*> &navigationParams);
+ virtual bool stop(QDeclarativeNavigatorPrivate &navigator);
protected:
/*!
@@ -94,7 +94,7 @@ protected:
call this method after performing implementation-specific initialization within
the constructor.
*/
- void engineInitialized();
+ virtual void engineInitialized();
QScopedPointer<QNavigationManagerEnginePrivate> d_ptr;
};
diff --git a/src/locationlabs/locationlabs.pro b/src/locationlabs/locationlabs.pro
deleted file mode 100644
index add700ca..00000000
--- a/src/locationlabs/locationlabs.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TARGET = QtLocationLabs
-
-QT += core-private gui-private quick-private location-private positioning-private positioningquick-private
-
-CONFIG += simd optimize_full
-
-SOURCES += $$files(*.cpp)
-HEADERS += $$files(*.h)
-
-load(qt_module)
-
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 56b2acfc..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;
@@ -74,8 +101,22 @@ QGeoMap::Capabilities QGeoMapItemsOverlay::capabilities() const
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)
@@ -87,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 ff714954..42a59f06 100644
--- a/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h
+++ b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h
@@ -51,9 +51,10 @@ class QGeoMapItemsOverlay: public QGeoMap
Q_DECLARE_PRIVATE(QGeoMapItemsOverlay)
public:
QGeoMapItemsOverlay(QGeoMappingManagerEngineItemsOverlay *engine, QObject *parent);
-
virtual ~QGeoMapItemsOverlay();
- Capabilities capabilities() const override;
+
+ 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 11421e03..f401707b 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 2f5fa2e8..722420db 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/nokia/qgeouriprovider.cpp b/src/plugins/geoservices/nokia/qgeouriprovider.cpp
index b471f7c1..cef3d484 100644
--- a/src/plugins/geoservices/nokia/qgeouriprovider.cpp
+++ b/src/plugins/geoservices/nokia/qgeouriprovider.cpp
@@ -82,9 +82,9 @@ void QGeoUriProvider::setCurrentHost(const QString &host)
}
}
-void QGeoUriProvider::mobileCountryCodeChanged(int interface, const QString& mcc)
+void QGeoUriProvider::mobileCountryCodeChanged(int interfaceId, const QString& mcc)
{
- Q_UNUSED(interface)
+ Q_UNUSED(interfaceId)
Q_UNUSED(mcc)
setCurrentHost(isInternationalNetwork() || m_localizedHost.isEmpty() ? m_internationalHost : m_localizedHost);
diff --git a/src/plugins/geoservices/nokia/qgeouriprovider.h b/src/plugins/geoservices/nokia/qgeouriprovider.h
index e8d93a0f..d4d178a5 100644
--- a/src/plugins/geoservices/nokia/qgeouriprovider.h
+++ b/src/plugins/geoservices/nokia/qgeouriprovider.h
@@ -58,7 +58,7 @@ public:
QString getCurrentHost() const;
private Q_SLOTS:
- void mobileCountryCodeChanged(int interface, const QString& mcc);
+ void mobileCountryCodeChanged(int interfaceId, const QString& mcc);
private:
bool isInternationalNetwork() const;
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
diff --git a/src/positioning/qdoublevector2d_p.h b/src/positioning/qdoublevector2d_p.h
index e944d2f4..92ccfe85 100644
--- a/src/positioning/qdoublevector2d_p.h
+++ b/src/positioning/qdoublevector2d_p.h
@@ -73,6 +73,7 @@ public:
Q_DECL_CONSTEXPR inline double manhattanLength() const;
inline bool isNull() const;
+ inline bool isFinite() const;
Q_DECL_CONSTEXPR inline double x() const;
Q_DECL_CONSTEXPR inline double y() const;
@@ -136,6 +137,11 @@ inline bool QDoubleVector2D::isNull() const
return qIsNull(xp) && qIsNull(yp);
}
+inline bool QDoubleVector2D::isFinite() const
+{
+ return qIsFinite(xp) && qIsFinite(yp);
+}
+
Q_DECL_CONSTEXPR inline double QDoubleVector2D::x() const { return xp; }
Q_DECL_CONSTEXPR inline double QDoubleVector2D::y() const { return yp; }
diff --git a/src/src.pro b/src/src.pro
index 54fddb62..87ea7983 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -21,14 +21,8 @@ qtHaveModule(quick) {
plugins.depends += location
- exists(locationlabs):qtConfig(location-labs-plugin) {
- SUBDIRS += locationlabs
- locationlabs.depends += location
- }
-
SUBDIRS += imports
imports.depends += positioningquick positioning location
- exists(locationlabs):qtConfig(location-labs-plugin): imports.depends += locationlabs
}
plugins.depends += positioning
SUBDIRS += plugins
diff --git a/sync.profile b/sync.profile
index 57d89c2b..dcdc7296 100644
--- a/sync.profile
+++ b/sync.profile
@@ -2,7 +2,6 @@
"QtLocation" => "$basedir/src/location",
"QtPositioning" => "$basedir/src/positioning",
"QtPositioningQuick" => "$basedir/src/positioningquick",
- "QtLocationLabs" => "$basedir/src/locationlabs",
);
%moduleheaders = ( # restrict the module headers to those found in relative path
);