summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-03-30 16:24:21 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-04-11 12:51:09 +0300
commitddc6dcf9cdaee59e6f31b7bfa05932f1980feba4 (patch)
treef8971cba38b289d639186d2bdcaf62977ccb20fb
parent6a0c4e0142ef44d7c9f3f05e9a7ddfed985809ad (diff)
downloadqtlocation-mapboxgl-ddc6dcf9cdaee59e6f31b7bfa05932f1980feba4.tar.gz
[core] Move {Map,Transform}::{get,set}{Min,Max}Zoom to bounds pragma
-rw-r--r--include/mbgl/map/map.hpp6
-rw-r--r--src/mbgl/map/map.cpp3
-rw-r--r--src/mbgl/map/transform.cpp2
-rw-r--r--src/mbgl/map/transform.hpp8
-rw-r--r--src/mbgl/map/transform_state.cpp2
-rw-r--r--src/mbgl/map/transform_state.hpp6
6 files changed, 20 insertions, 7 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index d4eb0ce8d1..b740c3462e 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -109,9 +109,11 @@ public:
CameraOptions cameraForLatLngs(const std::vector<LatLng>&, optional<EdgeInsets>) const;
LatLngBounds latLngBoundsForCamera(const CameraOptions&) const;
void resetZoom();
- void setMinZoom(const double minZoom);
+
+ // Bounds
+ void setMinZoom(double);
double getMinZoom() const;
- void setMaxZoom(const double maxZoom);
+ void setMaxZoom(double);
double getMaxZoom() const;
// Rotation
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 60113b5733..f42c11bdbb 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -664,6 +664,9 @@ void Map::resetZoom() {
setZoom(0);
}
+#pragma mark - Bounds
+
+
void Map::setMinZoom(const double minZoom) {
impl->transform.setMinZoom(minZoom);
if (getZoom() < minZoom) {
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp
index 5104aa0562..b8c3c3fefb 100644
--- a/src/mbgl/map/transform.cpp
+++ b/src/mbgl/map/transform.cpp
@@ -433,6 +433,8 @@ void Transform::setScale(double scale, optional<EdgeInsets> padding, const Anima
setScale(scale, anchor, animation);
}
+#pragma mark - Bounds
+
void Transform::setMinZoom(const double minZoom) {
if (std::isnan(minZoom)) return;
state.setMinZoom(minZoom);
diff --git a/src/mbgl/map/transform.hpp b/src/mbgl/map/transform.hpp
index 15b97cb198..4b97e07b52 100644
--- a/src/mbgl/map/transform.hpp
+++ b/src/mbgl/map/transform.hpp
@@ -55,6 +55,11 @@ public:
LatLng getLatLng(optional<EdgeInsets> = {}) const;
ScreenCoordinate getScreenCoordinate(optional<EdgeInsets> = {}) const;
+ // Bounds
+
+ void setMinZoom(double);
+ void setMaxZoom(double);
+
// Zoom
/** Scales the map, keeping the given point fixed within the view.
@@ -94,9 +99,6 @@ public:
/** Returns the scale factor. */
double getScale() const;
- void setMinZoom(const double minZoom);
- void setMaxZoom(const double maxZoom);
-
// Angle
void rotateBy(const ScreenCoordinate& first, const ScreenCoordinate& second, const AnimationOptions& = {});
diff --git a/src/mbgl/map/transform_state.cpp b/src/mbgl/map/transform_state.cpp
index 2e97cc9bc8..3336c71125 100644
--- a/src/mbgl/map/transform_state.cpp
+++ b/src/mbgl/map/transform_state.cpp
@@ -140,6 +140,8 @@ double TransformState::getScale() const {
return scale;
}
+#pragma mark - Bounds
+
void TransformState::setMinZoom(const double minZoom) {
if (minZoom <= getMaxZoom()) {
min_scale = zoomScale(util::clamp(minZoom, util::MIN_ZOOM, util::MAX_ZOOM));
diff --git a/src/mbgl/map/transform_state.hpp b/src/mbgl/map/transform_state.hpp
index d281c31995..4a0218e10e 100644
--- a/src/mbgl/map/transform_state.hpp
+++ b/src/mbgl/map/transform_state.hpp
@@ -49,9 +49,11 @@ public:
double getZoom() const;
int32_t getIntegerZoom() const;
double getZoomFraction() const;
- void setMinZoom(const double minZoom);
+
+ // Bounds
+ void setMinZoom(double);
double getMinZoom() const;
- void setMaxZoom(const double maxZoom);
+ void setMaxZoom(double);
double getMaxZoom() const;
// Rotation