diff options
Diffstat (limited to 'include/mbgl/style')
-rw-r--r-- | include/mbgl/style/conversion/make_property_setters.hpp | 58 | ||||
-rw-r--r-- | include/mbgl/style/conversion/make_property_setters.hpp.ejs | 1 | ||||
-rw-r--r-- | include/mbgl/style/conversion/property_setter.hpp | 19 | ||||
-rw-r--r-- | include/mbgl/style/conversion/transition_options.hpp | 45 | ||||
-rw-r--r-- | include/mbgl/style/layers/background_layer.hpp | 5 | ||||
-rw-r--r-- | include/mbgl/style/layers/circle_layer.hpp | 12 | ||||
-rw-r--r-- | include/mbgl/style/layers/fill_extrusion_layer.hpp | 9 | ||||
-rw-r--r-- | include/mbgl/style/layers/fill_layer.hpp | 9 | ||||
-rw-r--r-- | include/mbgl/style/layers/layer.hpp.ejs | 3 | ||||
-rw-r--r-- | include/mbgl/style/layers/line_layer.hpp | 12 | ||||
-rw-r--r-- | include/mbgl/style/layers/raster_layer.hpp | 9 | ||||
-rw-r--r-- | include/mbgl/style/layers/symbol_layer.hpp | 16 |
12 files changed, 198 insertions, 0 deletions
diff --git a/include/mbgl/style/conversion/make_property_setters.hpp b/include/mbgl/style/conversion/make_property_setters.hpp index e30359937e..32fa810f0b 100644 --- a/include/mbgl/style/conversion/make_property_setters.hpp +++ b/include/mbgl/style/conversion/make_property_setters.hpp @@ -77,69 +77,127 @@ auto makePaintPropertySetters() { std::unordered_map<std::string, PaintPropertySetter<V>> result; result["fill-antialias"] = makePropertySetter<V>(&FillLayer::setFillAntialias); + result["fill-antialias-transition"] = makeTransitionSetter<V>(&FillLayer::setFillAntialiasTransition); result["fill-opacity"] = makePropertySetter<V>(&FillLayer::setFillOpacity); + result["fill-opacity-transition"] = makeTransitionSetter<V>(&FillLayer::setFillOpacityTransition); result["fill-color"] = makePropertySetter<V>(&FillLayer::setFillColor); + result["fill-color-transition"] = makeTransitionSetter<V>(&FillLayer::setFillColorTransition); result["fill-outline-color"] = makePropertySetter<V>(&FillLayer::setFillOutlineColor); + result["fill-outline-color-transition"] = makeTransitionSetter<V>(&FillLayer::setFillOutlineColorTransition); result["fill-translate"] = makePropertySetter<V>(&FillLayer::setFillTranslate); + result["fill-translate-transition"] = makeTransitionSetter<V>(&FillLayer::setFillTranslateTransition); result["fill-translate-anchor"] = makePropertySetter<V>(&FillLayer::setFillTranslateAnchor); + result["fill-translate-anchor-transition"] = makeTransitionSetter<V>(&FillLayer::setFillTranslateAnchorTransition); result["fill-pattern"] = makePropertySetter<V>(&FillLayer::setFillPattern); + result["fill-pattern-transition"] = makeTransitionSetter<V>(&FillLayer::setFillPatternTransition); result["line-opacity"] = makePropertySetter<V>(&LineLayer::setLineOpacity); + result["line-opacity-transition"] = makeTransitionSetter<V>(&LineLayer::setLineOpacityTransition); result["line-color"] = makePropertySetter<V>(&LineLayer::setLineColor); + result["line-color-transition"] = makeTransitionSetter<V>(&LineLayer::setLineColorTransition); result["line-translate"] = makePropertySetter<V>(&LineLayer::setLineTranslate); + result["line-translate-transition"] = makeTransitionSetter<V>(&LineLayer::setLineTranslateTransition); result["line-translate-anchor"] = makePropertySetter<V>(&LineLayer::setLineTranslateAnchor); + result["line-translate-anchor-transition"] = makeTransitionSetter<V>(&LineLayer::setLineTranslateAnchorTransition); result["line-width"] = makePropertySetter<V>(&LineLayer::setLineWidth); + result["line-width-transition"] = makeTransitionSetter<V>(&LineLayer::setLineWidthTransition); result["line-gap-width"] = makePropertySetter<V>(&LineLayer::setLineGapWidth); + result["line-gap-width-transition"] = makeTransitionSetter<V>(&LineLayer::setLineGapWidthTransition); result["line-offset"] = makePropertySetter<V>(&LineLayer::setLineOffset); + result["line-offset-transition"] = makeTransitionSetter<V>(&LineLayer::setLineOffsetTransition); result["line-blur"] = makePropertySetter<V>(&LineLayer::setLineBlur); + result["line-blur-transition"] = makeTransitionSetter<V>(&LineLayer::setLineBlurTransition); result["line-dasharray"] = makePropertySetter<V>(&LineLayer::setLineDasharray); + result["line-dasharray-transition"] = makeTransitionSetter<V>(&LineLayer::setLineDasharrayTransition); result["line-pattern"] = makePropertySetter<V>(&LineLayer::setLinePattern); + result["line-pattern-transition"] = makeTransitionSetter<V>(&LineLayer::setLinePatternTransition); result["icon-opacity"] = makePropertySetter<V>(&SymbolLayer::setIconOpacity); + result["icon-opacity-transition"] = makeTransitionSetter<V>(&SymbolLayer::setIconOpacityTransition); result["icon-color"] = makePropertySetter<V>(&SymbolLayer::setIconColor); + result["icon-color-transition"] = makeTransitionSetter<V>(&SymbolLayer::setIconColorTransition); result["icon-halo-color"] = makePropertySetter<V>(&SymbolLayer::setIconHaloColor); + result["icon-halo-color-transition"] = makeTransitionSetter<V>(&SymbolLayer::setIconHaloColorTransition); result["icon-halo-width"] = makePropertySetter<V>(&SymbolLayer::setIconHaloWidth); + result["icon-halo-width-transition"] = makeTransitionSetter<V>(&SymbolLayer::setIconHaloWidthTransition); result["icon-halo-blur"] = makePropertySetter<V>(&SymbolLayer::setIconHaloBlur); + result["icon-halo-blur-transition"] = makeTransitionSetter<V>(&SymbolLayer::setIconHaloBlurTransition); result["icon-translate"] = makePropertySetter<V>(&SymbolLayer::setIconTranslate); + result["icon-translate-transition"] = makeTransitionSetter<V>(&SymbolLayer::setIconTranslateTransition); result["icon-translate-anchor"] = makePropertySetter<V>(&SymbolLayer::setIconTranslateAnchor); + result["icon-translate-anchor-transition"] = makeTransitionSetter<V>(&SymbolLayer::setIconTranslateAnchorTransition); result["text-opacity"] = makePropertySetter<V>(&SymbolLayer::setTextOpacity); + result["text-opacity-transition"] = makeTransitionSetter<V>(&SymbolLayer::setTextOpacityTransition); result["text-color"] = makePropertySetter<V>(&SymbolLayer::setTextColor); + result["text-color-transition"] = makeTransitionSetter<V>(&SymbolLayer::setTextColorTransition); result["text-halo-color"] = makePropertySetter<V>(&SymbolLayer::setTextHaloColor); + result["text-halo-color-transition"] = makeTransitionSetter<V>(&SymbolLayer::setTextHaloColorTransition); result["text-halo-width"] = makePropertySetter<V>(&SymbolLayer::setTextHaloWidth); + result["text-halo-width-transition"] = makeTransitionSetter<V>(&SymbolLayer::setTextHaloWidthTransition); result["text-halo-blur"] = makePropertySetter<V>(&SymbolLayer::setTextHaloBlur); + result["text-halo-blur-transition"] = makeTransitionSetter<V>(&SymbolLayer::setTextHaloBlurTransition); result["text-translate"] = makePropertySetter<V>(&SymbolLayer::setTextTranslate); + result["text-translate-transition"] = makeTransitionSetter<V>(&SymbolLayer::setTextTranslateTransition); result["text-translate-anchor"] = makePropertySetter<V>(&SymbolLayer::setTextTranslateAnchor); + result["text-translate-anchor-transition"] = makeTransitionSetter<V>(&SymbolLayer::setTextTranslateAnchorTransition); result["circle-radius"] = makePropertySetter<V>(&CircleLayer::setCircleRadius); + result["circle-radius-transition"] = makeTransitionSetter<V>(&CircleLayer::setCircleRadiusTransition); result["circle-color"] = makePropertySetter<V>(&CircleLayer::setCircleColor); + result["circle-color-transition"] = makeTransitionSetter<V>(&CircleLayer::setCircleColorTransition); result["circle-blur"] = makePropertySetter<V>(&CircleLayer::setCircleBlur); + result["circle-blur-transition"] = makeTransitionSetter<V>(&CircleLayer::setCircleBlurTransition); result["circle-opacity"] = makePropertySetter<V>(&CircleLayer::setCircleOpacity); + result["circle-opacity-transition"] = makeTransitionSetter<V>(&CircleLayer::setCircleOpacityTransition); result["circle-translate"] = makePropertySetter<V>(&CircleLayer::setCircleTranslate); + result["circle-translate-transition"] = makeTransitionSetter<V>(&CircleLayer::setCircleTranslateTransition); result["circle-translate-anchor"] = makePropertySetter<V>(&CircleLayer::setCircleTranslateAnchor); + result["circle-translate-anchor-transition"] = makeTransitionSetter<V>(&CircleLayer::setCircleTranslateAnchorTransition); result["circle-pitch-scale"] = makePropertySetter<V>(&CircleLayer::setCirclePitchScale); + result["circle-pitch-scale-transition"] = makeTransitionSetter<V>(&CircleLayer::setCirclePitchScaleTransition); result["circle-stroke-width"] = makePropertySetter<V>(&CircleLayer::setCircleStrokeWidth); + result["circle-stroke-width-transition"] = makeTransitionSetter<V>(&CircleLayer::setCircleStrokeWidthTransition); result["circle-stroke-color"] = makePropertySetter<V>(&CircleLayer::setCircleStrokeColor); + result["circle-stroke-color-transition"] = makeTransitionSetter<V>(&CircleLayer::setCircleStrokeColorTransition); result["circle-stroke-opacity"] = makePropertySetter<V>(&CircleLayer::setCircleStrokeOpacity); + result["circle-stroke-opacity-transition"] = makeTransitionSetter<V>(&CircleLayer::setCircleStrokeOpacityTransition); result["fill-extrusion-opacity"] = makePropertySetter<V>(&FillExtrusionLayer::setFillExtrusionOpacity); + result["fill-extrusion-opacity-transition"] = makeTransitionSetter<V>(&FillExtrusionLayer::setFillExtrusionOpacityTransition); result["fill-extrusion-color"] = makePropertySetter<V>(&FillExtrusionLayer::setFillExtrusionColor); + result["fill-extrusion-color-transition"] = makeTransitionSetter<V>(&FillExtrusionLayer::setFillExtrusionColorTransition); result["fill-extrusion-translate"] = makePropertySetter<V>(&FillExtrusionLayer::setFillExtrusionTranslate); + result["fill-extrusion-translate-transition"] = makeTransitionSetter<V>(&FillExtrusionLayer::setFillExtrusionTranslateTransition); result["fill-extrusion-translate-anchor"] = makePropertySetter<V>(&FillExtrusionLayer::setFillExtrusionTranslateAnchor); + result["fill-extrusion-translate-anchor-transition"] = makeTransitionSetter<V>(&FillExtrusionLayer::setFillExtrusionTranslateAnchorTransition); result["fill-extrusion-pattern"] = makePropertySetter<V>(&FillExtrusionLayer::setFillExtrusionPattern); + result["fill-extrusion-pattern-transition"] = makeTransitionSetter<V>(&FillExtrusionLayer::setFillExtrusionPatternTransition); result["fill-extrusion-height"] = makePropertySetter<V>(&FillExtrusionLayer::setFillExtrusionHeight); + result["fill-extrusion-height-transition"] = makeTransitionSetter<V>(&FillExtrusionLayer::setFillExtrusionHeightTransition); result["fill-extrusion-base"] = makePropertySetter<V>(&FillExtrusionLayer::setFillExtrusionBase); + result["fill-extrusion-base-transition"] = makeTransitionSetter<V>(&FillExtrusionLayer::setFillExtrusionBaseTransition); result["raster-opacity"] = makePropertySetter<V>(&RasterLayer::setRasterOpacity); + result["raster-opacity-transition"] = makeTransitionSetter<V>(&RasterLayer::setRasterOpacityTransition); result["raster-hue-rotate"] = makePropertySetter<V>(&RasterLayer::setRasterHueRotate); + result["raster-hue-rotate-transition"] = makeTransitionSetter<V>(&RasterLayer::setRasterHueRotateTransition); result["raster-brightness-min"] = makePropertySetter<V>(&RasterLayer::setRasterBrightnessMin); + result["raster-brightness-min-transition"] = makeTransitionSetter<V>(&RasterLayer::setRasterBrightnessMinTransition); result["raster-brightness-max"] = makePropertySetter<V>(&RasterLayer::setRasterBrightnessMax); + result["raster-brightness-max-transition"] = makeTransitionSetter<V>(&RasterLayer::setRasterBrightnessMaxTransition); result["raster-saturation"] = makePropertySetter<V>(&RasterLayer::setRasterSaturation); + result["raster-saturation-transition"] = makeTransitionSetter<V>(&RasterLayer::setRasterSaturationTransition); result["raster-contrast"] = makePropertySetter<V>(&RasterLayer::setRasterContrast); + result["raster-contrast-transition"] = makeTransitionSetter<V>(&RasterLayer::setRasterContrastTransition); result["raster-fade-duration"] = makePropertySetter<V>(&RasterLayer::setRasterFadeDuration); + result["raster-fade-duration-transition"] = makeTransitionSetter<V>(&RasterLayer::setRasterFadeDurationTransition); result["background-color"] = makePropertySetter<V>(&BackgroundLayer::setBackgroundColor); + result["background-color-transition"] = makeTransitionSetter<V>(&BackgroundLayer::setBackgroundColorTransition); result["background-pattern"] = makePropertySetter<V>(&BackgroundLayer::setBackgroundPattern); + result["background-pattern-transition"] = makeTransitionSetter<V>(&BackgroundLayer::setBackgroundPatternTransition); result["background-opacity"] = makePropertySetter<V>(&BackgroundLayer::setBackgroundOpacity); + result["background-opacity-transition"] = makeTransitionSetter<V>(&BackgroundLayer::setBackgroundOpacityTransition); return result; } diff --git a/include/mbgl/style/conversion/make_property_setters.hpp.ejs b/include/mbgl/style/conversion/make_property_setters.hpp.ejs index ed8f6e891c..65fbdea63e 100644 --- a/include/mbgl/style/conversion/make_property_setters.hpp.ejs +++ b/include/mbgl/style/conversion/make_property_setters.hpp.ejs @@ -36,6 +36,7 @@ auto makePaintPropertySetters() { <% for (const layer of locals.layers) { -%> <% for (const property of layer.paintProperties) { -%> result["<%- property.name %>"] = makePropertySetter<V>(&<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>); + result["<%- property.name %>-transition"] = makeTransitionSetter<V>(&<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>Transition); <% } -%> <% } -%> diff --git a/include/mbgl/style/conversion/property_setter.hpp b/include/mbgl/style/conversion/property_setter.hpp index 52fb160fde..6a15c64026 100644 --- a/include/mbgl/style/conversion/property_setter.hpp +++ b/include/mbgl/style/conversion/property_setter.hpp @@ -5,6 +5,7 @@ #include <mbgl/style/conversion/constant.hpp> #include <mbgl/style/conversion/property_value.hpp> #include <mbgl/style/conversion/data_driven_property_value.hpp> +#include <mbgl/style/conversion/transition_options.hpp> #include <functional> #include <string> @@ -37,6 +38,24 @@ auto makePropertySetter(void (L::*setter)(PropertyValue, const Args&...args)) { }; } +template <class V, class L, class...Args> +auto makeTransitionSetter(void (L::*setter)(const TransitionOptions&, const Args&...args)) { + return [setter] (Layer& layer, const V& value, const Args&...args) -> optional<Error> { + L* typedLayer = layer.as<L>(); + if (!typedLayer) { + return Error { "layer doesn't support this property" }; + } + + Result<TransitionOptions> transition = convert<TransitionOptions>(value); + if (!transition) { + return transition.error(); + } + + (typedLayer->*setter)(*transition, args...); + return {}; + }; +} + template <class V> optional<Error> setVisibility(Layer& layer, const V& value) { if (isUndefined(value)) { diff --git a/include/mbgl/style/conversion/transition_options.hpp b/include/mbgl/style/conversion/transition_options.hpp new file mode 100644 index 0000000000..cdd65cfe9f --- /dev/null +++ b/include/mbgl/style/conversion/transition_options.hpp @@ -0,0 +1,45 @@ +#pragma once + +#include <mbgl/style/transition_options.hpp> +#include <mbgl/style/conversion.hpp> + +namespace mbgl { +namespace style { +namespace conversion { + +template <> +struct Converter<TransitionOptions> { +public: + template <class V> + Result<TransitionOptions> operator()(const V& value) const { + if (!isObject(value)) { + return Error { "transition must be an object" }; + } + + TransitionOptions result; + + auto duration = objectMember(value, "duration"); + if (duration) { + auto number = toNumber(*duration); + if (!number) { + return Error { "duration must be a number" }; + } + result.duration = { std::chrono::milliseconds(int64_t(*number)) }; + } + + auto delay = objectMember(value, "delay"); + if (delay) { + auto number = toNumber(*delay); + if (!number) { + return Error { "delay must be a number" }; + } + result.delay = { std::chrono::milliseconds(int64_t(*number)) }; + } + + return result; + } +}; + +} // namespace conversion +} // namespace style +} // namespace mbgl diff --git a/include/mbgl/style/layers/background_layer.hpp b/include/mbgl/style/layers/background_layer.hpp index 050cb67df6..94076931e7 100644 --- a/include/mbgl/style/layers/background_layer.hpp +++ b/include/mbgl/style/layers/background_layer.hpp @@ -12,6 +12,8 @@ namespace mbgl { namespace style { +class TransitionOptions; + class BackgroundLayer : public Layer { public: BackgroundLayer(const std::string& layerID); @@ -22,14 +24,17 @@ public: static PropertyValue<Color> getDefaultBackgroundColor(); PropertyValue<Color> getBackgroundColor(const optional<std::string>& klass = {}) const; void setBackgroundColor(PropertyValue<Color>, const optional<std::string>& klass = {}); + void setBackgroundColorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<std::string> getDefaultBackgroundPattern(); PropertyValue<std::string> getBackgroundPattern(const optional<std::string>& klass = {}) const; void setBackgroundPattern(PropertyValue<std::string>, const optional<std::string>& klass = {}); + void setBackgroundPatternTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<float> getDefaultBackgroundOpacity(); PropertyValue<float> getBackgroundOpacity(const optional<std::string>& klass = {}) const; void setBackgroundOpacity(PropertyValue<float>, const optional<std::string>& klass = {}); + void setBackgroundOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {}); // Private implementation diff --git a/include/mbgl/style/layers/circle_layer.hpp b/include/mbgl/style/layers/circle_layer.hpp index 8ffea9946f..35db4b3962 100644 --- a/include/mbgl/style/layers/circle_layer.hpp +++ b/include/mbgl/style/layers/circle_layer.hpp @@ -12,6 +12,8 @@ namespace mbgl { namespace style { +class TransitionOptions; + class CircleLayer : public Layer { public: CircleLayer(const std::string& layerID, const std::string& sourceID); @@ -30,42 +32,52 @@ public: static DataDrivenPropertyValue<float> getDefaultCircleRadius(); DataDrivenPropertyValue<float> getCircleRadius(const optional<std::string>& klass = {}) const; void setCircleRadius(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {}); + void setCircleRadiusTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<Color> getDefaultCircleColor(); DataDrivenPropertyValue<Color> getCircleColor(const optional<std::string>& klass = {}) const; void setCircleColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {}); + void setCircleColorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<float> getDefaultCircleBlur(); DataDrivenPropertyValue<float> getCircleBlur(const optional<std::string>& klass = {}) const; void setCircleBlur(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {}); + void setCircleBlurTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<float> getDefaultCircleOpacity(); DataDrivenPropertyValue<float> getCircleOpacity(const optional<std::string>& klass = {}) const; void setCircleOpacity(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {}); + void setCircleOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<std::array<float, 2>> getDefaultCircleTranslate(); PropertyValue<std::array<float, 2>> getCircleTranslate(const optional<std::string>& klass = {}) const; void setCircleTranslate(PropertyValue<std::array<float, 2>>, const optional<std::string>& klass = {}); + void setCircleTranslateTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<TranslateAnchorType> getDefaultCircleTranslateAnchor(); PropertyValue<TranslateAnchorType> getCircleTranslateAnchor(const optional<std::string>& klass = {}) const; void setCircleTranslateAnchor(PropertyValue<TranslateAnchorType>, const optional<std::string>& klass = {}); + void setCircleTranslateAnchorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<CirclePitchScaleType> getDefaultCirclePitchScale(); PropertyValue<CirclePitchScaleType> getCirclePitchScale(const optional<std::string>& klass = {}) const; void setCirclePitchScale(PropertyValue<CirclePitchScaleType>, const optional<std::string>& klass = {}); + void setCirclePitchScaleTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<float> getDefaultCircleStrokeWidth(); DataDrivenPropertyValue<float> getCircleStrokeWidth(const optional<std::string>& klass = {}) const; void setCircleStrokeWidth(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {}); + void setCircleStrokeWidthTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<Color> getDefaultCircleStrokeColor(); DataDrivenPropertyValue<Color> getCircleStrokeColor(const optional<std::string>& klass = {}) const; void setCircleStrokeColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {}); + void setCircleStrokeColorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<float> getDefaultCircleStrokeOpacity(); DataDrivenPropertyValue<float> getCircleStrokeOpacity(const optional<std::string>& klass = {}) const; void setCircleStrokeOpacity(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {}); + void setCircleStrokeOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {}); // Private implementation diff --git a/include/mbgl/style/layers/fill_extrusion_layer.hpp b/include/mbgl/style/layers/fill_extrusion_layer.hpp index 09a0040ff3..c19a4ee168 100644 --- a/include/mbgl/style/layers/fill_extrusion_layer.hpp +++ b/include/mbgl/style/layers/fill_extrusion_layer.hpp @@ -12,6 +12,8 @@ namespace mbgl { namespace style { +class TransitionOptions; + class FillExtrusionLayer : public Layer { public: FillExtrusionLayer(const std::string& layerID, const std::string& sourceID); @@ -30,30 +32,37 @@ public: static PropertyValue<float> getDefaultFillExtrusionOpacity(); PropertyValue<float> getFillExtrusionOpacity(const optional<std::string>& klass = {}) const; void setFillExtrusionOpacity(PropertyValue<float>, const optional<std::string>& klass = {}); + void setFillExtrusionOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<Color> getDefaultFillExtrusionColor(); DataDrivenPropertyValue<Color> getFillExtrusionColor(const optional<std::string>& klass = {}) const; void setFillExtrusionColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {}); + void setFillExtrusionColorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<std::array<float, 2>> getDefaultFillExtrusionTranslate(); PropertyValue<std::array<float, 2>> getFillExtrusionTranslate(const optional<std::string>& klass = {}) const; void setFillExtrusionTranslate(PropertyValue<std::array<float, 2>>, const optional<std::string>& klass = {}); + void setFillExtrusionTranslateTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<TranslateAnchorType> getDefaultFillExtrusionTranslateAnchor(); PropertyValue<TranslateAnchorType> getFillExtrusionTranslateAnchor(const optional<std::string>& klass = {}) const; void setFillExtrusionTranslateAnchor(PropertyValue<TranslateAnchorType>, const optional<std::string>& klass = {}); + void setFillExtrusionTranslateAnchorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<std::string> getDefaultFillExtrusionPattern(); PropertyValue<std::string> getFillExtrusionPattern(const optional<std::string>& klass = {}) const; void setFillExtrusionPattern(PropertyValue<std::string>, const optional<std::string>& klass = {}); + void setFillExtrusionPatternTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<float> getDefaultFillExtrusionHeight(); DataDrivenPropertyValue<float> getFillExtrusionHeight(const optional<std::string>& klass = {}) const; void setFillExtrusionHeight(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {}); + void setFillExtrusionHeightTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<float> getDefaultFillExtrusionBase(); DataDrivenPropertyValue<float> getFillExtrusionBase(const optional<std::string>& klass = {}) const; void setFillExtrusionBase(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {}); + void setFillExtrusionBaseTransition(const TransitionOptions&, const optional<std::string>& klass = {}); // Private implementation diff --git a/include/mbgl/style/layers/fill_layer.hpp b/include/mbgl/style/layers/fill_layer.hpp index 079541ec39..c064eab350 100644 --- a/include/mbgl/style/layers/fill_layer.hpp +++ b/include/mbgl/style/layers/fill_layer.hpp @@ -12,6 +12,8 @@ namespace mbgl { namespace style { +class TransitionOptions; + class FillLayer : public Layer { public: FillLayer(const std::string& layerID, const std::string& sourceID); @@ -30,30 +32,37 @@ public: static PropertyValue<bool> getDefaultFillAntialias(); PropertyValue<bool> getFillAntialias(const optional<std::string>& klass = {}) const; void setFillAntialias(PropertyValue<bool>, const optional<std::string>& klass = {}); + void setFillAntialiasTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<float> getDefaultFillOpacity(); DataDrivenPropertyValue<float> getFillOpacity(const optional<std::string>& klass = {}) const; void setFillOpacity(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {}); + void setFillOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<Color> getDefaultFillColor(); DataDrivenPropertyValue<Color> getFillColor(const optional<std::string>& klass = {}) const; void setFillColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {}); + void setFillColorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<Color> getDefaultFillOutlineColor(); DataDrivenPropertyValue<Color> getFillOutlineColor(const optional<std::string>& klass = {}) const; void setFillOutlineColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {}); + void setFillOutlineColorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<std::array<float, 2>> getDefaultFillTranslate(); PropertyValue<std::array<float, 2>> getFillTranslate(const optional<std::string>& klass = {}) const; void setFillTranslate(PropertyValue<std::array<float, 2>>, const optional<std::string>& klass = {}); + void setFillTranslateTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<TranslateAnchorType> getDefaultFillTranslateAnchor(); PropertyValue<TranslateAnchorType> getFillTranslateAnchor(const optional<std::string>& klass = {}) const; void setFillTranslateAnchor(PropertyValue<TranslateAnchorType>, const optional<std::string>& klass = {}); + void setFillTranslateAnchorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<std::string> getDefaultFillPattern(); PropertyValue<std::string> getFillPattern(const optional<std::string>& klass = {}) const; void setFillPattern(PropertyValue<std::string>, const optional<std::string>& klass = {}); + void setFillPatternTransition(const TransitionOptions&, const optional<std::string>& klass = {}); // Private implementation diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs index 0c902de5af..d66eae8198 100644 --- a/include/mbgl/style/layers/layer.hpp.ejs +++ b/include/mbgl/style/layers/layer.hpp.ejs @@ -21,6 +21,8 @@ namespace mbgl { namespace style { +class TransitionOptions; + class <%- camelize(type) %>Layer : public Layer { public: <% if (type === 'background') { -%> @@ -58,6 +60,7 @@ public: static <%- propertyValueType(property) %> getDefault<%- camelize(property.name) %>(); <%- propertyValueType(property) %> get<%- camelize(property.name) %>(const optional<std::string>& klass = {}) const; void set<%- camelize(property.name) %>(<%- propertyValueType(property) %>, const optional<std::string>& klass = {}); + void set<%- camelize(property.name) %>Transition(const TransitionOptions&, const optional<std::string>& klass = {}); <% } -%> // Private implementation diff --git a/include/mbgl/style/layers/line_layer.hpp b/include/mbgl/style/layers/line_layer.hpp index c9413f1096..2ed269ae74 100644 --- a/include/mbgl/style/layers/line_layer.hpp +++ b/include/mbgl/style/layers/line_layer.hpp @@ -14,6 +14,8 @@ namespace mbgl { namespace style { +class TransitionOptions; + class LineLayer : public Layer { public: LineLayer(const std::string& layerID, const std::string& sourceID); @@ -50,42 +52,52 @@ public: static DataDrivenPropertyValue<float> getDefaultLineOpacity(); DataDrivenPropertyValue<float> getLineOpacity(const optional<std::string>& klass = {}) const; void setLineOpacity(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {}); + void setLineOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<Color> getDefaultLineColor(); DataDrivenPropertyValue<Color> getLineColor(const optional<std::string>& klass = {}) const; void setLineColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {}); + void setLineColorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<std::array<float, 2>> getDefaultLineTranslate(); PropertyValue<std::array<float, 2>> getLineTranslate(const optional<std::string>& klass = {}) const; void setLineTranslate(PropertyValue<std::array<float, 2>>, const optional<std::string>& klass = {}); + void setLineTranslateTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<TranslateAnchorType> getDefaultLineTranslateAnchor(); PropertyValue<TranslateAnchorType> getLineTranslateAnchor(const optional<std::string>& klass = {}) const; void setLineTranslateAnchor(PropertyValue<TranslateAnchorType>, const optional<std::string>& klass = {}); + void setLineTranslateAnchorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<float> getDefaultLineWidth(); PropertyValue<float> getLineWidth(const optional<std::string>& klass = {}) const; void setLineWidth(PropertyValue<float>, const optional<std::string>& klass = {}); + void setLineWidthTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<float> getDefaultLineGapWidth(); DataDrivenPropertyValue<float> getLineGapWidth(const optional<std::string>& klass = {}) const; void setLineGapWidth(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {}); + void setLineGapWidthTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<float> getDefaultLineOffset(); DataDrivenPropertyValue<float> getLineOffset(const optional<std::string>& klass = {}) const; void setLineOffset(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {}); + void setLineOffsetTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static DataDrivenPropertyValue<float> getDefaultLineBlur(); DataDrivenPropertyValue<float> getLineBlur(const optional<std::string>& klass = {}) const; void setLineBlur(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {}); + void setLineBlurTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<std::vector<float>> getDefaultLineDasharray(); PropertyValue<std::vector<float>> getLineDasharray(const optional<std::string>& klass = {}) const; void setLineDasharray(PropertyValue<std::vector<float>>, const optional<std::string>& klass = {}); + void setLineDasharrayTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<std::string> getDefaultLinePattern(); PropertyValue<std::string> getLinePattern(const optional<std::string>& klass = {}) const; void setLinePattern(PropertyValue<std::string>, const optional<std::string>& klass = {}); + void setLinePatternTransition(const TransitionOptions&, const optional<std::string>& klass = {}); // Private implementation diff --git a/include/mbgl/style/layers/raster_layer.hpp b/include/mbgl/style/layers/raster_layer.hpp index e998abf12a..72665baa72 100644 --- a/include/mbgl/style/layers/raster_layer.hpp +++ b/include/mbgl/style/layers/raster_layer.hpp @@ -12,6 +12,8 @@ namespace mbgl { namespace style { +class TransitionOptions; + class RasterLayer : public Layer { public: RasterLayer(const std::string& layerID, const std::string& sourceID); @@ -25,30 +27,37 @@ public: static PropertyValue<float> getDefaultRasterOpacity(); PropertyValue<float> getRasterOpacity(const optional<std::string>& klass = {}) const; void setRasterOpacity(PropertyValue<float>, const optional<std::string>& klass = {}); + void setRasterOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<float> getDefaultRasterHueRotate(); PropertyValue<float> getRasterHueRotate(const optional<std::string>& klass = {}) const; void setRasterHueRotate(PropertyValue<float>, const optional<std::string>& klass = {}); + void setRasterHueRotateTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<float> getDefaultRasterBrightnessMin(); PropertyValue<float> getRasterBrightnessMin(const optional<std::string>& klass = {}) const; void setRasterBrightnessMin(PropertyValue<float>, const optional<std::string>& klass = {}); + void setRasterBrightnessMinTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<float> getDefaultRasterBrightnessMax(); PropertyValue<float> getRasterBrightnessMax(const optional<std::string>& klass = {}) const; void setRasterBrightnessMax(PropertyValue<float>, const optional<std::string>& klass = {}); + void setRasterBrightnessMaxTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<float> getDefaultRasterSaturation(); PropertyValue<float> getRasterSaturation(const optional<std::string>& klass = {}) const; void setRasterSaturation(PropertyValue<float>, const optional<std::string>& klass = {}); + void setRasterSaturationTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<float> getDefaultRasterContrast(); PropertyValue<float> getRasterContrast(const optional<std::string>& klass = {}) const; void setRasterContrast(PropertyValue<float>, const optional<std::string>& klass = {}); + void setRasterContrastTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<float> getDefaultRasterFadeDuration(); PropertyValue<float> getRasterFadeDuration(const optional<std::string>& klass = {}) const; void setRasterFadeDuration(PropertyValue<float>, const optional<std::string>& klass = {}); + void setRasterFadeDurationTransition(const TransitionOptions&, const optional<std::string>& klass = {}); // Private implementation diff --git a/include/mbgl/style/layers/symbol_layer.hpp b/include/mbgl/style/layers/symbol_layer.hpp index 8826408e81..ad21a70698 100644 --- a/include/mbgl/style/layers/symbol_layer.hpp +++ b/include/mbgl/style/layers/symbol_layer.hpp @@ -14,6 +14,8 @@ namespace mbgl { namespace style { +class TransitionOptions; + class SymbolLayer : public Layer { public: SymbolLayer(const std::string& layerID, const std::string& sourceID); @@ -170,58 +172,72 @@ public: static PropertyValue<float> getDefaultIconOpacity(); PropertyValue<float> getIconOpacity(const optional<std::string>& klass = {}) const; void setIconOpacity(PropertyValue<float>, const optional<std::string>& klass = {}); + void setIconOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<Color> getDefaultIconColor(); PropertyValue<Color> getIconColor(const optional<std::string>& klass = {}) const; void setIconColor(PropertyValue<Color>, const optional<std::string>& klass = {}); + void setIconColorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<Color> getDefaultIconHaloColor(); PropertyValue<Color> getIconHaloColor(const optional<std::string>& klass = {}) const; void setIconHaloColor(PropertyValue<Color>, const optional<std::string>& klass = {}); + void setIconHaloColorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<float> getDefaultIconHaloWidth(); PropertyValue<float> getIconHaloWidth(const optional<std::string>& klass = {}) const; void setIconHaloWidth(PropertyValue<float>, const optional<std::string>& klass = {}); + void setIconHaloWidthTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<float> getDefaultIconHaloBlur(); PropertyValue<float> getIconHaloBlur(const optional<std::string>& klass = {}) const; void setIconHaloBlur(PropertyValue<float>, const optional<std::string>& klass = {}); + void setIconHaloBlurTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<std::array<float, 2>> getDefaultIconTranslate(); PropertyValue<std::array<float, 2>> getIconTranslate(const optional<std::string>& klass = {}) const; void setIconTranslate(PropertyValue<std::array<float, 2>>, const optional<std::string>& klass = {}); + void setIconTranslateTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<TranslateAnchorType> getDefaultIconTranslateAnchor(); PropertyValue<TranslateAnchorType> getIconTranslateAnchor(const optional<std::string>& klass = {}) const; void setIconTranslateAnchor(PropertyValue<TranslateAnchorType>, const optional<std::string>& klass = {}); + void setIconTranslateAnchorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<float> getDefaultTextOpacity(); PropertyValue<float> getTextOpacity(const optional<std::string>& klass = {}) const; void setTextOpacity(PropertyValue<float>, const optional<std::string>& klass = {}); + void setTextOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<Color> getDefaultTextColor(); PropertyValue<Color> getTextColor(const optional<std::string>& klass = {}) const; void setTextColor(PropertyValue<Color>, const optional<std::string>& klass = {}); + void setTextColorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<Color> getDefaultTextHaloColor(); PropertyValue<Color> getTextHaloColor(const optional<std::string>& klass = {}) const; void setTextHaloColor(PropertyValue<Color>, const optional<std::string>& klass = {}); + void setTextHaloColorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<float> getDefaultTextHaloWidth(); PropertyValue<float> getTextHaloWidth(const optional<std::string>& klass = {}) const; void setTextHaloWidth(PropertyValue<float>, const optional<std::string>& klass = {}); + void setTextHaloWidthTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<float> getDefaultTextHaloBlur(); PropertyValue<float> getTextHaloBlur(const optional<std::string>& klass = {}) const; void setTextHaloBlur(PropertyValue<float>, const optional<std::string>& klass = {}); + void setTextHaloBlurTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<std::array<float, 2>> getDefaultTextTranslate(); PropertyValue<std::array<float, 2>> getTextTranslate(const optional<std::string>& klass = {}) const; void setTextTranslate(PropertyValue<std::array<float, 2>>, const optional<std::string>& klass = {}); + void setTextTranslateTransition(const TransitionOptions&, const optional<std::string>& klass = {}); static PropertyValue<TranslateAnchorType> getDefaultTextTranslateAnchor(); PropertyValue<TranslateAnchorType> getTextTranslateAnchor(const optional<std::string>& klass = {}) const; void setTextTranslateAnchor(PropertyValue<TranslateAnchorType>, const optional<std::string>& klass = {}); + void setTextTranslateAnchorTransition(const TransitionOptions&, const optional<std::string>& klass = {}); // Private implementation |