summaryrefslogtreecommitdiff
path: root/src/mbgl/map/map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/map/map.cpp')
-rw-r--r--src/mbgl/map/map.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 7e72595149..eda16160ae 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -128,7 +128,7 @@ bool Map::isPanning() const {
#pragma mark -
-CameraOptions Map::getCameraOptions(optional<EdgeInsets> padding) const {
+CameraOptions Map::getCameraOptions(const optional<EdgeInsets>& padding) const {
return impl->transform.getCameraOptions(padding);
}
@@ -158,7 +158,7 @@ void Map::pitchBy(double pitch, const AnimationOptions& animation) {
easeTo(CameraOptions().withPitch((impl->transform.getPitch() * util::RAD2DEG) - pitch), animation);
}
-void Map::scaleBy(double scale, optional<ScreenCoordinate> anchor, const AnimationOptions& animation) {
+void Map::scaleBy(double scale, const optional<ScreenCoordinate>& anchor, const AnimationOptions& animation) {
const double zoom = impl->transform.getZoom() + impl->transform.getState().scaleZoom(scale);
easeTo(CameraOptions().withZoom(zoom).withAnchor(anchor), animation);
}
@@ -169,13 +169,20 @@ void Map::rotateBy(const ScreenCoordinate& first, const ScreenCoordinate& second
impl->onUpdate();
}
-CameraOptions Map::cameraForLatLngBounds(const LatLngBounds& bounds, const EdgeInsets& padding, optional<double> bearing, optional<double> pitch) const {
- return cameraForLatLngs({
- bounds.northwest(),
- bounds.southwest(),
- bounds.southeast(),
- bounds.northeast(),
- }, padding, bearing, pitch);
+CameraOptions Map::cameraForLatLngBounds(const LatLngBounds& bounds,
+ const EdgeInsets& padding,
+ const optional<double>& bearing,
+ const optional<double>& pitch) const {
+ return cameraForLatLngs(
+ {
+ bounds.northwest(),
+ bounds.southwest(),
+ bounds.southeast(),
+ bounds.northeast(),
+ },
+ padding,
+ bearing,
+ pitch);
}
CameraOptions cameraForLatLngs(const std::vector<LatLng>& latLngs, const Transform& transform, const EdgeInsets& padding) {
@@ -223,8 +230,10 @@ CameraOptions cameraForLatLngs(const std::vector<LatLng>& latLngs, const Transfo
.withZoom(zoom);
}
-CameraOptions Map::cameraForLatLngs(const std::vector<LatLng>& latLngs, const EdgeInsets& padding, optional<double> bearing, optional<double> pitch) const {
-
+CameraOptions Map::cameraForLatLngs(const std::vector<LatLng>& latLngs,
+ const EdgeInsets& padding,
+ const optional<double>& bearing,
+ const optional<double>& pitch) const {
if (!bearing && !pitch) {
return mbgl::cameraForLatLngs(latLngs, impl->transform, padding);
}
@@ -240,8 +249,10 @@ CameraOptions Map::cameraForLatLngs(const std::vector<LatLng>& latLngs, const Ed
.withPitch(transform.getPitch() * util::RAD2DEG);
}
-CameraOptions Map::cameraForGeometry(const Geometry<double>& geometry, const EdgeInsets& padding, optional<double> bearing, optional<double> pitch) const {
-
+CameraOptions Map::cameraForGeometry(const Geometry<double>& geometry,
+ const EdgeInsets& padding,
+ const optional<double>& bearing,
+ const optional<double>& pitch) const {
std::vector<LatLng> latLngs;
forEachPoint(geometry, [&](const Point<double>& pt) {
latLngs.emplace_back(pt.y, pt.x);