summaryrefslogtreecommitdiff
path: root/src/location/maps
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@theqtcompany.com>2015-04-10 18:59:31 +0200
committerMichal Klocek <michal.klocek@theqtcompany.com>2015-05-04 08:41:37 +0000
commit986110e3a41b0e90ab55fa7d17ef12599c824b56 (patch)
tree32f2c8061621aeb00c5a00fca2f376039411276a /src/location/maps
parentca1e96183643f59f95b6b9391d9d4c15bdac4a64 (diff)
downloadqtlocation-986110e3a41b0e90ab55fa7d17ef12599c824b56.tar.gz
Remove QGeoMapData class.
Since QGeoMap class does not have any subclasses, there is no need for keeping the bridge in form of QGeoMapData. This commit basically renames QGeoMapData to be QGeoMap. Change-Id: I6eb2f56f7ea83663034f4a8297e8e8f7f185d6a9 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/location/maps')
-rw-r--r--src/location/maps/maps.pri4
-rw-r--r--src/location/maps/qgeomap.cpp202
-rw-r--r--src/location/maps/qgeomap_p.h34
-rw-r--r--src/location/maps/qgeomap_p_p.h (renamed from src/location/maps/qgeomapdata_p_p.h)14
-rw-r--r--src/location/maps/qgeomapcontroller.cpp4
-rw-r--r--src/location/maps/qgeomapcontroller_p.h6
-rw-r--r--src/location/maps/qgeomapdata.cpp256
-rw-r--r--src/location/maps/qgeomapdata_p.h116
-rw-r--r--src/location/maps/qgeomappingmanager.cpp4
-rw-r--r--src/location/maps/qgeomappingmanagerengine_p.h4
-rw-r--r--src/location/maps/qgeotiledmapdata.cpp2
-rw-r--r--src/location/maps/qgeotiledmapdata_p.h4
12 files changed, 201 insertions, 449 deletions
diff --git a/src/location/maps/maps.pri b/src/location/maps/maps.pri
index 4ad7f0d6..8bacc68c 100644
--- a/src/location/maps/maps.pri
+++ b/src/location/maps/maps.pri
@@ -29,8 +29,7 @@ PRIVATE_HEADERS += \
maps/qgeomapscene_p.h \
maps/qgeotilerequestmanager_p.h \
maps/qgeomap_p.h \
- maps/qgeomapdata_p.h \
- maps/qgeomapdata_p_p.h \
+ maps/qgeomap_p_p.h \
maps/qgeotiledmapdata_p.h \
maps/qgeotiledmapdata_p_p.h \
maps/qgeotilefetcher_p.h \
@@ -69,7 +68,6 @@ SOURCES += \
maps/qgeomapscene.cpp \
maps/qgeotilerequestmanager.cpp \
maps/qgeomap.cpp \
- maps/qgeomapdata.cpp \
maps/qgeotiledmapdata.cpp \
maps/qgeomappingmanager.cpp \
maps/qgeomappingmanagerengine.cpp \
diff --git a/src/location/maps/qgeomap.cpp b/src/location/maps/qgeomap.cpp
index 48f20487..0fe8268c 100644
--- a/src/location/maps/qgeomap.cpp
+++ b/src/location/maps/qgeomap.cpp
@@ -35,102 +35,222 @@
****************************************************************************/
#include "qgeomap_p.h"
-#include "qgeomapdata_p.h"
+#include "qgeomap_p_p.h"
#include "qgeocameracapabilities_p.h"
+#include "qgeomapcontroller_p.h"
+#include "qgeomappingmanagerengine_p.h"
QT_BEGIN_NAMESPACE
-QGeoMap::QGeoMap(QGeoMapData *mapData, QObject *parent)
+QGeoMap::QGeoMap(QGeoMappingManagerEngine *engine, QObject *parent)
: QObject(parent),
- m_mapData(mapData)
-{
- connect(m_mapData, SIGNAL(cameraDataChanged(QGeoCameraData)), this, SIGNAL(cameraDataChanged(QGeoCameraData)));
- connect(m_mapData, SIGNAL(updateRequired()), this, SIGNAL(updateRequired()));
- connect(m_mapData, SIGNAL(activeMapTypeChanged()), this, SIGNAL(activeMapTypeChanged()));
- connect(m_mapData, SIGNAL(copyrightsChanged(QImage)), this, SIGNAL(copyrightsChanged(QImage)));
- connect(m_mapData, SIGNAL(copyrightsChanged(QString)), this, SIGNAL(copyrightsChanged(QString)));
-}
+ d_ptr(new QGeoMapPrivate(engine, this)) {}
QGeoMap::~QGeoMap()
{
- delete m_mapData;
+ delete d_ptr;
}
QGeoMapController *QGeoMap::mapController()
{
- return m_mapData->mapController();
-}
-
-QSGNode *QGeoMap::updateSceneGraph(QSGNode *oldNode, QQuickWindow *window)
-{
- return m_mapData->updateSceneGraph(oldNode, window);
+ Q_D(QGeoMap);
+ return d->mapController();
}
void QGeoMap::resize(int width, int height)
{
- m_mapData->resize(width, height);
+ Q_D(QGeoMap);
+ d->resize(width, height);
+
+ // always emit this signal to trigger items to redraw
+ emit cameraDataChanged(d->cameraData());
}
int QGeoMap::width() const
{
- return m_mapData->width();
+ Q_D(const QGeoMap);
+ return d->width();
}
int QGeoMap::height() const
{
- return m_mapData->height();
+ Q_D(const QGeoMap);
+ return d->height();
}
-QGeoCameraCapabilities QGeoMap::cameraCapabilities() const
+void QGeoMap::setCameraData(const QGeoCameraData &cameraData)
{
- return m_mapData->cameraCapabilities();
+ Q_D(QGeoMap);
+ if (cameraData == d->cameraData())
+ return;
+
+ d->setCameraData(cameraData);
+ update();
+
+ emit cameraDataChanged(d->cameraData());
}
-void QGeoMap::setCameraData(const QGeoCameraData &cameraData)
+QGeoCameraData QGeoMap::cameraData() const
{
- m_mapData->setCameraData(cameraData);
+ Q_D(const QGeoMap);
+ return d->cameraData();
}
-void QGeoMap::cameraStopped()
+void QGeoMap::update()
{
- m_mapData->prefetchData();
+ emit updateRequired();
}
-QGeoCameraData QGeoMap::cameraData() const
+void QGeoMap::setActiveMapType(const QGeoMapType type)
{
- return m_mapData->cameraData();
+ Q_D(QGeoMap);
+ d->setActiveMapType(type);
}
-QGeoCoordinate QGeoMap::itemPositionToCoordinate(const QDoubleVector2D &pos, bool clipToViewport) const
+const QGeoMapType QGeoMap::activeMapType() const
{
- return m_mapData->itemPositionToCoordinate(pos, clipToViewport);
+ Q_D(const QGeoMap);
+ return d->activeMapType();
}
-QDoubleVector2D QGeoMap::coordinateToItemPosition(const QGeoCoordinate &coordinate, bool clipToViewport) const
+QString QGeoMap::pluginString()
{
- return m_mapData->coordinateToItemPosition(coordinate, clipToViewport);
+ Q_D(QGeoMap);
+ return d->pluginString();
}
-void QGeoMap::update()
+QGeoCameraCapabilities QGeoMap::cameraCapabilities()
{
- emit m_mapData->update();
+ Q_D(QGeoMap);
+ if (d->engine())
+ return d->engine()->cameraCapabilities();
+ else
+ return QGeoCameraCapabilities();
}
-void QGeoMap::setActiveMapType(const QGeoMapType type)
+QGeoMappingManagerEngine *QGeoMap::engine()
{
- m_mapData->setActiveMapType(type);
+ Q_D(QGeoMap);
+ return d->engine();
}
-const QGeoMapType QGeoMap::activeMapType() const
+QGeoMapPrivate::QGeoMapPrivate(QGeoMappingManagerEngine *engine, QGeoMap *parent)
+ : m_width(0),
+ m_height(0),
+ m_aspectRatio(0.0),
+ m_map(parent),
+ m_engine(engine),
+ m_controller(0),
+ m_activeMapType(QGeoMapType())
{
- return m_mapData->activeMapType();
+ m_pluginString = m_engine->managerName() + QLatin1Char('_') + QString::number(m_engine->managerVersion());
}
-QString QGeoMap::pluginString()
+QGeoMapPrivate::~QGeoMapPrivate()
+{
+ // controller_ is a child of map_, don't need to delete it here
+
+ // TODO map items are not deallocated!
+ // However: how to ensure this is done in rendering thread?
+}
+
+QGeoMappingManagerEngine *QGeoMapPrivate::engine() const
+{
+ return m_engine;
+}
+
+QString QGeoMapPrivate::pluginString()
+{
+ return m_pluginString;
+}
+
+QGeoMapController *QGeoMapPrivate::mapController()
+{
+ if (!m_controller)
+ m_controller = new QGeoMapController(m_map);
+ return m_controller;
+}
+
+void QGeoMapPrivate::setCameraData(const QGeoCameraData &cameraData)
+{
+ QGeoCameraData oldCameraData = m_cameraData;
+ m_cameraData = cameraData;
+
+ if (m_engine) {
+ QGeoCameraCapabilities capabilities = m_engine->cameraCapabilities();
+ if (m_cameraData.zoomLevel() < capabilities.minimumZoomLevel())
+ m_cameraData.setZoomLevel(capabilities.minimumZoomLevel());
+
+ if (m_cameraData.zoomLevel() > capabilities.maximumZoomLevel())
+ m_cameraData.setZoomLevel(capabilities.maximumZoomLevel());
+
+ if (!capabilities.supportsBearing())
+ m_cameraData.setBearing(0.0);
+
+ if (capabilities.supportsTilting()) {
+ if (m_cameraData.tilt() < capabilities.minimumTilt())
+ m_cameraData.setTilt(capabilities.minimumTilt());
+
+ if (m_cameraData.tilt() > capabilities.maximumTilt())
+ m_cameraData.setTilt(capabilities.maximumTilt());
+ } else {
+ m_cameraData.setTilt(0.0);
+ }
+
+ if (!capabilities.supportsRolling())
+ m_cameraData.setRoll(0.0);
+ }
+
+ // Do not call this expensive function if the width is 0, since it will get called
+ // anyway when it is resized to a width > 0.
+ // this is mainly an optimization to the initialization of the geomap, which would otherwise
+ // call changeCameraData four or more times
+ if (width() > 0)
+ m_map->changeCameraData(oldCameraData);
+}
+
+QGeoCameraData QGeoMapPrivate::cameraData() const
{
- return m_mapData->pluginString();
+ return m_cameraData;
}
-#include "moc_qgeomap_p.cpp"
+void QGeoMapPrivate::resize(int width, int height)
+{
+ m_width = width;
+ m_height = height;
+ m_aspectRatio = 1.0 * m_width / m_height;
+ m_map->mapResized(width, height);
+ setCameraData(m_cameraData);
+}
+
+int QGeoMapPrivate::width() const
+{
+ return m_width;
+}
+
+int QGeoMapPrivate::height() const
+{
+ return m_height;
+}
+
+double QGeoMapPrivate::aspectRatio() const
+{
+ return m_aspectRatio;
+}
+
+void QGeoMapPrivate::setActiveMapType(const QGeoMapType &type)
+{
+ m_activeMapType = type;
+
+ m_map->changeActiveMapType(type);
+ setCameraData(m_cameraData);
+
+ m_map->update();
+}
+
+const QGeoMapType QGeoMapPrivate::activeMapType() const
+{
+ return m_activeMapType;
+}
QT_END_NAMESPACE
diff --git a/src/location/maps/qgeomap_p.h b/src/location/maps/qgeomap_p.h
index d6ebbfe3..4b30f6bb 100644
--- a/src/location/maps/qgeomap_p.h
+++ b/src/location/maps/qgeomap_p.h
@@ -47,15 +47,16 @@
// We mean it.
//
+#include "qgeocameradata_p.h"
#include "qgeomaptype_p.h"
#include <QtCore/QObject>
#include <QtPositioning/private/qdoublevector2d_p.h>
QT_BEGIN_NAMESPACE
-class QGeoCameraData;
+class QGeoMappingManagerEngine;
+class QGeoMapPrivate;
class QGeoMapController;
-class QGeoMapData;
class QGeoCameraCapabilities;
class QGeoCoordinate;
class QSGNode;
@@ -65,16 +66,13 @@ class Q_LOCATION_EXPORT QGeoMap : public QObject
{
Q_OBJECT
- Q_PROPERTY(QGeoCameraData camera READ cameraData WRITE setCameraData NOTIFY cameraDataChanged)
- Q_PROPERTY(QGeoMapType activeMapType READ activeMapType WRITE setActiveMapType NOTIFY activeMapTypeChanged)
-
public:
- QGeoMap(QGeoMapData *mapData, QObject *parent = 0);
+ QGeoMap(QGeoMappingManagerEngine *engine, QObject *parent = 0);
virtual ~QGeoMap();
QGeoMapController *mapController();
- QSGNode *updateSceneGraph(QSGNode *oldNode, QQuickWindow *window);
+ virtual QSGNode *updateSceneGraph(QSGNode *, QQuickWindow *window) = 0;
void resize(int width, int height);
int width() const;
@@ -82,29 +80,37 @@ public:
void setCameraData(const QGeoCameraData &cameraData);
QGeoCameraData cameraData() const;
- QGeoCameraCapabilities cameraCapabilities() const;
-
- QGeoCoordinate itemPositionToCoordinate(const QDoubleVector2D &pos, bool clipToViewport = true) const;
- QDoubleVector2D coordinateToItemPosition(const QGeoCoordinate &coordinate, bool clipToViewport = true) const;
void setActiveMapType(const QGeoMapType mapType);
const QGeoMapType activeMapType() const;
+ virtual QGeoCoordinate itemPositionToCoordinate(const QDoubleVector2D &pos, bool clipToViewport = true) const = 0;
+ virtual QDoubleVector2D coordinateToItemPosition(const QGeoCoordinate &coordinate, bool clipToViewport = true) const = 0;
+
QString pluginString();
+ QGeoCameraCapabilities cameraCapabilities();
+ QGeoMappingManagerEngine *engine();
+
+protected:
+ virtual void mapResized(int width, int height) = 0;
+ virtual void changeCameraData(const QGeoCameraData &oldCameraData) = 0;
+ virtual void changeActiveMapType(const QGeoMapType mapType) = 0;
public Q_SLOTS:
void update();
- void cameraStopped(); // optional hint for prefetch
+ virtual void prefetchData() {}
Q_SIGNALS:
void cameraDataChanged(const QGeoCameraData &cameraData);
void updateRequired();
void activeMapTypeChanged();
void copyrightsChanged(const QImage &copyrightsImage);
- void copyrightsChanged(const QString &copyrights);
+ void copyrightsChanged(const QString &copyrightsHtml);
private:
- QGeoMapData *m_mapData;
+ QGeoMapPrivate *d_ptr;
+ Q_DECLARE_PRIVATE(QGeoMap)
+ Q_DISABLE_COPY(QGeoMap)
};
QT_END_NAMESPACE
diff --git a/src/location/maps/qgeomapdata_p_p.h b/src/location/maps/qgeomap_p_p.h
index c5700885..18f5ba43 100644
--- a/src/location/maps/qgeomapdata_p_p.h
+++ b/src/location/maps/qgeomap_p_p.h
@@ -33,8 +33,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef QGEOMAPDATA_P_P_H
-#define QGEOMAPDATA_P_P_H
+#ifndef QGEOMAP_P_P_H
+#define QGEOMAP_P_P_H
//
// W A R N I N G
@@ -53,14 +53,14 @@
QT_BEGIN_NAMESPACE
class QGeoMappingManagerEngine;
-class QGeoMapData;
+class QGeoMap;
class QGeoMapController;
-class QGeoMapDataPrivate
+class QGeoMapPrivate
{
public:
- QGeoMapDataPrivate(QGeoMappingManagerEngine *engine, QGeoMapData *parent);
- virtual ~QGeoMapDataPrivate();
+ QGeoMapPrivate(QGeoMappingManagerEngine *engine, QGeoMap *parent);
+ virtual ~QGeoMapPrivate();
QGeoMappingManagerEngine *engine() const;
@@ -83,7 +83,7 @@ private:
int m_height;
double m_aspectRatio;
- QGeoMapData *m_map;
+ QGeoMap *m_map;
QGeoMappingManagerEngine *m_engine;
QString m_pluginString;
QGeoMapController *m_controller;
diff --git a/src/location/maps/qgeomapcontroller.cpp b/src/location/maps/qgeomapcontroller.cpp
index 81d8e9bb..661839fe 100644
--- a/src/location/maps/qgeomapcontroller.cpp
+++ b/src/location/maps/qgeomapcontroller.cpp
@@ -36,14 +36,14 @@
#include "qgeomapcontroller_p.h"
-#include "qgeomapdata_p.h"
+#include "qgeomap_p.h"
#include <QtPositioning/private/qgeoprojection_p.h>
#include <QPointF>
QT_BEGIN_NAMESPACE
-QGeoMapController::QGeoMapController(QGeoMapData *map)
+QGeoMapController::QGeoMapController(QGeoMap *map)
: QObject(map),
map_(map)
{
diff --git a/src/location/maps/qgeomapcontroller_p.h b/src/location/maps/qgeomapcontroller_p.h
index f989d22c..06f2b926 100644
--- a/src/location/maps/qgeomapcontroller_p.h
+++ b/src/location/maps/qgeomapcontroller_p.h
@@ -54,7 +54,7 @@
QT_BEGIN_NAMESPACE
-class QGeoMapData;
+class QGeoMap;
class Q_LOCATION_EXPORT QGeoMapController : public QObject
@@ -68,7 +68,7 @@ class Q_LOCATION_EXPORT QGeoMapController : public QObject
Q_PROPERTY(qreal zoom READ zoom WRITE setZoom NOTIFY zoomChanged)
public:
- QGeoMapController(QGeoMapData *map);
+ QGeoMapController(QGeoMap *map);
~QGeoMapController();
QGeoCoordinate center() const;
@@ -103,7 +103,7 @@ Q_SIGNALS:
void zoomChanged(qreal zoom);
private:
- QGeoMapData *map_;
+ QGeoMap *map_;
QGeoCameraData oldCameraData_;
};
diff --git a/src/location/maps/qgeomapdata.cpp b/src/location/maps/qgeomapdata.cpp
deleted file mode 100644
index 7055b628..00000000
--- a/src/location/maps/qgeomapdata.cpp
+++ /dev/null
@@ -1,256 +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 "qgeomapdata_p.h"
-#include "qgeomapdata_p_p.h"
-#include "qgeocameracapabilities_p.h"
-#include "qgeomapcontroller_p.h"
-#include "qgeomappingmanagerengine_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QGeoMapData::QGeoMapData(QGeoMappingManagerEngine *engine, QObject *parent)
- : QObject(parent),
- d_ptr(new QGeoMapDataPrivate(engine, this)) {}
-
-QGeoMapData::~QGeoMapData()
-{
- delete d_ptr;
-}
-
-QGeoMapController *QGeoMapData::mapController()
-{
- Q_D(QGeoMapData);
- return d->mapController();
-}
-
-void QGeoMapData::resize(int width, int height)
-{
- Q_D(QGeoMapData);
- d->resize(width, height);
-
- // always emit this signal to trigger items to redraw
- emit cameraDataChanged(d->cameraData());
-}
-
-int QGeoMapData::width() const
-{
- Q_D(const QGeoMapData);
- return d->width();
-}
-
-int QGeoMapData::height() const
-{
- Q_D(const QGeoMapData);
- return d->height();
-}
-
-void QGeoMapData::setCameraData(const QGeoCameraData &cameraData)
-{
- Q_D(QGeoMapData);
- if (cameraData == d->cameraData())
- return;
-
- d->setCameraData(cameraData);
- update();
-
- emit cameraDataChanged(d->cameraData());
-}
-
-QGeoCameraData QGeoMapData::cameraData() const
-{
- Q_D(const QGeoMapData);
- return d->cameraData();
-}
-
-void QGeoMapData::update()
-{
- emit updateRequired();
-}
-
-void QGeoMapData::setActiveMapType(const QGeoMapType type)
-{
- Q_D(QGeoMapData);
- d->setActiveMapType(type);
-}
-
-const QGeoMapType QGeoMapData::activeMapType() const
-{
- Q_D(const QGeoMapData);
- return d->activeMapType();
-}
-
-QString QGeoMapData::pluginString()
-{
- Q_D(QGeoMapData);
- return d->pluginString();
-}
-
-QGeoCameraCapabilities QGeoMapData::cameraCapabilities()
-{
- Q_D(QGeoMapData);
- if (d->engine())
- return d->engine()->cameraCapabilities();
- else
- return QGeoCameraCapabilities();
-}
-
-QGeoMappingManagerEngine *QGeoMapData::engine()
-{
- Q_D(QGeoMapData);
- return d->engine();
-}
-
-QGeoMapDataPrivate::QGeoMapDataPrivate(QGeoMappingManagerEngine *engine, QGeoMapData *parent)
- : m_width(0),
- m_height(0),
- m_aspectRatio(0.0),
- m_map(parent),
- m_engine(engine),
- m_controller(0),
- m_activeMapType(QGeoMapType())
-{
- m_pluginString = m_engine->managerName() + QLatin1Char('_') + QString::number(m_engine->managerVersion());
-}
-
-QGeoMapDataPrivate::~QGeoMapDataPrivate()
-{
- // controller_ is a child of map_, don't need to delete it here
-
- // TODO map items are not deallocated!
- // However: how to ensure this is done in rendering thread?
-}
-
-QGeoMappingManagerEngine *QGeoMapDataPrivate::engine() const
-{
- return m_engine;
-}
-
-QString QGeoMapDataPrivate::pluginString()
-{
- return m_pluginString;
-}
-
-QGeoMapController *QGeoMapDataPrivate::mapController()
-{
- if (!m_controller)
- m_controller = new QGeoMapController(m_map);
- return m_controller;
-}
-
-void QGeoMapDataPrivate::setCameraData(const QGeoCameraData &cameraData)
-{
- QGeoCameraData oldCameraData = m_cameraData;
- m_cameraData = cameraData;
-
- if (m_engine) {
- QGeoCameraCapabilities capabilities = m_engine->cameraCapabilities();
- if (m_cameraData.zoomLevel() < capabilities.minimumZoomLevel())
- m_cameraData.setZoomLevel(capabilities.minimumZoomLevel());
-
- if (m_cameraData.zoomLevel() > capabilities.maximumZoomLevel())
- m_cameraData.setZoomLevel(capabilities.maximumZoomLevel());
-
- if (!capabilities.supportsBearing())
- m_cameraData.setBearing(0.0);
-
- if (capabilities.supportsTilting()) {
- if (m_cameraData.tilt() < capabilities.minimumTilt())
- m_cameraData.setTilt(capabilities.minimumTilt());
-
- if (m_cameraData.tilt() > capabilities.maximumTilt())
- m_cameraData.setTilt(capabilities.maximumTilt());
- } else {
- m_cameraData.setTilt(0.0);
- }
-
- if (!capabilities.supportsRolling())
- m_cameraData.setRoll(0.0);
- }
-
- // Do not call this expensive function if the width is 0, since it will get called
- // anyway when it is resized to a width > 0.
- // this is mainly an optimization to the initialization of the geomap, which would otherwise
- // call changeCameraData four or more times
- if (width() > 0)
- m_map->changeCameraData(oldCameraData);
-}
-
-QGeoCameraData QGeoMapDataPrivate::cameraData() const
-{
- return m_cameraData;
-}
-
-void QGeoMapDataPrivate::resize(int width, int height)
-{
- m_width = width;
- m_height = height;
- m_aspectRatio = 1.0 * m_width / m_height;
- m_map->mapResized(width, height);
- setCameraData(m_cameraData);
-}
-
-int QGeoMapDataPrivate::width() const
-{
- return m_width;
-}
-
-int QGeoMapDataPrivate::height() const
-{
- return m_height;
-}
-
-double QGeoMapDataPrivate::aspectRatio() const
-{
- return m_aspectRatio;
-}
-
-void QGeoMapDataPrivate::setActiveMapType(const QGeoMapType &type)
-{
- m_activeMapType = type;
-
- m_map->changeActiveMapType(type);
- setCameraData(m_cameraData);
-
- m_map->update();
-}
-
-const QGeoMapType QGeoMapDataPrivate::activeMapType() const
-{
- return m_activeMapType;
-}
-
-QT_END_NAMESPACE
diff --git a/src/location/maps/qgeomapdata_p.h b/src/location/maps/qgeomapdata_p.h
deleted file mode 100644
index 59b7bdff..00000000
--- a/src/location/maps/qgeomapdata_p.h
+++ /dev/null
@@ -1,116 +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$
-**
-****************************************************************************/
-#ifndef QGEOMAPDATA_P_H
-#define QGEOMAPDATA_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 "qgeocameradata_p.h"
-#include "qgeomaptype_p.h"
-#include <QtPositioning/private/qdoublevector2d_p.h>
-#include <QtCore/QObject>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoMappingManagerEngine;
-class QGeoMapDataPrivate;
-class QGeoMapController;
-class QGeoCameraCapabilities;
-class QSGNode;
-class QQuickWindow;
-
-class Q_LOCATION_EXPORT QGeoMapData : public QObject
-{
- Q_OBJECT
-public:
- QGeoMapData(QGeoMappingManagerEngine *engine, QObject *parent = 0);
- virtual ~QGeoMapData();
-
- QGeoMapController *mapController();
-
- virtual QSGNode *updateSceneGraph(QSGNode *, QQuickWindow *window) = 0;
-
- void resize(int width, int height);
- int width() const;
- int height() const;
-
- void setCameraData(const QGeoCameraData &cameraData);
- QGeoCameraData cameraData() const;
-
- void setActiveMapType(const QGeoMapType mapType);
- const QGeoMapType activeMapType() const;
-
- virtual QGeoCoordinate itemPositionToCoordinate(const QDoubleVector2D &pos, bool clipToViewport = true) const = 0;
- virtual QDoubleVector2D coordinateToItemPosition(const QGeoCoordinate &coordinate, bool clipToViewport = true) const = 0;
-
- QString pluginString();
- QGeoCameraCapabilities cameraCapabilities();
- QGeoMappingManagerEngine *engine();
- virtual void prefetchData() {}
-
-protected:
- virtual void mapResized(int width, int height) = 0;
- virtual void changeCameraData(const QGeoCameraData &oldCameraData) = 0;
- virtual void changeActiveMapType(const QGeoMapType mapType) = 0;
-
-public Q_SLOTS:
- void update();
-
-Q_SIGNALS:
- void cameraDataChanged(const QGeoCameraData &cameraData);
- void updateRequired();
- void activeMapTypeChanged();
- void copyrightsChanged(const QImage &copyrightsImage);
- void copyrightsChanged(const QString &copyrightsHtml);
-
-private:
- QGeoMapDataPrivate *d_ptr;
- Q_DECLARE_PRIVATE(QGeoMapData)
- Q_DISABLE_COPY(QGeoMapData)
-};
-
-QT_END_NAMESPACE
-
-#endif // QGEOMAP_P_H
diff --git a/src/location/maps/qgeomappingmanager.cpp b/src/location/maps/qgeomappingmanager.cpp
index 4c80fe97..910e61d8 100644
--- a/src/location/maps/qgeomappingmanager.cpp
+++ b/src/location/maps/qgeomappingmanager.cpp
@@ -132,8 +132,8 @@ QGeoCameraCapabilities QGeoMappingManager::cameraCapabilities() const
*/
QGeoMap *QGeoMappingManager::createMap(QObject *parent)
{
- QGeoMapData *mapData = d_ptr->engine->createMapData();
- QGeoMap *map = new QGeoMap(mapData, parent);
+ QGeoMap * map = d_ptr->engine->createMapData();
+ connect(parent,&QObject::destroyed,map,&QGeoMap::deleteLater);
return map;
}
diff --git a/src/location/maps/qgeomappingmanagerengine_p.h b/src/location/maps/qgeomappingmanagerengine_p.h
index b6a2f75b..dac7be0c 100644
--- a/src/location/maps/qgeomappingmanagerengine_p.h
+++ b/src/location/maps/qgeomappingmanagerengine_p.h
@@ -70,7 +70,7 @@ class QGeoMappingManagerPrivate;
class QGeoMapRequestOptions;
class QGeoMappingManagerEnginePrivate;
-class QGeoMapData;
+class QGeoMap;
class Q_LOCATION_EXPORT QGeoMappingManagerEngine : public QObject
{
@@ -80,7 +80,7 @@ public:
explicit QGeoMappingManagerEngine(QObject *parent = 0);
virtual ~QGeoMappingManagerEngine();
- virtual QGeoMapData *createMapData() = 0;
+ virtual QGeoMap *createMapData() = 0;
QVariantMap parameters() const;
diff --git a/src/location/maps/qgeotiledmapdata.cpp b/src/location/maps/qgeotiledmapdata.cpp
index bef041bb..3e5f3dbd 100644
--- a/src/location/maps/qgeotiledmapdata.cpp
+++ b/src/location/maps/qgeotiledmapdata.cpp
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
QGeoTiledMapData::QGeoTiledMapData(QGeoTiledMappingManagerEngine *engine, QObject *parent)
- : QGeoMapData(engine, parent)
+ : QGeoMap(engine, parent)
{
d_ptr = new QGeoTiledMapDataPrivate(this, engine);
engine->registerMap(this);
diff --git a/src/location/maps/qgeotiledmapdata_p.h b/src/location/maps/qgeotiledmapdata_p.h
index c61fdf02..dd9952bd 100644
--- a/src/location/maps/qgeotiledmapdata_p.h
+++ b/src/location/maps/qgeotiledmapdata_p.h
@@ -50,7 +50,7 @@
#include <QObject>
#include <QString>
-#include "qgeomapdata_p.h"
+#include "qgeomap_p.h"
#include "qgeocameradata_p.h"
#include "qgeomaptype_p.h"
@@ -70,7 +70,7 @@ class QSGNode;
class QPointF;
-class Q_LOCATION_EXPORT QGeoTiledMapData : public QGeoMapData
+class Q_LOCATION_EXPORT QGeoTiledMapData : public QGeoMap
{
Q_OBJECT
public: