summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mbgl/style/layers/background_layer.hpp3
-rw-r--r--include/mbgl/style/layers/circle_layer.hpp10
-rw-r--r--include/mbgl/style/layers/fill_extrusion_layer.hpp7
-rw-r--r--include/mbgl/style/layers/fill_layer.hpp7
-rw-r--r--include/mbgl/style/layers/layer.hpp.ejs1
-rw-r--r--include/mbgl/style/layers/line_layer.hpp10
-rw-r--r--include/mbgl/style/layers/raster_layer.hpp7
-rw-r--r--include/mbgl/style/layers/symbol_layer.hpp14
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.h21
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.mm54
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.h56
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.mm146
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.h35
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.mm92
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.h63
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.mm162
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.h49
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.mm126
-rw-r--r--platform/darwin/src/MGLStyle.h22
-rw-r--r--platform/darwin/src/MGLStyle.mm26
-rw-r--r--platform/darwin/src/MGLStyleLayer.h.ejs9
-rw-r--r--platform/darwin/src/MGLStyleLayer.mm.ejs24
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.h87
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.mm218
-rw-r--r--platform/darwin/src/MGLTypes.h33
-rw-r--r--platform/darwin/src/NSValue+MGLAdditions.h17
-rw-r--r--platform/darwin/src/NSValue+MGLAdditions.m12
-rw-r--r--platform/darwin/test/MGLBackgroundStyleLayerTests.mm32
-rw-r--r--platform/darwin/test/MGLCircleStyleLayerTests.mm68
-rw-r--r--platform/darwin/test/MGLFillStyleLayerTests.mm41
-rw-r--r--platform/darwin/test/MGLLineStyleLayerTests.mm68
-rw-r--r--platform/darwin/test/MGLRasterStyleLayerTests.mm41
-rw-r--r--platform/darwin/test/MGLStyleLayerTests.mm.ejs16
-rw-r--r--platform/darwin/test/MGLSymbolStyleLayerTests.mm95
-rw-r--r--platform/ios/CHANGELOG.md3
-rw-r--r--platform/ios/app/MBXViewController.m4
-rw-r--r--platform/macos/CHANGELOG.md3
-rw-r--r--platform/macos/app/MapDocument.m4
-rw-r--r--src/mbgl/style/layers/background_layer.cpp12
-rw-r--r--src/mbgl/style/layers/circle_layer.cpp40
-rw-r--r--src/mbgl/style/layers/fill_extrusion_layer.cpp28
-rw-r--r--src/mbgl/style/layers/fill_layer.cpp28
-rw-r--r--src/mbgl/style/layers/layer.cpp.ejs4
-rw-r--r--src/mbgl/style/layers/line_layer.cpp40
-rw-r--r--src/mbgl/style/layers/raster_layer.cpp28
-rw-r--r--src/mbgl/style/layers/symbol_layer.cpp56
-rw-r--r--src/mbgl/style/paint_property.hpp5
47 files changed, 1883 insertions, 44 deletions
diff --git a/include/mbgl/style/layers/background_layer.hpp b/include/mbgl/style/layers/background_layer.hpp
index 94076931e7..0de3302b7a 100644
--- a/include/mbgl/style/layers/background_layer.hpp
+++ b/include/mbgl/style/layers/background_layer.hpp
@@ -25,16 +25,19 @@ public:
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 = {});
+ TransitionOptions getBackgroundColorTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getBackgroundPatternTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getBackgroundOpacityTransition(const optional<std::string>& klass = {}) const;
// Private implementation
diff --git a/include/mbgl/style/layers/circle_layer.hpp b/include/mbgl/style/layers/circle_layer.hpp
index 35db4b3962..c12d476706 100644
--- a/include/mbgl/style/layers/circle_layer.hpp
+++ b/include/mbgl/style/layers/circle_layer.hpp
@@ -33,51 +33,61 @@ public:
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 = {});
+ TransitionOptions getCircleRadiusTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getCircleColorTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getCircleBlurTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getCircleOpacityTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getCircleTranslateTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getCircleTranslateAnchorTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getCirclePitchScaleTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getCircleStrokeWidthTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getCircleStrokeColorTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getCircleStrokeOpacityTransition(const optional<std::string>& klass = {}) const;
// Private implementation
diff --git a/include/mbgl/style/layers/fill_extrusion_layer.hpp b/include/mbgl/style/layers/fill_extrusion_layer.hpp
index c19a4ee168..31d517d016 100644
--- a/include/mbgl/style/layers/fill_extrusion_layer.hpp
+++ b/include/mbgl/style/layers/fill_extrusion_layer.hpp
@@ -33,36 +33,43 @@ public:
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 = {});
+ TransitionOptions getFillExtrusionOpacityTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getFillExtrusionColorTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getFillExtrusionTranslateTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getFillExtrusionTranslateAnchorTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getFillExtrusionPatternTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getFillExtrusionHeightTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getFillExtrusionBaseTransition(const optional<std::string>& klass = {}) const;
// Private implementation
diff --git a/include/mbgl/style/layers/fill_layer.hpp b/include/mbgl/style/layers/fill_layer.hpp
index c064eab350..aac4be92e2 100644
--- a/include/mbgl/style/layers/fill_layer.hpp
+++ b/include/mbgl/style/layers/fill_layer.hpp
@@ -33,36 +33,43 @@ public:
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 = {});
+ TransitionOptions getFillAntialiasTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getFillOpacityTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getFillColorTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getFillOutlineColorTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getFillTranslateTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getFillTranslateAnchorTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getFillPatternTransition(const optional<std::string>& klass = {}) const;
// Private implementation
diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs
index d66eae8198..972d932b59 100644
--- a/include/mbgl/style/layers/layer.hpp.ejs
+++ b/include/mbgl/style/layers/layer.hpp.ejs
@@ -61,6 +61,7 @@ public:
<%- 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 = {});
+ TransitionOptions get<%- camelize(property.name) %>Transition(const optional<std::string>& klass = {}) const;
<% } -%>
// Private implementation
diff --git a/include/mbgl/style/layers/line_layer.hpp b/include/mbgl/style/layers/line_layer.hpp
index 2ed269ae74..756cc6f431 100644
--- a/include/mbgl/style/layers/line_layer.hpp
+++ b/include/mbgl/style/layers/line_layer.hpp
@@ -53,51 +53,61 @@ public:
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 = {});
+ TransitionOptions getLineOpacityTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getLineColorTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getLineTranslateTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getLineTranslateAnchorTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getLineWidthTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getLineGapWidthTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getLineOffsetTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getLineBlurTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getLineDasharrayTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getLinePatternTransition(const optional<std::string>& klass = {}) const;
// Private implementation
diff --git a/include/mbgl/style/layers/raster_layer.hpp b/include/mbgl/style/layers/raster_layer.hpp
index 72665baa72..3596a71f58 100644
--- a/include/mbgl/style/layers/raster_layer.hpp
+++ b/include/mbgl/style/layers/raster_layer.hpp
@@ -28,36 +28,43 @@ public:
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 = {});
+ TransitionOptions getRasterOpacityTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getRasterHueRotateTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getRasterBrightnessMinTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getRasterBrightnessMaxTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getRasterSaturationTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getRasterContrastTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getRasterFadeDurationTransition(const optional<std::string>& klass = {}) const;
// Private implementation
diff --git a/include/mbgl/style/layers/symbol_layer.hpp b/include/mbgl/style/layers/symbol_layer.hpp
index aeccabb97e..d24f808bac 100644
--- a/include/mbgl/style/layers/symbol_layer.hpp
+++ b/include/mbgl/style/layers/symbol_layer.hpp
@@ -173,71 +173,85 @@ public:
DataDrivenPropertyValue<float> getIconOpacity(const optional<std::string>& klass = {}) const;
void setIconOpacity(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setIconOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {});
+ TransitionOptions getIconOpacityTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<Color> getDefaultIconColor();
DataDrivenPropertyValue<Color> getIconColor(const optional<std::string>& klass = {}) const;
void setIconColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {});
void setIconColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
+ TransitionOptions getIconColorTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<Color> getDefaultIconHaloColor();
DataDrivenPropertyValue<Color> getIconHaloColor(const optional<std::string>& klass = {}) const;
void setIconHaloColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {});
void setIconHaloColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
+ TransitionOptions getIconHaloColorTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultIconHaloWidth();
DataDrivenPropertyValue<float> getIconHaloWidth(const optional<std::string>& klass = {}) const;
void setIconHaloWidth(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setIconHaloWidthTransition(const TransitionOptions&, const optional<std::string>& klass = {});
+ TransitionOptions getIconHaloWidthTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultIconHaloBlur();
DataDrivenPropertyValue<float> getIconHaloBlur(const optional<std::string>& klass = {}) const;
void setIconHaloBlur(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setIconHaloBlurTransition(const TransitionOptions&, const optional<std::string>& klass = {});
+ TransitionOptions getIconHaloBlurTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getIconTranslateTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getIconTranslateAnchorTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultTextOpacity();
DataDrivenPropertyValue<float> getTextOpacity(const optional<std::string>& klass = {}) const;
void setTextOpacity(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setTextOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {});
+ TransitionOptions getTextOpacityTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<Color> getDefaultTextColor();
DataDrivenPropertyValue<Color> getTextColor(const optional<std::string>& klass = {}) const;
void setTextColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {});
void setTextColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
+ TransitionOptions getTextColorTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<Color> getDefaultTextHaloColor();
DataDrivenPropertyValue<Color> getTextHaloColor(const optional<std::string>& klass = {}) const;
void setTextHaloColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {});
void setTextHaloColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
+ TransitionOptions getTextHaloColorTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultTextHaloWidth();
DataDrivenPropertyValue<float> getTextHaloWidth(const optional<std::string>& klass = {}) const;
void setTextHaloWidth(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setTextHaloWidthTransition(const TransitionOptions&, const optional<std::string>& klass = {});
+ TransitionOptions getTextHaloWidthTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultTextHaloBlur();
DataDrivenPropertyValue<float> getTextHaloBlur(const optional<std::string>& klass = {}) const;
void setTextHaloBlur(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setTextHaloBlurTransition(const TransitionOptions&, const optional<std::string>& klass = {});
+ TransitionOptions getTextHaloBlurTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getTextTranslateTransition(const optional<std::string>& klass = {}) const;
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 = {});
+ TransitionOptions getTextTranslateAnchorTransition(const optional<std::string>& klass = {}) const;
// Private implementation
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.h b/platform/darwin/src/MGLBackgroundStyleLayer.h
index 0d0eccd685..3b987dbc99 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.h
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.h
@@ -69,6 +69,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `backgroundColor` property.
+
+ This property corresponds to the `background-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition backgroundColorTransition;
+
+/**
The opacity at which the background will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -85,6 +92,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *backgroundOpacity;
/**
+ The transition affecting any changes to this layer’s `backgroundOpacity` property.
+
+ This property corresponds to the `background-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition backgroundOpacityTransition;
+
+/**
Name of image in style images to use for drawing an image background. For
seamless patterns, image width and height must be a factor of two (2, 4, 8,
..., 512).
@@ -97,6 +111,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *backgroundPattern;
+/**
+ The transition affecting any changes to this layer’s `backgroundPattern` property.
+
+ This property corresponds to the `background-pattern-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition backgroundPatternTransition;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm
index bcad0aa11b..8f416a0ea2 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.mm
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLBackgroundStyleLayer.h"
@@ -101,6 +102,24 @@
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
+- (void)setBackgroundColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setBackgroundColorTransition(options);
+}
+
+- (MGLTransition)backgroundColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setBackgroundOpacity:(MGLStyleValue<NSNumber *> *)backgroundOpacity {
MGLAssertStyleLayerIsValid();
@@ -118,6 +137,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setBackgroundOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setBackgroundOpacityTransition(options);
+}
+
+- (MGLTransition)backgroundOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setBackgroundPattern:(MGLStyleValue<NSString *> *)backgroundPattern {
MGLAssertStyleLayerIsValid();
@@ -135,5 +172,22 @@
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
+- (void)setBackgroundPatternTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setBackgroundPatternTransition(options);
+}
+
+- (MGLTransition)backgroundPatternTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundPatternTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
@end
diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h
index 7a64c25a23..d1d48d65c6 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.h
+++ b/platform/darwin/src/MGLCircleStyleLayer.h
@@ -107,6 +107,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleBlur;
+/**
+ The transition affecting any changes to this layer’s `circleBlur` property.
+
+ This property corresponds to the `circle-blur-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleBlurTransition;
+
#if TARGET_OS_IPHONE
/**
The fill color of the circle.
@@ -160,6 +167,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `circleColor` property.
+
+ This property corresponds to the `circle-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleColorTransition;
+
+/**
The opacity at which the circle will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -185,6 +199,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleOpacity;
/**
+ The transition affecting any changes to this layer’s `circleOpacity` property.
+
+ This property corresponds to the `circle-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleOpacityTransition;
+
+/**
Circle radius.
This property is measured in points.
@@ -212,6 +233,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleRadius;
/**
+ The transition affecting any changes to this layer’s `circleRadius` property.
+
+ This property corresponds to the `circle-radius-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleRadiusTransition;
+
+/**
Controls the scaling behavior of the circle when the map is pitched.
The default value of this property is an `MGLStyleValue` object containing an
@@ -285,6 +313,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `circleStrokeColor` property.
+
+ This property corresponds to the `circle-stroke-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleStrokeColorTransition;
+
+/**
The opacity of the circle's stroke.
The default value of this property is an `MGLStyleValue` object containing an
@@ -310,6 +345,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleStrokeOpacity;
/**
+ The transition affecting any changes to this layer’s `circleStrokeOpacity` property.
+
+ This property corresponds to the `circle-stroke-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleStrokeOpacityTransition;
+
+/**
The width of the circle's stroke. Strokes are placed outside of the
`circleRadius`.
@@ -337,6 +379,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleStrokeWidth;
+/**
+ The transition affecting any changes to this layer’s `circleStrokeWidth` property.
+
+ This property corresponds to the `circle-stroke-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleStrokeWidthTransition;
+
#if TARGET_OS_IPHONE
/**
The geometry's offset.
@@ -383,6 +432,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circleTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `circleTranslation` property.
+
+ This property corresponds to the `circle-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circleTranslate __attribute__((unavailable("Use circleTranslation instead.")));
/**
diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm
index 808e00bc38..330b9cdac0 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.mm
+++ b/platform/darwin/src/MGLCircleStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLCircleStyleLayer.h"
@@ -151,6 +152,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleBlurTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleBlurTransition(options);
+}
+
+- (MGLTransition)circleBlurTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleBlurTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleColor:(MGLStyleValue<MGLColor *> *)circleColor {
MGLAssertStyleLayerIsValid();
@@ -168,6 +187,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleColorTransition(options);
+}
+
+- (MGLTransition)circleColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleOpacity:(MGLStyleValue<NSNumber *> *)circleOpacity {
MGLAssertStyleLayerIsValid();
@@ -185,6 +222,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleOpacityTransition(options);
+}
+
+- (MGLTransition)circleOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleRadius:(MGLStyleValue<NSNumber *> *)circleRadius {
MGLAssertStyleLayerIsValid();
@@ -202,6 +257,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleRadiusTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleRadiusTransition(options);
+}
+
+- (MGLTransition)circleRadiusTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleRadiusTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleScaleAlignment:(MGLStyleValue<NSValue *> *)circleScaleAlignment {
MGLAssertStyleLayerIsValid();
@@ -243,6 +316,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleStrokeColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleStrokeColorTransition(options);
+}
+
+- (MGLTransition)circleStrokeColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleStrokeColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleStrokeOpacity:(MGLStyleValue<NSNumber *> *)circleStrokeOpacity {
MGLAssertStyleLayerIsValid();
@@ -260,6 +351,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleStrokeOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleStrokeOpacityTransition(options);
+}
+
+- (MGLTransition)circleStrokeOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleStrokeOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleStrokeWidth:(MGLStyleValue<NSNumber *> *)circleStrokeWidth {
MGLAssertStyleLayerIsValid();
@@ -277,6 +386,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleStrokeWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleStrokeWidthTransition(options);
+}
+
+- (MGLTransition)circleStrokeWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleStrokeWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleTranslation:(MGLStyleValue<NSValue *> *)circleTranslation {
MGLAssertStyleLayerIsValid();
@@ -294,6 +421,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setCircleTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleTranslateTransition(options);
+}
+
+- (MGLTransition)circleTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleTranslate:(MGLStyleValue<NSValue *> *)circleTranslate {
}
@@ -325,7 +470,6 @@ namespace mbgl {
return self.circleTranslationAnchor;
}
-
@end
@implementation NSValue (MGLCircleStyleLayerAdditions)
diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h
index 32b62344c7..d1d90b5a23 100644
--- a/platform/darwin/src/MGLFillStyleLayer.h
+++ b/platform/darwin/src/MGLFillStyleLayer.h
@@ -134,6 +134,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `fillColor` property.
+
+ This property corresponds to the `fill-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillColorTransition;
+
+/**
The opacity of the entire fill layer. In contrast to the `fillColor`, this
value will also affect the 1pt stroke around the fill, if the stroke is used.
@@ -159,6 +166,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *fillOpacity;
+/**
+ The transition affecting any changes to this layer’s `fillOpacity` property.
+
+ This property corresponds to the `fill-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillOpacityTransition;
+
#if TARGET_OS_IPHONE
/**
The outline color of the fill. Matches the value of `fillColor` if unspecified.
@@ -212,6 +226,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `fillOutlineColor` property.
+
+ This property corresponds to the `fill-outline-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillOutlineColorTransition;
+
+/**
Name of image in sprite to use for drawing image fills. For seamless patterns,
image width and height must be a factor of two (2, 4, 8, ..., 512).
@@ -223,6 +244,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *fillPattern;
+/**
+ The transition affecting any changes to this layer’s `fillPattern` property.
+
+ This property corresponds to the `fill-pattern-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillPatternTransition;
+
#if TARGET_OS_IPHONE
/**
The geometry's offset.
@@ -269,6 +297,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *fillTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `fillTranslation` property.
+
+ This property corresponds to the `fill-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *fillTranslate __attribute__((unavailable("Use fillTranslation instead.")));
/**
diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm
index 6716e0efb1..1322a7a0b6 100644
--- a/platform/darwin/src/MGLFillStyleLayer.mm
+++ b/platform/darwin/src/MGLFillStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLFillStyleLayer.h"
@@ -170,6 +171,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setFillColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillColorTransition(options);
+}
+
+- (MGLTransition)fillColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillOpacity:(MGLStyleValue<NSNumber *> *)fillOpacity {
MGLAssertStyleLayerIsValid();
@@ -187,6 +206,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setFillOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillOpacityTransition(options);
+}
+
+- (MGLTransition)fillOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillOutlineColor:(MGLStyleValue<MGLColor *> *)fillOutlineColor {
MGLAssertStyleLayerIsValid();
@@ -204,6 +241,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setFillOutlineColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillOutlineColorTransition(options);
+}
+
+- (MGLTransition)fillOutlineColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillOutlineColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillPattern:(MGLStyleValue<NSString *> *)fillPattern {
MGLAssertStyleLayerIsValid();
@@ -221,6 +276,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
+- (void)setFillPatternTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillPatternTransition(options);
+}
+
+- (MGLTransition)fillPatternTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillPatternTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillTranslation:(MGLStyleValue<NSValue *> *)fillTranslation {
MGLAssertStyleLayerIsValid();
@@ -238,6 +311,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setFillTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillTranslateTransition(options);
+}
+
+- (MGLTransition)fillTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillTranslate:(MGLStyleValue<NSValue *> *)fillTranslate {
}
@@ -269,7 +360,6 @@ namespace mbgl {
return self.fillTranslationAnchor;
}
-
@end
@implementation NSValue (MGLFillStyleLayerAdditions)
diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h
index 7cfa27e1cc..e0f8d69a81 100644
--- a/platform/darwin/src/MGLLineStyleLayer.h
+++ b/platform/darwin/src/MGLLineStyleLayer.h
@@ -208,6 +208,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineBlur;
+/**
+ The transition affecting any changes to this layer’s `lineBlur` property.
+
+ This property corresponds to the `line-blur-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineBlurTransition;
+
#if TARGET_OS_IPHONE
/**
The color with which the line will be drawn.
@@ -267,6 +274,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `lineColor` property.
+
+ This property corresponds to the `line-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineColorTransition;
+
+/**
Specifies the lengths of the alternating dashes and gaps that form the dash
pattern. The lengths are later scaled by the line width. To convert a dash
length to points, multiply the length by the current line width.
@@ -288,6 +302,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSNumber *> *> *lineDashPattern;
+/**
+ The transition affecting any changes to this layer’s `lineDashPattern` property.
+
+ This property corresponds to the `line-dasharray-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineDashPatternTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSNumber *> *> *lineDasharray __attribute__((unavailable("Use lineDashPattern instead.")));
/**
@@ -319,6 +340,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineGapWidth;
/**
+ The transition affecting any changes to this layer’s `lineGapWidth` property.
+
+ This property corresponds to the `line-gap-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineGapWidthTransition;
+
+/**
The line's offset. For linear features, a positive value offsets the line to
the right, relative to the direction of the line, and a negative value to the
left. For polygon features, a positive value results in an inset, and a
@@ -349,6 +377,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineOffset;
/**
+ The transition affecting any changes to this layer’s `lineOffset` property.
+
+ This property corresponds to the `line-offset-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineOffsetTransition;
+
+/**
The opacity at which the line will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -374,6 +409,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineOpacity;
/**
+ The transition affecting any changes to this layer’s `lineOpacity` property.
+
+ This property corresponds to the `line-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineOpacityTransition;
+
+/**
Name of image in style images to use for drawing image lines. For seamless
patterns, image width must be a factor of two (2, 4, 8, ..., 512).
@@ -385,6 +427,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *linePattern;
+/**
+ The transition affecting any changes to this layer’s `linePattern` property.
+
+ This property corresponds to the `line-pattern-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition linePatternTransition;
+
#if TARGET_OS_IPHONE
/**
The geometry's offset.
@@ -431,6 +480,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *lineTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `lineTranslation` property.
+
+ This property corresponds to the `line-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *lineTranslate __attribute__((unavailable("Use lineTranslation instead.")));
/**
@@ -475,6 +531,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineWidth;
+/**
+ The transition affecting any changes to this layer’s `lineWidth` property.
+
+ This property corresponds to the `line-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineWidthTransition;
+
@end
/**
diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm
index 80b1e907e6..e37489cf0b 100644
--- a/platform/darwin/src/MGLLineStyleLayer.mm
+++ b/platform/darwin/src/MGLLineStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLLineStyleLayer.h"
@@ -228,6 +229,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineBlurTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineBlurTransition(options);
+}
+
+- (MGLTransition)lineBlurTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineBlurTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineColor:(MGLStyleValue<MGLColor *> *)lineColor {
MGLAssertStyleLayerIsValid();
@@ -245,6 +264,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineColorTransition(options);
+}
+
+- (MGLTransition)lineColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineDashPattern:(MGLStyleValue<NSArray<NSNumber *> *> *)lineDashPattern {
MGLAssertStyleLayerIsValid();
@@ -262,6 +299,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::vector<float>, NSArray<NSNumber *> *, float>().toStyleValue(propertyValue);
}
+- (void)setLineDashPatternTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineDasharrayTransition(options);
+}
+
+- (MGLTransition)lineDashPatternTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineDasharrayTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineDasharray:(MGLStyleValue<NSArray<NSNumber *> *> *)lineDasharray {
}
@@ -286,6 +341,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineGapWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineGapWidthTransition(options);
+}
+
+- (MGLTransition)lineGapWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineGapWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineOffset:(MGLStyleValue<NSNumber *> *)lineOffset {
MGLAssertStyleLayerIsValid();
@@ -303,6 +376,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineOffsetTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineOffsetTransition(options);
+}
+
+- (MGLTransition)lineOffsetTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineOffsetTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineOpacity:(MGLStyleValue<NSNumber *> *)lineOpacity {
MGLAssertStyleLayerIsValid();
@@ -320,6 +411,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineOpacityTransition(options);
+}
+
+- (MGLTransition)lineOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLinePattern:(MGLStyleValue<NSString *> *)linePattern {
MGLAssertStyleLayerIsValid();
@@ -337,6 +446,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
+- (void)setLinePatternTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLinePatternTransition(options);
+}
+
+- (MGLTransition)linePatternTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLinePatternTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineTranslation:(MGLStyleValue<NSValue *> *)lineTranslation {
MGLAssertStyleLayerIsValid();
@@ -354,6 +481,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setLineTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineTranslateTransition(options);
+}
+
+- (MGLTransition)lineTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineTranslate:(MGLStyleValue<NSValue *> *)lineTranslate {
}
@@ -402,6 +547,23 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setLineWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineWidthTransition(options);
+}
+
+- (MGLTransition)lineWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
@end
diff --git a/platform/darwin/src/MGLRasterStyleLayer.h b/platform/darwin/src/MGLRasterStyleLayer.h
index edd88c319d..d411cba5f0 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.h
+++ b/platform/darwin/src/MGLRasterStyleLayer.h
@@ -59,6 +59,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *maximumRasterBrightness;
+/**
+ The transition affecting any changes to this layer’s `maximumRasterBrightness` property.
+
+ This property corresponds to the `raster-brightness-max-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition maximumRasterBrightnessTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterBrightnessMax __attribute__((unavailable("Use maximumRasterBrightness instead.")));
/**
@@ -82,6 +89,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *minimumRasterBrightness;
+/**
+ The transition affecting any changes to this layer’s `minimumRasterBrightness` property.
+
+ This property corresponds to the `raster-brightness-min-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition minimumRasterBrightnessTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterBrightnessMin __attribute__((unavailable("Use minimumRasterBrightness instead.")));
/**
@@ -101,6 +115,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterContrast;
/**
+ The transition affecting any changes to this layer’s `rasterContrast` property.
+
+ This property corresponds to the `raster-contrast-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterContrastTransition;
+
+/**
Fade duration when a new tile is added.
This property is measured in milliseconds.
@@ -119,6 +140,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterFadeDuration;
/**
+ The transition affecting any changes to this layer’s `rasterFadeDuration` property.
+
+ This property corresponds to the `raster-fade-duration-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterFadeDurationTransition;
+
+/**
Rotates hues around the color wheel.
This property is measured in degrees.
@@ -140,6 +168,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterHueRotation;
+/**
+ The transition affecting any changes to this layer’s `rasterHueRotation` property.
+
+ This property corresponds to the `raster-hue-rotate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterHueRotationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterHueRotate __attribute__((unavailable("Use rasterHueRotation instead.")));
/**
@@ -159,6 +194,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterOpacity;
/**
+ The transition affecting any changes to this layer’s `rasterOpacity` property.
+
+ This property corresponds to the `raster-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterOpacityTransition;
+
+/**
Increase or reduce the saturation of the image.
The default value of this property is an `MGLStyleValue` object containing an
@@ -174,6 +216,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterSaturation;
+/**
+ The transition affecting any changes to this layer’s `rasterSaturation` property.
+
+ This property corresponds to the `raster-saturation-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterSaturationTransition;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm
index 2108a5a0c8..80508e4e70 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.mm
+++ b/platform/darwin/src/MGLRasterStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLRasterStyleLayer.h"
@@ -108,6 +109,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setMaximumRasterBrightnessTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterBrightnessMaxTransition(options);
+}
+
+- (MGLTransition)maximumRasterBrightnessTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterBrightnessMaxTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterBrightnessMax:(MGLStyleValue<NSNumber *> *)rasterBrightnessMax {
}
@@ -132,6 +151,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setMinimumRasterBrightnessTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterBrightnessMinTransition(options);
+}
+
+- (MGLTransition)minimumRasterBrightnessTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterBrightnessMinTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterBrightnessMin:(MGLStyleValue<NSNumber *> *)rasterBrightnessMin {
}
@@ -156,6 +193,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterContrastTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterContrastTransition(options);
+}
+
+- (MGLTransition)rasterContrastTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterContrastTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterFadeDuration:(MGLStyleValue<NSNumber *> *)rasterFadeDuration {
MGLAssertStyleLayerIsValid();
@@ -173,6 +228,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterFadeDurationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterFadeDurationTransition(options);
+}
+
+- (MGLTransition)rasterFadeDurationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterFadeDurationTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterHueRotation:(MGLStyleValue<NSNumber *> *)rasterHueRotation {
MGLAssertStyleLayerIsValid();
@@ -190,6 +263,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterHueRotationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterHueRotateTransition(options);
+}
+
+- (MGLTransition)rasterHueRotationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterHueRotateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterHueRotate:(MGLStyleValue<NSNumber *> *)rasterHueRotate {
}
@@ -214,6 +305,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterOpacityTransition(options);
+}
+
+- (MGLTransition)rasterOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterSaturation:(MGLStyleValue<NSNumber *> *)rasterSaturation {
MGLAssertStyleLayerIsValid();
@@ -231,5 +340,22 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterSaturationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterSaturationTransition(options);
+}
+
+- (MGLTransition)rasterSaturationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterSaturationTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
@end
diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h
index 689faf78cf..0dddec307b 100644
--- a/platform/darwin/src/MGLStyle.h
+++ b/platform/darwin/src/MGLStyle.h
@@ -194,6 +194,12 @@ MGL_EXPORT
@property (nonatomic, strong) NS_SET_OF(__kindof MGLSource *) *sources;
/**
+ Values describing animated transitions to styling changes, either to the style URL
+ or to individual properties.
+ */
+@property (nonatomic) MGLTransition transition;
+
+/**
Returns a source with the given identifier in the current style.
@note Source identifiers are not guaranteed to exist across styles or different
@@ -442,22 +448,6 @@ MGL_EXPORT
*/
- (void)removeImageForName:(NSString *)name;
-#pragma mark Managing a Style’s Transition Options
-
-/**
- The duration in seconds to animate any changes to the style URL or to layout and paint attributes.
-
- By default, this property is set to zero seconds, so any changes take effect without animation.
- */
-@property (nonatomic) NSTimeInterval transitionDuration;
-
-/**
- The delay in seconds to before applying any changes to the style URL or to layout and paint attributes.
-
- By default, this property is set to zero seconds, so any changes begin to animate immediately.
- */
-@property (nonatomic) NSTimeInterval transitionDelay;
-
@end
NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm
index be82e34cb4..2e999a5165 100644
--- a/platform/darwin/src/MGLStyle.mm
+++ b/platform/darwin/src/MGLStyle.mm
@@ -572,30 +572,24 @@ static NSURL *MGLStyleURL_emerald;
#pragma mark Style transitions
-- (void)setTransitionDuration:(NSTimeInterval)duration
+- (void)setTransition:(MGLTransition)transition
{
auto transitionOptions = self.mapView.mbglMap->getTransitionOptions();
- transitionOptions.duration = MGLDurationFromTimeInterval(duration);
+ transitionOptions.duration = MGLDurationFromTimeInterval(transition.duration);
+ transitionOptions.delay = MGLDurationFromTimeInterval(transition.delay);
+
self.mapView.mbglMap->setTransitionOptions(transitionOptions);
}
-- (NSTimeInterval)transitionDuration
+- (MGLTransition)transition
{
+ MGLTransition transition;
const mbgl::style::TransitionOptions transitionOptions = self.mapView.mbglMap->getTransitionOptions();
- return MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
-}
-
-- (void)setTransitionDelay:(NSTimeInterval)delay
-{
- auto transitionOptions = self.mapView.mbglMap->getTransitionOptions();
- transitionOptions.delay = MGLDurationFromTimeInterval(delay);
- self.mapView.mbglMap->setTransitionOptions(transitionOptions);
-}
-- (NSTimeInterval)transitionDelay
-{
- const mbgl::style::TransitionOptions transitionOptions = self.mapView.mbglMap->getTransitionOptions();
- return MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+
+ return transition;
}
- (NSString *)description
diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs
index f0a4ba64a3..d5540aa3df 100644
--- a/platform/darwin/src/MGLStyleLayer.h.ejs
+++ b/platform/darwin/src/MGLStyleLayer.h.ejs
@@ -111,6 +111,15 @@ MGL_EXPORT
*/
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } if (property.getter) { %>, getter=<%- objCGetter(property) -%><% } %>) MGLStyleValue<<%- propertyType(property, true) %>> *<%- camelizeWithLeadingLowercase(property.name) %>;
+<% if (property["transition"]) { -%>
+/**
+ The transition affecting any changes to this layer’s `<%- camelizeWithLeadingLowercase(property.name) %>` property.
+
+ This property corresponds to the `<%- originalPropertyName(property) %>-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition <%- camelizeWithLeadingLowercase(property.name) %>Transition;
+
+<% } -%>
<% if (property.original) { -%>
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } %>) MGLStyleValue<<%- propertyType(property, true) %>> *<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> __attribute__((unavailable("Use <%- camelizeWithLeadingLowercase(property.name) %> instead.")));
diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs
index 24aff7fca8..1e5f3df160 100644
--- a/platform/darwin/src/MGLStyleLayer.mm.ejs
+++ b/platform/darwin/src/MGLStyleLayer.mm.ejs
@@ -10,6 +10,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGL<%- camelize(type) %>StyleLayer.h"
@@ -228,8 +229,8 @@ namespace mbgl {
<% } -%>
<% if (paintProperties.length) { -%>
#pragma mark - Accessing the Paint Attributes
-
<% for (const property of paintProperties) { -%>
+
- (void)set<%- camelize(property.name) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- objCName(property) %> {
MGLAssertStyleLayerIsValid();
@@ -270,15 +271,34 @@ namespace mbgl {
<% } -%>
<% } -%>
}
+<% if (property["transition"]) { -%>
+
+- (void)set<%- camelize(property.name) %>Transition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->set<%- camelize(originalPropertyName(property)) %>Transition(options);
+}
+
+- (MGLTransition)<%- objCGetter(property) %>Transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->get<%- camelize(originalPropertyName(property)) %>Transition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+<% } -%>
<% if (property.original) { -%>
+
- (void)set<%- camelize(originalPropertyName(property)) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> {
}
- (MGLStyleValue<<%- propertyType(property, true) %>> *)<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> {
return self.<%- objCGetter(property) %>;
}
-
<% } -%>
<% } -%>
<% } -%>
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h
index 47d140f91f..f3ea5e9179 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.h
+++ b/platform/darwin/src/MGLSymbolStyleLayer.h
@@ -334,7 +334,8 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconIgnorePlacement __attribute__((unavailable("Use iconIgnoresPlacement instead.")));
/**
- A string with {tokens} replaced, referencing the data property to pull from.
+ Name of image in sprite to use for drawing an image background. A string with
+ {tokens} replaced, referencing the data property to pull from.
This attribute corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-icon-image"><code>icon-image</code></a>
@@ -1247,6 +1248,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `iconColor` property.
+
+ This property corresponds to the `icon-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconColorTransition;
+
+/**
Fade out the halo towards the outside.
This property is measured in points.
@@ -1276,6 +1284,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconHaloBlur;
+/**
+ The transition affecting any changes to this layer’s `iconHaloBlur` property.
+
+ This property corresponds to the `icon-halo-blur-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconHaloBlurTransition;
+
#if TARGET_OS_IPHONE
/**
The color of the icon’s halo. The `iconImageName` property must be set to a
@@ -1337,6 +1352,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `iconHaloColor` property.
+
+ This property corresponds to the `icon-halo-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconHaloColorTransition;
+
+/**
Distance of halo to the icon outline.
This property is measured in points.
@@ -1367,6 +1389,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconHaloWidth;
/**
+ The transition affecting any changes to this layer’s `iconHaloWidth` property.
+
+ This property corresponds to the `icon-halo-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconHaloWidthTransition;
+
+/**
The opacity at which the icon will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -1394,6 +1423,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconOpacity;
+/**
+ The transition affecting any changes to this layer’s `iconOpacity` property.
+
+ This property corresponds to the `icon-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconOpacityTransition;
+
#if TARGET_OS_IPHONE
/**
Distance that the icon's anchor is moved from its original placement.
@@ -1446,6 +1482,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *iconTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `iconTranslation` property.
+
+ This property corresponds to the `icon-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *iconTranslate __attribute__((unavailable("Use iconTranslation instead.")));
/**
@@ -1531,6 +1574,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `textColor` property.
+
+ This property corresponds to the `text-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textColorTransition;
+
+/**
The halo's fadeout distance towards the outside.
This property is measured in points.
@@ -1560,6 +1610,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textHaloBlur;
+/**
+ The transition affecting any changes to this layer’s `textHaloBlur` property.
+
+ This property corresponds to the `text-halo-blur-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textHaloBlurTransition;
+
#if TARGET_OS_IPHONE
/**
The color of the text's halo, which helps it stand out from backgrounds.
@@ -1619,6 +1676,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `textHaloColor` property.
+
+ This property corresponds to the `text-halo-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textHaloColorTransition;
+
+/**
Distance of halo to the font outline. Max text halo width is 1/4 of the
font-size.
@@ -1650,6 +1714,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textHaloWidth;
/**
+ The transition affecting any changes to this layer’s `textHaloWidth` property.
+
+ This property corresponds to the `text-halo-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textHaloWidthTransition;
+
+/**
The opacity at which the text will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -1677,6 +1748,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textOpacity;
+/**
+ The transition affecting any changes to this layer’s `textOpacity` property.
+
+ This property corresponds to the `text-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textOpacityTransition;
+
#if TARGET_OS_IPHONE
/**
Distance that the text's anchor is moved from its original placement.
@@ -1729,6 +1807,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `textTranslation` property.
+
+ This property corresponds to the `text-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textTranslate __attribute__((unavailable("Use textTranslation instead.")));
/**
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm
index 52648e7a05..8441931685 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.mm
+++ b/platform/darwin/src/MGLSymbolStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLSymbolStyleLayer.h"
@@ -904,6 +905,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconColorTransition(options);
+}
+
+- (MGLTransition)iconColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconHaloBlur:(MGLStyleValue<NSNumber *> *)iconHaloBlur {
MGLAssertStyleLayerIsValid();
@@ -921,6 +940,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconHaloBlurTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconHaloBlurTransition(options);
+}
+
+- (MGLTransition)iconHaloBlurTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconHaloBlurTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconHaloColor:(MGLStyleValue<MGLColor *> *)iconHaloColor {
MGLAssertStyleLayerIsValid();
@@ -938,6 +975,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconHaloColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconHaloColorTransition(options);
+}
+
+- (MGLTransition)iconHaloColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconHaloColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconHaloWidth:(MGLStyleValue<NSNumber *> *)iconHaloWidth {
MGLAssertStyleLayerIsValid();
@@ -955,6 +1010,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconHaloWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconHaloWidthTransition(options);
+}
+
+- (MGLTransition)iconHaloWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconHaloWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconOpacity:(MGLStyleValue<NSNumber *> *)iconOpacity {
MGLAssertStyleLayerIsValid();
@@ -972,6 +1045,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconOpacityTransition(options);
+}
+
+- (MGLTransition)iconOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconTranslation:(MGLStyleValue<NSValue *> *)iconTranslation {
MGLAssertStyleLayerIsValid();
@@ -989,6 +1080,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setIconTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconTranslateTransition(options);
+}
+
+- (MGLTransition)iconTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconTranslate:(MGLStyleValue<NSValue *> *)iconTranslate {
}
@@ -1037,6 +1146,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextColorTransition(options);
+}
+
+- (MGLTransition)textColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextHaloBlur:(MGLStyleValue<NSNumber *> *)textHaloBlur {
MGLAssertStyleLayerIsValid();
@@ -1054,6 +1181,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextHaloBlurTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextHaloBlurTransition(options);
+}
+
+- (MGLTransition)textHaloBlurTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextHaloBlurTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextHaloColor:(MGLStyleValue<MGLColor *> *)textHaloColor {
MGLAssertStyleLayerIsValid();
@@ -1071,6 +1216,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextHaloColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextHaloColorTransition(options);
+}
+
+- (MGLTransition)textHaloColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextHaloColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextHaloWidth:(MGLStyleValue<NSNumber *> *)textHaloWidth {
MGLAssertStyleLayerIsValid();
@@ -1088,6 +1251,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextHaloWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextHaloWidthTransition(options);
+}
+
+- (MGLTransition)textHaloWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextHaloWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextOpacity:(MGLStyleValue<NSNumber *> *)textOpacity {
MGLAssertStyleLayerIsValid();
@@ -1105,6 +1286,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextOpacityTransition(options);
+}
+
+- (MGLTransition)textOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextTranslation:(MGLStyleValue<NSValue *> *)textTranslation {
MGLAssertStyleLayerIsValid();
@@ -1122,6 +1321,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setTextTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextTranslateTransition(options);
+}
+
+- (MGLTransition)textTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextTranslate:(MGLStyleValue<NSValue *> *)textTranslate {
}
@@ -1153,7 +1370,6 @@ namespace mbgl {
return self.textTranslationAnchor;
}
-
@end
@implementation NSValue (MGLSymbolStyleLayerAdditions)
diff --git a/platform/darwin/src/MGLTypes.h b/platform/darwin/src/MGLTypes.h
index 65cebbe5f4..5216e921f1 100644
--- a/platform/darwin/src/MGLTypes.h
+++ b/platform/darwin/src/MGLTypes.h
@@ -70,6 +70,39 @@ typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
#endif
};
+/**
+ A structure containing information about a transition.
+ */
+typedef struct MGLTransition {
+ /**
+ The amount of time the animation should take, not including the delay.
+ */
+ NSTimeInterval duration;
+
+ /**
+ The amount of time in seconds to wait before beginning the animation.
+ */
+ NSTimeInterval delay;
+} MGLTransition;
+
+/**
+ Creates a new `MGLTransition` from the given duration and delay.
+
+ @param duration The amount of time the animation should take, not including
+ the delay.
+ @param delay The amount of time in seconds to wait before beginning the
+ animation.
+
+ @return Returns a `MGLTransition` struct containing the transition attributes.
+ */
+NS_INLINE MGLTransition MGLTransitionMake(NSTimeInterval duration, NSTimeInterval delay) {
+ MGLTransition transition;
+ transition.duration = duration;
+ transition.delay = delay;
+
+ return transition;
+}
+
NS_ASSUME_NONNULL_END
#ifndef NS_ARRAY_OF
diff --git a/platform/darwin/src/NSValue+MGLAdditions.h b/platform/darwin/src/NSValue+MGLAdditions.h
index 76388cf2bb..e6755021d0 100644
--- a/platform/darwin/src/NSValue+MGLAdditions.h
+++ b/platform/darwin/src/NSValue+MGLAdditions.h
@@ -2,6 +2,7 @@
#import "MGLGeometry.h"
#import "MGLOfflinePack.h"
+#import "MGLTypes.h"
NS_ASSUME_NONNULL_BEGIN
@@ -70,6 +71,22 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (readonly) MGLOfflinePackProgress MGLOfflinePackProgressValue;
+#pragma mark Working with Transition Values
+
+/**
+ Creates a new value object containing the given `MGLTransition`
+ structure.
+
+ @param transition The value for the new object.
+ @return A new value object that contains the transition information.
+ */
++ (NSValue *)valueWithMGLTransition:(MGLTransition)transition;
+
+/**
+ The `MGLTransition` structure representation of the value.
+ */
+@property (readonly) MGLTransition MGLTransitionValue;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/NSValue+MGLAdditions.m b/platform/darwin/src/NSValue+MGLAdditions.m
index 0d2128bea8..a95ef23941 100644
--- a/platform/darwin/src/NSValue+MGLAdditions.m
+++ b/platform/darwin/src/NSValue+MGLAdditions.m
@@ -46,4 +46,16 @@
return progress;
}
+#pragma mark Working with Transition Values
+
++ (NSValue *)valueWithMGLTransition:(MGLTransition)transition; {
+ return [NSValue value:&transition withObjCType:@encode(MGLTransition)];
+}
+
+- (MGLTransition)MGLTransitionValue {
+ MGLTransition transition;
+ [self getValue:&transition];
+ return transition;
+}
+
@end
diff --git a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
index 92c0ac7cbc..c96a4fe7fa 100644
--- a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
+++ b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/background_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLBackgroundLayerTests : MGLStyleLayerTests
@end
@@ -22,6 +24,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::BackgroundLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::BackgroundLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// background-color
{
XCTAssertTrue(rawLayer->getBackgroundColor().isUndefined(),
@@ -59,6 +64,15 @@
XCTAssertThrowsSpecificNamed(layer.backgroundColor = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<MGLColor *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.backgroundColor = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.backgroundColorTransition = transitionTest;
+ auto toptions = rawLayer->getBackgroundColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition backgroundColorTransition = layer.backgroundColorTransition;
+ XCTAssertEqual(backgroundColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(backgroundColorTransition.duration, transitionTest.duration);
}
// background-opacity
@@ -98,6 +112,15 @@
XCTAssertThrowsSpecificNamed(layer.backgroundOpacity = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.backgroundOpacity = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.backgroundOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getBackgroundOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition backgroundOpacityTransition = layer.backgroundOpacityTransition;
+ XCTAssertEqual(backgroundOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(backgroundOpacityTransition.duration, transitionTest.duration);
}
// background-pattern
@@ -137,6 +160,15 @@
XCTAssertThrowsSpecificNamed(layer.backgroundPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSString *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.backgroundPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.backgroundPatternTransition = transitionTest;
+ auto toptions = rawLayer->getBackgroundPatternTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition backgroundPatternTransition = layer.backgroundPatternTransition;
+ XCTAssertEqual(backgroundPatternTransition.delay, transitionTest.delay);
+ XCTAssertEqual(backgroundPatternTransition.duration, transitionTest.duration);
}
}
diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.mm b/platform/darwin/test/MGLCircleStyleLayerTests.mm
index d7515e8e4e..2a2e9f2d4a 100644
--- a/platform/darwin/test/MGLCircleStyleLayerTests.mm
+++ b/platform/darwin/test/MGLCircleStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/circle_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLCircleLayerTests : MGLStyleLayerTests
@end
@@ -43,6 +45,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::CircleLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::CircleLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// circle-blur
{
XCTAssertTrue(rawLayer->getCircleBlur().isUndefined(),
@@ -98,6 +103,15 @@
@"Unsetting circleBlur should return circle-blur to the default value.");
XCTAssertEqualObjects(layer.circleBlur, defaultStyleValue,
@"circleBlur should return the default value after being unset.");
+ // Transition property test
+ layer.circleBlurTransition = transitionTest;
+ auto toptions = rawLayer->getCircleBlurTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleBlurTransition = layer.circleBlurTransition;
+ XCTAssertEqual(circleBlurTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleBlurTransition.duration, transitionTest.duration);
}
// circle-color
@@ -155,6 +169,15 @@
@"Unsetting circleColor should return circle-color to the default value.");
XCTAssertEqualObjects(layer.circleColor, defaultStyleValue,
@"circleColor should return the default value after being unset.");
+ // Transition property test
+ layer.circleColorTransition = transitionTest;
+ auto toptions = rawLayer->getCircleColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleColorTransition = layer.circleColorTransition;
+ XCTAssertEqual(circleColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleColorTransition.duration, transitionTest.duration);
}
// circle-opacity
@@ -212,6 +235,15 @@
@"Unsetting circleOpacity should return circle-opacity to the default value.");
XCTAssertEqualObjects(layer.circleOpacity, defaultStyleValue,
@"circleOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.circleOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getCircleOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleOpacityTransition = layer.circleOpacityTransition;
+ XCTAssertEqual(circleOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleOpacityTransition.duration, transitionTest.duration);
}
// circle-radius
@@ -269,6 +301,15 @@
@"Unsetting circleRadius should return circle-radius to the default value.");
XCTAssertEqualObjects(layer.circleRadius, defaultStyleValue,
@"circleRadius should return the default value after being unset.");
+ // Transition property test
+ layer.circleRadiusTransition = transitionTest;
+ auto toptions = rawLayer->getCircleRadiusTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleRadiusTransition = layer.circleRadiusTransition;
+ XCTAssertEqual(circleRadiusTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleRadiusTransition.duration, transitionTest.duration);
}
// circle-pitch-scale
@@ -365,6 +406,15 @@
@"Unsetting circleStrokeColor should return circle-stroke-color to the default value.");
XCTAssertEqualObjects(layer.circleStrokeColor, defaultStyleValue,
@"circleStrokeColor should return the default value after being unset.");
+ // Transition property test
+ layer.circleStrokeColorTransition = transitionTest;
+ auto toptions = rawLayer->getCircleStrokeColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleStrokeColorTransition = layer.circleStrokeColorTransition;
+ XCTAssertEqual(circleStrokeColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleStrokeColorTransition.duration, transitionTest.duration);
}
// circle-stroke-opacity
@@ -422,6 +472,15 @@
@"Unsetting circleStrokeOpacity should return circle-stroke-opacity to the default value.");
XCTAssertEqualObjects(layer.circleStrokeOpacity, defaultStyleValue,
@"circleStrokeOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.circleStrokeOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getCircleStrokeOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleStrokeOpacityTransition = layer.circleStrokeOpacityTransition;
+ XCTAssertEqual(circleStrokeOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleStrokeOpacityTransition.duration, transitionTest.duration);
}
// circle-stroke-width
@@ -479,6 +538,15 @@
@"Unsetting circleStrokeWidth should return circle-stroke-width to the default value.");
XCTAssertEqualObjects(layer.circleStrokeWidth, defaultStyleValue,
@"circleStrokeWidth should return the default value after being unset.");
+ // Transition property test
+ layer.circleStrokeWidthTransition = transitionTest;
+ auto toptions = rawLayer->getCircleStrokeWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleStrokeWidthTransition = layer.circleStrokeWidthTransition;
+ XCTAssertEqual(circleStrokeWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleStrokeWidthTransition.duration, transitionTest.duration);
}
// circle-translate
diff --git a/platform/darwin/test/MGLFillStyleLayerTests.mm b/platform/darwin/test/MGLFillStyleLayerTests.mm
index c03b22c399..85f0b24fa7 100644
--- a/platform/darwin/test/MGLFillStyleLayerTests.mm
+++ b/platform/darwin/test/MGLFillStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/fill_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLFillLayerTests : MGLStyleLayerTests
@end
@@ -43,6 +45,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::FillLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::FillLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// fill-antialias
{
XCTAssertTrue(rawLayer->getFillAntialias().isUndefined(),
@@ -137,6 +142,15 @@
@"Unsetting fillColor should return fill-color to the default value.");
XCTAssertEqualObjects(layer.fillColor, defaultStyleValue,
@"fillColor should return the default value after being unset.");
+ // Transition property test
+ layer.fillColorTransition = transitionTest;
+ auto toptions = rawLayer->getFillColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition fillColorTransition = layer.fillColorTransition;
+ XCTAssertEqual(fillColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(fillColorTransition.duration, transitionTest.duration);
}
// fill-opacity
@@ -194,6 +208,15 @@
@"Unsetting fillOpacity should return fill-opacity to the default value.");
XCTAssertEqualObjects(layer.fillOpacity, defaultStyleValue,
@"fillOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.fillOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getFillOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition fillOpacityTransition = layer.fillOpacityTransition;
+ XCTAssertEqual(fillOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(fillOpacityTransition.duration, transitionTest.duration);
}
// fill-outline-color
@@ -251,6 +274,15 @@
@"Unsetting fillOutlineColor should return fill-outline-color to the default value.");
XCTAssertEqualObjects(layer.fillOutlineColor, defaultStyleValue,
@"fillOutlineColor should return the default value after being unset.");
+ // Transition property test
+ layer.fillOutlineColorTransition = transitionTest;
+ auto toptions = rawLayer->getFillOutlineColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition fillOutlineColorTransition = layer.fillOutlineColorTransition;
+ XCTAssertEqual(fillOutlineColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(fillOutlineColorTransition.duration, transitionTest.duration);
}
// fill-pattern
@@ -290,6 +322,15 @@
XCTAssertThrowsSpecificNamed(layer.fillPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSString *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.fillPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.fillPatternTransition = transitionTest;
+ auto toptions = rawLayer->getFillPatternTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition fillPatternTransition = layer.fillPatternTransition;
+ XCTAssertEqual(fillPatternTransition.delay, transitionTest.delay);
+ XCTAssertEqual(fillPatternTransition.duration, transitionTest.duration);
}
// fill-translate
diff --git a/platform/darwin/test/MGLLineStyleLayerTests.mm b/platform/darwin/test/MGLLineStyleLayerTests.mm
index 95c3e434c0..1e92959520 100644
--- a/platform/darwin/test/MGLLineStyleLayerTests.mm
+++ b/platform/darwin/test/MGLLineStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/line_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLLineLayerTests : MGLStyleLayerTests
@end
@@ -43,6 +45,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::LineLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::LineLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// line-cap
{
XCTAssertTrue(rawLayer->getLineCap().isUndefined(),
@@ -254,6 +259,15 @@
@"Unsetting lineBlur should return line-blur to the default value.");
XCTAssertEqualObjects(layer.lineBlur, defaultStyleValue,
@"lineBlur should return the default value after being unset.");
+ // Transition property test
+ layer.lineBlurTransition = transitionTest;
+ auto toptions = rawLayer->getLineBlurTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineBlurTransition = layer.lineBlurTransition;
+ XCTAssertEqual(lineBlurTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineBlurTransition.duration, transitionTest.duration);
}
// line-color
@@ -311,6 +325,15 @@
@"Unsetting lineColor should return line-color to the default value.");
XCTAssertEqualObjects(layer.lineColor, defaultStyleValue,
@"lineColor should return the default value after being unset.");
+ // Transition property test
+ layer.lineColorTransition = transitionTest;
+ auto toptions = rawLayer->getLineColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineColorTransition = layer.lineColorTransition;
+ XCTAssertEqual(lineColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineColorTransition.duration, transitionTest.duration);
}
// line-dasharray
@@ -407,6 +430,15 @@
@"Unsetting lineGapWidth should return line-gap-width to the default value.");
XCTAssertEqualObjects(layer.lineGapWidth, defaultStyleValue,
@"lineGapWidth should return the default value after being unset.");
+ // Transition property test
+ layer.lineGapWidthTransition = transitionTest;
+ auto toptions = rawLayer->getLineGapWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineGapWidthTransition = layer.lineGapWidthTransition;
+ XCTAssertEqual(lineGapWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineGapWidthTransition.duration, transitionTest.duration);
}
// line-offset
@@ -464,6 +496,15 @@
@"Unsetting lineOffset should return line-offset to the default value.");
XCTAssertEqualObjects(layer.lineOffset, defaultStyleValue,
@"lineOffset should return the default value after being unset.");
+ // Transition property test
+ layer.lineOffsetTransition = transitionTest;
+ auto toptions = rawLayer->getLineOffsetTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineOffsetTransition = layer.lineOffsetTransition;
+ XCTAssertEqual(lineOffsetTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineOffsetTransition.duration, transitionTest.duration);
}
// line-opacity
@@ -521,6 +562,15 @@
@"Unsetting lineOpacity should return line-opacity to the default value.");
XCTAssertEqualObjects(layer.lineOpacity, defaultStyleValue,
@"lineOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.lineOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getLineOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineOpacityTransition = layer.lineOpacityTransition;
+ XCTAssertEqual(lineOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineOpacityTransition.duration, transitionTest.duration);
}
// line-pattern
@@ -560,6 +610,15 @@
XCTAssertThrowsSpecificNamed(layer.linePattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSString *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.linePattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.linePatternTransition = transitionTest;
+ auto toptions = rawLayer->getLinePatternTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition linePatternTransition = layer.linePatternTransition;
+ XCTAssertEqual(linePatternTransition.delay, transitionTest.delay);
+ XCTAssertEqual(linePatternTransition.duration, transitionTest.duration);
}
// line-translate
@@ -683,6 +742,15 @@
XCTAssertThrowsSpecificNamed(layer.lineWidth = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.lineWidth = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.lineWidthTransition = transitionTest;
+ auto toptions = rawLayer->getLineWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineWidthTransition = layer.lineWidthTransition;
+ XCTAssertEqual(lineWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineWidthTransition.duration, transitionTest.duration);
}
}
diff --git a/platform/darwin/test/MGLRasterStyleLayerTests.mm b/platform/darwin/test/MGLRasterStyleLayerTests.mm
index b7a764e6c2..7b0757eeb6 100644
--- a/platform/darwin/test/MGLRasterStyleLayerTests.mm
+++ b/platform/darwin/test/MGLRasterStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/raster_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLRasterLayerTests : MGLStyleLayerTests
@end
@@ -25,6 +27,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::RasterLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::RasterLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// raster-brightness-max
{
XCTAssertTrue(rawLayer->getRasterBrightnessMax().isUndefined(),
@@ -140,6 +145,15 @@
XCTAssertThrowsSpecificNamed(layer.rasterContrast = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.rasterContrast = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.rasterContrastTransition = transitionTest;
+ auto toptions = rawLayer->getRasterContrastTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition rasterContrastTransition = layer.rasterContrastTransition;
+ XCTAssertEqual(rasterContrastTransition.delay, transitionTest.delay);
+ XCTAssertEqual(rasterContrastTransition.duration, transitionTest.duration);
}
// raster-fade-duration
@@ -179,6 +193,15 @@
XCTAssertThrowsSpecificNamed(layer.rasterFadeDuration = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.rasterFadeDuration = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.rasterFadeDurationTransition = transitionTest;
+ auto toptions = rawLayer->getRasterFadeDurationTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition rasterFadeDurationTransition = layer.rasterFadeDurationTransition;
+ XCTAssertEqual(rasterFadeDurationTransition.delay, transitionTest.delay);
+ XCTAssertEqual(rasterFadeDurationTransition.duration, transitionTest.duration);
}
// raster-hue-rotate
@@ -257,6 +280,15 @@
XCTAssertThrowsSpecificNamed(layer.rasterOpacity = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.rasterOpacity = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.rasterOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getRasterOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition rasterOpacityTransition = layer.rasterOpacityTransition;
+ XCTAssertEqual(rasterOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(rasterOpacityTransition.duration, transitionTest.duration);
}
// raster-saturation
@@ -296,6 +328,15 @@
XCTAssertThrowsSpecificNamed(layer.rasterSaturation = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.rasterSaturation = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.rasterSaturationTransition = transitionTest;
+ auto toptions = rawLayer->getRasterSaturationTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition rasterSaturationTransition = layer.rasterSaturationTransition;
+ XCTAssertEqual(rasterSaturationTransition.delay, transitionTest.delay);
+ XCTAssertEqual(rasterSaturationTransition.duration, transitionTest.duration);
}
}
diff --git a/platform/darwin/test/MGLStyleLayerTests.mm.ejs b/platform/darwin/test/MGLStyleLayerTests.mm.ejs
index 810d7fbd3b..a405ae58c4 100644
--- a/platform/darwin/test/MGLStyleLayerTests.mm.ejs
+++ b/platform/darwin/test/MGLStyleLayerTests.mm.ejs
@@ -7,10 +7,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/<%- type %>_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGL<%- camelize(type) %>LayerTests : MGLStyleLayerTests
@end
@@ -53,6 +55,9 @@
XCTAssertNotEqual(layer.rawLayer, nullptr);
XCTAssertTrue(layer.rawLayer->is<mbgl::style::<%- camelize(type) %>Layer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::<%- camelize(type) %>Layer>();
+
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
<% for (const property of properties) { -%>
// <%- originalPropertyName(property) %>
@@ -124,6 +129,17 @@
functionStyleValue = [MGLStyleValue<<%- propertyType(property) %>> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.<%- objCName(property) %> = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
<% } -%>
+<% if (property["transition"] && !property.original) { -%>
+ // Transition property test
+ layer.<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition = transitionTest;
+ auto toptions = rawLayer->get<%- camelize(originalPropertyName(property)) %>Transition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition <%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition = layer.<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition;
+ XCTAssertEqual(<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition.delay, transitionTest.delay);
+ XCTAssertEqual(<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition.duration, transitionTest.duration);
+<% } -%>
}
<% } -%>
}
diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.mm b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
index 1d599f5aca..e3e473ef78 100644
--- a/platform/darwin/test/MGLSymbolStyleLayerTests.mm
+++ b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/symbol_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLSymbolLayerTests : MGLStyleLayerTests
@end
@@ -43,6 +45,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::SymbolLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::SymbolLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// icon-allow-overlap
{
XCTAssertTrue(rawLayer->getIconAllowOverlap().isUndefined(),
@@ -1468,6 +1473,15 @@
@"Unsetting iconColor should return icon-color to the default value.");
XCTAssertEqualObjects(layer.iconColor, defaultStyleValue,
@"iconColor should return the default value after being unset.");
+ // Transition property test
+ layer.iconColorTransition = transitionTest;
+ auto toptions = rawLayer->getIconColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconColorTransition = layer.iconColorTransition;
+ XCTAssertEqual(iconColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconColorTransition.duration, transitionTest.duration);
}
// icon-halo-blur
@@ -1525,6 +1539,15 @@
@"Unsetting iconHaloBlur should return icon-halo-blur to the default value.");
XCTAssertEqualObjects(layer.iconHaloBlur, defaultStyleValue,
@"iconHaloBlur should return the default value after being unset.");
+ // Transition property test
+ layer.iconHaloBlurTransition = transitionTest;
+ auto toptions = rawLayer->getIconHaloBlurTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconHaloBlurTransition = layer.iconHaloBlurTransition;
+ XCTAssertEqual(iconHaloBlurTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconHaloBlurTransition.duration, transitionTest.duration);
}
// icon-halo-color
@@ -1582,6 +1605,15 @@
@"Unsetting iconHaloColor should return icon-halo-color to the default value.");
XCTAssertEqualObjects(layer.iconHaloColor, defaultStyleValue,
@"iconHaloColor should return the default value after being unset.");
+ // Transition property test
+ layer.iconHaloColorTransition = transitionTest;
+ auto toptions = rawLayer->getIconHaloColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconHaloColorTransition = layer.iconHaloColorTransition;
+ XCTAssertEqual(iconHaloColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconHaloColorTransition.duration, transitionTest.duration);
}
// icon-halo-width
@@ -1639,6 +1671,15 @@
@"Unsetting iconHaloWidth should return icon-halo-width to the default value.");
XCTAssertEqualObjects(layer.iconHaloWidth, defaultStyleValue,
@"iconHaloWidth should return the default value after being unset.");
+ // Transition property test
+ layer.iconHaloWidthTransition = transitionTest;
+ auto toptions = rawLayer->getIconHaloWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconHaloWidthTransition = layer.iconHaloWidthTransition;
+ XCTAssertEqual(iconHaloWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconHaloWidthTransition.duration, transitionTest.duration);
}
// icon-opacity
@@ -1696,6 +1737,15 @@
@"Unsetting iconOpacity should return icon-opacity to the default value.");
XCTAssertEqualObjects(layer.iconOpacity, defaultStyleValue,
@"iconOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.iconOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getIconOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconOpacityTransition = layer.iconOpacityTransition;
+ XCTAssertEqual(iconOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconOpacityTransition.duration, transitionTest.duration);
}
// icon-translate
@@ -1837,6 +1887,15 @@
@"Unsetting textColor should return text-color to the default value.");
XCTAssertEqualObjects(layer.textColor, defaultStyleValue,
@"textColor should return the default value after being unset.");
+ // Transition property test
+ layer.textColorTransition = transitionTest;
+ auto toptions = rawLayer->getTextColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textColorTransition = layer.textColorTransition;
+ XCTAssertEqual(textColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textColorTransition.duration, transitionTest.duration);
}
// text-halo-blur
@@ -1894,6 +1953,15 @@
@"Unsetting textHaloBlur should return text-halo-blur to the default value.");
XCTAssertEqualObjects(layer.textHaloBlur, defaultStyleValue,
@"textHaloBlur should return the default value after being unset.");
+ // Transition property test
+ layer.textHaloBlurTransition = transitionTest;
+ auto toptions = rawLayer->getTextHaloBlurTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textHaloBlurTransition = layer.textHaloBlurTransition;
+ XCTAssertEqual(textHaloBlurTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textHaloBlurTransition.duration, transitionTest.duration);
}
// text-halo-color
@@ -1951,6 +2019,15 @@
@"Unsetting textHaloColor should return text-halo-color to the default value.");
XCTAssertEqualObjects(layer.textHaloColor, defaultStyleValue,
@"textHaloColor should return the default value after being unset.");
+ // Transition property test
+ layer.textHaloColorTransition = transitionTest;
+ auto toptions = rawLayer->getTextHaloColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textHaloColorTransition = layer.textHaloColorTransition;
+ XCTAssertEqual(textHaloColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textHaloColorTransition.duration, transitionTest.duration);
}
// text-halo-width
@@ -2008,6 +2085,15 @@
@"Unsetting textHaloWidth should return text-halo-width to the default value.");
XCTAssertEqualObjects(layer.textHaloWidth, defaultStyleValue,
@"textHaloWidth should return the default value after being unset.");
+ // Transition property test
+ layer.textHaloWidthTransition = transitionTest;
+ auto toptions = rawLayer->getTextHaloWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textHaloWidthTransition = layer.textHaloWidthTransition;
+ XCTAssertEqual(textHaloWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textHaloWidthTransition.duration, transitionTest.duration);
}
// text-opacity
@@ -2065,6 +2151,15 @@
@"Unsetting textOpacity should return text-opacity to the default value.");
XCTAssertEqualObjects(layer.textOpacity, defaultStyleValue,
@"textOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.textOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getTextOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textOpacityTransition = layer.textOpacityTransition;
+ XCTAssertEqual(textOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textOpacityTransition.duration, transitionTest.duration);
}
// text-translate
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 56f600187a..7ddb503543 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -26,7 +26,8 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* Point-placed labels in symbol style layers are now placed at more optimal locations within polygons. ([#7465](https://github.com/mapbox/mapbox-gl-native/pull/7465))
* Fixed flickering that occurred when manipulating a style layer. ([#7616](https://github.com/mapbox/mapbox-gl-native/pull/7616))
* Symbol style layers can now render point collections (known as multipoints in GeoJSON). ([#7445](https://github.com/mapbox/mapbox-gl-native/pull/7445))
-* Added properties to MGLStyle to delay or animate changes to style layers. ([#7711](https://github.com/mapbox/mapbox-gl-native/pull/7711))
+* Added a `transition` property to MGLStyle to customize the timing of changes to style layers. ([#7711](https://github.com/mapbox/mapbox-gl-native/pull/7711))
+* Added properties to MGLStyleLayer subclasses to customize the timing of transitions between values of individual attributes. ([#8225](https://github.com/mapbox/mapbox-gl-native/pull/8225))
* Fixed an issue causing lines and text labels toward the top of the map view to appear blurry when the map is tilted. ([#7444](https://github.com/mapbox/mapbox-gl-native/pull/7444))
* Fixed incorrect interpolation of style functions in Boolean-typed style attributes. ([#7526](https://github.com/mapbox/mapbox-gl-native/pull/7526))
* Removed support for the `ref` property in layers in style JSON files. ([#7586](https://github.com/mapbox/mapbox-gl-native/pull/7586))
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index e1ff440e9e..39458c4f31 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -915,8 +915,8 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
- (void)styleBuildingLayer
{
- self.mapView.style.transitionDuration = 5;
- self.mapView.style.transitionDelay = 1;
+ MGLTransition transition = { 5, 1 };
+ self.mapView.style.transition = transition;
MGLFillStyleLayer *buildingLayer = (MGLFillStyleLayer *)[self.mapView.style layerWithIdentifier:@"building"];
buildingLayer.fillColor = [MGLStyleValue<UIColor *> valueWithRawValue:[UIColor purpleColor]];
}
diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md
index 8f52719f91..7c00f14be7 100644
--- a/platform/macos/CHANGELOG.md
+++ b/platform/macos/CHANGELOG.md
@@ -18,7 +18,8 @@
* Point-placed labels in symbol style layers are now placed at more optimal locations within polygons. ([#7465](https://github.com/mapbox/mapbox-gl-native/pull/7465))
* Fixed flickering that occurred when manipulating a style layer. ([#7616](https://github.com/mapbox/mapbox-gl-native/pull/7616))
* Symbol style layers can now render point collections (known as multipoints in GeoJSON). ([#7445](https://github.com/mapbox/mapbox-gl-native/pull/7445))
-* Added properties to MGLStyle to delay or animate changes to style layers. ([#7711](https://github.com/mapbox/mapbox-gl-native/pull/7711))
+* Added a `transition` property to MGLStyle to customize the timing of changes to style layers. ([#7711](https://github.com/mapbox/mapbox-gl-native/pull/7711))
+* Added properties to MGLStyleLayer subclasses to customize the timing of transitions between values of individual attributes. ([#8225](https://github.com/mapbox/mapbox-gl-native/pull/8225))
* Fixed an issue causing lines and text labels toward the top of the map view to appear blurry when the map is tilted. ([#7444](https://github.com/mapbox/mapbox-gl-native/pull/7444))
* Fixed incorrect interpolation of style functions in Boolean-typed style attributes. ([#7526](https://github.com/mapbox/mapbox-gl-native/pull/7526))
* Removed support for the `ref` property in layers in style JSON files. ([#7586](https://github.com/mapbox/mapbox-gl-native/pull/7586))
diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m
index b120f2da6d..ec90888084 100644
--- a/platform/macos/app/MapDocument.m
+++ b/platform/macos/app/MapDocument.m
@@ -683,8 +683,8 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
}
- (IBAction)manipulateStyle:(id)sender {
- self.mapView.style.transitionDuration = 5;
- self.mapView.style.transitionDelay = 1;
+ MGLTransition transition = { .duration = 5, .delay = 1 };
+ self.mapView.style.transition = transition;
MGLFillStyleLayer *fillStyleLayer = (MGLFillStyleLayer *)[self.mapView.style layerWithIdentifier:@"water"];
diff --git a/src/mbgl/style/layers/background_layer.cpp b/src/mbgl/style/layers/background_layer.cpp
index 5a903f1b6b..e2a517b9f4 100644
--- a/src/mbgl/style/layers/background_layer.cpp
+++ b/src/mbgl/style/layers/background_layer.cpp
@@ -59,6 +59,10 @@ void BackgroundLayer::setBackgroundColorTransition(const TransitionOptions& valu
impl->paint.setTransition<BackgroundColor>(value, klass);
}
+TransitionOptions BackgroundLayer::getBackgroundColorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<BackgroundColor>(klass);
+}
+
PropertyValue<std::string> BackgroundLayer::getDefaultBackgroundPattern() {
return { "" };
}
@@ -78,6 +82,10 @@ void BackgroundLayer::setBackgroundPatternTransition(const TransitionOptions& va
impl->paint.setTransition<BackgroundPattern>(value, klass);
}
+TransitionOptions BackgroundLayer::getBackgroundPatternTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<BackgroundPattern>(klass);
+}
+
PropertyValue<float> BackgroundLayer::getDefaultBackgroundOpacity() {
return { 1 };
}
@@ -97,5 +105,9 @@ void BackgroundLayer::setBackgroundOpacityTransition(const TransitionOptions& va
impl->paint.setTransition<BackgroundOpacity>(value, klass);
}
+TransitionOptions BackgroundLayer::getBackgroundOpacityTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<BackgroundOpacity>(klass);
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp
index 53248e9397..a628d7a417 100644
--- a/src/mbgl/style/layers/circle_layer.cpp
+++ b/src/mbgl/style/layers/circle_layer.cpp
@@ -88,6 +88,10 @@ void CircleLayer::setCircleRadiusTransition(const TransitionOptions& value, cons
impl->paint.setTransition<CircleRadius>(value, klass);
}
+TransitionOptions CircleLayer::getCircleRadiusTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<CircleRadius>(klass);
+}
+
DataDrivenPropertyValue<Color> CircleLayer::getDefaultCircleColor() {
return { Color::black() };
}
@@ -111,6 +115,10 @@ void CircleLayer::setCircleColorTransition(const TransitionOptions& value, const
impl->paint.setTransition<CircleColor>(value, klass);
}
+TransitionOptions CircleLayer::getCircleColorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<CircleColor>(klass);
+}
+
DataDrivenPropertyValue<float> CircleLayer::getDefaultCircleBlur() {
return { 0 };
}
@@ -134,6 +142,10 @@ void CircleLayer::setCircleBlurTransition(const TransitionOptions& value, const
impl->paint.setTransition<CircleBlur>(value, klass);
}
+TransitionOptions CircleLayer::getCircleBlurTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<CircleBlur>(klass);
+}
+
DataDrivenPropertyValue<float> CircleLayer::getDefaultCircleOpacity() {
return { 1 };
}
@@ -157,6 +169,10 @@ void CircleLayer::setCircleOpacityTransition(const TransitionOptions& value, con
impl->paint.setTransition<CircleOpacity>(value, klass);
}
+TransitionOptions CircleLayer::getCircleOpacityTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<CircleOpacity>(klass);
+}
+
PropertyValue<std::array<float, 2>> CircleLayer::getDefaultCircleTranslate() {
return { {{ 0, 0 }} };
}
@@ -176,6 +192,10 @@ void CircleLayer::setCircleTranslateTransition(const TransitionOptions& value, c
impl->paint.setTransition<CircleTranslate>(value, klass);
}
+TransitionOptions CircleLayer::getCircleTranslateTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<CircleTranslate>(klass);
+}
+
PropertyValue<TranslateAnchorType> CircleLayer::getDefaultCircleTranslateAnchor() {
return { TranslateAnchorType::Map };
}
@@ -195,6 +215,10 @@ void CircleLayer::setCircleTranslateAnchorTransition(const TransitionOptions& va
impl->paint.setTransition<CircleTranslateAnchor>(value, klass);
}
+TransitionOptions CircleLayer::getCircleTranslateAnchorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<CircleTranslateAnchor>(klass);
+}
+
PropertyValue<CirclePitchScaleType> CircleLayer::getDefaultCirclePitchScale() {
return { CirclePitchScaleType::Map };
}
@@ -214,6 +238,10 @@ void CircleLayer::setCirclePitchScaleTransition(const TransitionOptions& value,
impl->paint.setTransition<CirclePitchScale>(value, klass);
}
+TransitionOptions CircleLayer::getCirclePitchScaleTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<CirclePitchScale>(klass);
+}
+
DataDrivenPropertyValue<float> CircleLayer::getDefaultCircleStrokeWidth() {
return { 0 };
}
@@ -237,6 +265,10 @@ void CircleLayer::setCircleStrokeWidthTransition(const TransitionOptions& value,
impl->paint.setTransition<CircleStrokeWidth>(value, klass);
}
+TransitionOptions CircleLayer::getCircleStrokeWidthTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<CircleStrokeWidth>(klass);
+}
+
DataDrivenPropertyValue<Color> CircleLayer::getDefaultCircleStrokeColor() {
return { Color::black() };
}
@@ -260,6 +292,10 @@ void CircleLayer::setCircleStrokeColorTransition(const TransitionOptions& value,
impl->paint.setTransition<CircleStrokeColor>(value, klass);
}
+TransitionOptions CircleLayer::getCircleStrokeColorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<CircleStrokeColor>(klass);
+}
+
DataDrivenPropertyValue<float> CircleLayer::getDefaultCircleStrokeOpacity() {
return { 1 };
}
@@ -283,5 +319,9 @@ void CircleLayer::setCircleStrokeOpacityTransition(const TransitionOptions& valu
impl->paint.setTransition<CircleStrokeOpacity>(value, klass);
}
+TransitionOptions CircleLayer::getCircleStrokeOpacityTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<CircleStrokeOpacity>(klass);
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/fill_extrusion_layer.cpp b/src/mbgl/style/layers/fill_extrusion_layer.cpp
index 4672ede9b8..53f7fc0757 100644
--- a/src/mbgl/style/layers/fill_extrusion_layer.cpp
+++ b/src/mbgl/style/layers/fill_extrusion_layer.cpp
@@ -84,6 +84,10 @@ void FillExtrusionLayer::setFillExtrusionOpacityTransition(const TransitionOptio
impl->paint.setTransition<FillExtrusionOpacity>(value, klass);
}
+TransitionOptions FillExtrusionLayer::getFillExtrusionOpacityTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<FillExtrusionOpacity>(klass);
+}
+
DataDrivenPropertyValue<Color> FillExtrusionLayer::getDefaultFillExtrusionColor() {
return { Color::black() };
}
@@ -107,6 +111,10 @@ void FillExtrusionLayer::setFillExtrusionColorTransition(const TransitionOptions
impl->paint.setTransition<FillExtrusionColor>(value, klass);
}
+TransitionOptions FillExtrusionLayer::getFillExtrusionColorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<FillExtrusionColor>(klass);
+}
+
PropertyValue<std::array<float, 2>> FillExtrusionLayer::getDefaultFillExtrusionTranslate() {
return { {{ 0, 0 }} };
}
@@ -126,6 +134,10 @@ void FillExtrusionLayer::setFillExtrusionTranslateTransition(const TransitionOpt
impl->paint.setTransition<FillExtrusionTranslate>(value, klass);
}
+TransitionOptions FillExtrusionLayer::getFillExtrusionTranslateTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<FillExtrusionTranslate>(klass);
+}
+
PropertyValue<TranslateAnchorType> FillExtrusionLayer::getDefaultFillExtrusionTranslateAnchor() {
return { TranslateAnchorType::Map };
}
@@ -145,6 +157,10 @@ void FillExtrusionLayer::setFillExtrusionTranslateAnchorTransition(const Transit
impl->paint.setTransition<FillExtrusionTranslateAnchor>(value, klass);
}
+TransitionOptions FillExtrusionLayer::getFillExtrusionTranslateAnchorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<FillExtrusionTranslateAnchor>(klass);
+}
+
PropertyValue<std::string> FillExtrusionLayer::getDefaultFillExtrusionPattern() {
return { "" };
}
@@ -164,6 +180,10 @@ void FillExtrusionLayer::setFillExtrusionPatternTransition(const TransitionOptio
impl->paint.setTransition<FillExtrusionPattern>(value, klass);
}
+TransitionOptions FillExtrusionLayer::getFillExtrusionPatternTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<FillExtrusionPattern>(klass);
+}
+
DataDrivenPropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionHeight() {
return { 0 };
}
@@ -187,6 +207,10 @@ void FillExtrusionLayer::setFillExtrusionHeightTransition(const TransitionOption
impl->paint.setTransition<FillExtrusionHeight>(value, klass);
}
+TransitionOptions FillExtrusionLayer::getFillExtrusionHeightTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<FillExtrusionHeight>(klass);
+}
+
DataDrivenPropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionBase() {
return { 0 };
}
@@ -210,5 +234,9 @@ void FillExtrusionLayer::setFillExtrusionBaseTransition(const TransitionOptions&
impl->paint.setTransition<FillExtrusionBase>(value, klass);
}
+TransitionOptions FillExtrusionLayer::getFillExtrusionBaseTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<FillExtrusionBase>(klass);
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp
index dfa88b5b0f..34203a10c0 100644
--- a/src/mbgl/style/layers/fill_layer.cpp
+++ b/src/mbgl/style/layers/fill_layer.cpp
@@ -84,6 +84,10 @@ void FillLayer::setFillAntialiasTransition(const TransitionOptions& value, const
impl->paint.setTransition<FillAntialias>(value, klass);
}
+TransitionOptions FillLayer::getFillAntialiasTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<FillAntialias>(klass);
+}
+
DataDrivenPropertyValue<float> FillLayer::getDefaultFillOpacity() {
return { 1 };
}
@@ -107,6 +111,10 @@ void FillLayer::setFillOpacityTransition(const TransitionOptions& value, const o
impl->paint.setTransition<FillOpacity>(value, klass);
}
+TransitionOptions FillLayer::getFillOpacityTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<FillOpacity>(klass);
+}
+
DataDrivenPropertyValue<Color> FillLayer::getDefaultFillColor() {
return { Color::black() };
}
@@ -130,6 +138,10 @@ void FillLayer::setFillColorTransition(const TransitionOptions& value, const opt
impl->paint.setTransition<FillColor>(value, klass);
}
+TransitionOptions FillLayer::getFillColorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<FillColor>(klass);
+}
+
DataDrivenPropertyValue<Color> FillLayer::getDefaultFillOutlineColor() {
return { {} };
}
@@ -153,6 +165,10 @@ void FillLayer::setFillOutlineColorTransition(const TransitionOptions& value, co
impl->paint.setTransition<FillOutlineColor>(value, klass);
}
+TransitionOptions FillLayer::getFillOutlineColorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<FillOutlineColor>(klass);
+}
+
PropertyValue<std::array<float, 2>> FillLayer::getDefaultFillTranslate() {
return { {{ 0, 0 }} };
}
@@ -172,6 +188,10 @@ void FillLayer::setFillTranslateTransition(const TransitionOptions& value, const
impl->paint.setTransition<FillTranslate>(value, klass);
}
+TransitionOptions FillLayer::getFillTranslateTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<FillTranslate>(klass);
+}
+
PropertyValue<TranslateAnchorType> FillLayer::getDefaultFillTranslateAnchor() {
return { TranslateAnchorType::Map };
}
@@ -191,6 +211,10 @@ void FillLayer::setFillTranslateAnchorTransition(const TransitionOptions& value,
impl->paint.setTransition<FillTranslateAnchor>(value, klass);
}
+TransitionOptions FillLayer::getFillTranslateAnchorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<FillTranslateAnchor>(klass);
+}
+
PropertyValue<std::string> FillLayer::getDefaultFillPattern() {
return { "" };
}
@@ -210,5 +234,9 @@ void FillLayer::setFillPatternTransition(const TransitionOptions& value, const o
impl->paint.setTransition<FillPattern>(value, klass);
}
+TransitionOptions FillLayer::getFillPatternTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<FillPattern>(klass);
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs
index 335573abf3..76c83f474a 100644
--- a/src/mbgl/style/layers/layer.cpp.ejs
+++ b/src/mbgl/style/layers/layer.cpp.ejs
@@ -130,6 +130,10 @@ void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(<%- propertyV
void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>Transition(const TransitionOptions& value, const optional<std::string>& klass) {
impl->paint.setTransition<<%- camelize(property.name) %>>(value, klass);
}
+
+TransitionOptions <%- camelize(type) %>Layer::get<%- camelize(property.name) %>Transition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<<%- camelize(property.name) %>>(klass);
+}
<% } -%>
} // namespace style
diff --git a/src/mbgl/style/layers/line_layer.cpp b/src/mbgl/style/layers/line_layer.cpp
index eaaa0fcd45..cfb68f3262 100644
--- a/src/mbgl/style/layers/line_layer.cpp
+++ b/src/mbgl/style/layers/line_layer.cpp
@@ -145,6 +145,10 @@ void LineLayer::setLineOpacityTransition(const TransitionOptions& value, const o
impl->paint.setTransition<LineOpacity>(value, klass);
}
+TransitionOptions LineLayer::getLineOpacityTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<LineOpacity>(klass);
+}
+
DataDrivenPropertyValue<Color> LineLayer::getDefaultLineColor() {
return { Color::black() };
}
@@ -168,6 +172,10 @@ void LineLayer::setLineColorTransition(const TransitionOptions& value, const opt
impl->paint.setTransition<LineColor>(value, klass);
}
+TransitionOptions LineLayer::getLineColorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<LineColor>(klass);
+}
+
PropertyValue<std::array<float, 2>> LineLayer::getDefaultLineTranslate() {
return { {{ 0, 0 }} };
}
@@ -187,6 +195,10 @@ void LineLayer::setLineTranslateTransition(const TransitionOptions& value, const
impl->paint.setTransition<LineTranslate>(value, klass);
}
+TransitionOptions LineLayer::getLineTranslateTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<LineTranslate>(klass);
+}
+
PropertyValue<TranslateAnchorType> LineLayer::getDefaultLineTranslateAnchor() {
return { TranslateAnchorType::Map };
}
@@ -206,6 +218,10 @@ void LineLayer::setLineTranslateAnchorTransition(const TransitionOptions& value,
impl->paint.setTransition<LineTranslateAnchor>(value, klass);
}
+TransitionOptions LineLayer::getLineTranslateAnchorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<LineTranslateAnchor>(klass);
+}
+
PropertyValue<float> LineLayer::getDefaultLineWidth() {
return { 1 };
}
@@ -225,6 +241,10 @@ void LineLayer::setLineWidthTransition(const TransitionOptions& value, const opt
impl->paint.setTransition<LineWidth>(value, klass);
}
+TransitionOptions LineLayer::getLineWidthTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<LineWidth>(klass);
+}
+
DataDrivenPropertyValue<float> LineLayer::getDefaultLineGapWidth() {
return { 0 };
}
@@ -248,6 +268,10 @@ void LineLayer::setLineGapWidthTransition(const TransitionOptions& value, const
impl->paint.setTransition<LineGapWidth>(value, klass);
}
+TransitionOptions LineLayer::getLineGapWidthTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<LineGapWidth>(klass);
+}
+
DataDrivenPropertyValue<float> LineLayer::getDefaultLineOffset() {
return { 0 };
}
@@ -271,6 +295,10 @@ void LineLayer::setLineOffsetTransition(const TransitionOptions& value, const op
impl->paint.setTransition<LineOffset>(value, klass);
}
+TransitionOptions LineLayer::getLineOffsetTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<LineOffset>(klass);
+}
+
DataDrivenPropertyValue<float> LineLayer::getDefaultLineBlur() {
return { 0 };
}
@@ -294,6 +322,10 @@ void LineLayer::setLineBlurTransition(const TransitionOptions& value, const opti
impl->paint.setTransition<LineBlur>(value, klass);
}
+TransitionOptions LineLayer::getLineBlurTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<LineBlur>(klass);
+}
+
PropertyValue<std::vector<float>> LineLayer::getDefaultLineDasharray() {
return { { } };
}
@@ -313,6 +345,10 @@ void LineLayer::setLineDasharrayTransition(const TransitionOptions& value, const
impl->paint.setTransition<LineDasharray>(value, klass);
}
+TransitionOptions LineLayer::getLineDasharrayTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<LineDasharray>(klass);
+}
+
PropertyValue<std::string> LineLayer::getDefaultLinePattern() {
return { "" };
}
@@ -332,5 +368,9 @@ void LineLayer::setLinePatternTransition(const TransitionOptions& value, const o
impl->paint.setTransition<LinePattern>(value, klass);
}
+TransitionOptions LineLayer::getLinePatternTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<LinePattern>(klass);
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/raster_layer.cpp b/src/mbgl/style/layers/raster_layer.cpp
index 2108a5c49f..dfdd13e63c 100644
--- a/src/mbgl/style/layers/raster_layer.cpp
+++ b/src/mbgl/style/layers/raster_layer.cpp
@@ -66,6 +66,10 @@ void RasterLayer::setRasterOpacityTransition(const TransitionOptions& value, con
impl->paint.setTransition<RasterOpacity>(value, klass);
}
+TransitionOptions RasterLayer::getRasterOpacityTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<RasterOpacity>(klass);
+}
+
PropertyValue<float> RasterLayer::getDefaultRasterHueRotate() {
return { 0 };
}
@@ -85,6 +89,10 @@ void RasterLayer::setRasterHueRotateTransition(const TransitionOptions& value, c
impl->paint.setTransition<RasterHueRotate>(value, klass);
}
+TransitionOptions RasterLayer::getRasterHueRotateTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<RasterHueRotate>(klass);
+}
+
PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMin() {
return { 0 };
}
@@ -104,6 +112,10 @@ void RasterLayer::setRasterBrightnessMinTransition(const TransitionOptions& valu
impl->paint.setTransition<RasterBrightnessMin>(value, klass);
}
+TransitionOptions RasterLayer::getRasterBrightnessMinTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<RasterBrightnessMin>(klass);
+}
+
PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMax() {
return { 1 };
}
@@ -123,6 +135,10 @@ void RasterLayer::setRasterBrightnessMaxTransition(const TransitionOptions& valu
impl->paint.setTransition<RasterBrightnessMax>(value, klass);
}
+TransitionOptions RasterLayer::getRasterBrightnessMaxTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<RasterBrightnessMax>(klass);
+}
+
PropertyValue<float> RasterLayer::getDefaultRasterSaturation() {
return { 0 };
}
@@ -142,6 +158,10 @@ void RasterLayer::setRasterSaturationTransition(const TransitionOptions& value,
impl->paint.setTransition<RasterSaturation>(value, klass);
}
+TransitionOptions RasterLayer::getRasterSaturationTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<RasterSaturation>(klass);
+}
+
PropertyValue<float> RasterLayer::getDefaultRasterContrast() {
return { 0 };
}
@@ -161,6 +181,10 @@ void RasterLayer::setRasterContrastTransition(const TransitionOptions& value, co
impl->paint.setTransition<RasterContrast>(value, klass);
}
+TransitionOptions RasterLayer::getRasterContrastTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<RasterContrast>(klass);
+}
+
PropertyValue<float> RasterLayer::getDefaultRasterFadeDuration() {
return { 300 };
}
@@ -180,5 +204,9 @@ void RasterLayer::setRasterFadeDurationTransition(const TransitionOptions& value
impl->paint.setTransition<RasterFadeDuration>(value, klass);
}
+TransitionOptions RasterLayer::getRasterFadeDurationTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<RasterFadeDuration>(klass);
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp
index d85b8c00e6..42bcf0e6b0 100644
--- a/src/mbgl/style/layers/symbol_layer.cpp
+++ b/src/mbgl/style/layers/symbol_layer.cpp
@@ -565,6 +565,10 @@ void SymbolLayer::setIconOpacityTransition(const TransitionOptions& value, const
impl->paint.setTransition<IconOpacity>(value, klass);
}
+TransitionOptions SymbolLayer::getIconOpacityTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<IconOpacity>(klass);
+}
+
DataDrivenPropertyValue<Color> SymbolLayer::getDefaultIconColor() {
return { Color::black() };
}
@@ -588,6 +592,10 @@ void SymbolLayer::setIconColorTransition(const TransitionOptions& value, const o
impl->paint.setTransition<IconColor>(value, klass);
}
+TransitionOptions SymbolLayer::getIconColorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<IconColor>(klass);
+}
+
DataDrivenPropertyValue<Color> SymbolLayer::getDefaultIconHaloColor() {
return { {} };
}
@@ -611,6 +619,10 @@ void SymbolLayer::setIconHaloColorTransition(const TransitionOptions& value, con
impl->paint.setTransition<IconHaloColor>(value, klass);
}
+TransitionOptions SymbolLayer::getIconHaloColorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<IconHaloColor>(klass);
+}
+
DataDrivenPropertyValue<float> SymbolLayer::getDefaultIconHaloWidth() {
return { 0 };
}
@@ -634,6 +646,10 @@ void SymbolLayer::setIconHaloWidthTransition(const TransitionOptions& value, con
impl->paint.setTransition<IconHaloWidth>(value, klass);
}
+TransitionOptions SymbolLayer::getIconHaloWidthTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<IconHaloWidth>(klass);
+}
+
DataDrivenPropertyValue<float> SymbolLayer::getDefaultIconHaloBlur() {
return { 0 };
}
@@ -657,6 +673,10 @@ void SymbolLayer::setIconHaloBlurTransition(const TransitionOptions& value, cons
impl->paint.setTransition<IconHaloBlur>(value, klass);
}
+TransitionOptions SymbolLayer::getIconHaloBlurTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<IconHaloBlur>(klass);
+}
+
PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultIconTranslate() {
return { {{ 0, 0 }} };
}
@@ -676,6 +696,10 @@ void SymbolLayer::setIconTranslateTransition(const TransitionOptions& value, con
impl->paint.setTransition<IconTranslate>(value, klass);
}
+TransitionOptions SymbolLayer::getIconTranslateTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<IconTranslate>(klass);
+}
+
PropertyValue<TranslateAnchorType> SymbolLayer::getDefaultIconTranslateAnchor() {
return { TranslateAnchorType::Map };
}
@@ -695,6 +719,10 @@ void SymbolLayer::setIconTranslateAnchorTransition(const TransitionOptions& valu
impl->paint.setTransition<IconTranslateAnchor>(value, klass);
}
+TransitionOptions SymbolLayer::getIconTranslateAnchorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<IconTranslateAnchor>(klass);
+}
+
DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextOpacity() {
return { 1 };
}
@@ -718,6 +746,10 @@ void SymbolLayer::setTextOpacityTransition(const TransitionOptions& value, const
impl->paint.setTransition<TextOpacity>(value, klass);
}
+TransitionOptions SymbolLayer::getTextOpacityTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<TextOpacity>(klass);
+}
+
DataDrivenPropertyValue<Color> SymbolLayer::getDefaultTextColor() {
return { Color::black() };
}
@@ -741,6 +773,10 @@ void SymbolLayer::setTextColorTransition(const TransitionOptions& value, const o
impl->paint.setTransition<TextColor>(value, klass);
}
+TransitionOptions SymbolLayer::getTextColorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<TextColor>(klass);
+}
+
DataDrivenPropertyValue<Color> SymbolLayer::getDefaultTextHaloColor() {
return { {} };
}
@@ -764,6 +800,10 @@ void SymbolLayer::setTextHaloColorTransition(const TransitionOptions& value, con
impl->paint.setTransition<TextHaloColor>(value, klass);
}
+TransitionOptions SymbolLayer::getTextHaloColorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<TextHaloColor>(klass);
+}
+
DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextHaloWidth() {
return { 0 };
}
@@ -787,6 +827,10 @@ void SymbolLayer::setTextHaloWidthTransition(const TransitionOptions& value, con
impl->paint.setTransition<TextHaloWidth>(value, klass);
}
+TransitionOptions SymbolLayer::getTextHaloWidthTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<TextHaloWidth>(klass);
+}
+
DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextHaloBlur() {
return { 0 };
}
@@ -810,6 +854,10 @@ void SymbolLayer::setTextHaloBlurTransition(const TransitionOptions& value, cons
impl->paint.setTransition<TextHaloBlur>(value, klass);
}
+TransitionOptions SymbolLayer::getTextHaloBlurTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<TextHaloBlur>(klass);
+}
+
PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultTextTranslate() {
return { {{ 0, 0 }} };
}
@@ -829,6 +877,10 @@ void SymbolLayer::setTextTranslateTransition(const TransitionOptions& value, con
impl->paint.setTransition<TextTranslate>(value, klass);
}
+TransitionOptions SymbolLayer::getTextTranslateTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<TextTranslate>(klass);
+}
+
PropertyValue<TranslateAnchorType> SymbolLayer::getDefaultTextTranslateAnchor() {
return { TranslateAnchorType::Map };
}
@@ -848,5 +900,9 @@ void SymbolLayer::setTextTranslateAnchorTransition(const TransitionOptions& valu
impl->paint.setTransition<TextTranslateAnchor>(value, klass);
}
+TransitionOptions SymbolLayer::getTextTranslateAnchorTransition(const optional<std::string>& klass) const {
+ return impl->paint.getTransition<TextTranslateAnchor>(klass);
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/paint_property.hpp b/src/mbgl/style/paint_property.hpp
index 599bbef1f4..d4a5ee4c76 100644
--- a/src/mbgl/style/paint_property.hpp
+++ b/src/mbgl/style/paint_property.hpp
@@ -225,6 +225,11 @@ public:
void setTransition(const TransitionOptions& value, const optional<std::string>& klass) {
cascading.template get<P>().setTransition(value, klass);
}
+
+ template <class P>
+ auto getTransition(const optional<std::string>& klass) const {
+ return cascading.template get<P>().getTransition(klass);
+ }
void cascade(const CascadeParameters& parameters) {
unevaluated = Unevaluated {