summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@theqtcompany.com>2016-06-30 13:22:04 +0200
committerPaolo Angelelli <paolo.angelelli@theqtcompany.com>2016-06-30 13:18:01 +0000
commit7505c7ef734245bef4094fe627290a8836a6e3f8 (patch)
treeee9f2e600d034a469c48cad1cc4bdddec1897df0 /src
parent706f97d93b7e0e01bc287d9379e692ffd1bd08a6 (diff)
downloadqtlocation-7505c7ef734245bef4094fe627290a8836a6e3f8.tar.gz
Refactor: rename improperly named methods
After consultation, it seems that Qt favors using "At" rather than "For" in naming a method such as "maximumLatitudeForZoom". Moreover, this methods returns the maximum latitude that map center can have at a specific zoom level, so it is important to make that clear not only in the comments but also in the method's name. Change-Id: I26f0d18f8ca94b1bdd085cd49dd603d51a68689b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/imports/location/qdeclarativegeomap.cpp10
-rw-r--r--src/location/maps/qgeomap_p.h4
-rw-r--r--src/location/maps/qgeotiledmap.cpp4
-rw-r--r--src/location/maps/qgeotiledmap_p.h4
4 files changed, 11 insertions, 11 deletions
diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp
index a8d93fab..67cee411 100644
--- a/src/imports/location/qdeclarativegeomap.cpp
+++ b/src/imports/location/qdeclarativegeomap.cpp
@@ -280,10 +280,10 @@ void QDeclarativeGeoMap::initialize()
// try to keep center change signal in the end
bool centerHasChanged = false;
- setMinimumZoomLevel(m_map->minimumZoomForMapSize(width(), height()));
+ setMinimumZoomLevel(m_map->minimumZoomAtMapSize(width(), height()));
// set latitude bundary check
- m_maximumViewportLatitude = m_map->maximumLatitudeForZoom(m_cameraData.zoomLevel());
+ m_maximumViewportLatitude = m_map->maximumCenterLatitudeAtZoom(m_cameraData.zoomLevel());
QGeoCoordinate center = m_cameraData.center();
center.setLatitude(qBound(-m_maximumViewportLatitude, center.latitude(), m_maximumViewportLatitude));
@@ -589,7 +589,7 @@ void QDeclarativeGeoMap::setMinimumZoomLevel(qreal minimumZoomLevel)
if (m_map) {
minimumZoomLevel = qBound(qreal(m_map->cameraCapabilities().minimumZoomLevel()), minimumZoomLevel, maximumZoomLevel());
- double minimumViewportZoomLevel = m_map->minimumZoomForMapSize(width(),height());
+ double minimumViewportZoomLevel = m_map->minimumZoomAtMapSize(width(),height());
if (minimumZoomLevel < minimumViewportZoomLevel)
minimumZoomLevel = minimumViewportZoomLevel;
}
@@ -688,7 +688,7 @@ void QDeclarativeGeoMap::setZoomLevel(qreal zoomLevel)
if (m_initialized) {
m_cameraData.setZoomLevel(qBound(minimumZoomLevel(), zoomLevel, maximumZoomLevel()));
- m_maximumViewportLatitude = m_map->maximumLatitudeForZoom(m_cameraData.zoomLevel());
+ m_maximumViewportLatitude = m_map->maximumCenterLatitudeAtZoom(m_cameraData.zoomLevel());
QGeoCoordinate coord = m_cameraData.center();
coord.setLatitude(qBound(-m_maximumViewportLatitude, coord.latitude(), m_maximumViewportLatitude));
if (coord != m_cameraData.center()) {
@@ -1252,7 +1252,7 @@ void QDeclarativeGeoMap::geometryChanged(const QRectF &newGeometry, const QRectF
if (!m_initialized)
initialize();
else
- setMinimumZoomLevel(m_map->minimumZoomForMapSize(newGeometry.width(), newGeometry.height()));
+ setMinimumZoomLevel(m_map->minimumZoomAtMapSize(newGeometry.width(), newGeometry.height()));
/*!
The fitViewportTo*() functions depend on a valid map geometry.
diff --git a/src/location/maps/qgeomap_p.h b/src/location/maps/qgeomap_p.h
index 8f7642d4..c081a0d7 100644
--- a/src/location/maps/qgeomap_p.h
+++ b/src/location/maps/qgeomap_p.h
@@ -84,8 +84,8 @@ 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 minimumZoomForMapSize(int width, int height) const = 0;
- virtual double maximumLatitudeForZoom(double zoomLevel) const = 0;
+ virtual double minimumZoomAtMapSize(int width, int height) const = 0;
+ virtual double maximumCenterLatitudeAtZoom(double zoomLevel) const = 0;
virtual void prefetchData();
virtual void clearData();
diff --git a/src/location/maps/qgeotiledmap.cpp b/src/location/maps/qgeotiledmap.cpp
index 99af8ab5..ac02afa8 100644
--- a/src/location/maps/qgeotiledmap.cpp
+++ b/src/location/maps/qgeotiledmap.cpp
@@ -164,7 +164,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::minimumZoomForMapSize(int width, int height) const
+double QGeoTiledMap::minimumZoomAtMapSize(int width, int height) const
{
Q_D(const QGeoTiledMap);
double maxSize = qMax(width,height);
@@ -178,7 +178,7 @@ double QGeoTiledMap::minimumZoomForMapSize(int width, int height) const
// 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
+double QGeoTiledMap::maximumCenterLatitudeAtZoom(double zoomLevel) const
{
Q_D(const QGeoTiledMap);
double mapEdgeSize = std::pow(2.0,zoomLevel);
diff --git a/src/location/maps/qgeotiledmap_p.h b/src/location/maps/qgeotiledmap_p.h
index 6c735e86..5d31921b 100644
--- a/src/location/maps/qgeotiledmap_p.h
+++ b/src/location/maps/qgeotiledmap_p.h
@@ -86,8 +86,8 @@ 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;
+ double minimumZoomAtMapSize(int width, int height) const Q_DECL_OVERRIDE;
+ double maximumCenterLatitudeAtZoom(double zoomLevel) const Q_DECL_OVERRIDE;
void prefetchData() Q_DECL_OVERRIDE;
void clearData() Q_DECL_OVERRIDE;