summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-04-11 13:40:17 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-04-11 14:50:22 -0700
commit62576e24a0e98a73c1396150f1f09acb838080e6 (patch)
tree0a322ed0db5965071e9f78ef6e12bf83056b8421 /include
parentb71d86599d5e7c265b320300b18cfc0ea082c6d2 (diff)
downloadqtlocation-mapboxgl-62576e24a0e98a73c1396150f1f09acb838080e6.tar.gz
[core] Revert use of optional<EdgeInsets>, because EdgeInsets has a natural "empty" state
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/map/camera.hpp2
-rw-r--r--include/mbgl/map/map.hpp20
-rw-r--r--include/mbgl/util/geo.hpp3
3 files changed, 14 insertions, 11 deletions
diff --git a/include/mbgl/map/camera.hpp b/include/mbgl/map/camera.hpp
index 20b863cf4e..53b5b590b1 100644
--- a/include/mbgl/map/camera.hpp
+++ b/include/mbgl/map/camera.hpp
@@ -17,7 +17,7 @@ struct CameraOptions {
/** Padding around the interior of the view that affects the frame of
reference for `center`. */
- optional<EdgeInsets> padding;
+ EdgeInsets padding;
/** Point of reference for `zoom` and `angle`, assuming an origin at the
top-left corner of the view. */
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index 74942e211d..c39009c8da 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -82,7 +82,7 @@ public:
bool isPanning() const;
// Camera
- CameraOptions getCameraOptions(optional<EdgeInsets>) const;
+ CameraOptions getCameraOptions(const EdgeInsets&) const;
void jumpTo(const CameraOptions&);
void easeTo(const CameraOptions&, const AnimationOptions&);
void flyTo(const CameraOptions&, const AnimationOptions&);
@@ -90,10 +90,10 @@ public:
// Position
void moveBy(const ScreenCoordinate&, const AnimationOptions& = {});
void setLatLng(const LatLng&, optional<ScreenCoordinate>, const AnimationOptions& = {});
- void setLatLng(const LatLng&, optional<EdgeInsets>, const AnimationOptions& = {});
+ void setLatLng(const LatLng&, const EdgeInsets&, const AnimationOptions& = {});
void setLatLng(const LatLng&, const AnimationOptions& = {});
- LatLng getLatLng(optional<EdgeInsets> = {}) const;
- void resetPosition(optional<EdgeInsets> = {});
+ LatLng getLatLng(const EdgeInsets& = {}) const;
+ void resetPosition(const EdgeInsets& = {});
// Scale
void scaleBy(double ds, optional<ScreenCoordinate> = {}, const AnimationOptions& = {});
@@ -101,12 +101,12 @@ public:
double getScale() const;
void setZoom(double zoom, const AnimationOptions& = {});
void setZoom(double zoom, optional<ScreenCoordinate>, const AnimationOptions& = {});
- void setZoom(double zoom, optional<EdgeInsets>, const AnimationOptions& = {});
+ void setZoom(double zoom, const EdgeInsets&, const AnimationOptions& = {});
double getZoom() const;
void setLatLngZoom(const LatLng&, double zoom, const AnimationOptions& = {});
- void setLatLngZoom(const LatLng&, double zoom, optional<EdgeInsets>, const AnimationOptions& = {});
- CameraOptions cameraForLatLngBounds(const LatLngBounds&, optional<EdgeInsets>) const;
- CameraOptions cameraForLatLngs(const std::vector<LatLng>&, optional<EdgeInsets>) const;
+ void setLatLngZoom(const LatLng&, double zoom, const EdgeInsets&, const AnimationOptions& = {});
+ CameraOptions cameraForLatLngBounds(const LatLngBounds&, const EdgeInsets&) const;
+ CameraOptions cameraForLatLngs(const std::vector<LatLng>&, const EdgeInsets&) const;
LatLngBounds latLngBoundsForCamera(const CameraOptions&) const;
void resetZoom();
@@ -126,10 +126,10 @@ public:
void rotateBy(const ScreenCoordinate& first, const ScreenCoordinate& second, const AnimationOptions& = {});
void setBearing(double degrees, const AnimationOptions& = {});
void setBearing(double degrees, optional<ScreenCoordinate>, const AnimationOptions& = {});
- void setBearing(double degrees, optional<EdgeInsets>, const AnimationOptions& = {});
+ void setBearing(double degrees, const EdgeInsets&, const AnimationOptions& = {});
double getBearing() const;
void resetNorth(const AnimationOptions& = {{mbgl::Milliseconds(500)}});
- void resetNorth(optional<EdgeInsets>, const AnimationOptions& = {{mbgl::Milliseconds(500)}});
+ void resetNorth(const EdgeInsets&, const AnimationOptions& = {{mbgl::Milliseconds(500)}});
// Pitch
void setPitch(double pitch, const AnimationOptions& = {});
diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp
index 04aa1e1bfa..edd40e73ca 100644
--- a/include/mbgl/util/geo.hpp
+++ b/include/mbgl/util/geo.hpp
@@ -221,6 +221,9 @@ public:
EdgeInsets(const double t, const double l, const double b, const double r)
: top(t), left(l), bottom(b), right(r) {}
+ bool isFlush() const {
+ return top == 0 && left == 0 && bottom == 0 && right == 0;
+ }
void operator+=(const EdgeInsets& o) {
top += o.top;