diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-02-17 16:22:51 +0100 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-03-08 10:00:45 +0000 |
commit | 34c474703f6761a2dafecb219da51c66ebd4709a (patch) | |
tree | 66fa4786736a62ded4ed1d91afd040340fab63e7 /src/plugins/geoservices/itemsoverlay | |
parent | 0be06411a8a8ce8748faa93b5fa767a58f53cb9e (diff) | |
download | qtlocation-34c474703f6761a2dafecb219da51c66ebd4709a.tar.gz |
Add itemsoverlay plugin
This change adds a new plugin that does only offer an empty transparent
map.
The intended usage is to add overlay layers into which to place only map
items.
Change-Id: I51e64b0354f533bf73480e800e0d5338920a7fc5
Reviewed-by: Thiago Marcos P. Santos <tmpsantos@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/plugins/geoservices/itemsoverlay')
8 files changed, 482 insertions, 0 deletions
diff --git a/src/plugins/geoservices/itemsoverlay/itemsoverlay.pro b/src/plugins/geoservices/itemsoverlay/itemsoverlay.pro new file mode 100644 index 00000000..2a09a994 --- /dev/null +++ b/src/plugins/geoservices/itemsoverlay/itemsoverlay.pro @@ -0,0 +1,20 @@ +TARGET = qtgeoservices_itemsoverlay + +QT += location-private positioning-private + +HEADERS += \ + qgeomapitemsoverlay.h \ + qgeomappingmanagerengineitemsoverlay.h \ + qgeoserviceproviderpluginitemsoverlay.h + +SOURCES += \ + qgeoserviceproviderpluginitemsoverlay.cpp \ + qgeomappingmanagerengineitemsoverlay.cpp \ + qgeomapitemsoverlay.cpp + +PLUGIN_TYPE = geoservices +PLUGIN_CLASS_NAME = QGeoServiceProviderFactoryItemsOverlay +load(qt_plugin) + +DISTFILES += \ + itemsoverlay_plugin.json diff --git a/src/plugins/geoservices/itemsoverlay/itemsoverlay_plugin.json b/src/plugins/geoservices/itemsoverlay/itemsoverlay_plugin.json new file mode 100644 index 00000000..8b79082e --- /dev/null +++ b/src/plugins/geoservices/itemsoverlay/itemsoverlay_plugin.json @@ -0,0 +1,9 @@ +{ + "Keys": ["itemsoverlay"], + "Provider": "itemsoverlay", + "Version": 100, + "Experimental": false, + "Features": [ + "OfflineMappingFeature" + ] +} diff --git a/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp new file mode 100644 index 00000000..fecae107 --- /dev/null +++ b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "qgeomapitemsoverlay.h" +#include "qgeomappingmanagerengineitemsoverlay.h" +#include <QtLocation/private/qgeomap_p_p.h> +#include <QtQuick/qsgnode.h> + +QT_BEGIN_NAMESPACE + +class QGeoMapItemsOverlayPrivate : public QGeoMapPrivate +{ + Q_DECLARE_PUBLIC(QGeoMap) +public: + QGeoMapItemsOverlayPrivate(QGeoMappingManagerEngineItemsOverlay *engine); + + virtual ~QGeoMapItemsOverlayPrivate(); + +protected: + void changeViewportSize(const QSize &size) Q_DECL_OVERRIDE; + void changeCameraData(const QGeoCameraData &oldCameraData) Q_DECL_OVERRIDE; + void changeActiveMapType(const QGeoMapType mapType) Q_DECL_OVERRIDE; +}; + +QGeoMapItemsOverlay::QGeoMapItemsOverlay(QGeoMappingManagerEngineItemsOverlay *engine, QObject *parent) + : QGeoMap(*(new QGeoMapItemsOverlayPrivate(engine)), parent) +{ + +} + +QGeoMapItemsOverlay::~QGeoMapItemsOverlay() +{ +} + +QSGNode *QGeoMapItemsOverlay::updateSceneGraph(QSGNode *node, QQuickWindow *window) +{ + Q_UNUSED(window) + return node; +} + +QGeoMapItemsOverlayPrivate::QGeoMapItemsOverlayPrivate(QGeoMappingManagerEngineItemsOverlay *engine) + : QGeoMapPrivate(engine, new QGeoProjectionWebMercator) +{ +} + +QGeoMapItemsOverlayPrivate::~QGeoMapItemsOverlayPrivate() +{ +} + +void QGeoMapItemsOverlayPrivate::changeViewportSize(const QSize &size) +{ + Q_UNUSED(size) +} + +void QGeoMapItemsOverlayPrivate::changeCameraData(const QGeoCameraData &oldCameraData) +{ + Q_UNUSED(oldCameraData) +} + +void QGeoMapItemsOverlayPrivate::changeActiveMapType(const QGeoMapType mapType) +{ + Q_UNUSED(mapType) +} + +QT_END_NAMESPACE + + + + diff --git a/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h new file mode 100644 index 00000000..bd53a693 --- /dev/null +++ b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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 QGEOMAPITEMSOVERLAY_H +#define QGEOMAPITEMSOVERLAY_H + +#include <QtLocation/private/qgeomap_p.h> +#include <QtLocation/private/qgeoprojection_p.h> + +QT_BEGIN_NAMESPACE + +class QGeoMappingManagerEngineItemsOverlay; +class QGeoMapItemsOverlayPrivate; +class QGeoMapItemsOverlay: public QGeoMap +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QGeoMapItemsOverlay) +public: + QGeoMapItemsOverlay(QGeoMappingManagerEngineItemsOverlay *engine, QObject *parent); + + virtual ~QGeoMapItemsOverlay(); +protected: + QSGNode *updateSceneGraph(QSGNode *node, QQuickWindow *window) Q_DECL_OVERRIDE; + +private: + Q_DISABLE_COPY(QGeoMapItemsOverlay) +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/geoservices/itemsoverlay/qgeomappingmanagerengineitemsoverlay.cpp b/src/plugins/geoservices/itemsoverlay/qgeomappingmanagerengineitemsoverlay.cpp new file mode 100644 index 00000000..bbb30164 --- /dev/null +++ b/src/plugins/geoservices/itemsoverlay/qgeomappingmanagerengineitemsoverlay.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "qgeomappingmanagerengineitemsoverlay.h" + +#include <QtLocation/private/qgeocameracapabilities_p.h> +#include <QtLocation/private/qgeomaptype_p.h> +#include "qgeomapitemsoverlay.h" + +QT_BEGIN_NAMESPACE + + + +QGeoMappingManagerEngineItemsOverlay::QGeoMappingManagerEngineItemsOverlay(const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) +: QGeoMappingManagerEngine() +{ + Q_UNUSED(parameters) + Q_UNUSED(error) + Q_UNUSED(errorString) + QGeoCameraCapabilities cameraCaps; + cameraCaps.setMinimumZoomLevel(0.0); + cameraCaps.setMaximumZoomLevel(30.0); + cameraCaps.setSupportsBearing(true); + cameraCaps.setSupportsTilting(true); + cameraCaps.setMinimumTilt(0); + cameraCaps.setMaximumTilt(89); + cameraCaps.setMinimumFieldOfView(1.0); + cameraCaps.setMaximumFieldOfView(179.0); + setCameraCapabilities(cameraCaps); + + QList<QGeoMapType> mapTypes; + mapTypes << QGeoMapType(QGeoMapType::NoMap, tr("Empty Map"), tr("Empty Map"), false, false, 1); + setSupportedMapTypes(mapTypes); + + engineInitialized(); +} + +QGeoMappingManagerEngineItemsOverlay::~QGeoMappingManagerEngineItemsOverlay() +{ +} + +QGeoMap *QGeoMappingManagerEngineItemsOverlay::createMap() +{ + return new QGeoMapItemsOverlay(this, this); +} + +QT_END_NAMESPACE diff --git a/src/plugins/geoservices/itemsoverlay/qgeomappingmanagerengineitemsoverlay.h b/src/plugins/geoservices/itemsoverlay/qgeomappingmanagerengineitemsoverlay.h new file mode 100644 index 00000000..892bf59c --- /dev/null +++ b/src/plugins/geoservices/itemsoverlay/qgeomappingmanagerengineitemsoverlay.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Canonical 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 QGEOMAPPINGMANAGERENGINEITEMSOVERLAY_H +#define QGEOMAPPINGMANAGERENGINEITEMSOVERLAY_H + +#include <QtLocation/QGeoServiceProvider> +#include <QtLocation/private/qgeomappingmanagerengine_p.h> + +QT_BEGIN_NAMESPACE + +class QGeoMappingManagerEngineItemsOverlay : public QGeoMappingManagerEngine +{ + Q_OBJECT + +public: + QGeoMappingManagerEngineItemsOverlay(const QVariantMap ¶meters, + QGeoServiceProvider::Error *error, QString *errorString); + ~QGeoMappingManagerEngineItemsOverlay(); + + QGeoMap *createMap() Q_DECL_OVERRIDE; +}; + +QT_END_NAMESPACE + +#endif // QGEOMAPPINGMANAGERENGINENOMAP_H diff --git a/src/plugins/geoservices/itemsoverlay/qgeoserviceproviderpluginitemsoverlay.cpp b/src/plugins/geoservices/itemsoverlay/qgeoserviceproviderpluginitemsoverlay.cpp new file mode 100644 index 00000000..b83a5eb1 --- /dev/null +++ b/src/plugins/geoservices/itemsoverlay/qgeoserviceproviderpluginitemsoverlay.cpp @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "qgeoserviceproviderpluginitemsoverlay.h" +#include "qgeomappingmanagerengineitemsoverlay.h" + +QT_BEGIN_NAMESPACE + +QGeoCodingManagerEngine *QGeoServiceProviderFactoryItemsOverlay::createGeocodingManagerEngine( + const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const +{ + Q_UNUSED(parameters) + Q_UNUSED(error) + Q_UNUSED(errorString) + + return 0; +} + +QGeoMappingManagerEngine *QGeoServiceProviderFactoryItemsOverlay::createMappingManagerEngine( + const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const +{ + return new QGeoMappingManagerEngineItemsOverlay(parameters, error, errorString); +} + +QGeoRoutingManagerEngine *QGeoServiceProviderFactoryItemsOverlay::createRoutingManagerEngine( + const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const +{ + Q_UNUSED(parameters) + Q_UNUSED(error) + Q_UNUSED(errorString) + + return 0; +} + +QPlaceManagerEngine *QGeoServiceProviderFactoryItemsOverlay::createPlaceManagerEngine( + const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const +{ + Q_UNUSED(parameters) + Q_UNUSED(error) + Q_UNUSED(errorString) + + return 0; +} + +QT_END_NAMESPACE diff --git a/src/plugins/geoservices/itemsoverlay/qgeoserviceproviderpluginitemsoverlay.h b/src/plugins/geoservices/itemsoverlay/qgeoserviceproviderpluginitemsoverlay.h new file mode 100644 index 00000000..8ed1da8f --- /dev/null +++ b/src/plugins/geoservices/itemsoverlay/qgeoserviceproviderpluginitemsoverlay.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** 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 QGEOSERVICEPROVIDER_ITEMSOVERLAY_H +#define QGEOSERVICEPROVIDER_ITEMSOVERLAY_H + +#include <QtCore/QObject> +#include <QtLocation/QGeoServiceProviderFactory> + +QT_BEGIN_NAMESPACE + +class QGeoServiceProviderFactoryItemsOverlay: public QObject, public QGeoServiceProviderFactory +{ + Q_OBJECT + Q_INTERFACES(QGeoServiceProviderFactory) + Q_PLUGIN_METADATA(IID "org.qt-project.qt.geoservice.serviceproviderfactory/5.0" + FILE "itemsoverlay_plugin.json") + +public: + QGeoCodingManagerEngine *createGeocodingManagerEngine(const QVariantMap ¶meters, + QGeoServiceProvider::Error *error, + QString *errorString) const; + QGeoMappingManagerEngine *createMappingManagerEngine(const QVariantMap ¶meters, + QGeoServiceProvider::Error *error, + QString *errorString) const; + QGeoRoutingManagerEngine *createRoutingManagerEngine(const QVariantMap ¶meters, + QGeoServiceProvider::Error *error, + QString *errorString) const; + QPlaceManagerEngine *createPlaceManagerEngine(const QVariantMap ¶meters, + QGeoServiceProvider::Error *error, + QString *errorString) const; +}; + +QT_END_NAMESPACE + +#endif |