diff options
Diffstat (limited to 'src/location/maps')
-rw-r--r-- | src/location/maps/maps.pri | 2 | ||||
-rw-r--r-- | src/location/maps/qgeocameradata.cpp | 4 | ||||
-rw-r--r-- | src/location/maps/qgeomap.cpp | 42 | ||||
-rw-r--r-- | src/location/maps/qgeomap_p.h | 7 | ||||
-rw-r--r-- | src/location/maps/qgeomap_p_p.h | 1 | ||||
-rw-r--r-- | src/location/maps/qgeomapcontroller.cpp | 215 | ||||
-rw-r--r-- | src/location/maps/qgeomapcontroller_p.h | 112 | ||||
-rw-r--r-- | src/location/maps/qgeotiledmap.cpp | 106 | ||||
-rw-r--r-- | src/location/maps/qgeotiledmap_p.h | 3 | ||||
-rw-r--r-- | src/location/maps/qgeotiledmap_p_p.h | 3 |
10 files changed, 45 insertions, 450 deletions
diff --git a/src/location/maps/maps.pri b/src/location/maps/maps.pri index 69e6f62b..c8e28bab 100644 --- a/src/location/maps/maps.pri +++ b/src/location/maps/maps.pri @@ -25,7 +25,6 @@ PRIVATE_HEADERS += \ maps/qgeocodingmanagerengine_p.h \ maps/qgeocodingmanager_p.h \ maps/qgeomaneuver_p.h \ - maps/qgeomapcontroller_p.h \ maps/qgeotiledmapscene_p.h \ maps/qgeotilerequestmanager_p.h \ maps/qgeomap_p.h \ @@ -65,7 +64,6 @@ SOURCES += \ maps/qgeocodingmanager.cpp \ maps/qgeocodingmanagerengine.cpp \ maps/qgeomaneuver.cpp \ - maps/qgeomapcontroller.cpp \ maps/qgeotilerequestmanager.cpp \ maps/qgeomap.cpp \ maps/qgeomappingmanager.cpp \ diff --git a/src/location/maps/qgeocameradata.cpp b/src/location/maps/qgeocameradata.cpp index a45d855a..23586082 100644 --- a/src/location/maps/qgeocameradata.cpp +++ b/src/location/maps/qgeocameradata.cpp @@ -59,11 +59,11 @@ public: QGeoCameraDataPrivate::QGeoCameraDataPrivate() : QSharedData(), - m_center(-27.5, 153), + m_center(0, 0), m_bearing(0.0), m_tilt(0.0), m_roll(0.0), - m_zoomLevel(9.0) {} + m_zoomLevel(0.0) {} QGeoCameraDataPrivate::QGeoCameraDataPrivate(const QGeoCameraDataPrivate &rhs) : QSharedData(rhs), diff --git a/src/location/maps/qgeomap.cpp b/src/location/maps/qgeomap.cpp index 4cc2bbfe..7817553c 100644 --- a/src/location/maps/qgeomap.cpp +++ b/src/location/maps/qgeomap.cpp @@ -37,8 +37,8 @@ #include "qgeomap_p.h" #include "qgeomap_p_p.h" #include "qgeocameracapabilities_p.h" -#include "qgeomapcontroller_p.h" #include "qgeomappingmanagerengine_p.h" +#include <QDebug> QT_BEGIN_NAMESPACE @@ -51,14 +51,6 @@ QGeoMap::~QGeoMap() { } -QGeoMapController *QGeoMap::mapController() -{ - Q_D(QGeoMap); - if (!d->m_controller) - d->m_controller = new QGeoMapController(this); - return d->m_controller; -} - void QGeoMap::resize(int width, int height) { Q_D(QGeoMap); @@ -119,11 +111,6 @@ const QGeoMapType QGeoMap::activeMapType() const return d->m_activeMapType; } -double QGeoMap::minimumZoom() const -{ - Q_D(const QGeoMap); - return d->m_minimumZoom; -} QGeoCameraCapabilities QGeoMap::cameraCapabilities() const { @@ -149,9 +136,7 @@ QGeoMapPrivate::QGeoMapPrivate(QGeoMappingManagerEngine *engine) m_width(0), m_height(0), m_aspectRatio(0.0), - m_minimumZoom(0.0), m_engine(engine), - m_controller(0), m_activeMapType(QGeoMapType()) { } @@ -169,31 +154,6 @@ void QGeoMapPrivate::setCameraData(const QGeoCameraData &cameraData) QGeoCameraData oldCameraData = m_cameraData; m_cameraData = cameraData; - if (!m_engine.isNull()) { - 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 diff --git a/src/location/maps/qgeomap_p.h b/src/location/maps/qgeomap_p.h index 7747347f..e2af2eda 100644 --- a/src/location/maps/qgeomap_p.h +++ b/src/location/maps/qgeomap_p.h @@ -70,23 +70,22 @@ class Q_LOCATION_EXPORT QGeoMap : public QObject public: virtual ~QGeoMap(); - QGeoMapController *mapController(); - void resize(int width, int height); int width() const; int height() const; QGeoCameraData cameraData() const; + QGeoCameraCapabilities cameraCapabilities() 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; - double minimumZoom() const; + virtual double minimumZoomForMapSize(int width, int height) const = 0; + virtual double maximumLatitudeForZoom(double zoomLevel) const = 0; virtual void prefetchData(); virtual void clearData(); - QGeoCameraCapabilities cameraCapabilities() const; protected: QGeoMap(QGeoMapPrivate &dd, QObject *parent = 0); diff --git a/src/location/maps/qgeomap_p_p.h b/src/location/maps/qgeomap_p_p.h index 1d1c9a13..3b996ecc 100644 --- a/src/location/maps/qgeomap_p_p.h +++ b/src/location/maps/qgeomap_p_p.h @@ -77,7 +77,6 @@ protected: int m_width; int m_height; double m_aspectRatio; - double m_minimumZoom; QPointer<QGeoMappingManagerEngine> m_engine; QGeoMapController *m_controller; QGeoCameraData m_cameraData; diff --git a/src/location/maps/qgeomapcontroller.cpp b/src/location/maps/qgeomapcontroller.cpp deleted file mode 100644 index 661839fe..00000000 --- a/src/location/maps/qgeomapcontroller.cpp +++ /dev/null @@ -1,215 +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 "qgeomapcontroller_p.h" - -#include "qgeomap_p.h" -#include <QtPositioning/private/qgeoprojection_p.h> - -#include <QPointF> - -QT_BEGIN_NAMESPACE - -QGeoMapController::QGeoMapController(QGeoMap *map) - : QObject(map), - map_(map) -{ - oldCameraData_ = map_->cameraData(); - - connect(map_, - SIGNAL(cameraDataChanged(QGeoCameraData)), - this, - SLOT(cameraDataChanged(QGeoCameraData))); -} - -QGeoMapController::~QGeoMapController() {} - -void QGeoMapController::cameraDataChanged(const QGeoCameraData &cameraData) -{ - if (oldCameraData_.center() != cameraData.center()) - emit centerChanged(cameraData.center()); - - if (oldCameraData_.bearing() != cameraData.bearing()) - emit bearingChanged(cameraData.bearing()); - - if (oldCameraData_.tilt() != cameraData.tilt()) - emit tiltChanged(cameraData.tilt()); - - if (oldCameraData_.roll() != cameraData.roll()) - emit rollChanged(cameraData.roll()); - - if (oldCameraData_.zoomLevel() != cameraData.zoomLevel()) - emit zoomChanged(cameraData.zoomLevel()); - - oldCameraData_ = cameraData; -} - -QGeoCoordinate QGeoMapController::center() const -{ - return map_->cameraData().center(); -} - -void QGeoMapController::setCenter(const QGeoCoordinate ¢er) -{ - QGeoCameraData cd = map_->cameraData(); - - if (center == cd.center()) - return; - - cd.setCenter(center); - map_->setCameraData(cd); -} - -void QGeoMapController::setLatitude(qreal latitude) -{ - QGeoCameraData cd = map_->cameraData(); - - if (latitude == cd.center().latitude()) - return; - - QGeoCoordinate coord(latitude, cd.center().longitude(), cd.center().altitude()); - cd.setCenter(coord); - map_->setCameraData(cd); -} - -void QGeoMapController::setLongitude(qreal longitude) -{ - QGeoCameraData cd = map_->cameraData(); - - if (longitude == cd.center().longitude()) - return; - - QGeoCoordinate coord(cd.center().latitude(), longitude, cd.center().altitude()); - cd.setCenter(coord); - map_->setCameraData(cd); -} - - -void QGeoMapController::setAltitude(qreal altitude) -{ - QGeoCameraData cd = map_->cameraData(); - - if (altitude == cd.center().altitude()) - return; - - QGeoCoordinate coord(cd.center().latitude(), cd.center().longitude(), altitude); - cd.setCenter(coord); - map_->setCameraData(cd); -} - -qreal QGeoMapController::bearing() const -{ - return map_->cameraData().bearing(); -} - -void QGeoMapController::setBearing(qreal bearing) -{ - QGeoCameraData cd = map_->cameraData(); - - if (bearing == cd.bearing()) - return; - - cd.setBearing(bearing); - map_->setCameraData(cd); -} - -qreal QGeoMapController::tilt() const -{ - return map_->cameraData().tilt(); -} - -void QGeoMapController::setTilt(qreal tilt) -{ - QGeoCameraData cd = map_->cameraData(); - - if (tilt == cd.tilt()) - return; - - cd.setTilt(tilt); - map_->setCameraData(cd); -} - -qreal QGeoMapController::roll() const -{ - return map_->cameraData().roll(); -} - -void QGeoMapController::setRoll(qreal roll) -{ - QGeoCameraData cd = map_->cameraData(); - - if (roll == cd.roll()) - return; - - cd.setRoll(roll); - map_->setCameraData(cd); -} - -qreal QGeoMapController::zoom() const -{ - return map_->cameraData().zoomLevel(); -} - -void QGeoMapController::setZoom(qreal zoom) -{ - QGeoCameraData cd = map_->cameraData(); - - if (zoom == cd.zoomLevel()) - return; - - cd.setZoomLevel(zoom); - map_->setCameraData(cd); -} - -void QGeoMapController::pan(qreal dx, qreal dy) -{ - if (dx == 0 && dy == 0) - return; - QGeoCameraData cd = map_->cameraData(); - QGeoCoordinate coord = map_->itemPositionToCoordinate( - QDoubleVector2D(map_->width() / 2 + dx, - map_->height() / 2 + dy)); - - - // keep altitude as it was - coord.setAltitude(cd.center().altitude()); - if (coord.isValid()) { - cd.setCenter(coord); - map_->setCameraData(cd); - } -} - -QT_END_NAMESPACE diff --git a/src/location/maps/qgeomapcontroller_p.h b/src/location/maps/qgeomapcontroller_p.h deleted file mode 100644 index 06f2b926..00000000 --- a/src/location/maps/qgeomapcontroller_p.h +++ /dev/null @@ -1,112 +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 QGEOMAPCONTROLLER_P_H -#define QGEOMAPCONTROLLER_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 "qgeocoordinate.h" -#include "qgeocameradata_p.h" - -QT_BEGIN_NAMESPACE - -class QGeoMap; - - -class Q_LOCATION_EXPORT QGeoMapController : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter NOTIFY centerChanged) - Q_PROPERTY(qreal bearing READ bearing WRITE setBearing NOTIFY bearingChanged) - Q_PROPERTY(qreal tilt READ tilt WRITE setTilt NOTIFY tiltChanged) - Q_PROPERTY(qreal roll READ roll WRITE setRoll NOTIFY rollChanged) - Q_PROPERTY(qreal zoom READ zoom WRITE setZoom NOTIFY zoomChanged) - -public: - QGeoMapController(QGeoMap *map); - ~QGeoMapController(); - - QGeoCoordinate center() const; - void setCenter(const QGeoCoordinate ¢er); - - void setLatitude(qreal latitude); - void setLongitude(qreal longitude); - void setAltitude(qreal altitude); - - qreal bearing() const; - void setBearing(qreal bearing); - - qreal tilt() const; - void setTilt(qreal tilt); - - qreal roll() const; - void setRoll(qreal roll); - - qreal zoom() const; - void setZoom(qreal zoom); - - void pan(qreal dx, qreal dy); - -private Q_SLOTS: - void cameraDataChanged(const QGeoCameraData &cameraData); - -Q_SIGNALS: - void centerChanged(const QGeoCoordinate ¢er); - void bearingChanged(qreal bearing); - void tiltChanged(qreal tilt); - void rollChanged(qreal roll); - void zoomChanged(qreal zoom); - -private: - QGeoMap *map_; - QGeoCameraData oldCameraData_; -}; - -QT_END_NAMESPACE - -#endif // QGEOMAPCONTROLLER_P_H diff --git a/src/location/maps/qgeotiledmap.cpp b/src/location/maps/qgeotiledmap.cpp index 3705bfca..13d01fc6 100644 --- a/src/location/maps/qgeotiledmap.cpp +++ b/src/location/maps/qgeotiledmap.cpp @@ -103,19 +103,6 @@ QSGNode *QGeoTiledMap::updateSceneGraph(QSGNode *oldNode, QQuickWindow *window) return d->updateSceneGraph(oldNode, window); } -// This method returns the minimum zoom level that this specific qgeomap type allows -// at a given canvas size (width,height) and for a given tile size (usually 256). -double QGeoTiledMap::minimumZoomLevel(int width, int height, int tileSize) const -{ - double maxSize = qMax(width,height); - double numTiles = maxSize / tileSize; - double minZoom = std::log(numTiles) / std::log(2.0); - const QGeoCameraCapabilities capa = cameraCapabilities(); - if (capa.isValid()) - minZoom = qMax(minZoom, capa.minimumZoomLevel()); - return minZoom; -} - void QGeoTiledMap::prefetchData() { Q_D(QGeoTiledMap); @@ -175,6 +162,38 @@ QDoubleVector2D QGeoTiledMap::coordinateToItemPosition(const QGeoCoordinate &coo return pos; } +// This method returns the minimum zoom level that this specific qgeomap type allows +// at a given canvas size (width,height) and for a given tile size (usually 256). +double QGeoTiledMap::minimumZoomForMapSize(int width, int height) const +{ + Q_D(const QGeoTiledMap); + double maxSize = qMax(width,height); + double numTiles = maxSize / d->m_visibleTiles->tileSize(); + return std::log(numTiles) / std::log(2.0); +} + +// This method recalculates the "no-trespassing" limits for the map center. +// This has to be done when: +// 1) the map is resized, because the meters per pixel remain the same, but +// the amount of pixels between the center and the borders changes +// 2) when the zoom level changes, because the amount of pixels between the center +// and the borders stays the same, but the meters per pixel change +double QGeoTiledMap::maximumLatitudeForZoom(double zoomLevel) const +{ + Q_D(const QGeoTiledMap); + double mapEdgeSize = std::pow(2.0,zoomLevel); + mapEdgeSize *= d->m_visibleTiles->tileSize(); + + // At init time weird things happen + int clampedWindowHeight = (d->m_height > mapEdgeSize) ? mapEdgeSize : d->m_height; + + // Use the window height divided by 2 as the topmost allowed center, with respect to the map size in pixels + double mercatorTopmost = (clampedWindowHeight * 0.5) / mapEdgeSize ; + QGeoCoordinate topMost = QGeoProjection::mercatorToCoord(QDoubleVector2D(0.0,mercatorTopmost)); + + return topMost.latitude(); +} + QGeoTiledMapPrivate::QGeoTiledMapPrivate(QGeoTiledMappingManagerEngine *engine) : QGeoMapPrivate(engine), m_cache(engine->tileCache()), @@ -184,8 +203,7 @@ QGeoTiledMapPrivate::QGeoTiledMapPrivate(QGeoTiledMappingManagerEngine *engine) m_tileRequests(0), m_maxZoomLevel(static_cast<int>(std::ceil(engine->cameraCapabilities().maximumZoomLevel()))), m_minZoomLevel(static_cast<int>(std::ceil(engine->cameraCapabilities().minimumZoomLevel()))), - m_prefetchStyle(QGeoTiledMap::PrefetchTwoNeighbourLayers), - m_centerLatitudinalBound(0.0) + m_prefetchStyle(QGeoTiledMap::PrefetchTwoNeighbourLayers) { int tileSize = engine->tileSize().width(); QString pluginString(engine->managerName() + QLatin1Char('_') + QString::number(engine->managerVersion())); @@ -208,7 +226,6 @@ QGeoTiledMapPrivate::~QGeoTiledMapPrivate() // However: how to ensure this is done in rendering thread? } - void QGeoTiledMapPrivate::prefetchTiles() { if (m_tileRequests) { @@ -264,6 +281,8 @@ void QGeoTiledMapPrivate::prefetchTiles() void QGeoTiledMapPrivate::changeCameraData(const QGeoCameraData &oldCameraData) { + Q_UNUSED(oldCameraData) // TODO: taking care in following commit + // For zoomlevel, "snap" 0.01 either side of a whole number. // This is so that when we turn off bilinear scaling, we're // snapped to the exact pixel size of the tiles @@ -277,24 +296,6 @@ void QGeoTiledMapPrivate::changeCameraData(const QGeoCameraData &oldCameraData) m_cameraData.setZoomLevel(izl); } - double oldZoomLevel = oldCameraData.zoomLevel(); - if (m_cameraData.zoomLevel() != oldZoomLevel) { - // Zoom level changed: recompute latitudinal border for the center - updateCenterLatitudinalBound(m_visibleTiles->tileSize(),m_cameraData.zoomLevel()); - } - - QGeoCoordinate coord = m_cameraData.center(); - if (coord.isValid()) { - double lat = coord.latitude(); - if (m_mapScene->verticalLock()) - lat = oldCameraData.center().latitude(); - - // Clamp center latitude to prevent gray borders - lat = qBound(-m_centerLatitudinalBound, lat, m_centerLatitudinalBound); - coord.setLatitude(lat); - } - m_cameraData.setCenter(coord); - m_visibleTiles->setCameraData(m_cameraData); m_mapScene->setCameraData(m_cameraData); @@ -324,27 +325,6 @@ void QGeoTiledMapPrivate::updateScene() q->update(); } -// This method recalculates the "no-trespassing" limits for the map center. -// This has to be done when: -// 1) the map is resized, because the meters per pixel remain the same, but -// the amount of pixels between the center and the borders changes -// 2) when the zoom level changes, because the amount of pixels between the center -// and the borders stays the same, but the meters per pixel change -void QGeoTiledMapPrivate::updateCenterLatitudinalBound(int tileSize, double zoomLevel) -{ - double mapEdgeSize = std::pow(2.0,zoomLevel); - mapEdgeSize *= tileSize; - - // At init time weird things happen - int clampedWindowHeight = (m_height > mapEdgeSize) ? mapEdgeSize : m_height; - - // Use the window height divided by 2 as the topmost allowed center, with respect to the map size in pixels - double mercatorTopmost = (clampedWindowHeight * 0.5) / mapEdgeSize ; - QGeoCoordinate topMost = QGeoProjection::mercatorToCoord(QDoubleVector2D(0.0,mercatorTopmost)); - - m_centerLatitudinalBound = topMost.latitude(); -} - void QGeoTiledMapPrivate::changeActiveMapType(const QGeoMapType mapType) { m_visibleTiles->setMapType(mapType); @@ -365,21 +345,6 @@ void QGeoTiledMapPrivate::mapResized(int width, int height) m_mapScene->setScreenSize(QSize(width, height)); m_visibleTiles->setScreenSize(QSize(width, height)); m_prefetchTiles->setScreenSize(QSize(width, height)); - // Keep the following step order: - // 1) Update the minimum zoom level - m_minimumZoom = q->minimumZoomLevel(width, height, m_visibleTiles->tileSize()); - - // 2) clamp the current zoom level in the camera data, which will have to be - // propagated in the QDeclarativeGeoMap - QGeoCameraData camData = q->cameraData(); - double zoomLevel = camData.zoomLevel(); - zoomLevel = qMax(m_minimumZoom,zoomLevel); // The correct zoom level. Will be set later - - // 3) Since the map size changed, recompute latitudinal bound for the center. - // This is re-done, despite being already in changeCameraData, because - // changeCameraData triggers it only on zoomLevel changed, which might not - // be the case. - updateCenterLatitudinalBound(m_visibleTiles->tileSize(), zoomLevel); if (width > 0 && height > 0 && m_cache) { // absolute minimum size: one tile each side of display, 32-bit colour @@ -394,6 +359,7 @@ void QGeoTiledMapPrivate::mapResized(int width, int height) int newSize = qMax(m_cache->minTextureUsage(), texCacheSize); m_cache->setMinTextureUsage(newSize); } + q->evaluateCopyrights(m_visibleTiles->createTiles()); } diff --git a/src/location/maps/qgeotiledmap_p.h b/src/location/maps/qgeotiledmap_p.h index 051264ff..6c735e86 100644 --- a/src/location/maps/qgeotiledmap_p.h +++ b/src/location/maps/qgeotiledmap_p.h @@ -86,13 +86,14 @@ public: QGeoCoordinate itemPositionToCoordinate(const QDoubleVector2D &pos, bool clipToViewport = true) const Q_DECL_OVERRIDE; QDoubleVector2D coordinateToItemPosition(const QGeoCoordinate &coordinate, bool clipToViewport = true) const Q_DECL_OVERRIDE; + double minimumZoomForMapSize(int width, int height) const Q_DECL_OVERRIDE; + double maximumLatitudeForZoom(double zoomLevel) const Q_DECL_OVERRIDE; void prefetchData() Q_DECL_OVERRIDE; void clearData() Q_DECL_OVERRIDE; protected: QSGNode *updateSceneGraph(QSGNode *, QQuickWindow *window) Q_DECL_OVERRIDE; virtual void evaluateCopyrights(const QSet<QGeoTileSpec> &visibleTiles); - double minimumZoomLevel(int width, int height, int tileSize) const; private Q_SLOTS: void handleTileVersionChanged(); diff --git a/src/location/maps/qgeotiledmap_p_p.h b/src/location/maps/qgeotiledmap_p_p.h index 6a7ceec9..d0c7b9d6 100644 --- a/src/location/maps/qgeotiledmap_p_p.h +++ b/src/location/maps/qgeotiledmap_p_p.h @@ -90,7 +90,6 @@ protected: private: void updateScene(); - void updateCenterLatitudinalBound(int tileSize, double zoomLevel); private: QAbstractGeoTileCache *m_cache; @@ -101,7 +100,7 @@ private: int m_maxZoomLevel; int m_minZoomLevel; QGeoTiledMap::PrefetchStyle m_prefetchStyle; - double m_centerLatitudinalBound; + bool m_geomoteryUpdated; Q_DISABLE_COPY(QGeoTiledMapPrivate) }; |