From 2f100373feff003b3a9f43c9314ea239f38b97b3 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Thu, 22 Feb 2018 16:30:23 +0100 Subject: Move locationlabs code into location The labs feature will still be controlled by location-labs-plugin config option. They will simply come from the QtLocation module, and be exposed to QML via the additional qml plugin in imports/locationlabs. Change-Id: I133d625708e78ba5d8121a95e45142aae5ec274b Reviewed-by: Alex Blasche --- src/imports/imports.pro | 6 +- src/imports/locationlabs/locationlabs.cpp | 14 +- src/imports/locationlabs/locationlabs.pro | 2 +- src/location/labs/labs.pri | 4 + src/location/labs/qmapcircleobject.cpp | 243 ++++++++++++++++++++ src/location/labs/qmapcircleobject_p.h | 93 ++++++++ src/location/labs/qmapcircleobject_p_p.h | 117 ++++++++++ src/location/labs/qmapiconobject.cpp | 205 +++++++++++++++++ src/location/labs/qmapiconobject_p.h | 88 +++++++ src/location/labs/qmapiconobject_p_p.h | 105 +++++++++ src/location/labs/qmapobjectview.cpp | 355 +++++++++++++++++++++++++++++ src/location/labs/qmapobjectview_p.h | 116 ++++++++++ src/location/labs/qmapobjectview_p_p.h | 86 +++++++ src/location/labs/qmappolygonobject.cpp | 217 ++++++++++++++++++ src/location/labs/qmappolygonobject_p.h | 90 ++++++++ src/location/labs/qmappolygonobject_p_p.h | 112 +++++++++ src/location/labs/qmappolylineobject.cpp | 186 +++++++++++++++ src/location/labs/qmappolylineobject_p.h | 85 +++++++ src/location/labs/qmappolylineobject_p_p.h | 107 +++++++++ src/location/labs/qmaprouteobject.cpp | 161 +++++++++++++ src/location/labs/qmaprouteobject_p.h | 90 ++++++++ src/location/labs/qmaprouteobject_p_p.h | 79 +++++++ src/location/location.pro | 2 + src/locationlabs/locationlabs.pro | 11 - src/locationlabs/qmapcircleobject.cpp | 243 -------------------- src/locationlabs/qmapcircleobject_p.h | 93 -------- src/locationlabs/qmapcircleobject_p_p.h | 117 ---------- src/locationlabs/qmapiconobject.cpp | 205 ----------------- src/locationlabs/qmapiconobject_p.h | 88 ------- src/locationlabs/qmapiconobject_p_p.h | 105 --------- src/locationlabs/qmapobjectview.cpp | 355 ----------------------------- src/locationlabs/qmapobjectview_p.h | 116 ---------- src/locationlabs/qmapobjectview_p_p.h | 86 ------- src/locationlabs/qmappolygonobject.cpp | 217 ------------------ src/locationlabs/qmappolygonobject_p.h | 90 -------- src/locationlabs/qmappolygonobject_p_p.h | 112 --------- src/locationlabs/qmappolylineobject.cpp | 186 --------------- src/locationlabs/qmappolylineobject_p.h | 85 ------- src/locationlabs/qmappolylineobject_p_p.h | 107 --------- src/locationlabs/qmaprouteobject.cpp | 161 ------------- src/locationlabs/qmaprouteobject_p.h | 90 -------- src/locationlabs/qmaprouteobject_p_p.h | 79 ------- src/src.pro | 6 - sync.profile | 1 - 44 files changed, 2552 insertions(+), 2564 deletions(-) create mode 100644 src/location/labs/labs.pri create mode 100644 src/location/labs/qmapcircleobject.cpp create mode 100644 src/location/labs/qmapcircleobject_p.h create mode 100644 src/location/labs/qmapcircleobject_p_p.h create mode 100644 src/location/labs/qmapiconobject.cpp create mode 100644 src/location/labs/qmapiconobject_p.h create mode 100644 src/location/labs/qmapiconobject_p_p.h create mode 100644 src/location/labs/qmapobjectview.cpp create mode 100644 src/location/labs/qmapobjectview_p.h create mode 100644 src/location/labs/qmapobjectview_p_p.h create mode 100644 src/location/labs/qmappolygonobject.cpp create mode 100644 src/location/labs/qmappolygonobject_p.h create mode 100644 src/location/labs/qmappolygonobject_p_p.h create mode 100644 src/location/labs/qmappolylineobject.cpp create mode 100644 src/location/labs/qmappolylineobject_p.h create mode 100644 src/location/labs/qmappolylineobject_p_p.h create mode 100644 src/location/labs/qmaprouteobject.cpp create mode 100644 src/location/labs/qmaprouteobject_p.h create mode 100644 src/location/labs/qmaprouteobject_p_p.h delete mode 100644 src/locationlabs/locationlabs.pro delete mode 100644 src/locationlabs/qmapcircleobject.cpp delete mode 100644 src/locationlabs/qmapcircleobject_p.h delete mode 100644 src/locationlabs/qmapcircleobject_p_p.h delete mode 100644 src/locationlabs/qmapiconobject.cpp delete mode 100644 src/locationlabs/qmapiconobject_p.h delete mode 100644 src/locationlabs/qmapiconobject_p_p.h delete mode 100644 src/locationlabs/qmapobjectview.cpp delete mode 100644 src/locationlabs/qmapobjectview_p.h delete mode 100644 src/locationlabs/qmapobjectview_p_p.h delete mode 100644 src/locationlabs/qmappolygonobject.cpp delete mode 100644 src/locationlabs/qmappolygonobject_p.h delete mode 100644 src/locationlabs/qmappolygonobject_p_p.h delete mode 100644 src/locationlabs/qmappolylineobject.cpp delete mode 100644 src/locationlabs/qmappolylineobject_p.h delete mode 100644 src/locationlabs/qmappolylineobject_p_p.h delete mode 100644 src/locationlabs/qmaprouteobject.cpp delete mode 100644 src/locationlabs/qmaprouteobject_p.h delete mode 100644 src/locationlabs/qmaprouteobject_p_p.h 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 1ae5d770..83deb27e 100644 --- a/src/imports/locationlabs/locationlabs.cpp +++ b/src/imports/locationlabs/locationlabs.cpp @@ -34,13 +34,12 @@ ** ****************************************************************************/ -#include -#include -#include -#include -#include -#include -//#include +#include +#include +#include +#include +#include +#include #include #include @@ -74,7 +73,6 @@ public: int minor = 11; // Register the 5.11 types - //qmlRegisterType(uri, major, minor, "Navigator"); qmlRegisterType(uri, major, minor, "MapIconObject"); qmlRegisterType(uri, major, minor, "MapObjectView"); qmlRegisterType(uri, major, minor, "MapRouteObject"); 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/labs/labs.pri b/src/location/labs/labs.pri new file mode 100644 index 00000000..de2fd820 --- /dev/null +++ b/src/location/labs/labs.pri @@ -0,0 +1,4 @@ +INCLUDEPATH += labs + +PRIVATE_HEADERS += $$files($$PWD/*.h) +SOURCES += $$files($$PWD/*.cpp) diff --git a/src/location/labs/qmapcircleobject.cpp b/src/location/labs/qmapcircleobject.cpp new file mode 100644 index 00000000..9d8b14c0 --- /dev/null +++ b/src/location/labs/qmapcircleobject.cpp @@ -0,0 +1,243 @@ +/**************************************************************************** +** +** 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 + +QT_BEGIN_NAMESPACE + +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 ¢er) +{ + 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(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(*this)); +} + + + +QMapCircleObject::QMapCircleObject(QObject *parent) + : QGeoMapObject(QExplicitlySharedDataPointer(new QMapCircleObjectPrivateDefault(this)), parent) + +{ + QMapCircleObjectPrivate *d = static_cast(d_ptr.data()); + d->setBorderColor(QColor(Qt::black)); // These are QDeclarativeMapLineProperties defaults + d->setBorderWidth(1.0); +} + +QMapCircleObject::~QMapCircleObject() +{ + +} + + +QGeoCoordinate QMapCircleObject::center() const +{ + return static_cast(d_ptr.data())->center(); +} + +qreal QMapCircleObject::radius() const +{ + return static_cast(d_ptr.data())->radius(); +} + +QColor QMapCircleObject::color() const +{ + return static_cast(d_ptr.data())->color(); +} + +QDeclarativeMapLineProperties *QMapCircleObject::border() +{ + if (!m_border) { + m_border = new QDeclarativeMapLineProperties; + connect(m_border, &QDeclarativeMapLineProperties::colorChanged, this, [this](const QColor &color){ + static_cast(d_ptr.data())->setBorderColor(color); + }); + connect(m_border, &QDeclarativeMapLineProperties::widthChanged, this, [this](qreal width){ + static_cast(d_ptr.data())->setBorderWidth(width); + }); + } + return m_border; +} + +void QMapCircleObject::setCenter(const QGeoCoordinate ¢er) +{ + auto ptr = static_cast(d_ptr.data()); + if (ptr->center() == center) + return; + + ptr->setCenter(center); + emit centerChanged(); +} + +void QMapCircleObject::setRadius(qreal radius) +{ + auto d = static_cast(d_ptr.data()); + if (d->radius() == radius) + return; + + d->setRadius(radius); + emit radiusChanged(); +} + +void QMapCircleObject::setColor(const QColor &color) +{ + auto d = static_cast(d_ptr.data()); + if (d->color() == color) + return; + + d->setColor(color); + emit colorChanged(); +} + +void QMapCircleObject::setMap(QGeoMap *map) +{ + QMapCircleObjectPrivate *d = static_cast(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 +#include +#include +#include +#include + +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 ¢er); + 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 +#include +#include +#include + +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 ¢er) = 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 ¢er) 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..7a3a1a75 --- /dev/null +++ b/src/location/labs/qmapiconobject.cpp @@ -0,0 +1,205 @@ +/**************************************************************************** +** +** 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 + +QT_BEGIN_NAMESPACE + +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(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 ¢er) +{ + 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(*this)); +} + + +/* + + QGeoMapIconPrivate default implementation + +*/ + + +QMapIconObject::QMapIconObject(QObject *parent) + : QGeoMapObject(QExplicitlySharedDataPointer(new QMapIconObjectPrivateDefault(this)), parent) +{} + +QMapIconObject::~QMapIconObject() +{ + +} + +QVariant QMapIconObject::content() const +{ + const QMapIconObjectPrivate *d = static_cast(d_ptr.data()); + return d->content(); +} + +QGeoCoordinate QMapIconObject::coordinate() const +{ + const QMapIconObjectPrivate *d = static_cast(d_ptr.data()); + return d->coordinate(); +} + +void QMapIconObject::setContent(QVariant content) +{ + QMapIconObjectPrivate *d = static_cast(d_ptr.data()); + if (d->content() == content) + return; + + d->setContent(content); + emit contentChanged(content); +} + +void QMapIconObject::setCoordinate(const QGeoCoordinate ¢er) +{ + QMapIconObjectPrivate *d = static_cast(d_ptr.data()); + if (d->coordinate() == center) + return; + + d->setCoordinate(center); + emit coordinateChanged(center); +} + +QSizeF QMapIconObject::size() const +{ + const QMapIconObjectPrivate *d = static_cast(d_ptr.data()); + return d->size(); +} + + +void QMapIconObject::setSize(const QSizeF &size) +{ + QMapIconObjectPrivate *d = static_cast(d_ptr.data()); + if (d->size() == size) + return; + + d->setSize(size); + emit sizeChanged(); +} + +void QMapIconObject::setMap(QGeoMap *map) +{ + QMapIconObjectPrivate *d = static_cast(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 +#include +#include +#include +#include + +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 +#include +#include + +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/location/labs/qmapobjectview.cpp b/src/location/labs/qmapobjectview.cpp new file mode 100644 index 00000000..310775a1 --- /dev/null +++ b/src/location/labs/qmapobjectview.cpp @@ -0,0 +1,355 @@ +/**************************************************************************** +** +** 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 "qmapobjectview_p.h" +#include "qmapobjectview_p_p.h" +#include +#include + +QT_BEGIN_NAMESPACE + +/* + + QGeoMapLayerPrivate + +*/ + +static const QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::Asynchronous; + +QMapObjectViewPrivate::QMapObjectViewPrivate(QGeoMapObject *q) + : QGeoMapObjectPrivate(q) +{ +} + +QMapObjectViewPrivate::~QMapObjectViewPrivate() +{ + +} + +QGeoMapObject::Type QMapObjectViewPrivate::type() const +{ + return QGeoMapObject::ViewType; +} + + +/* + + QGeoMapLayerPrivateDefault + +*/ + + +QMapObjectViewPrivateDefault::QMapObjectViewPrivateDefault(const QMapObjectViewPrivate &other) : QMapObjectViewPrivate(other.q) +{ +} + +QMapObjectViewPrivateDefault::~QMapObjectViewPrivateDefault() +{ + +} + +QMapObjectViewPrivateDefault::QMapObjectViewPrivateDefault(QGeoMapObject *q) : QMapObjectViewPrivate(q) +{ + +} + +QGeoMapObjectPrivate *QMapObjectViewPrivateDefault::clone() +{ + return new QMapObjectViewPrivateDefault(*this); +} + +/* + + QMapObjectView + +*/ + + +QMapObjectView::QMapObjectView(QObject *parent) + : QGeoMapObject(QExplicitlySharedDataPointer(new QMapObjectViewPrivateDefault(this)), parent) +{ + +} + +QMapObjectView::~QMapObjectView() +{ + flushDelegateModel(); + flushUserAddedMapObjects(); +} + +QList QMapObjectView::geoMapObjectChildren() const +{ + auto kids = QGeoMapObject::geoMapObjectChildren(); + auto size = m_instantiatedMapObjects.count(); + for (int i = 0; i < size; ++i) { + auto obj = qobject_cast(m_instantiatedMapObjects[i]); + if (obj) + kids << obj; + } + for (int i = 0; i < m_userAddedMapObjects.size(); ++i) { + auto obj = m_userAddedMapObjects.at(i); + if (obj) + kids << obj; + } + return kids; +} + +void QMapObjectView::setMap(QGeoMap *map) +{ + QMapObjectViewPrivate *d = static_cast(d_ptr.data()); + if (d->m_map == map) + return; + + QGeoMapObject::setMap(map); // This is where the specialized pimpl gets created and injected + + for (int i = 0; i < m_userAddedMapObjects.size(); ++i) { + auto obj = m_userAddedMapObjects.at(i); + if (obj && obj->map() != map) + obj->setMap(map); + } + + if (!map) { + // Map was set, now it has ben re-set to NULL + flushDelegateModel(); + flushUserAddedMapObjects(); + d_ptr = new QMapObjectViewPrivateDefault(*d); + } else if (d->m_componentCompleted) { + // Map was null, now it's set AND delegateModel is already complete. + // some delegates may have been incubated but not added to the map. + for (int i = 0; i < m_pendingMapObjects.size(); ++i) { + auto obj = m_pendingMapObjects.at(i); + if (obj && obj->map() != map) + obj->setMap(map); + } + m_pendingMapObjects.clear(); + } +} + +void QMapObjectView::classBegin() +{ + QQmlContext *ctx = qmlContext(this); + m_delegateModel = new QQmlDelegateModel(ctx, this); + m_delegateModel->classBegin(); + + QQmlInstanceModel *model = m_delegateModel; + connect(model, &QQmlInstanceModel::modelUpdated, this, &QMapObjectView::modelUpdated); + connect(model, &QQmlInstanceModel::createdItem, this, &QMapObjectView::createdItem); + connect(model, &QQmlInstanceModel::destroyingItem, this, &QMapObjectView::destroyingItem); + connect(model, &QQmlInstanceModel::initItem, this, &QMapObjectView::initItem); +} + +void QMapObjectView::componentComplete() +{ + QGeoMapObject::componentComplete(); + if (m_delegate) + m_delegateModel->setDelegate(m_delegate); + if (m_model.isValid()) + m_delegateModel->setModel(m_model); + m_delegateModel->componentComplete(); +} + +QVariant QMapObjectView::model() const +{ + return m_model; +} + +QQmlComponent *QMapObjectView::delegate() const +{ + return m_delegate; +} + +void QMapObjectView::setModel(QVariant model) +{ + if (m_model == model) + return; + m_model = model; + + if (d_ptr->m_componentCompleted) + m_delegateModel->setModel(model); + + emit modelChanged(model); +} + +void QMapObjectView::setDelegate(QQmlComponent *delegate) +{ + if (m_delegate == delegate) + return; + m_delegate = delegate; + + if (d_ptr->m_componentCompleted) + m_delegateModel->setDelegate(delegate); + + emit delegateChanged(delegate); +} + +/*! + \qmlmethod void Qt.labs.location::MapObjectView::addMapObject(MapObject object) + + Adds the given \a object to the MapObjectView (for example MapIconObject, MapRouteObject), and, + indirectly, to the underlying map. If the object already is on the MapObjectView, it will not be added again. + + \sa removeMapObject +*/ +void QMapObjectView::addMapObject(QGeoMapObject *object) +{ + if (m_userAddedMapObjects.indexOf(object) < 0) + m_userAddedMapObjects.append(object); + if (map() && object->map() != map()) + object->setMap(map()); +} + +/*! + \qmlmethod void Qt.labs.location::MapObjectView::removeMapObject(MapObject object) + + Removes the given \a object from the MapObjectView (for example MapIconObject, MapRouteObject), and, + indirectly, from the underlying map. + + \sa addMapObject +*/ +void QMapObjectView::removeMapObject(QGeoMapObject *object) +{ + int idx = m_userAddedMapObjects.indexOf(object); + if ( idx >= 0) { + object->setMap(nullptr); + m_userAddedMapObjects.remove(idx); + } +} + +void QMapObjectView::destroyingItem(QObject * /*object*/) +{ + +} + +void QMapObjectView::initItem(int /*index*/, QObject * /*object*/) +{ + +} + +void QMapObjectView::modelUpdated(const QQmlChangeSet &changeSet, bool reset) +{ + // move changes are expressed as one remove + one insert, with the same moveId. + // For simplicity, they will be treated as remove + insert. + // Changes will be also ignored, as they represent only data changes, not layout changes + if (reset) { // Assuming this means "remove everything already instantiated" + flushDelegateModel(); + } else { + // Remove map objects from the back to the front to retain the mapping to what is received from the changesets + const QVector &removes = changeSet.removes(); + std::map mapRemoves; + for (int i = 0; i < removes.size(); i++) + mapRemoves.insert(std::pair(removes.at(i).start(), i)); + + for (auto rit = mapRemoves.rbegin(); rit != mapRemoves.rend(); ++rit) { + const QQmlChangeSet::Change &c = removes.at(rit->second); + for (int idx = c.end() - 1; idx >= c.start(); --idx) + removeMapObjectFromMap(idx); + } + } + + 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(m_delegateModel->object(idx, incubationMode)); + if (mo) // if not, a createdItem signal will be emitted. + addMapObjectToMap(mo, idx); + } + } +} + +void QMapObjectView::addMapObjectToMap(QGeoMapObject *object, int index) +{ + if (!object) + return; + + m_instantiatedMapObjects[index] = object; + if (map()) + object->setMap(map()); + else + m_pendingMapObjects << object; + + // ToDo: + // Figure out the proper way to replace "mo->setVisible(visible());". Options: + // - simply leave it to the user to set up a property binding + // - set up a property binding automatically + // - add a viewVisibility member to QGeoMapObject that gets combined at all times, + // and a connection for it. +} + +void QMapObjectView::removeMapObjectFromMap(int index) +{ + if (index >= 0 && index < m_instantiatedMapObjects.size()) { + QGeoMapObject *mo = m_instantiatedMapObjects.takeAt(index); + if (!mo) + return; + mo->setMap(nullptr); + m_delegateModel->release(mo); + } +} + +// See QObject *QQmlDelegateModel::object(int index, QQmlIncubator::IncubationMode incubationMode) doc +// for explanation on when createdItem is emitted. +void QMapObjectView::createdItem(int index, QObject * /*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(m_delegateModel->object(index, incubationMode)); + if (mo) + addMapObjectToMap(mo, index); +} + + +void QMapObjectView::flushDelegateModel() +{ + // Backward as removeItemFromMap modifies m_instantiatedItems + for (int i = m_instantiatedMapObjects.size() -1; i >= 0 ; i--) + removeMapObjectFromMap(i); +} + +void QMapObjectView::flushUserAddedMapObjects() +{ + for (int i = 0; i < m_userAddedMapObjects.size(); ++i) { + auto obj = m_userAddedMapObjects.at(i); + if (obj) + obj->setMap(nullptr); // obj parent might not be this. If so, it would not be destroyed by destroying this view. + } +} + +QT_END_NAMESPACE + diff --git a/src/location/labs/qmapobjectview_p.h b/src/location/labs/qmapobjectview_p.h new file mode 100644 index 00000000..49b80883 --- /dev/null +++ b/src/location/labs/qmapobjectview_p.h @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** 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 QMAPOBJECTVIEW_P_H +#define QMAPOBJECTVIEW_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 +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QQmlDelegateModel; +class QMapObjectViewPrivate; +class QQmlChangeSet; +class Q_LOCATION_PRIVATE_EXPORT QMapObjectView : public QGeoMapObject +{ + Q_OBJECT + Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged) + Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) + Q_INTERFACES(QQmlParserStatus) +public: + QMapObjectView(QObject *parent = nullptr); + ~QMapObjectView() override; + + // QGeoMapObject interface + QList geoMapObjectChildren() const override; + void setMap(QGeoMap *map) override; + + // QQmlParserStatus interface + void classBegin() override; + void componentComplete() override; + + QVariant model() const; + void setModel(QVariant model); + + QQmlComponent *delegate() const; + void setDelegate(QQmlComponent * delegate); + +public Q_SLOTS: + // The dynamic API that matches Map.add/remove MapItem + void addMapObject(QGeoMapObject *object); + void removeMapObject(QGeoMapObject *object); + +signals: + void modelChanged(QVariant model); + void delegateChanged(QQmlComponent * delegate); + +protected Q_SLOTS: + void destroyingItem(QObject *object); + void initItem(int index, QObject *object); + void createdItem(int index, QObject *object); + void modelUpdated(const QQmlChangeSet &changeSet, bool reset); + +protected: + void addMapObjectToMap(QGeoMapObject *object, int index); + void removeMapObjectFromMap(int index); + void flushDelegateModel(); + void flushUserAddedMapObjects(); + + QVariant m_model; + QQmlComponent *m_delegate = nullptr; + QQmlDelegateModel *m_delegateModel = nullptr; + QVector> m_instantiatedMapObjects; + QVector> m_pendingMapObjects; + QVector> m_userAddedMapObjects; // A third list containing the objects dynamically added through addMapObject +}; + +QT_END_NAMESPACE + +#endif // QMAPOBJECTVIEW_P_H diff --git a/src/location/labs/qmapobjectview_p_p.h b/src/location/labs/qmapobjectview_p_p.h new file mode 100644 index 00000000..7550e209 --- /dev/null +++ b/src/location/labs/qmapobjectview_p_p.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** 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 QMAPOBJECTVIEW_P_P_H +#define QMAPOBJECTVIEW_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 +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QQmlDelegateModel; +class QGeoMap; +class Q_LOCATION_PRIVATE_EXPORT QMapObjectViewPrivate : public QGeoMapObjectPrivate +{ +public: + QMapObjectViewPrivate(QGeoMapObject *q); + ~QMapObjectViewPrivate() override; + + virtual QGeoMapObject::Type type() const override final; +}; + +class Q_LOCATION_PRIVATE_EXPORT QMapObjectViewPrivateDefault : public QMapObjectViewPrivate +{ +public: + QMapObjectViewPrivateDefault(QGeoMapObject *q); + QMapObjectViewPrivateDefault(const QMapObjectViewPrivate &other); + ~QMapObjectViewPrivateDefault() override; + + + // QGeoMapObjectPrivate interface +public: + QGeoMapObjectPrivate *clone() override; +}; + +QT_END_NAMESPACE + +#endif // QMAPOBJECTVIEW_P_P_H diff --git a/src/location/labs/qmappolygonobject.cpp b/src/location/labs/qmappolygonobject.cpp new file mode 100644 index 00000000..fd4c660a --- /dev/null +++ b/src/location/labs/qmappolygonobject.cpp @@ -0,0 +1,217 @@ +/**************************************************************************** +** +** 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 + +QT_BEGIN_NAMESPACE + +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 QMapPolygonObjectPrivateDefault::path() const +{ + return m_path; +} + +void QMapPolygonObjectPrivateDefault::setPath(const QList &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(*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(other); + return (QGeoMapObjectPrivate::equals(o) + && path() == o.path() + && borderColor() == o.borderColor() + && fillColor() == o.fillColor() + && borderWidth() == o.borderWidth()); +} + + + + +QMapPolygonObject::QMapPolygonObject(QObject *parent) + : QGeoMapObject(QExplicitlySharedDataPointer(new QMapPolygonObjectPrivateDefault(this)), parent) +{ + QMapPolygonObjectPrivate *d = static_cast(d_ptr.data()); + d->setBorderColor(QColor(Qt::black)); // These are QDeclarativeMapLineProperties defaults + d->setBorderWidth(1.0); +} + +QMapPolygonObject::~QMapPolygonObject() +{} + +QVariantList QMapPolygonObject::path() const +{ + QVariantList p; + for (const QGeoCoordinate &c: static_cast(d_ptr.data())->path()) + p << QVariant::fromValue(c); + return p; +} + +void QMapPolygonObject::setPath(const QVariantList &path) +{ + QList p; + bool ok = false; + for (const auto &c: path) { + const QGeoCoordinate coord = parseCoordinate(c, &ok); + if (ok) + p << coord; + } + auto pimpl = static_cast(d_ptr.data()); + if (p != pimpl->path()) { + pimpl->setPath(p); + emit pathChanged(); + } +} + +QColor QMapPolygonObject::color() const +{ + return static_cast(d_ptr.data())->fillColor(); +} + +QDeclarativeMapLineProperties *QMapPolygonObject::border() +{ + if (!m_border) { + m_border = new QDeclarativeMapLineProperties; + connect(m_border, &QDeclarativeMapLineProperties::colorChanged, this, [this](const QColor &color){ + static_cast(d_ptr.data())->setBorderColor(color); + }); + connect(m_border, &QDeclarativeMapLineProperties::widthChanged, this, [this](qreal width){ + static_cast(d_ptr.data())->setBorderWidth(width); + }); + } + return m_border; +} + +void QMapPolygonObject::setColor(const QColor &fillColor) +{ + auto ptr = static_cast(d_ptr.data()); + + if (ptr->fillColor() == fillColor) + return; + + ptr->setFillColor(fillColor); + emit colorChanged(); +} + +void QMapPolygonObject::setMap(QGeoMap *map) +{ + QMapPolygonObjectPrivate *d = static_cast(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 +#include +#include + +#include + +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 +#include +#include +#include + +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 path() const = 0; + virtual void setPath(const QList &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 path() const override; + void setPath(const QList &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 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..1e625c1f --- /dev/null +++ b/src/location/labs/qmappolylineobject.cpp @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** 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 + +QT_BEGIN_NAMESPACE + +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 QMapPolylineObjectPrivateDefault::path() const +{ + return m_path; +} + +void QMapPolylineObjectPrivateDefault::setPath(const QList &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(other); + return (QGeoMapObjectPrivate::equals(o) + && path() == o.path() + && color() == o.color() + && width() == o.width()); +} + +QGeoMapObjectPrivate *QMapPolylineObjectPrivateDefault::clone() +{ + return new QMapPolylineObjectPrivateDefault(static_cast(*this)); +} + +QMapPolylineObject::QMapPolylineObject(QObject *parent) + : QGeoMapObject(QExplicitlySharedDataPointer(new QMapPolylineObjectPrivateDefault(this)), parent) +{ + QMapPolylineObjectPrivate *d = static_cast(d_ptr.data()); + d->setColor(QColor(Qt::black)); // These are QDeclarativeMapLineProperties defaults + d->setWidth(1.0); +} + +QMapPolylineObject::~QMapPolylineObject() +{} + +QVariantList QMapPolylineObject::path() const +{ + QVariantList p; + for (const QGeoCoordinate &c: static_cast(d_ptr.data())->path()) + p << QVariant::fromValue(c); + return p; +} + +QDeclarativeMapLineProperties *QMapPolylineObject::border() +{ + if (!m_border) { + m_border = new QDeclarativeMapLineProperties; + connect(m_border, &QDeclarativeMapLineProperties::colorChanged, this, [this](const QColor &color){ + static_cast(d_ptr.data())->setColor(color); + }); + connect(m_border, &QDeclarativeMapLineProperties::widthChanged, this, [this](qreal width){ + static_cast(d_ptr.data())->setWidth(width); + }); + } + return m_border; +} + +void QMapPolylineObject::setPath(const QVariantList &path) +{ + QList p; + bool ok = false; + for (const auto &c: path) { + const QGeoCoordinate coord = parseCoordinate(c, &ok); + if (ok) + p << coord; + } + auto pimpl = static_cast(d_ptr.data()); + if (p != pimpl->path()) { + pimpl->setPath(p); + emit pathChanged(); + } +} + +void QMapPolylineObject::setMap(QGeoMap *map) +{ + QMapPolylineObjectPrivate *d = static_cast(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 +#include +#include + +#include + +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 +#include +#include +#include + +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 path() const = 0; + virtual void setPath(const QList &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 path() const override; + void setPath(const QList &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 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/location/labs/qmaprouteobject.cpp b/src/location/labs/qmaprouteobject.cpp new file mode 100644 index 00000000..724bdb73 --- /dev/null +++ b/src/location/labs/qmaprouteobject.cpp @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** 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 +#include "qmaprouteobject_p.h" +#include "qmaprouteobject_p_p.h" + +QT_BEGIN_NAMESPACE + +/* + + QGeoMapRoutePrivate + +*/ + +QMapRouteObjectPrivate::QMapRouteObjectPrivate(QGeoMapObject *q) : QGeoMapObjectPrivate(q) +{ + +} + +QMapRouteObjectPrivate::QMapRouteObjectPrivate(const QMapRouteObjectPrivate &other) : QGeoMapObjectPrivate(other) +{ + // QGeoMapRoutePrivate doesn't contain anything because QGeoRoute has already everything necessary. +} + +QMapRouteObjectPrivate::~QMapRouteObjectPrivate() +{ + +} + +QGeoMapObject::Type QMapRouteObjectPrivate::type() const +{ + return QGeoMapObject::RouteType; +} + +QDeclarativeGeoRoute *QMapRouteObjectPrivate::declarativeGeoRoute() const +{ + const QMapRouteObject *r = static_cast(q); + return r->m_route; +} + +QGeoRoute QMapRouteObjectPrivate::route() const +{ + const QDeclarativeGeoRoute *r = declarativeGeoRoute(); + if (r) + return r->route(); + return {}; +} + +void QMapRouteObjectPrivate::setRoute(const QDeclarativeGeoRoute *route) +{ + Q_UNUSED(route) +} + +bool QMapRouteObjectPrivate::equals(const QGeoMapObjectPrivate &other) const +{ + if (other.type() != type()) // This check might be unnecessary, depending on how equals gets used + return false; + + const QMapRouteObjectPrivate &o = static_cast(other); + return (QGeoMapObjectPrivate::equals(o) + && route() == o.route()); // Could also be done shallow, comparing declarativeGeoRoute() +} + +QGeoMapObjectPrivate *QMapRouteObjectPrivate::clone() +{ + return new QMapRouteObjectPrivate(*this); +} + + +/* + + QGeoMapRoute + +*/ + +QMapRouteObject::QMapRouteObject(QObject *parent) + : QGeoMapObject(QExplicitlySharedDataPointer(new QMapRouteObjectPrivate(this)), parent) +{ + +} + +QMapRouteObject::~QMapRouteObject() +{ + +} + +QDeclarativeGeoRoute *QMapRouteObject::route() const +{ + return m_route; +} + +QGeoRoute QMapRouteObject::geoRoute() const +{ + if (m_route) + return m_route->route(); + return {}; +} + +void QMapRouteObject::setRoute(QDeclarativeGeoRoute *route) +{ + if (route == m_route) + return; +// if ((!m_route && !route) || (m_route && route && m_route->route() == route->route())) +// return; + + m_route = route; + QMapRouteObjectPrivate *d = static_cast(d_ptr.data()); + d->setRoute(route); + emit routeChanged(route); +} + +void QMapRouteObject::setMap(QGeoMap *map) +{ + QMapRouteObjectPrivate *d = static_cast(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 QMapRouteObjectPrivate(*d); + // Old pimpl deleted implicitly by QExplicitlySharedDataPointer + } +} + +QT_END_NAMESPACE diff --git a/src/location/labs/qmaprouteobject_p.h b/src/location/labs/qmaprouteobject_p.h new file mode 100644 index 00000000..dcc35807 --- /dev/null +++ b/src/location/labs/qmaprouteobject_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 QDECLARATIVEMAPROUTEDELEGATE_P_H +#define QDECLARATIVEMAPROUTEDELEGATE_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 +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +class QDeclarativeGeoRoute; +class QGeoRoute; +class QMapRouteObjectPrivate; +class Q_LOCATION_PRIVATE_EXPORT QMapRouteObject : public QGeoMapObject +{ + Q_OBJECT + Q_PROPERTY(QDeclarativeGeoRoute *route READ route WRITE setRoute NOTIFY routeChanged) + +public: + explicit QMapRouteObject(QObject *parent = nullptr); + ~QMapRouteObject() override; + + QDeclarativeGeoRoute *route() const; + QGeoRoute geoRoute() const; + + void setMap(QGeoMap *map) override; + void setRoute(QDeclarativeGeoRoute * route); + +signals: + void routeChanged(QDeclarativeGeoRoute * route); + +protected: + QDeclarativeGeoRoute *m_route = nullptr; + + friend class QMapRouteObjectPrivate; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QMapRouteObject) + +#endif // QDECLARATIVEMAPROUTEDELEGATE_P_H diff --git a/src/location/labs/qmaprouteobject_p_p.h b/src/location/labs/qmaprouteobject_p_p.h new file mode 100644 index 00000000..e01b1cc6 --- /dev/null +++ b/src/location/labs/qmaprouteobject_p_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** 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 QGEOMAPROUTE_P_P_H +#define QGEOMAPROUTE_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 +#include +#include +QT_BEGIN_NAMESPACE + +class QGeoRoute; + +class Q_LOCATION_PRIVATE_EXPORT QMapRouteObjectPrivate : public QGeoMapObjectPrivate +{ +public: + QMapRouteObjectPrivate(QGeoMapObject *q); + QMapRouteObjectPrivate(const QMapRouteObjectPrivate &other); + ~QMapRouteObjectPrivate() override; + + virtual QGeoMapObject::Type type() const override final; + + QDeclarativeGeoRoute *declarativeGeoRoute() const; + + virtual QGeoRoute route() const; + virtual void setRoute(const QDeclarativeGeoRoute *route); + + // QGeoMapObjectPrivate interface + bool equals(const QGeoMapObjectPrivate &other) const override; + QGeoMapObjectPrivate *clone() override; +}; + +QT_END_NAMESPACE + +#endif // QGEOMAPROUTE_P_P_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/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/locationlabs/qmapcircleobject.cpp b/src/locationlabs/qmapcircleobject.cpp deleted file mode 100644 index 9d8b14c0..00000000 --- a/src/locationlabs/qmapcircleobject.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/**************************************************************************** -** -** 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 - -QT_BEGIN_NAMESPACE - -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 ¢er) -{ - 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(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(*this)); -} - - - -QMapCircleObject::QMapCircleObject(QObject *parent) - : QGeoMapObject(QExplicitlySharedDataPointer(new QMapCircleObjectPrivateDefault(this)), parent) - -{ - QMapCircleObjectPrivate *d = static_cast(d_ptr.data()); - d->setBorderColor(QColor(Qt::black)); // These are QDeclarativeMapLineProperties defaults - d->setBorderWidth(1.0); -} - -QMapCircleObject::~QMapCircleObject() -{ - -} - - -QGeoCoordinate QMapCircleObject::center() const -{ - return static_cast(d_ptr.data())->center(); -} - -qreal QMapCircleObject::radius() const -{ - return static_cast(d_ptr.data())->radius(); -} - -QColor QMapCircleObject::color() const -{ - return static_cast(d_ptr.data())->color(); -} - -QDeclarativeMapLineProperties *QMapCircleObject::border() -{ - if (!m_border) { - m_border = new QDeclarativeMapLineProperties; - connect(m_border, &QDeclarativeMapLineProperties::colorChanged, this, [this](const QColor &color){ - static_cast(d_ptr.data())->setBorderColor(color); - }); - connect(m_border, &QDeclarativeMapLineProperties::widthChanged, this, [this](qreal width){ - static_cast(d_ptr.data())->setBorderWidth(width); - }); - } - return m_border; -} - -void QMapCircleObject::setCenter(const QGeoCoordinate ¢er) -{ - auto ptr = static_cast(d_ptr.data()); - if (ptr->center() == center) - return; - - ptr->setCenter(center); - emit centerChanged(); -} - -void QMapCircleObject::setRadius(qreal radius) -{ - auto d = static_cast(d_ptr.data()); - if (d->radius() == radius) - return; - - d->setRadius(radius); - emit radiusChanged(); -} - -void QMapCircleObject::setColor(const QColor &color) -{ - auto d = static_cast(d_ptr.data()); - if (d->color() == color) - return; - - d->setColor(color); - emit colorChanged(); -} - -void QMapCircleObject::setMap(QGeoMap *map) -{ - QMapCircleObjectPrivate *d = static_cast(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/locationlabs/qmapcircleobject_p.h b/src/locationlabs/qmapcircleobject_p.h deleted file mode 100644 index 0c050d34..00000000 --- a/src/locationlabs/qmapcircleobject_p.h +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** 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 -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class Q_LOCATIONLABS_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 ¢er); - 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/locationlabs/qmapcircleobject_p_p.h b/src/locationlabs/qmapcircleobject_p_p.h deleted file mode 100644 index 8f237bd6..00000000 --- a/src/locationlabs/qmapcircleobject_p_p.h +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** 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 -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class Q_LOCATIONLABS_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 ¢er) = 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_LOCATIONLABS_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 ¢er) 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/locationlabs/qmapiconobject.cpp b/src/locationlabs/qmapiconobject.cpp deleted file mode 100644 index 7a3a1a75..00000000 --- a/src/locationlabs/qmapiconobject.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/**************************************************************************** -** -** 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 - -QT_BEGIN_NAMESPACE - -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(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 ¢er) -{ - 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(*this)); -} - - -/* - - QGeoMapIconPrivate default implementation - -*/ - - -QMapIconObject::QMapIconObject(QObject *parent) - : QGeoMapObject(QExplicitlySharedDataPointer(new QMapIconObjectPrivateDefault(this)), parent) -{} - -QMapIconObject::~QMapIconObject() -{ - -} - -QVariant QMapIconObject::content() const -{ - const QMapIconObjectPrivate *d = static_cast(d_ptr.data()); - return d->content(); -} - -QGeoCoordinate QMapIconObject::coordinate() const -{ - const QMapIconObjectPrivate *d = static_cast(d_ptr.data()); - return d->coordinate(); -} - -void QMapIconObject::setContent(QVariant content) -{ - QMapIconObjectPrivate *d = static_cast(d_ptr.data()); - if (d->content() == content) - return; - - d->setContent(content); - emit contentChanged(content); -} - -void QMapIconObject::setCoordinate(const QGeoCoordinate ¢er) -{ - QMapIconObjectPrivate *d = static_cast(d_ptr.data()); - if (d->coordinate() == center) - return; - - d->setCoordinate(center); - emit coordinateChanged(center); -} - -QSizeF QMapIconObject::size() const -{ - const QMapIconObjectPrivate *d = static_cast(d_ptr.data()); - return d->size(); -} - - -void QMapIconObject::setSize(const QSizeF &size) -{ - QMapIconObjectPrivate *d = static_cast(d_ptr.data()); - if (d->size() == size) - return; - - d->setSize(size); - emit sizeChanged(); -} - -void QMapIconObject::setMap(QGeoMap *map) -{ - QMapIconObjectPrivate *d = static_cast(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/locationlabs/qmapiconobject_p.h b/src/locationlabs/qmapiconobject_p.h deleted file mode 100644 index 4fcef648..00000000 --- a/src/locationlabs/qmapiconobject_p.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** 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 -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class Q_LOCATIONLABS_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/locationlabs/qmapiconobject_p_p.h b/src/locationlabs/qmapiconobject_p_p.h deleted file mode 100644 index 7eec58a1..00000000 --- a/src/locationlabs/qmapiconobject_p_p.h +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** 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 -#include -#include - -QT_BEGIN_NAMESPACE - -class Q_LOCATIONLABS_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_LOCATIONLABS_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/locationlabs/qmapobjectview.cpp deleted file mode 100644 index 310775a1..00000000 --- a/src/locationlabs/qmapobjectview.cpp +++ /dev/null @@ -1,355 +0,0 @@ -/**************************************************************************** -** -** 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 "qmapobjectview_p.h" -#include "qmapobjectview_p_p.h" -#include -#include - -QT_BEGIN_NAMESPACE - -/* - - QGeoMapLayerPrivate - -*/ - -static const QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::Asynchronous; - -QMapObjectViewPrivate::QMapObjectViewPrivate(QGeoMapObject *q) - : QGeoMapObjectPrivate(q) -{ -} - -QMapObjectViewPrivate::~QMapObjectViewPrivate() -{ - -} - -QGeoMapObject::Type QMapObjectViewPrivate::type() const -{ - return QGeoMapObject::ViewType; -} - - -/* - - QGeoMapLayerPrivateDefault - -*/ - - -QMapObjectViewPrivateDefault::QMapObjectViewPrivateDefault(const QMapObjectViewPrivate &other) : QMapObjectViewPrivate(other.q) -{ -} - -QMapObjectViewPrivateDefault::~QMapObjectViewPrivateDefault() -{ - -} - -QMapObjectViewPrivateDefault::QMapObjectViewPrivateDefault(QGeoMapObject *q) : QMapObjectViewPrivate(q) -{ - -} - -QGeoMapObjectPrivate *QMapObjectViewPrivateDefault::clone() -{ - return new QMapObjectViewPrivateDefault(*this); -} - -/* - - QMapObjectView - -*/ - - -QMapObjectView::QMapObjectView(QObject *parent) - : QGeoMapObject(QExplicitlySharedDataPointer(new QMapObjectViewPrivateDefault(this)), parent) -{ - -} - -QMapObjectView::~QMapObjectView() -{ - flushDelegateModel(); - flushUserAddedMapObjects(); -} - -QList QMapObjectView::geoMapObjectChildren() const -{ - auto kids = QGeoMapObject::geoMapObjectChildren(); - auto size = m_instantiatedMapObjects.count(); - for (int i = 0; i < size; ++i) { - auto obj = qobject_cast(m_instantiatedMapObjects[i]); - if (obj) - kids << obj; - } - for (int i = 0; i < m_userAddedMapObjects.size(); ++i) { - auto obj = m_userAddedMapObjects.at(i); - if (obj) - kids << obj; - } - return kids; -} - -void QMapObjectView::setMap(QGeoMap *map) -{ - QMapObjectViewPrivate *d = static_cast(d_ptr.data()); - if (d->m_map == map) - return; - - QGeoMapObject::setMap(map); // This is where the specialized pimpl gets created and injected - - for (int i = 0; i < m_userAddedMapObjects.size(); ++i) { - auto obj = m_userAddedMapObjects.at(i); - if (obj && obj->map() != map) - obj->setMap(map); - } - - if (!map) { - // Map was set, now it has ben re-set to NULL - flushDelegateModel(); - flushUserAddedMapObjects(); - d_ptr = new QMapObjectViewPrivateDefault(*d); - } else if (d->m_componentCompleted) { - // Map was null, now it's set AND delegateModel is already complete. - // some delegates may have been incubated but not added to the map. - for (int i = 0; i < m_pendingMapObjects.size(); ++i) { - auto obj = m_pendingMapObjects.at(i); - if (obj && obj->map() != map) - obj->setMap(map); - } - m_pendingMapObjects.clear(); - } -} - -void QMapObjectView::classBegin() -{ - QQmlContext *ctx = qmlContext(this); - m_delegateModel = new QQmlDelegateModel(ctx, this); - m_delegateModel->classBegin(); - - QQmlInstanceModel *model = m_delegateModel; - connect(model, &QQmlInstanceModel::modelUpdated, this, &QMapObjectView::modelUpdated); - connect(model, &QQmlInstanceModel::createdItem, this, &QMapObjectView::createdItem); - connect(model, &QQmlInstanceModel::destroyingItem, this, &QMapObjectView::destroyingItem); - connect(model, &QQmlInstanceModel::initItem, this, &QMapObjectView::initItem); -} - -void QMapObjectView::componentComplete() -{ - QGeoMapObject::componentComplete(); - if (m_delegate) - m_delegateModel->setDelegate(m_delegate); - if (m_model.isValid()) - m_delegateModel->setModel(m_model); - m_delegateModel->componentComplete(); -} - -QVariant QMapObjectView::model() const -{ - return m_model; -} - -QQmlComponent *QMapObjectView::delegate() const -{ - return m_delegate; -} - -void QMapObjectView::setModel(QVariant model) -{ - if (m_model == model) - return; - m_model = model; - - if (d_ptr->m_componentCompleted) - m_delegateModel->setModel(model); - - emit modelChanged(model); -} - -void QMapObjectView::setDelegate(QQmlComponent *delegate) -{ - if (m_delegate == delegate) - return; - m_delegate = delegate; - - if (d_ptr->m_componentCompleted) - m_delegateModel->setDelegate(delegate); - - emit delegateChanged(delegate); -} - -/*! - \qmlmethod void Qt.labs.location::MapObjectView::addMapObject(MapObject object) - - Adds the given \a object to the MapObjectView (for example MapIconObject, MapRouteObject), and, - indirectly, to the underlying map. If the object already is on the MapObjectView, it will not be added again. - - \sa removeMapObject -*/ -void QMapObjectView::addMapObject(QGeoMapObject *object) -{ - if (m_userAddedMapObjects.indexOf(object) < 0) - m_userAddedMapObjects.append(object); - if (map() && object->map() != map()) - object->setMap(map()); -} - -/*! - \qmlmethod void Qt.labs.location::MapObjectView::removeMapObject(MapObject object) - - Removes the given \a object from the MapObjectView (for example MapIconObject, MapRouteObject), and, - indirectly, from the underlying map. - - \sa addMapObject -*/ -void QMapObjectView::removeMapObject(QGeoMapObject *object) -{ - int idx = m_userAddedMapObjects.indexOf(object); - if ( idx >= 0) { - object->setMap(nullptr); - m_userAddedMapObjects.remove(idx); - } -} - -void QMapObjectView::destroyingItem(QObject * /*object*/) -{ - -} - -void QMapObjectView::initItem(int /*index*/, QObject * /*object*/) -{ - -} - -void QMapObjectView::modelUpdated(const QQmlChangeSet &changeSet, bool reset) -{ - // move changes are expressed as one remove + one insert, with the same moveId. - // For simplicity, they will be treated as remove + insert. - // Changes will be also ignored, as they represent only data changes, not layout changes - if (reset) { // Assuming this means "remove everything already instantiated" - flushDelegateModel(); - } else { - // Remove map objects from the back to the front to retain the mapping to what is received from the changesets - const QVector &removes = changeSet.removes(); - std::map mapRemoves; - for (int i = 0; i < removes.size(); i++) - mapRemoves.insert(std::pair(removes.at(i).start(), i)); - - for (auto rit = mapRemoves.rbegin(); rit != mapRemoves.rend(); ++rit) { - const QQmlChangeSet::Change &c = removes.at(rit->second); - for (int idx = c.end() - 1; idx >= c.start(); --idx) - removeMapObjectFromMap(idx); - } - } - - 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(m_delegateModel->object(idx, incubationMode)); - if (mo) // if not, a createdItem signal will be emitted. - addMapObjectToMap(mo, idx); - } - } -} - -void QMapObjectView::addMapObjectToMap(QGeoMapObject *object, int index) -{ - if (!object) - return; - - m_instantiatedMapObjects[index] = object; - if (map()) - object->setMap(map()); - else - m_pendingMapObjects << object; - - // ToDo: - // Figure out the proper way to replace "mo->setVisible(visible());". Options: - // - simply leave it to the user to set up a property binding - // - set up a property binding automatically - // - add a viewVisibility member to QGeoMapObject that gets combined at all times, - // and a connection for it. -} - -void QMapObjectView::removeMapObjectFromMap(int index) -{ - if (index >= 0 && index < m_instantiatedMapObjects.size()) { - QGeoMapObject *mo = m_instantiatedMapObjects.takeAt(index); - if (!mo) - return; - mo->setMap(nullptr); - m_delegateModel->release(mo); - } -} - -// See QObject *QQmlDelegateModel::object(int index, QQmlIncubator::IncubationMode incubationMode) doc -// for explanation on when createdItem is emitted. -void QMapObjectView::createdItem(int index, QObject * /*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(m_delegateModel->object(index, incubationMode)); - if (mo) - addMapObjectToMap(mo, index); -} - - -void QMapObjectView::flushDelegateModel() -{ - // Backward as removeItemFromMap modifies m_instantiatedItems - for (int i = m_instantiatedMapObjects.size() -1; i >= 0 ; i--) - removeMapObjectFromMap(i); -} - -void QMapObjectView::flushUserAddedMapObjects() -{ - for (int i = 0; i < m_userAddedMapObjects.size(); ++i) { - auto obj = m_userAddedMapObjects.at(i); - if (obj) - obj->setMap(nullptr); // obj parent might not be this. If so, it would not be destroyed by destroying this view. - } -} - -QT_END_NAMESPACE - diff --git a/src/locationlabs/qmapobjectview_p.h b/src/locationlabs/qmapobjectview_p.h deleted file mode 100644 index cfdc6702..00000000 --- a/src/locationlabs/qmapobjectview_p.h +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** 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 QMAPOBJECTVIEW_P_H -#define QMAPOBJECTVIEW_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 -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QQmlDelegateModel; -class QMapObjectViewPrivate; -class QQmlChangeSet; -class Q_LOCATIONLABS_PRIVATE_EXPORT QMapObjectView : public QGeoMapObject -{ - Q_OBJECT - Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged) - Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) - Q_INTERFACES(QQmlParserStatus) -public: - QMapObjectView(QObject *parent = nullptr); - ~QMapObjectView() override; - - // QGeoMapObject interface - QList geoMapObjectChildren() const override; - void setMap(QGeoMap *map) override; - - // QQmlParserStatus interface - void classBegin() override; - void componentComplete() override; - - QVariant model() const; - void setModel(QVariant model); - - QQmlComponent *delegate() const; - void setDelegate(QQmlComponent * delegate); - -public Q_SLOTS: - // The dynamic API that matches Map.add/remove MapItem - void addMapObject(QGeoMapObject *object); - void removeMapObject(QGeoMapObject *object); - -signals: - void modelChanged(QVariant model); - void delegateChanged(QQmlComponent * delegate); - -protected Q_SLOTS: - void destroyingItem(QObject *object); - void initItem(int index, QObject *object); - void createdItem(int index, QObject *object); - void modelUpdated(const QQmlChangeSet &changeSet, bool reset); - -protected: - void addMapObjectToMap(QGeoMapObject *object, int index); - void removeMapObjectFromMap(int index); - void flushDelegateModel(); - void flushUserAddedMapObjects(); - - QVariant m_model; - QQmlComponent *m_delegate = nullptr; - QQmlDelegateModel *m_delegateModel = nullptr; - QVector> m_instantiatedMapObjects; - QVector> m_pendingMapObjects; - QVector> m_userAddedMapObjects; // A third list containing the objects dynamically added through addMapObject -}; - -QT_END_NAMESPACE - -#endif // QMAPOBJECTVIEW_P_H diff --git a/src/locationlabs/qmapobjectview_p_p.h b/src/locationlabs/qmapobjectview_p_p.h deleted file mode 100644 index 5c0cdf82..00000000 --- a/src/locationlabs/qmapobjectview_p_p.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** 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 QMAPOBJECTVIEW_P_P_H -#define QMAPOBJECTVIEW_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 -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QQmlDelegateModel; -class QGeoMap; -class Q_LOCATIONLABS_PRIVATE_EXPORT QMapObjectViewPrivate : public QGeoMapObjectPrivate -{ -public: - QMapObjectViewPrivate(QGeoMapObject *q); - ~QMapObjectViewPrivate() override; - - virtual QGeoMapObject::Type type() const override final; -}; - -class Q_LOCATIONLABS_PRIVATE_EXPORT QMapObjectViewPrivateDefault : public QMapObjectViewPrivate -{ -public: - QMapObjectViewPrivateDefault(QGeoMapObject *q); - QMapObjectViewPrivateDefault(const QMapObjectViewPrivate &other); - ~QMapObjectViewPrivateDefault() override; - - - // QGeoMapObjectPrivate interface -public: - QGeoMapObjectPrivate *clone() override; -}; - -QT_END_NAMESPACE - -#endif // QMAPOBJECTVIEW_P_P_H diff --git a/src/locationlabs/qmappolygonobject.cpp b/src/locationlabs/qmappolygonobject.cpp deleted file mode 100644 index fd4c660a..00000000 --- a/src/locationlabs/qmappolygonobject.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/**************************************************************************** -** -** 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 - -QT_BEGIN_NAMESPACE - -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 QMapPolygonObjectPrivateDefault::path() const -{ - return m_path; -} - -void QMapPolygonObjectPrivateDefault::setPath(const QList &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(*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(other); - return (QGeoMapObjectPrivate::equals(o) - && path() == o.path() - && borderColor() == o.borderColor() - && fillColor() == o.fillColor() - && borderWidth() == o.borderWidth()); -} - - - - -QMapPolygonObject::QMapPolygonObject(QObject *parent) - : QGeoMapObject(QExplicitlySharedDataPointer(new QMapPolygonObjectPrivateDefault(this)), parent) -{ - QMapPolygonObjectPrivate *d = static_cast(d_ptr.data()); - d->setBorderColor(QColor(Qt::black)); // These are QDeclarativeMapLineProperties defaults - d->setBorderWidth(1.0); -} - -QMapPolygonObject::~QMapPolygonObject() -{} - -QVariantList QMapPolygonObject::path() const -{ - QVariantList p; - for (const QGeoCoordinate &c: static_cast(d_ptr.data())->path()) - p << QVariant::fromValue(c); - return p; -} - -void QMapPolygonObject::setPath(const QVariantList &path) -{ - QList p; - bool ok = false; - for (const auto &c: path) { - const QGeoCoordinate coord = parseCoordinate(c, &ok); - if (ok) - p << coord; - } - auto pimpl = static_cast(d_ptr.data()); - if (p != pimpl->path()) { - pimpl->setPath(p); - emit pathChanged(); - } -} - -QColor QMapPolygonObject::color() const -{ - return static_cast(d_ptr.data())->fillColor(); -} - -QDeclarativeMapLineProperties *QMapPolygonObject::border() -{ - if (!m_border) { - m_border = new QDeclarativeMapLineProperties; - connect(m_border, &QDeclarativeMapLineProperties::colorChanged, this, [this](const QColor &color){ - static_cast(d_ptr.data())->setBorderColor(color); - }); - connect(m_border, &QDeclarativeMapLineProperties::widthChanged, this, [this](qreal width){ - static_cast(d_ptr.data())->setBorderWidth(width); - }); - } - return m_border; -} - -void QMapPolygonObject::setColor(const QColor &fillColor) -{ - auto ptr = static_cast(d_ptr.data()); - - if (ptr->fillColor() == fillColor) - return; - - ptr->setFillColor(fillColor); - emit colorChanged(); -} - -void QMapPolygonObject::setMap(QGeoMap *map) -{ - QMapPolygonObjectPrivate *d = static_cast(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/locationlabs/qmappolygonobject_p.h b/src/locationlabs/qmappolygonobject_p.h deleted file mode 100644 index f9fcaad7..00000000 --- a/src/locationlabs/qmappolygonobject_p.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** 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 -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -class Q_LOCATIONLABS_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/locationlabs/qmappolygonobject_p_p.h b/src/locationlabs/qmappolygonobject_p_p.h deleted file mode 100644 index c2e1eb9c..00000000 --- a/src/locationlabs/qmappolygonobject_p_p.h +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** 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 -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class Q_LOCATIONLABS_PRIVATE_EXPORT QMapPolygonObjectPrivate : public QGeoMapObjectPrivate -{ -public: - QMapPolygonObjectPrivate(QGeoMapObject *q); - ~QMapPolygonObjectPrivate() override; - - virtual QGeoMapObject::Type type() const override final; - - virtual QList path() const = 0; - virtual void setPath(const QList &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_LOCATIONLABS_PRIVATE_EXPORT QMapPolygonObjectPrivateDefault : public QMapPolygonObjectPrivate -{ -public: - QMapPolygonObjectPrivateDefault(QGeoMapObject *q); - QMapPolygonObjectPrivateDefault(const QMapPolygonObjectPrivate &other); - ~QMapPolygonObjectPrivateDefault() override; - - // QMapPolygonObjectPrivate interface - QList path() const override; - void setPath(const QList &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 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/locationlabs/qmappolylineobject.cpp b/src/locationlabs/qmappolylineobject.cpp deleted file mode 100644 index 1e625c1f..00000000 --- a/src/locationlabs/qmappolylineobject.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** 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 - -QT_BEGIN_NAMESPACE - -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 QMapPolylineObjectPrivateDefault::path() const -{ - return m_path; -} - -void QMapPolylineObjectPrivateDefault::setPath(const QList &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(other); - return (QGeoMapObjectPrivate::equals(o) - && path() == o.path() - && color() == o.color() - && width() == o.width()); -} - -QGeoMapObjectPrivate *QMapPolylineObjectPrivateDefault::clone() -{ - return new QMapPolylineObjectPrivateDefault(static_cast(*this)); -} - -QMapPolylineObject::QMapPolylineObject(QObject *parent) - : QGeoMapObject(QExplicitlySharedDataPointer(new QMapPolylineObjectPrivateDefault(this)), parent) -{ - QMapPolylineObjectPrivate *d = static_cast(d_ptr.data()); - d->setColor(QColor(Qt::black)); // These are QDeclarativeMapLineProperties defaults - d->setWidth(1.0); -} - -QMapPolylineObject::~QMapPolylineObject() -{} - -QVariantList QMapPolylineObject::path() const -{ - QVariantList p; - for (const QGeoCoordinate &c: static_cast(d_ptr.data())->path()) - p << QVariant::fromValue(c); - return p; -} - -QDeclarativeMapLineProperties *QMapPolylineObject::border() -{ - if (!m_border) { - m_border = new QDeclarativeMapLineProperties; - connect(m_border, &QDeclarativeMapLineProperties::colorChanged, this, [this](const QColor &color){ - static_cast(d_ptr.data())->setColor(color); - }); - connect(m_border, &QDeclarativeMapLineProperties::widthChanged, this, [this](qreal width){ - static_cast(d_ptr.data())->setWidth(width); - }); - } - return m_border; -} - -void QMapPolylineObject::setPath(const QVariantList &path) -{ - QList p; - bool ok = false; - for (const auto &c: path) { - const QGeoCoordinate coord = parseCoordinate(c, &ok); - if (ok) - p << coord; - } - auto pimpl = static_cast(d_ptr.data()); - if (p != pimpl->path()) { - pimpl->setPath(p); - emit pathChanged(); - } -} - -void QMapPolylineObject::setMap(QGeoMap *map) -{ - QMapPolylineObjectPrivate *d = static_cast(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/locationlabs/qmappolylineobject_p.h b/src/locationlabs/qmappolylineobject_p.h deleted file mode 100644 index fe844a5c..00000000 --- a/src/locationlabs/qmappolylineobject_p.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** 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 -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -class Q_LOCATIONLABS_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/locationlabs/qmappolylineobject_p_p.h b/src/locationlabs/qmappolylineobject_p_p.h deleted file mode 100644 index 80eeb2cd..00000000 --- a/src/locationlabs/qmappolylineobject_p_p.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** 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 -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class Q_LOCATIONLABS_PRIVATE_EXPORT QMapPolylineObjectPrivate : public QGeoMapObjectPrivate -{ -public: - QMapPolylineObjectPrivate(QGeoMapObject *q); - ~QMapPolylineObjectPrivate() override; - - virtual QGeoMapObject::Type type() const override final; - - virtual QList path() const = 0; - virtual void setPath(const QList &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_LOCATIONLABS_PRIVATE_EXPORT QMapPolylineObjectPrivateDefault : public QMapPolylineObjectPrivate -{ -public: - QMapPolylineObjectPrivateDefault(QGeoMapObject *q); - QMapPolylineObjectPrivateDefault(const QMapPolylineObjectPrivate &other); - ~QMapPolylineObjectPrivateDefault() override; - - // QGeoMapPolylinePrivate interface - QList path() const override; - void setPath(const QList &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 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/locationlabs/qmaprouteobject.cpp deleted file mode 100644 index 724bdb73..00000000 --- a/src/locationlabs/qmaprouteobject.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************** -** -** 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 -#include "qmaprouteobject_p.h" -#include "qmaprouteobject_p_p.h" - -QT_BEGIN_NAMESPACE - -/* - - QGeoMapRoutePrivate - -*/ - -QMapRouteObjectPrivate::QMapRouteObjectPrivate(QGeoMapObject *q) : QGeoMapObjectPrivate(q) -{ - -} - -QMapRouteObjectPrivate::QMapRouteObjectPrivate(const QMapRouteObjectPrivate &other) : QGeoMapObjectPrivate(other) -{ - // QGeoMapRoutePrivate doesn't contain anything because QGeoRoute has already everything necessary. -} - -QMapRouteObjectPrivate::~QMapRouteObjectPrivate() -{ - -} - -QGeoMapObject::Type QMapRouteObjectPrivate::type() const -{ - return QGeoMapObject::RouteType; -} - -QDeclarativeGeoRoute *QMapRouteObjectPrivate::declarativeGeoRoute() const -{ - const QMapRouteObject *r = static_cast(q); - return r->m_route; -} - -QGeoRoute QMapRouteObjectPrivate::route() const -{ - const QDeclarativeGeoRoute *r = declarativeGeoRoute(); - if (r) - return r->route(); - return {}; -} - -void QMapRouteObjectPrivate::setRoute(const QDeclarativeGeoRoute *route) -{ - Q_UNUSED(route) -} - -bool QMapRouteObjectPrivate::equals(const QGeoMapObjectPrivate &other) const -{ - if (other.type() != type()) // This check might be unnecessary, depending on how equals gets used - return false; - - const QMapRouteObjectPrivate &o = static_cast(other); - return (QGeoMapObjectPrivate::equals(o) - && route() == o.route()); // Could also be done shallow, comparing declarativeGeoRoute() -} - -QGeoMapObjectPrivate *QMapRouteObjectPrivate::clone() -{ - return new QMapRouteObjectPrivate(*this); -} - - -/* - - QGeoMapRoute - -*/ - -QMapRouteObject::QMapRouteObject(QObject *parent) - : QGeoMapObject(QExplicitlySharedDataPointer(new QMapRouteObjectPrivate(this)), parent) -{ - -} - -QMapRouteObject::~QMapRouteObject() -{ - -} - -QDeclarativeGeoRoute *QMapRouteObject::route() const -{ - return m_route; -} - -QGeoRoute QMapRouteObject::geoRoute() const -{ - if (m_route) - return m_route->route(); - return {}; -} - -void QMapRouteObject::setRoute(QDeclarativeGeoRoute *route) -{ - if (route == m_route) - return; -// if ((!m_route && !route) || (m_route && route && m_route->route() == route->route())) -// return; - - m_route = route; - QMapRouteObjectPrivate *d = static_cast(d_ptr.data()); - d->setRoute(route); - emit routeChanged(route); -} - -void QMapRouteObject::setMap(QGeoMap *map) -{ - QMapRouteObjectPrivate *d = static_cast(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 QMapRouteObjectPrivate(*d); - // Old pimpl deleted implicitly by QExplicitlySharedDataPointer - } -} - -QT_END_NAMESPACE diff --git a/src/locationlabs/qmaprouteobject_p.h b/src/locationlabs/qmaprouteobject_p.h deleted file mode 100644 index 8fca325c..00000000 --- a/src/locationlabs/qmaprouteobject_p.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** 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 QDECLARATIVEMAPROUTEDELEGATE_P_H -#define QDECLARATIVEMAPROUTEDELEGATE_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 -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -class QDeclarativeGeoRoute; -class QGeoRoute; -class QMapRouteObjectPrivate; -class Q_LOCATIONLABS_PRIVATE_EXPORT QMapRouteObject : public QGeoMapObject -{ - Q_OBJECT - Q_PROPERTY(QDeclarativeGeoRoute *route READ route WRITE setRoute NOTIFY routeChanged) - -public: - explicit QMapRouteObject(QObject *parent = nullptr); - ~QMapRouteObject() override; - - QDeclarativeGeoRoute *route() const; - QGeoRoute geoRoute() const; - - void setMap(QGeoMap *map) override; - void setRoute(QDeclarativeGeoRoute * route); - -signals: - void routeChanged(QDeclarativeGeoRoute * route); - -protected: - QDeclarativeGeoRoute *m_route = nullptr; - - friend class QMapRouteObjectPrivate; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QMapRouteObject) - -#endif // QDECLARATIVEMAPROUTEDELEGATE_P_H diff --git a/src/locationlabs/qmaprouteobject_p_p.h b/src/locationlabs/qmaprouteobject_p_p.h deleted file mode 100644 index 8dbfc6b4..00000000 --- a/src/locationlabs/qmaprouteobject_p_p.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** 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 QGEOMAPROUTE_P_P_H -#define QGEOMAPROUTE_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 -#include -#include -QT_BEGIN_NAMESPACE - -class QGeoRoute; - -class Q_LOCATIONLABS_PRIVATE_EXPORT QMapRouteObjectPrivate : public QGeoMapObjectPrivate -{ -public: - QMapRouteObjectPrivate(QGeoMapObject *q); - QMapRouteObjectPrivate(const QMapRouteObjectPrivate &other); - ~QMapRouteObjectPrivate() override; - - virtual QGeoMapObject::Type type() const override final; - - QDeclarativeGeoRoute *declarativeGeoRoute() const; - - virtual QGeoRoute route() const; - virtual void setRoute(const QDeclarativeGeoRoute *route); - - // QGeoMapObjectPrivate interface - bool equals(const QGeoMapObjectPrivate &other) const override; - QGeoMapObjectPrivate *clone() override; -}; - -QT_END_NAMESPACE - -#endif // QGEOMAPROUTE_P_P_H 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 ); -- cgit v1.2.1