summaryrefslogtreecommitdiff
path: root/include/mbgl
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-03-23 18:10:16 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-03-24 13:51:35 +0200
commit80915992ab4e970ca005009ca1175bae24cb448b (patch)
tree75cfac7d0933b77ad5e93e95471cc0b96e85ba88 /include/mbgl
parente67abfbe67d7c08e90fdbd8727c4e9ed17dfa1ed (diff)
downloadqtlocation-mapboxgl-80915992ab4e970ca005009ca1175bae24cb448b.tar.gz
[core] Added Map::latLngBoundsForCamera
Diffstat (limited to 'include/mbgl')
-rw-r--r--include/mbgl/map/camera.hpp13
-rw-r--r--include/mbgl/map/map.hpp1
-rw-r--r--include/mbgl/util/geo.hpp8
3 files changed, 22 insertions, 0 deletions
diff --git a/include/mbgl/map/camera.hpp b/include/mbgl/map/camera.hpp
index 1c389577f0..20b863cf4e 100644
--- a/include/mbgl/map/camera.hpp
+++ b/include/mbgl/map/camera.hpp
@@ -36,6 +36,19 @@ struct CameraOptions {
optional<double> pitch;
};
+constexpr bool operator==(const CameraOptions& a, const CameraOptions& b) {
+ return a.center == b.center
+ && a.padding == b.padding
+ && a.anchor == b.anchor
+ && a.zoom == b.zoom
+ && a.angle == b.angle
+ && a.pitch == b.pitch;
+}
+
+constexpr bool operator!=(const CameraOptions& a, const CameraOptions& b) {
+ return !(a == b);
+}
+
/** Various options for describing a transition between viewpoints with
animation. All fields are optional; the default values depend on how this
struct is used. */
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index 30963f25db..d4eb0ce8d1 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -107,6 +107,7 @@ public:
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;
+ LatLngBounds latLngBoundsForCamera(const CameraOptions&) const;
void resetZoom();
void setMinZoom(const double minZoom);
double getMinZoom() const;
diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp
index 57a028e467..2cc9297aae 100644
--- a/include/mbgl/util/geo.hpp
+++ b/include/mbgl/util/geo.hpp
@@ -218,4 +218,12 @@ public:
ScreenCoordinate getCenter(uint16_t width, uint16_t height) const;
};
+constexpr bool operator==(const EdgeInsets& a, const EdgeInsets& b) {
+ return a.top == b.top && a.left == b.left && a.bottom == b.bottom && a.right == b.right;
+}
+
+constexpr bool operator!=(const EdgeInsets& a, const EdgeInsets& b) {
+ return !(a == b);
+}
+
} // namespace mbgl