diff options
Diffstat (limited to 'include/mbgl')
-rw-r--r-- | include/mbgl/map/camera.hpp | 13 | ||||
-rw-r--r-- | include/mbgl/map/map.hpp | 1 | ||||
-rw-r--r-- | include/mbgl/util/geo.hpp | 8 |
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 |