summaryrefslogtreecommitdiffstats
path: root/src/location/maps
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2016-11-18 19:02:36 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2016-11-22 09:28:38 +0000
commit95f8804ecaed79792a57b1fe3580266bfbbf7590 (patch)
tree43c53b67a32deaf4635b13a544d480a241775fa0 /src/location/maps
parent81b42ba2508241cdeeecdbcdac6f1d22be922022 (diff)
Renaming QGeoMapPrivate::changeMapSize to changeViewportSize
The current name of this method generate confusion, as what it does is changing the size of the final element in the application, and not the actual map size. This patch renames this method to changeDisplaySize It also renames QGeoMap::setSize to setViewportSize, as well as ::size to viewportSize , width to viewportWidth and height to viewportHeight, to make everything consistent and self-explanatory. Finally it also renames minimumZoomAtMapSize to minimumZoomAtViewportSize. Change-Id: I7c1ca8bb3ca3d6f6b0fe6fc881b9300db7110527 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/maps')
-rw-r--r--src/location/maps/qgeomap.cpp20
-rw-r--r--src/location/maps/qgeomap_p.h11
-rw-r--r--src/location/maps/qgeomap_p_p.h9
-rw-r--r--src/location/maps/qgeotiledmap.cpp14
-rw-r--r--src/location/maps/qgeotiledmap_p.h2
-rw-r--r--src/location/maps/qgeotiledmap_p_p.h2
6 files changed, 30 insertions, 28 deletions
diff --git a/src/location/maps/qgeomap.cpp b/src/location/maps/qgeomap.cpp
index c3b01a3e..0e0a2007 100644
--- a/src/location/maps/qgeomap.cpp
+++ b/src/location/maps/qgeomap.cpp
@@ -51,31 +51,31 @@ QGeoMap::~QGeoMap()
{
}
-void QGeoMap::setSize(const QSize& size)
+void QGeoMap::setViewportSize(const QSize& size)
{
Q_D(QGeoMap);
- if (size == d->m_size)
+ if (size == d->m_viewportSize)
return;
- d->m_size = size;
- d->changeMapSize(size);
+ d->m_viewportSize = size;
+ d->changeViewportSize(size);
}
-QSize QGeoMap::size() const
+QSize QGeoMap::viewportSize() const
{
Q_D(const QGeoMap);
- return d->m_size;
+ return d->m_viewportSize;
}
-int QGeoMap::width() const
+int QGeoMap::viewportWidth() const
{
Q_D(const QGeoMap);
- return d->m_size.width();
+ return d->m_viewportSize.width();
}
-int QGeoMap::height() const
+int QGeoMap::viewportHeight() const
{
Q_D(const QGeoMap);
- return d->m_size.height();
+ return d->m_viewportSize.height();
}
void QGeoMap::setCameraData(const QGeoCameraData &cameraData)
diff --git a/src/location/maps/qgeomap_p.h b/src/location/maps/qgeomap_p.h
index c45b1a0c..ea4806c0 100644
--- a/src/location/maps/qgeomap_p.h
+++ b/src/location/maps/qgeomap_p.h
@@ -70,10 +70,11 @@ class Q_LOCATION_EXPORT QGeoMap : public QObject
public:
virtual ~QGeoMap();
- void setSize(const QSize& size);
- QSize size() const;
- int width() const;
- int height() const;
+ // Sets the display size
+ void setViewportSize(const QSize& viewportSize);
+ QSize viewportSize() const;
+ int viewportWidth() const;
+ int viewportHeight() const;
QGeoCameraData cameraData() const;
@@ -84,7 +85,7 @@ public:
virtual QGeoCoordinate itemPositionToCoordinate(const QDoubleVector2D &pos, bool clipToViewport = true) const = 0;
virtual QDoubleVector2D coordinateToItemPosition(const QGeoCoordinate &coordinate, bool clipToViewport = true) const = 0;
- virtual double minimumZoomAtMapSize(int width, int height) const = 0;
+ virtual double minimumZoomAtViewportSize(int viewportWidth, int viewportHeight) const = 0;
virtual double maximumCenterLatitudeAtZoom(double zoomLevel) const = 0;
virtual QDoubleVector2D referenceCoordinateToItemPosition(const QGeoCoordinate &coordinate) const = 0;
diff --git a/src/location/maps/qgeomap_p_p.h b/src/location/maps/qgeomap_p_p.h
index f72c35ba..b95c1dc7 100644
--- a/src/location/maps/qgeomap_p_p.h
+++ b/src/location/maps/qgeomap_p_p.h
@@ -68,12 +68,13 @@ public:
virtual ~QGeoMapPrivate();
protected:
- virtual void changeMapSize(const QSize &size) = 0;
- virtual void changeCameraData(const QGeoCameraData &oldCameraData) = 0;
- virtual void changeActiveMapType(const QGeoMapType mapType) = 0;
+ /* Hooks into the actual map implementations */
+ 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()
protected:
- QSize m_size;
+ QSize m_viewportSize;
QPointer<QGeoMappingManagerEngine> m_engine;
QGeoMapController *m_controller;
QGeoCameraData m_cameraData;
diff --git a/src/location/maps/qgeotiledmap.cpp b/src/location/maps/qgeotiledmap.cpp
index fedaecbc..04f9ad21 100644
--- a/src/location/maps/qgeotiledmap.cpp
+++ b/src/location/maps/qgeotiledmap.cpp
@@ -142,8 +142,8 @@ QGeoCoordinate QGeoTiledMap::itemPositionToCoordinate(const QDoubleVector2D &pos
{
Q_D(const QGeoTiledMap);
if (clipToViewport) {
- int w = width();
- int h = height();
+ int w = viewportWidth();
+ int h = viewportHeight();
if ((pos.x() < 0) || (w < pos.x()) || (pos.y() < 0) || (h < pos.y()))
return QGeoCoordinate();
@@ -158,8 +158,8 @@ QDoubleVector2D QGeoTiledMap::coordinateToItemPosition(const QGeoCoordinate &coo
QDoubleVector2D pos = d->coordinateToItemPosition(coordinate);
if (clipToViewport) {
- int w = width();
- int h = height();
+ int w = viewportWidth();
+ int h = viewportHeight();
double x = pos.x();
double y = pos.y();
if ((x < 0.0) || (x > w) || (y < 0) || (y > h) || qIsNaN(x) || qIsNaN(y))
@@ -171,7 +171,7 @@ QDoubleVector2D QGeoTiledMap::coordinateToItemPosition(const QGeoCoordinate &coo
// 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::minimumZoomAtMapSize(int width, int height) const
+double QGeoTiledMap::minimumZoomAtViewportSize(int width, int height) const
{
Q_D(const QGeoTiledMap);
double maxSize = qMax(width,height);
@@ -192,7 +192,7 @@ double QGeoTiledMap::maximumCenterLatitudeAtZoom(double zoomLevel) const
mapEdgeSize *= d->m_visibleTiles->tileSize();
// At init time weird things happen
- int clampedWindowHeight = (height() > mapEdgeSize) ? mapEdgeSize : height();
+ int clampedWindowHeight = (viewportHeight() > mapEdgeSize) ? mapEdgeSize : viewportHeight();
// 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 ;
@@ -375,7 +375,7 @@ void QGeoTiledMapPrivate::clearScene()
updateScene();
}
-void QGeoTiledMapPrivate::changeMapSize(const QSize& size)
+void QGeoTiledMapPrivate::changeViewportSize(const QSize& size)
{
Q_Q(QGeoTiledMap);
diff --git a/src/location/maps/qgeotiledmap_p.h b/src/location/maps/qgeotiledmap_p.h
index 791384c7..d00a1ed9 100644
--- a/src/location/maps/qgeotiledmap_p.h
+++ b/src/location/maps/qgeotiledmap_p.h
@@ -86,7 +86,7 @@ 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 minimumZoomAtMapSize(int width, int height) const Q_DECL_OVERRIDE;
+ double minimumZoomAtViewportSize(int viewportWidth, int viewportHeight) const Q_DECL_OVERRIDE;
double maximumCenterLatitudeAtZoom(double zoomLevel) const Q_DECL_OVERRIDE;
diff --git a/src/location/maps/qgeotiledmap_p_p.h b/src/location/maps/qgeotiledmap_p_p.h
index ab36f6f7..01646d66 100644
--- a/src/location/maps/qgeotiledmap_p_p.h
+++ b/src/location/maps/qgeotiledmap_p_p.h
@@ -83,7 +83,7 @@ public:
QGeoMapType activeMapType();
protected:
- void changeMapSize(const QSize& size) Q_DECL_OVERRIDE;
+ void changeViewportSize(const QSize& size) Q_DECL_OVERRIDE;
void changeCameraData(const QGeoCameraData &cameraData) Q_DECL_OVERRIDE;
void changeActiveMapType(const QGeoMapType mapType) Q_DECL_OVERRIDE;
void changeTileVersion(int version);