diff options
Diffstat (limited to 'include/mbgl/map')
-rw-r--r-- | include/mbgl/map/map.hpp | 46 | ||||
-rw-r--r-- | include/mbgl/map/update.hpp | 17 |
2 files changed, 28 insertions, 35 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 3b8cea83a8..9d586d8b8a 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -1,6 +1,7 @@ #ifndef MBGL_MAP_MAP #define MBGL_MAP_MAP +#include <mbgl/util/optional.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/image.hpp> #include <mbgl/map/update.hpp> @@ -10,6 +11,7 @@ #include <mbgl/util/vec.hpp> #include <mbgl/annotation/annotation.hpp> #include <mbgl/style/types.hpp> +#include <mbgl/style/property_transition.hpp> #include <cstdint> #include <string> @@ -63,21 +65,13 @@ public: void update(Update update); // Styling - void addClass(const std::string&); - void removeClass(const std::string&); + void addClass(const std::string&, const PropertyTransition& = {}); + void removeClass(const std::string&, const PropertyTransition& = {}); + void setClasses(const std::vector<std::string>&, const PropertyTransition& = {}); + bool hasClass(const std::string&) const; - void setClasses(const std::vector<std::string>&); std::vector<std::string> getClasses() const; - void setDefaultFadeDuration(const Duration&); - Duration getDefaultFadeDuration() const; - - void setDefaultTransitionDuration(const Duration&); - Duration getDefaultTransitionDuration() const; - - void setDefaultTransitionDelay(const Duration&); - Duration getDefaultTransitionDelay() const; - void setStyleURL(const std::string& url); void setStyleJSON(const std::string& json, const std::string& base = ""); std::string getStyleURL() const; @@ -98,23 +92,23 @@ public: // Position void moveBy(const ScreenCoordinate&, const Duration& = Duration::zero()); - void setLatLng(const LatLng&, const ScreenCoordinate&, const Duration& = Duration::zero()); - void setLatLng(const LatLng&, const EdgeInsets&, const Duration& = Duration::zero()); + void setLatLng(const LatLng&, optional<ScreenCoordinate>, const Duration& = Duration::zero()); + void setLatLng(const LatLng&, optional<EdgeInsets>, const Duration& = Duration::zero()); void setLatLng(const LatLng&, const Duration& = Duration::zero()); - LatLng getLatLng(const EdgeInsets& = {}) const; - void resetPosition(const EdgeInsets& = {}); + LatLng getLatLng(optional<EdgeInsets> = {}) const; + void resetPosition(optional<EdgeInsets> = {}); // Scale - void scaleBy(double ds, const ScreenCoordinate& = { NAN, NAN }, const Duration& = Duration::zero()); - void setScale(double scale, const ScreenCoordinate& = { NAN, NAN }, const Duration& = Duration::zero()); + void scaleBy(double ds, optional<ScreenCoordinate> = {}, const Duration& = Duration::zero()); + void setScale(double scale, optional<ScreenCoordinate> = {}, const Duration& = Duration::zero()); double getScale() const; void setZoom(double zoom, const Duration& = Duration::zero()); - void setZoom(double zoom, const EdgeInsets&, const Duration& = Duration::zero()); + void setZoom(double zoom, optional<EdgeInsets>, const Duration& = Duration::zero()); double getZoom() const; void setLatLngZoom(const LatLng&, double zoom, const Duration& = Duration::zero()); - void setLatLngZoom(const LatLng&, double zoom, const EdgeInsets&, const Duration& = Duration::zero()); - CameraOptions cameraForLatLngBounds(const LatLngBounds&, const EdgeInsets&); - CameraOptions cameraForLatLngs(const std::vector<LatLng>&, const EdgeInsets&); + void setLatLngZoom(const LatLng&, double zoom, optional<EdgeInsets>, const Duration& = Duration::zero()); + CameraOptions cameraForLatLngBounds(const LatLngBounds&, optional<EdgeInsets>); + CameraOptions cameraForLatLngs(const std::vector<LatLng>&, optional<EdgeInsets>); void resetZoom(); void setMinZoom(const double minZoom); double getMinZoom() const; @@ -124,15 +118,15 @@ public: // Rotation void rotateBy(const ScreenCoordinate& first, const ScreenCoordinate& second, const Duration& = Duration::zero()); void setBearing(double degrees, const Duration& = Duration::zero()); - void setBearing(double degrees, const ScreenCoordinate&, const Duration& = Duration::zero()); - void setBearing(double degrees, const EdgeInsets&, const Duration& = Duration::zero()); + void setBearing(double degrees, optional<ScreenCoordinate>, const Duration& = Duration::zero()); + void setBearing(double degrees, optional<EdgeInsets>, const Duration& = Duration::zero()); double getBearing() const; void resetNorth(const Duration& = Milliseconds(500)); - void resetNorth(const EdgeInsets&, const Duration& = Milliseconds(500)); + void resetNorth(optional<EdgeInsets>, const Duration& = Milliseconds(500)); // Pitch void setPitch(double pitch, const Duration& = Duration::zero()); - void setPitch(double pitch, const ScreenCoordinate&, const Duration& = Duration::zero()); + void setPitch(double pitch, optional<ScreenCoordinate>, const Duration& = Duration::zero()); double getPitch() const; // North Orientation diff --git a/include/mbgl/map/update.hpp b/include/mbgl/map/update.hpp index 83c2637559..e47feea949 100644 --- a/include/mbgl/map/update.hpp +++ b/include/mbgl/map/update.hpp @@ -5,19 +5,18 @@ namespace mbgl { -enum class Update : uint32_t { +enum class Update : uint8_t { Nothing = 0, Dimensions = 1 << 1, - DefaultTransition = 1 << 2, - Classes = 1 << 3, - Zoom = 1 << 4, - RenderStill = 1 << 5, - Repaint = 1 << 6, - Annotations = 1 << 7, + Classes = 1 << 2, + RecalculateStyle = 1 << 3, + RenderStill = 1 << 4, + Repaint = 1 << 5, + Annotations = 1 << 6, }; inline Update operator| (const Update& lhs, const Update& rhs) { - return Update(static_cast<uint32_t>(lhs) | static_cast<uint32_t>(rhs)); + return Update(static_cast<uint8_t>(lhs) | static_cast<uint8_t>(rhs)); } inline Update& operator|=(Update& lhs, const Update& rhs) { @@ -26,7 +25,7 @@ inline Update& operator|=(Update& lhs, const Update& rhs) { } inline bool operator& (const Update& lhs, const Update& rhs) { - return static_cast<uint32_t>(lhs) & static_cast<uint32_t>(rhs); + return static_cast<uint8_t>(lhs) & static_cast<uint8_t>(rhs); } } // namespace mbgl |