diff options
Diffstat (limited to 'src/location')
-rw-r--r-- | src/location/maps/maps.pri | 4 | ||||
-rw-r--r-- | src/location/maps/qgeocodereply.cpp | 1 | ||||
-rw-r--r-- | src/location/maps/qgeocodereply.h | 1 | ||||
-rw-r--r-- | src/location/maps/qgeomap.cpp | 36 | ||||
-rw-r--r-- | src/location/maps/qgeomap_p.h | 6 | ||||
-rw-r--r-- | src/location/maps/qgeomap_p_p.h | 7 | ||||
-rw-r--r-- | src/location/maps/qgeomapparameter.cpp | 74 | ||||
-rw-r--r-- | src/location/maps/qgeomapparameter_p.h | 84 | ||||
-rw-r--r-- | src/location/maps/qgeoroutereply.cpp | 3 | ||||
-rw-r--r-- | src/location/maps/qgeoroutereply.h | 1 | ||||
-rw-r--r-- | src/location/maps/qgeotiledmap.cpp | 11 | ||||
-rw-r--r-- | src/location/maps/qgeotiledmap_p.h | 12 | ||||
-rw-r--r-- | src/location/maps/qgeotiledmap_p_p.h | 13 | ||||
-rw-r--r-- | src/location/maps/qgeotiledmapreply.cpp | 1 | ||||
-rw-r--r-- | src/location/maps/qgeotiledmapreply_p.h | 1 | ||||
-rw-r--r-- | src/location/places/qplacereply.cpp | 1 | ||||
-rw-r--r-- | src/location/places/qplacereply.h | 1 |
17 files changed, 240 insertions, 17 deletions
diff --git a/src/location/maps/maps.pri b/src/location/maps/maps.pri index 1ea54208..3f76f737 100644 --- a/src/location/maps/maps.pri +++ b/src/location/maps/maps.pri @@ -18,6 +18,7 @@ PUBLIC_HEADERS += \ maps/qgeoserviceprovider.h PRIVATE_HEADERS += \ + maps/qgeomapparameter_p.h \ maps/qgeocameracapabilities_p.h \ maps/qgeocameradata_p.h \ maps/qgeocameratiles_p.h \ @@ -91,4 +92,5 @@ SOURCES += \ maps/qgeotiledmapscene.cpp \ maps/qgeorouteparser.cpp \ maps/qgeorouteparserosrmv5.cpp \ - maps/qgeorouteparserosrmv4.cpp + maps/qgeorouteparserosrmv4.cpp \ + maps/qgeomapparameter.cpp diff --git a/src/location/maps/qgeocodereply.cpp b/src/location/maps/qgeocodereply.cpp index 47018217..d5112a69 100644 --- a/src/location/maps/qgeocodereply.cpp +++ b/src/location/maps/qgeocodereply.cpp @@ -233,6 +233,7 @@ void QGeoCodeReply::abort() { if (!isFinished()) setFinished(true); + emit aborted(); } /*! diff --git a/src/location/maps/qgeocodereply.h b/src/location/maps/qgeocodereply.h index 048493b4..c92bc606 100644 --- a/src/location/maps/qgeocodereply.h +++ b/src/location/maps/qgeocodereply.h @@ -80,6 +80,7 @@ public: Q_SIGNALS: void finished(); + void aborted(); void error(QGeoCodeReply::Error error, const QString &errorString = QString()); protected: diff --git a/src/location/maps/qgeomap.cpp b/src/location/maps/qgeomap.cpp index 0e0a2007..ac6d661b 100644 --- a/src/location/maps/qgeomap.cpp +++ b/src/location/maps/qgeomap.cpp @@ -130,6 +130,32 @@ void QGeoMap::clearData() } +void QGeoMap::addParameter(QGeoMapParameter *param) +{ + Q_D(QGeoMap); + if (param && !d->m_mapParameters.contains(param)) { + d->m_mapParameters.insert(param); + d->addParameter(param); + } +} + +void QGeoMap::removeParameter(QGeoMapParameter *param) +{ + Q_D(QGeoMap); + if (param && d->m_mapParameters.contains(param)) { + d->removeParameter(param); + d->m_mapParameters.remove(param); + } +} + +void QGeoMap::clearParameters() +{ + Q_D(QGeoMap); + for (QGeoMapParameter *p : d->m_mapParameters) + d->removeParameter(p); + d->m_mapParameters.clear(); +} + QGeoMapPrivate::QGeoMapPrivate(QGeoMappingManagerEngine *engine) : QObjectPrivate(), m_engine(engine), @@ -141,4 +167,14 @@ QGeoMapPrivate::~QGeoMapPrivate() { } +void QGeoMapPrivate::addParameter(QGeoMapParameter *param) +{ + Q_UNUSED(param) +} + +void QGeoMapPrivate::removeParameter(QGeoMapParameter *param) +{ + Q_UNUSED(param) +} + QT_END_NAMESPACE diff --git a/src/location/maps/qgeomap_p.h b/src/location/maps/qgeomap_p.h index ea4806c0..7a12820f 100644 --- a/src/location/maps/qgeomap_p.h +++ b/src/location/maps/qgeomap_p.h @@ -61,6 +61,7 @@ class QGeoCameraCapabilities; class QGeoCoordinate; class QSGNode; class QQuickWindow; +class QGeoMapParameter; class Q_LOCATION_EXPORT QGeoMap : public QObject { @@ -94,6 +95,10 @@ public: virtual void prefetchData(); virtual void clearData(); + void addParameter(QGeoMapParameter *param); + void removeParameter(QGeoMapParameter *param); + void clearParameters(); + protected: QGeoMap(QGeoMapPrivate &dd, QObject *parent = 0); void setCameraData(const QGeoCameraData &cameraData); @@ -108,7 +113,6 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QGeoMap) - friend class QGeoMapController; //setCameraData friend class QDeclarativeGeoMap; //updateSceneGraph }; diff --git a/src/location/maps/qgeomap_p_p.h b/src/location/maps/qgeomap_p_p.h index b95c1dc7..91938903 100644 --- a/src/location/maps/qgeomap_p_p.h +++ b/src/location/maps/qgeomap_p_p.h @@ -52,6 +52,7 @@ #include <QtLocation/private/qgeomaptype_p.h> #include <QtCore/private/qobject_p.h> #include <QtCore/QSize> +#include <QtCore/QSet> QT_BEGIN_NAMESPACE @@ -59,6 +60,7 @@ QT_BEGIN_NAMESPACE class QGeoMappingManagerEngine; class QGeoMap; class QGeoMapController; +class QGeoMapParameter; class Q_LOCATION_PRIVATE_EXPORT QGeoMapPrivate : public QObjectPrivate { @@ -69,6 +71,9 @@ public: protected: /* Hooks into the actual map implementations */ + virtual void addParameter(QGeoMapParameter *param); + virtual void removeParameter(QGeoMapParameter *param); + virtual void changeViewportSize(const QSize &size) = 0; // called by QGeoMap::setSize() virtual void changeCameraData(const QGeoCameraData &oldCameraData) = 0; // called by QGeoMap::setCameraData() virtual void changeActiveMapType(const QGeoMapType mapType) = 0; // called by QGeoMap::setActiveMapType() @@ -76,9 +81,9 @@ protected: protected: QSize m_viewportSize; QPointer<QGeoMappingManagerEngine> m_engine; - QGeoMapController *m_controller; QGeoCameraData m_cameraData; QGeoMapType m_activeMapType; + QSet<QGeoMapParameter *> m_mapParameters; }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeomapparameter.cpp b/src/location/maps/qgeomapparameter.cpp new file mode 100644 index 00000000..b8f9561f --- /dev/null +++ b/src/location/maps/qgeomapparameter.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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 "qgeomapparameter_p.h" +#include <QtCore/QVariant> + +QT_BEGIN_NAMESPACE + +QGeoMapParameter::QGeoMapParameter(QObject *parent) : QObject(parent) +{ + +} + +QGeoMapParameter::~QGeoMapParameter() +{ +} + +QString QGeoMapParameter::type() const +{ + return m_type; +} + +void QGeoMapParameter::setType(const QString &type) +{ + if (m_type.isEmpty()) + m_type = type; +} + +// DO NOT USE to set "type" +void QGeoMapParameter::updateProperty(const char *propertyName, QVariant value) +{ + setProperty(propertyName, value); + // This should technically be emitted only for dynamically added properties. + // Since this object has only type defined as Q_PROPERTY() which is a set-once + // no check is really needed here. + emit propertyUpdated(this, propertyName); +} + +QT_END_NAMESPACE + diff --git a/src/location/maps/qgeomapparameter_p.h b/src/location/maps/qgeomapparameter_p.h new file mode 100644 index 00000000..c3bef4d8 --- /dev/null +++ b/src/location/maps/qgeomapparameter_p.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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 QGEOMAPPARAMETER_P_H +#define QGEOMAPPARAMETER_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 <QObject> +#include <QString> +#include <QtLocation/qlocationglobal.h> + +QT_BEGIN_NAMESPACE + +class Q_LOCATION_EXPORT QGeoMapParameter : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QString type READ type WRITE setType) +public: + explicit QGeoMapParameter(QObject *parent = 0); + virtual ~QGeoMapParameter(); + + QString type() const; + void setType(const QString &type); + + void updateProperty(const char *propertyName, QVariant value); + +Q_SIGNALS: + void propertyUpdated(QGeoMapParameter *param, const char *propertyName); + +protected: + QString m_type; + + Q_DISABLE_COPY(QGeoMapParameter) + friend class QGeoMap; +}; + +QT_END_NAMESPACE + +#endif // QGEOMAPPARAMETER_P_H diff --git a/src/location/maps/qgeoroutereply.cpp b/src/location/maps/qgeoroutereply.cpp index ab869d3c..b1c98349 100644 --- a/src/location/maps/qgeoroutereply.cpp +++ b/src/location/maps/qgeoroutereply.cpp @@ -218,8 +218,7 @@ void QGeoRouteReply::addRoutes(const QList<QGeoRoute> &routes) */ void QGeoRouteReply::abort() { - if (!isFinished()) - setFinished(true); + emit aborted(); } /*! diff --git a/src/location/maps/qgeoroutereply.h b/src/location/maps/qgeoroutereply.h index 318d85f8..c1d6e8d1 100644 --- a/src/location/maps/qgeoroutereply.h +++ b/src/location/maps/qgeoroutereply.h @@ -74,6 +74,7 @@ public: Q_SIGNALS: void finished(); + void aborted(); void error(QGeoRouteReply::Error error, const QString &errorString = QString()); protected: diff --git a/src/location/maps/qgeotiledmap.cpp b/src/location/maps/qgeotiledmap.cpp index 04f9ad21..a3cad550 100644 --- a/src/location/maps/qgeotiledmap.cpp +++ b/src/location/maps/qgeotiledmap.cpp @@ -60,6 +60,17 @@ QGeoTiledMap::QGeoTiledMap(QGeoTiledMappingManagerEngine *engine, QObject *paren this,&QGeoTiledMap::handleTileVersionChanged); } +QGeoTiledMap::QGeoTiledMap(QGeoTiledMapPrivate &dd, QGeoTiledMappingManagerEngine *engine, QObject *parent) + : QGeoMap(dd, parent) +{ + Q_D(QGeoTiledMap); + + d->m_tileRequests = new QGeoTileRequestManager(this, engine); + + QObject::connect(engine,&QGeoTiledMappingManagerEngine::tileVersionChanged, + this,&QGeoTiledMap::handleTileVersionChanged); +} + QGeoTiledMap::~QGeoTiledMap() { Q_D(QGeoTiledMap); diff --git a/src/location/maps/qgeotiledmap_p.h b/src/location/maps/qgeotiledmap_p.h index d00a1ed9..b148b59c 100644 --- a/src/location/maps/qgeotiledmap_p.h +++ b/src/location/maps/qgeotiledmap_p.h @@ -49,10 +49,10 @@ #include <QObject> #include <QString> - -#include "qgeomap_p.h" -#include "qgeocameradata_p.h" -#include "qgeomaptype_p.h" +#include <QtLocation/private/qlocationglobal_p.h> +#include <QtLocation/private/qgeomap_p.h> +#include <QtLocation/private/qgeocameradata_p.h> +#include <QtLocation/private/qgeomaptype_p.h> #include <QtPositioning/private/qdoublevector2d_p.h> @@ -70,7 +70,7 @@ class QSGNode; class QPointF; -class Q_LOCATION_EXPORT QGeoTiledMap : public QGeoMap +class Q_LOCATION_PRIVATE_EXPORT QGeoTiledMap : public QGeoMap { Q_OBJECT Q_DECLARE_PRIVATE(QGeoTiledMap) @@ -103,6 +103,8 @@ protected: QSGNode *updateSceneGraph(QSGNode *, QQuickWindow *window) Q_DECL_OVERRIDE; virtual void evaluateCopyrights(const QSet<QGeoTileSpec> &visibleTiles); + QGeoTiledMap(QGeoTiledMapPrivate &dd, QGeoTiledMappingManagerEngine *engine, QObject *parent); + private Q_SLOTS: void handleTileVersionChanged(); diff --git a/src/location/maps/qgeotiledmap_p_p.h b/src/location/maps/qgeotiledmap_p_p.h index 01646d66..72873d77 100644 --- a/src/location/maps/qgeotiledmap_p_p.h +++ b/src/location/maps/qgeotiledmap_p_p.h @@ -47,9 +47,10 @@ // We mean it. // -#include "qgeomap_p_p.h" -#include "qgeocameradata_p.h" -#include "qgeomaptype_p.h" +#include <QtLocation/private/qlocationglobal_p.h> +#include <QtLocation/private/qgeomap_p_p.h> +#include <QtLocation/private/qgeocameradata_p.h> +#include <QtLocation/private/qgeomaptype_p.h> #include <QtPositioning/private/qdoublevector3d_p.h> #include <QtPositioning/private/qdoublevector2d_p.h> #include <QtCore/QPointer> @@ -66,7 +67,7 @@ class QGeoTileSpec; class QSGNode; class QQuickWindow; -class QGeoTiledMapPrivate : public QGeoMapPrivate +class Q_LOCATION_PRIVATE_EXPORT QGeoTiledMapPrivate : public QGeoMapPrivate { Q_DECLARE_PUBLIC(QGeoTiledMap) public: @@ -89,10 +90,9 @@ protected: void changeTileVersion(int version); void clearScene(); -private: void updateScene(); -private: +protected: QAbstractGeoTileCache *m_cache; QGeoCameraTiles *m_visibleTiles; QGeoCameraTiles *m_prefetchTiles; @@ -101,7 +101,6 @@ private: int m_maxZoomLevel; int m_minZoomLevel; QGeoTiledMap::PrefetchStyle m_prefetchStyle; - bool m_geomoteryUpdated; Q_DISABLE_COPY(QGeoTiledMapPrivate) }; diff --git a/src/location/maps/qgeotiledmapreply.cpp b/src/location/maps/qgeotiledmapreply.cpp index f2dfd9eb..34ca041f 100644 --- a/src/location/maps/qgeotiledmapreply.cpp +++ b/src/location/maps/qgeotiledmapreply.cpp @@ -242,6 +242,7 @@ void QGeoTiledMapReply::abort() { if (!isFinished()) setFinished(true); + emit aborted(); } /* diff --git a/src/location/maps/qgeotiledmapreply_p.h b/src/location/maps/qgeotiledmapreply_p.h index 91852cc3..fc991bb7 100644 --- a/src/location/maps/qgeotiledmapreply_p.h +++ b/src/location/maps/qgeotiledmapreply_p.h @@ -88,6 +88,7 @@ public: Q_SIGNALS: void finished(); + void aborted(); void error(QGeoTiledMapReply::Error error, const QString &errorString = QString()); protected: diff --git a/src/location/places/qplacereply.cpp b/src/location/places/qplacereply.cpp index 0590871d..582987b4 100644 --- a/src/location/places/qplacereply.cpp +++ b/src/location/places/qplacereply.cpp @@ -199,6 +199,7 @@ QPlaceReply::Error QPlaceReply::error() const */ void QPlaceReply::abort() { + emit aborted(); } /*! diff --git a/src/location/places/qplacereply.h b/src/location/places/qplacereply.h index 374c68b3..3eb3d6cc 100644 --- a/src/location/places/qplacereply.h +++ b/src/location/places/qplacereply.h @@ -86,6 +86,7 @@ public Q_SLOTS: Q_SIGNALS: void finished(); + void aborted(); void error(QPlaceReply::Error error, const QString &errorString = QString()); protected: |