diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2018-07-31 14:21:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-31 14:21:47 -0700 |
commit | 9bdd765a02de75851a00ab85223d5d582a104757 (patch) | |
tree | bcb417a47808a4a94c171b083c7f2e2cce457107 | |
parent | 885f6e3c02138398d094e49243817a83349b4d50 (diff) | |
download | qtlocation-mapboxgl-9bdd765a02de75851a00ab85223d5d582a104757.tar.gz |
[core] Merge DataDrivenPropertyValue into PropertyValue (#12513)
64 files changed, 802 insertions, 981 deletions
diff --git a/benchmark/function/camera_function.benchmark.cpp b/benchmark/function/camera_function.benchmark.cpp index 52b6bc9f08..51d2e22293 100644 --- a/benchmark/function/camera_function.benchmark.cpp +++ b/benchmark/function/camera_function.benchmark.cpp @@ -27,7 +27,7 @@ static void Parse_CameraFunction(benchmark::State& state) { state.PauseTiming(); auto doc = createFunctionJSON(stopCount); state.ResumeTiming(); - optional<PropertyValue<float>> result = conversion::convertJSON<PropertyValue<float>>(doc, error); + optional<PropertyValue<float>> result = conversion::convertJSON<PropertyValue<float>>(doc, error, false, false); if (!result) { state.SkipWithError(error.message.c_str()); } @@ -39,7 +39,7 @@ static void Evaluate_CameraFunction(benchmark::State& state) { size_t stopCount = state.range(0); auto doc = createFunctionJSON(stopCount); conversion::Error error; - optional<PropertyValue<float>> function = conversion::convertJSON<PropertyValue<float>>(doc, error); + optional<PropertyValue<float>> function = conversion::convertJSON<PropertyValue<float>>(doc, error, false, false); if (!function) { state.SkipWithError(error.message.c_str()); } diff --git a/benchmark/function/composite_function.benchmark.cpp b/benchmark/function/composite_function.benchmark.cpp index d495a518ca..f16254641f 100644 --- a/benchmark/function/composite_function.benchmark.cpp +++ b/benchmark/function/composite_function.benchmark.cpp @@ -5,7 +5,7 @@ #include <mbgl/style/conversion.hpp> #include <mbgl/style/conversion/json.hpp> #include <mbgl/style/conversion/function.hpp> -#include <mbgl/style/conversion/data_driven_property_value.hpp> +#include <mbgl/style/conversion/property_value.hpp> using namespace mbgl; using namespace mbgl::style; @@ -27,13 +27,13 @@ static std::string createFunctionJSON(size_t stopCount) { static void Parse_CompositeFunction(benchmark::State& state) { size_t stopCount = state.range(0); - + while (state.KeepRunning()) { conversion::Error error; state.PauseTiming(); auto doc = createFunctionJSON(stopCount); state.ResumeTiming(); - optional<DataDrivenPropertyValue<float>> result = conversion::convertJSON<DataDrivenPropertyValue<float>>(doc, error, false); + optional<PropertyValue<float>> result = conversion::convertJSON<PropertyValue<float>>(doc, error, true, false); if (!result) { state.SkipWithError(error.message.c_str()); } @@ -45,16 +45,16 @@ static void Evaluate_CompositeFunction(benchmark::State& state) { size_t stopCount = state.range(0); auto doc = createFunctionJSON(stopCount); conversion::Error error; - optional<DataDrivenPropertyValue<float>> function = conversion::convertJSON<DataDrivenPropertyValue<float>>(doc, error, false); + optional<PropertyValue<float>> function = conversion::convertJSON<PropertyValue<float>>(doc, error, true, false); if (!function) { state.SkipWithError(error.message.c_str()); } - + while(state.KeepRunning()) { float z = 24.0f * static_cast<float>(rand() % 100) / 100; function->asExpression().evaluate(z, StubGeometryTileFeature(PropertyMap { { "x", static_cast<int64_t>(rand() % 100) } }), -1.0f); } - + state.SetLabel(std::to_string(stopCount).c_str()); } diff --git a/benchmark/function/source_function.benchmark.cpp b/benchmark/function/source_function.benchmark.cpp index a5d2f95487..2164b2a418 100644 --- a/benchmark/function/source_function.benchmark.cpp +++ b/benchmark/function/source_function.benchmark.cpp @@ -4,7 +4,7 @@ #include <mbgl/style/conversion.hpp> #include <mbgl/style/conversion/json.hpp> -#include <mbgl/style/conversion/data_driven_property_value.hpp> +#include <mbgl/style/conversion/property_value.hpp> using namespace mbgl; using namespace mbgl::style; @@ -22,13 +22,13 @@ static std::string createFunctionJSON(size_t stopCount) { static void Parse_SourceFunction(benchmark::State& state) { size_t stopCount = state.range(0); - + while (state.KeepRunning()) { conversion::Error error; state.PauseTiming(); auto doc = createFunctionJSON(stopCount); state.ResumeTiming(); - optional<DataDrivenPropertyValue<float>> result = conversion::convertJSON<DataDrivenPropertyValue<float>>(doc, error, false); + optional<PropertyValue<float>> result = conversion::convertJSON<PropertyValue<float>>(doc, error, true, false); if (!result) { state.SkipWithError(error.message.c_str()); } @@ -40,15 +40,15 @@ static void Evaluate_SourceFunction(benchmark::State& state) { size_t stopCount = state.range(0); auto doc = createFunctionJSON(stopCount); conversion::Error error; - optional<DataDrivenPropertyValue<float>> function = conversion::convertJSON<DataDrivenPropertyValue<float>>(doc, error, false); + optional<PropertyValue<float>> function = conversion::convertJSON<PropertyValue<float>>(doc, error, true, false); if (!function) { state.SkipWithError(error.message.c_str()); } - + while(state.KeepRunning()) { function->asExpression().evaluate(StubGeometryTileFeature(PropertyMap { { "x", static_cast<int64_t>(rand() % 100) } }), -1.0f); } - + state.SetLabel(std::to_string(stopCount).c_str()); } diff --git a/cmake/core-files.cmake b/cmake/core-files.cmake index f2e26a9a7e..44aff682fc 100644 --- a/cmake/core-files.cmake +++ b/cmake/core-files.cmake @@ -363,7 +363,6 @@ set(MBGL_CORE_FILES # style include/mbgl/style/color_ramp_property_value.hpp include/mbgl/style/conversion.hpp - include/mbgl/style/data_driven_property_value.hpp include/mbgl/style/filter.hpp include/mbgl/style/image.hpp include/mbgl/style/layer.hpp @@ -413,7 +412,6 @@ set(MBGL_CORE_FILES include/mbgl/style/conversion/constant.hpp include/mbgl/style/conversion/coordinate.hpp include/mbgl/style/conversion/custom_geometry_source_options.hpp - include/mbgl/style/conversion/data_driven_property_value.hpp include/mbgl/style/conversion/filter.hpp include/mbgl/style/conversion/function.hpp include/mbgl/style/conversion/geojson.hpp diff --git a/include/mbgl/annotation/annotation.hpp b/include/mbgl/annotation/annotation.hpp index bbe479b5ba..8c099141c4 100644 --- a/include/mbgl/annotation/annotation.hpp +++ b/include/mbgl/annotation/annotation.hpp @@ -4,7 +4,7 @@ #include <mbgl/util/variant.hpp> #include <mbgl/util/color.hpp> #include <mbgl/style/property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> +#include <mbgl/style/property_value.hpp> #include <cstdint> #include <vector> @@ -34,35 +34,35 @@ using ShapeAnnotationGeometry = variant< class LineAnnotation { public: LineAnnotation(ShapeAnnotationGeometry geometry_, - style::DataDrivenPropertyValue<float> opacity_ = 1.0f, - style::DataDrivenPropertyValue<float> width_ = 1.0f, - style::DataDrivenPropertyValue<Color> color_ = Color::black()) + style::PropertyValue<float> opacity_ = 1.0f, + style::PropertyValue<float> width_ = 1.0f, + style::PropertyValue<Color> color_ = Color::black()) : geometry(std::move(geometry_)), opacity(std::move(opacity_)), width(std::move(width_)), color(std::move(color_)) {} ShapeAnnotationGeometry geometry; - style::DataDrivenPropertyValue<float> opacity; - style::DataDrivenPropertyValue<float> width; - style::DataDrivenPropertyValue<Color> color; + style::PropertyValue<float> opacity; + style::PropertyValue<float> width; + style::PropertyValue<Color> color; }; class FillAnnotation { public: FillAnnotation(ShapeAnnotationGeometry geometry_, - style::DataDrivenPropertyValue<float> opacity_ = 1.0f, - style::DataDrivenPropertyValue<Color> color_ = Color::black(), - style::DataDrivenPropertyValue<Color> outlineColor_ = {}) + style::PropertyValue<float> opacity_ = 1.0f, + style::PropertyValue<Color> color_ = Color::black(), + style::PropertyValue<Color> outlineColor_ = {}) : geometry(std::move(geometry_)), opacity(std::move(opacity_)), color(std::move(color_)), outlineColor(std::move(outlineColor_)) {} ShapeAnnotationGeometry geometry; - style::DataDrivenPropertyValue<float> opacity; - style::DataDrivenPropertyValue<Color> color; - style::DataDrivenPropertyValue<Color> outlineColor; + style::PropertyValue<float> opacity; + style::PropertyValue<Color> color; + style::PropertyValue<Color> outlineColor; }; using Annotation = variant< diff --git a/include/mbgl/style/conversion/color_ramp_property_value.hpp b/include/mbgl/style/conversion/color_ramp_property_value.hpp index 87049b043b..17aa177420 100644 --- a/include/mbgl/style/conversion/color_ramp_property_value.hpp +++ b/include/mbgl/style/conversion/color_ramp_property_value.hpp @@ -9,7 +9,7 @@ namespace conversion { template <> struct Converter<ColorRampPropertyValue> { - optional<ColorRampPropertyValue> operator()(const Convertible& value, Error& error, bool /* convertTokens */ = false) const; + optional<ColorRampPropertyValue> operator()(const Convertible& value, Error& error, bool /* allowDataExpressions */ = false, bool /* convertTokens */ = false) const; }; } // namespace conversion diff --git a/include/mbgl/style/conversion/data_driven_property_value.hpp b/include/mbgl/style/conversion/data_driven_property_value.hpp deleted file mode 100644 index 2d8817ecf4..0000000000 --- a/include/mbgl/style/conversion/data_driven_property_value.hpp +++ /dev/null @@ -1,78 +0,0 @@ -#pragma once - -#include <mbgl/style/data_driven_property_value.hpp> -#include <mbgl/style/conversion.hpp> -#include <mbgl/style/conversion/constant.hpp> -#include <mbgl/style/conversion/function.hpp> -#include <mbgl/style/expression/is_expression.hpp> -#include <mbgl/style/expression/is_constant.hpp> -#include <mbgl/style/expression/literal.hpp> -#include <mbgl/style/expression/value.hpp> -#include <mbgl/style/expression/parsing_context.hpp> - -namespace mbgl { -namespace style { -namespace conversion { - -template <class T> -struct Converter<DataDrivenPropertyValue<T>> { - optional<DataDrivenPropertyValue<T>> operator()(const Convertible& value, Error& error, bool convertTokens) const { - using namespace mbgl::style::expression; - - if (isUndefined(value)) { - return DataDrivenPropertyValue<T>(); - } - - optional<PropertyExpression<T>> expression; - - if (isExpression(value)) { - ParsingContext ctx(valueTypeToExpressionType<T>()); - ParseResult parsed = ctx.parseLayerPropertyExpression(value); - if (!parsed) { - error.message = ctx.getCombinedErrors(); - return nullopt; - } - expression = PropertyExpression<T>(std::move(*parsed)); - } else if (isObject(value)) { - expression = convertFunctionToExpression<T>(value, error, convertTokens); - } else { - optional<T> constant = convert<T>(value, error); - if (!constant) { - return nullopt; - } - return convertTokens ? maybeConvertTokens(*constant) : DataDrivenPropertyValue<T>(*constant); - } - - if (!expression) { - return nullopt; - } else if (!(*expression).isFeatureConstant() || !(*expression).isZoomConstant()) { - return { std::move(*expression) }; - } else if ((*expression).getExpression().getKind() == Kind::Literal) { - optional<T> constant = fromExpressionValue<T>( - static_cast<const Literal&>((*expression).getExpression()).getValue()); - if (!constant) { - return nullopt; - } - return DataDrivenPropertyValue<T>(*constant); - } else { - assert(false); - error.message = "expected a literal expression"; - return nullopt; - } - } - - template <class S> - DataDrivenPropertyValue<T> maybeConvertTokens(const S& t) const { - return DataDrivenPropertyValue<T>(t); - }; - - DataDrivenPropertyValue<T> maybeConvertTokens(const std::string& t) const { - return hasTokens(t) - ? DataDrivenPropertyValue<T>(PropertyExpression<T>(convertTokenStringToExpression(t))) - : DataDrivenPropertyValue<T>(t); - } -}; - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/property_value.hpp b/include/mbgl/style/conversion/property_value.hpp index 4d13144dd7..fa6752867b 100644 --- a/include/mbgl/style/conversion/property_value.hpp +++ b/include/mbgl/style/conversion/property_value.hpp @@ -16,13 +16,9 @@ namespace conversion { template <class T> struct Converter<PropertyValue<T>> { - optional<PropertyValue<T>> operator()(const Convertible& value, Error& error, bool convertTokens = false) const { + optional<PropertyValue<T>> operator()(const Convertible& value, Error& error, bool allowDataExpressions, bool convertTokens) const { using namespace mbgl::style::expression; - // Only icon-image and text-field support tokens, and they are both data-driven. - assert(!convertTokens); - (void)convertTokens; - if (isUndefined(value)) { return PropertyValue<T>(); } @@ -38,21 +34,21 @@ struct Converter<PropertyValue<T>> { } expression = PropertyExpression<T>(std::move(*parsed)); } else if (isObject(value)) { - expression = convertFunctionToExpression<T>(value, error, false); + expression = convertFunctionToExpression<T>(value, error, convertTokens); } else { optional<T> constant = convert<T>(value, error); if (!constant) { return nullopt; } - return { *constant }; + return convertTokens ? maybeConvertTokens(*constant) : PropertyValue<T>(*constant); } if (!expression) { return nullopt; - } else if (!(*expression).isFeatureConstant()) { + } else if (!allowDataExpressions && !(*expression).isFeatureConstant()) { error.message = "data expressions not supported"; return nullopt; - } else if (!(*expression).isZoomConstant()) { + } else if (!(*expression).isFeatureConstant() || !(*expression).isZoomConstant()) { return { std::move(*expression) }; } else if ((*expression).getExpression().getKind() == Kind::Literal) { optional<T> constant = fromExpressionValue<T>( @@ -67,6 +63,17 @@ struct Converter<PropertyValue<T>> { return nullopt; } } + + template <class S> + PropertyValue<T> maybeConvertTokens(const S& t) const { + return PropertyValue<T>(t); + }; + + PropertyValue<T> maybeConvertTokens(const std::string& t) const { + return hasTokens(t) + ? PropertyValue<T>(PropertyExpression<T>(convertTokenStringToExpression(t))) + : PropertyValue<T>(t); + } }; } // namespace conversion diff --git a/include/mbgl/style/data_driven_property_value.hpp b/include/mbgl/style/data_driven_property_value.hpp deleted file mode 100644 index baea861f62..0000000000 --- a/include/mbgl/style/data_driven_property_value.hpp +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include <mbgl/util/variant.hpp> -#include <mbgl/style/undefined.hpp> -#include <mbgl/style/property_expression.hpp> - -namespace mbgl { -namespace style { - -template <class T> -class DataDrivenPropertyValue { -private: - using Value = variant< - Undefined, - T, - PropertyExpression<T>>; - - Value value; - - friend bool operator==(const DataDrivenPropertyValue& lhs, - const DataDrivenPropertyValue& rhs) { - return lhs.value == rhs.value; - } - - friend bool operator!=(const DataDrivenPropertyValue& lhs, - const DataDrivenPropertyValue& rhs) { - return !(lhs == rhs); - } - -public: - DataDrivenPropertyValue() = default; - DataDrivenPropertyValue( T v) : value(std::move(v)) {} - DataDrivenPropertyValue(PropertyExpression<T> v) : value(std::move(v)) {} - - bool isUndefined() const { - return value.template is<Undefined>(); - } - - bool isDataDriven() const { - return value.match( - [] (const Undefined&) { return false; }, - [] (const T&) { return false; }, - [] (const PropertyExpression<T>& fn) { return !fn.isFeatureConstant(); } - ); - } - - bool isZoomConstant() const { - return value.match( - [] (const Undefined&) { return true; }, - [] (const T&) { return true; }, - [] (const PropertyExpression<T>& fn) { return fn.isZoomConstant(); } - ); - } - - const T & asConstant() const { return value.template get< T >(); } - const PropertyExpression<T>& asExpression() const { return value.template get<PropertyExpression<T>>(); } - - template <class... Ts> - auto match(Ts&&... ts) const { - return value.match(std::forward<Ts>(ts)...); - } - - template <typename Evaluator> - auto evaluate(const Evaluator& evaluator, TimePoint = {}) const { - return Value::visit(value, evaluator); - } - - bool hasDataDrivenPropertyDifference(const DataDrivenPropertyValue<T>& other) const { - return *this != other && (isDataDriven() || other.isDataDriven()); - } -}; - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/layers/background_layer.hpp b/include/mbgl/style/layers/background_layer.hpp index 903983844f..eab2681fec 100644 --- a/include/mbgl/style/layers/background_layer.hpp +++ b/include/mbgl/style/layers/background_layer.hpp @@ -5,7 +5,6 @@ #include <mbgl/style/layer.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/util/color.hpp> diff --git a/include/mbgl/style/layers/circle_layer.hpp b/include/mbgl/style/layers/circle_layer.hpp index 942dd67503..89ef926221 100644 --- a/include/mbgl/style/layers/circle_layer.hpp +++ b/include/mbgl/style/layers/circle_layer.hpp @@ -5,7 +5,6 @@ #include <mbgl/style/layer.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/util/color.hpp> @@ -36,27 +35,27 @@ public: // Paint properties - static DataDrivenPropertyValue<float> getDefaultCircleRadius(); - DataDrivenPropertyValue<float> getCircleRadius() const; - void setCircleRadius(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultCircleRadius(); + PropertyValue<float> getCircleRadius() const; + void setCircleRadius(PropertyValue<float>); void setCircleRadiusTransition(const TransitionOptions&); TransitionOptions getCircleRadiusTransition() const; - static DataDrivenPropertyValue<Color> getDefaultCircleColor(); - DataDrivenPropertyValue<Color> getCircleColor() const; - void setCircleColor(DataDrivenPropertyValue<Color>); + static PropertyValue<Color> getDefaultCircleColor(); + PropertyValue<Color> getCircleColor() const; + void setCircleColor(PropertyValue<Color>); void setCircleColorTransition(const TransitionOptions&); TransitionOptions getCircleColorTransition() const; - static DataDrivenPropertyValue<float> getDefaultCircleBlur(); - DataDrivenPropertyValue<float> getCircleBlur() const; - void setCircleBlur(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultCircleBlur(); + PropertyValue<float> getCircleBlur() const; + void setCircleBlur(PropertyValue<float>); void setCircleBlurTransition(const TransitionOptions&); TransitionOptions getCircleBlurTransition() const; - static DataDrivenPropertyValue<float> getDefaultCircleOpacity(); - DataDrivenPropertyValue<float> getCircleOpacity() const; - void setCircleOpacity(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultCircleOpacity(); + PropertyValue<float> getCircleOpacity() const; + void setCircleOpacity(PropertyValue<float>); void setCircleOpacityTransition(const TransitionOptions&); TransitionOptions getCircleOpacityTransition() const; @@ -84,21 +83,21 @@ public: void setCirclePitchAlignmentTransition(const TransitionOptions&); TransitionOptions getCirclePitchAlignmentTransition() const; - static DataDrivenPropertyValue<float> getDefaultCircleStrokeWidth(); - DataDrivenPropertyValue<float> getCircleStrokeWidth() const; - void setCircleStrokeWidth(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultCircleStrokeWidth(); + PropertyValue<float> getCircleStrokeWidth() const; + void setCircleStrokeWidth(PropertyValue<float>); void setCircleStrokeWidthTransition(const TransitionOptions&); TransitionOptions getCircleStrokeWidthTransition() const; - static DataDrivenPropertyValue<Color> getDefaultCircleStrokeColor(); - DataDrivenPropertyValue<Color> getCircleStrokeColor() const; - void setCircleStrokeColor(DataDrivenPropertyValue<Color>); + static PropertyValue<Color> getDefaultCircleStrokeColor(); + PropertyValue<Color> getCircleStrokeColor() const; + void setCircleStrokeColor(PropertyValue<Color>); void setCircleStrokeColorTransition(const TransitionOptions&); TransitionOptions getCircleStrokeColorTransition() const; - static DataDrivenPropertyValue<float> getDefaultCircleStrokeOpacity(); - DataDrivenPropertyValue<float> getCircleStrokeOpacity() const; - void setCircleStrokeOpacity(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultCircleStrokeOpacity(); + PropertyValue<float> getCircleStrokeOpacity() const; + void setCircleStrokeOpacity(PropertyValue<float>); void setCircleStrokeOpacityTransition(const TransitionOptions&); TransitionOptions getCircleStrokeOpacityTransition() const; diff --git a/include/mbgl/style/layers/fill_extrusion_layer.hpp b/include/mbgl/style/layers/fill_extrusion_layer.hpp index e1c54f54ee..742bac8c7e 100644 --- a/include/mbgl/style/layers/fill_extrusion_layer.hpp +++ b/include/mbgl/style/layers/fill_extrusion_layer.hpp @@ -5,7 +5,6 @@ #include <mbgl/style/layer.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/util/color.hpp> @@ -42,9 +41,9 @@ public: void setFillExtrusionOpacityTransition(const TransitionOptions&); TransitionOptions getFillExtrusionOpacityTransition() const; - static DataDrivenPropertyValue<Color> getDefaultFillExtrusionColor(); - DataDrivenPropertyValue<Color> getFillExtrusionColor() const; - void setFillExtrusionColor(DataDrivenPropertyValue<Color>); + static PropertyValue<Color> getDefaultFillExtrusionColor(); + PropertyValue<Color> getFillExtrusionColor() const; + void setFillExtrusionColor(PropertyValue<Color>); void setFillExtrusionColorTransition(const TransitionOptions&); TransitionOptions getFillExtrusionColorTransition() const; @@ -66,15 +65,15 @@ public: void setFillExtrusionPatternTransition(const TransitionOptions&); TransitionOptions getFillExtrusionPatternTransition() const; - static DataDrivenPropertyValue<float> getDefaultFillExtrusionHeight(); - DataDrivenPropertyValue<float> getFillExtrusionHeight() const; - void setFillExtrusionHeight(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultFillExtrusionHeight(); + PropertyValue<float> getFillExtrusionHeight() const; + void setFillExtrusionHeight(PropertyValue<float>); void setFillExtrusionHeightTransition(const TransitionOptions&); TransitionOptions getFillExtrusionHeightTransition() const; - static DataDrivenPropertyValue<float> getDefaultFillExtrusionBase(); - DataDrivenPropertyValue<float> getFillExtrusionBase() const; - void setFillExtrusionBase(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultFillExtrusionBase(); + PropertyValue<float> getFillExtrusionBase() const; + void setFillExtrusionBase(PropertyValue<float>); void setFillExtrusionBaseTransition(const TransitionOptions&); TransitionOptions getFillExtrusionBaseTransition() const; diff --git a/include/mbgl/style/layers/fill_layer.hpp b/include/mbgl/style/layers/fill_layer.hpp index dfbe69d7fe..d0b2a25bfe 100644 --- a/include/mbgl/style/layers/fill_layer.hpp +++ b/include/mbgl/style/layers/fill_layer.hpp @@ -5,7 +5,6 @@ #include <mbgl/style/layer.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/util/color.hpp> @@ -42,21 +41,21 @@ public: void setFillAntialiasTransition(const TransitionOptions&); TransitionOptions getFillAntialiasTransition() const; - static DataDrivenPropertyValue<float> getDefaultFillOpacity(); - DataDrivenPropertyValue<float> getFillOpacity() const; - void setFillOpacity(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultFillOpacity(); + PropertyValue<float> getFillOpacity() const; + void setFillOpacity(PropertyValue<float>); void setFillOpacityTransition(const TransitionOptions&); TransitionOptions getFillOpacityTransition() const; - static DataDrivenPropertyValue<Color> getDefaultFillColor(); - DataDrivenPropertyValue<Color> getFillColor() const; - void setFillColor(DataDrivenPropertyValue<Color>); + static PropertyValue<Color> getDefaultFillColor(); + PropertyValue<Color> getFillColor() const; + void setFillColor(PropertyValue<Color>); void setFillColorTransition(const TransitionOptions&); TransitionOptions getFillColorTransition() const; - static DataDrivenPropertyValue<Color> getDefaultFillOutlineColor(); - DataDrivenPropertyValue<Color> getFillOutlineColor() const; - void setFillOutlineColor(DataDrivenPropertyValue<Color>); + static PropertyValue<Color> getDefaultFillOutlineColor(); + PropertyValue<Color> getFillOutlineColor() const; + void setFillOutlineColor(PropertyValue<Color>); void setFillOutlineColorTransition(const TransitionOptions&); TransitionOptions getFillOutlineColorTransition() const; diff --git a/include/mbgl/style/layers/heatmap_layer.hpp b/include/mbgl/style/layers/heatmap_layer.hpp index 4c434b2aff..53fd24aa6c 100644 --- a/include/mbgl/style/layers/heatmap_layer.hpp +++ b/include/mbgl/style/layers/heatmap_layer.hpp @@ -6,7 +6,6 @@ #include <mbgl/style/layer.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/util/color.hpp> @@ -37,15 +36,15 @@ public: // Paint properties - static DataDrivenPropertyValue<float> getDefaultHeatmapRadius(); - DataDrivenPropertyValue<float> getHeatmapRadius() const; - void setHeatmapRadius(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultHeatmapRadius(); + PropertyValue<float> getHeatmapRadius() const; + void setHeatmapRadius(PropertyValue<float>); void setHeatmapRadiusTransition(const TransitionOptions&); TransitionOptions getHeatmapRadiusTransition() const; - static DataDrivenPropertyValue<float> getDefaultHeatmapWeight(); - DataDrivenPropertyValue<float> getHeatmapWeight() const; - void setHeatmapWeight(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultHeatmapWeight(); + PropertyValue<float> getHeatmapWeight() const; + void setHeatmapWeight(PropertyValue<float>); void setHeatmapWeightTransition(const TransitionOptions&); TransitionOptions getHeatmapWeightTransition() const; diff --git a/include/mbgl/style/layers/hillshade_layer.hpp b/include/mbgl/style/layers/hillshade_layer.hpp index 35664da46c..214576b120 100644 --- a/include/mbgl/style/layers/hillshade_layer.hpp +++ b/include/mbgl/style/layers/hillshade_layer.hpp @@ -5,7 +5,6 @@ #include <mbgl/style/layer.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/util/color.hpp> diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs index e15ff74f17..9d52973af4 100644 --- a/include/mbgl/style/layers/layer.hpp.ejs +++ b/include/mbgl/style/layers/layer.hpp.ejs @@ -13,7 +13,6 @@ #include <mbgl/style/layer.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/util/color.hpp> diff --git a/include/mbgl/style/layers/line_layer.hpp b/include/mbgl/style/layers/line_layer.hpp index 4519296323..26e3b81fc9 100644 --- a/include/mbgl/style/layers/line_layer.hpp +++ b/include/mbgl/style/layers/line_layer.hpp @@ -5,7 +5,6 @@ #include <mbgl/style/layer.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/util/color.hpp> @@ -42,9 +41,9 @@ public: PropertyValue<LineCapType> getLineCap() const; void setLineCap(PropertyValue<LineCapType>); - static DataDrivenPropertyValue<LineJoinType> getDefaultLineJoin(); - DataDrivenPropertyValue<LineJoinType> getLineJoin() const; - void setLineJoin(DataDrivenPropertyValue<LineJoinType>); + static PropertyValue<LineJoinType> getDefaultLineJoin(); + PropertyValue<LineJoinType> getLineJoin() const; + void setLineJoin(PropertyValue<LineJoinType>); static PropertyValue<float> getDefaultLineMiterLimit(); PropertyValue<float> getLineMiterLimit() const; @@ -56,15 +55,15 @@ public: // Paint properties - static DataDrivenPropertyValue<float> getDefaultLineOpacity(); - DataDrivenPropertyValue<float> getLineOpacity() const; - void setLineOpacity(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultLineOpacity(); + PropertyValue<float> getLineOpacity() const; + void setLineOpacity(PropertyValue<float>); void setLineOpacityTransition(const TransitionOptions&); TransitionOptions getLineOpacityTransition() const; - static DataDrivenPropertyValue<Color> getDefaultLineColor(); - DataDrivenPropertyValue<Color> getLineColor() const; - void setLineColor(DataDrivenPropertyValue<Color>); + static PropertyValue<Color> getDefaultLineColor(); + PropertyValue<Color> getLineColor() const; + void setLineColor(PropertyValue<Color>); void setLineColorTransition(const TransitionOptions&); TransitionOptions getLineColorTransition() const; @@ -80,27 +79,27 @@ public: void setLineTranslateAnchorTransition(const TransitionOptions&); TransitionOptions getLineTranslateAnchorTransition() const; - static DataDrivenPropertyValue<float> getDefaultLineWidth(); - DataDrivenPropertyValue<float> getLineWidth() const; - void setLineWidth(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultLineWidth(); + PropertyValue<float> getLineWidth() const; + void setLineWidth(PropertyValue<float>); void setLineWidthTransition(const TransitionOptions&); TransitionOptions getLineWidthTransition() const; - static DataDrivenPropertyValue<float> getDefaultLineGapWidth(); - DataDrivenPropertyValue<float> getLineGapWidth() const; - void setLineGapWidth(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultLineGapWidth(); + PropertyValue<float> getLineGapWidth() const; + void setLineGapWidth(PropertyValue<float>); void setLineGapWidthTransition(const TransitionOptions&); TransitionOptions getLineGapWidthTransition() const; - static DataDrivenPropertyValue<float> getDefaultLineOffset(); - DataDrivenPropertyValue<float> getLineOffset() const; - void setLineOffset(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultLineOffset(); + PropertyValue<float> getLineOffset() const; + void setLineOffset(PropertyValue<float>); void setLineOffsetTransition(const TransitionOptions&); TransitionOptions getLineOffsetTransition() const; - static DataDrivenPropertyValue<float> getDefaultLineBlur(); - DataDrivenPropertyValue<float> getLineBlur() const; - void setLineBlur(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultLineBlur(); + PropertyValue<float> getLineBlur() const; + void setLineBlur(PropertyValue<float>); void setLineBlurTransition(const TransitionOptions&); TransitionOptions getLineBlurTransition() const; diff --git a/include/mbgl/style/layers/raster_layer.hpp b/include/mbgl/style/layers/raster_layer.hpp index 8e7849c27d..c133c23484 100644 --- a/include/mbgl/style/layers/raster_layer.hpp +++ b/include/mbgl/style/layers/raster_layer.hpp @@ -5,7 +5,6 @@ #include <mbgl/style/layer.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/util/color.hpp> diff --git a/include/mbgl/style/layers/symbol_layer.hpp b/include/mbgl/style/layers/symbol_layer.hpp index f068e2d060..8c0b45d796 100644 --- a/include/mbgl/style/layers/symbol_layer.hpp +++ b/include/mbgl/style/layers/symbol_layer.hpp @@ -5,7 +5,6 @@ #include <mbgl/style/layer.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/util/color.hpp> @@ -66,9 +65,9 @@ public: PropertyValue<AlignmentType> getIconRotationAlignment() const; void setIconRotationAlignment(PropertyValue<AlignmentType>); - static DataDrivenPropertyValue<float> getDefaultIconSize(); - DataDrivenPropertyValue<float> getIconSize() const; - void setIconSize(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultIconSize(); + PropertyValue<float> getIconSize() const; + void setIconSize(PropertyValue<float>); static PropertyValue<IconTextFitType> getDefaultIconTextFit(); PropertyValue<IconTextFitType> getIconTextFit() const; @@ -78,13 +77,13 @@ public: PropertyValue<std::array<float, 4>> getIconTextFitPadding() const; void setIconTextFitPadding(PropertyValue<std::array<float, 4>>); - static DataDrivenPropertyValue<std::string> getDefaultIconImage(); - DataDrivenPropertyValue<std::string> getIconImage() const; - void setIconImage(DataDrivenPropertyValue<std::string>); + static PropertyValue<std::string> getDefaultIconImage(); + PropertyValue<std::string> getIconImage() const; + void setIconImage(PropertyValue<std::string>); - static DataDrivenPropertyValue<float> getDefaultIconRotate(); - DataDrivenPropertyValue<float> getIconRotate() const; - void setIconRotate(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultIconRotate(); + PropertyValue<float> getIconRotate() const; + void setIconRotate(PropertyValue<float>); static PropertyValue<float> getDefaultIconPadding(); PropertyValue<float> getIconPadding() const; @@ -94,13 +93,13 @@ public: PropertyValue<bool> getIconKeepUpright() const; void setIconKeepUpright(PropertyValue<bool>); - static DataDrivenPropertyValue<std::array<float, 2>> getDefaultIconOffset(); - DataDrivenPropertyValue<std::array<float, 2>> getIconOffset() const; - void setIconOffset(DataDrivenPropertyValue<std::array<float, 2>>); + static PropertyValue<std::array<float, 2>> getDefaultIconOffset(); + PropertyValue<std::array<float, 2>> getIconOffset() const; + void setIconOffset(PropertyValue<std::array<float, 2>>); - static DataDrivenPropertyValue<SymbolAnchorType> getDefaultIconAnchor(); - DataDrivenPropertyValue<SymbolAnchorType> getIconAnchor() const; - void setIconAnchor(DataDrivenPropertyValue<SymbolAnchorType>); + static PropertyValue<SymbolAnchorType> getDefaultIconAnchor(); + PropertyValue<SymbolAnchorType> getIconAnchor() const; + void setIconAnchor(PropertyValue<SymbolAnchorType>); static PropertyValue<AlignmentType> getDefaultIconPitchAlignment(); PropertyValue<AlignmentType> getIconPitchAlignment() const; @@ -114,45 +113,45 @@ public: PropertyValue<AlignmentType> getTextRotationAlignment() const; void setTextRotationAlignment(PropertyValue<AlignmentType>); - static DataDrivenPropertyValue<std::string> getDefaultTextField(); - DataDrivenPropertyValue<std::string> getTextField() const; - void setTextField(DataDrivenPropertyValue<std::string>); + static PropertyValue<std::string> getDefaultTextField(); + PropertyValue<std::string> getTextField() const; + void setTextField(PropertyValue<std::string>); - static DataDrivenPropertyValue<std::vector<std::string>> getDefaultTextFont(); - DataDrivenPropertyValue<std::vector<std::string>> getTextFont() const; - void setTextFont(DataDrivenPropertyValue<std::vector<std::string>>); + static PropertyValue<std::vector<std::string>> getDefaultTextFont(); + PropertyValue<std::vector<std::string>> getTextFont() const; + void setTextFont(PropertyValue<std::vector<std::string>>); - static DataDrivenPropertyValue<float> getDefaultTextSize(); - DataDrivenPropertyValue<float> getTextSize() const; - void setTextSize(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultTextSize(); + PropertyValue<float> getTextSize() const; + void setTextSize(PropertyValue<float>); - static DataDrivenPropertyValue<float> getDefaultTextMaxWidth(); - DataDrivenPropertyValue<float> getTextMaxWidth() const; - void setTextMaxWidth(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultTextMaxWidth(); + PropertyValue<float> getTextMaxWidth() const; + void setTextMaxWidth(PropertyValue<float>); static PropertyValue<float> getDefaultTextLineHeight(); PropertyValue<float> getTextLineHeight() const; void setTextLineHeight(PropertyValue<float>); - static DataDrivenPropertyValue<float> getDefaultTextLetterSpacing(); - DataDrivenPropertyValue<float> getTextLetterSpacing() const; - void setTextLetterSpacing(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultTextLetterSpacing(); + PropertyValue<float> getTextLetterSpacing() const; + void setTextLetterSpacing(PropertyValue<float>); - static DataDrivenPropertyValue<TextJustifyType> getDefaultTextJustify(); - DataDrivenPropertyValue<TextJustifyType> getTextJustify() const; - void setTextJustify(DataDrivenPropertyValue<TextJustifyType>); + static PropertyValue<TextJustifyType> getDefaultTextJustify(); + PropertyValue<TextJustifyType> getTextJustify() const; + void setTextJustify(PropertyValue<TextJustifyType>); - static DataDrivenPropertyValue<SymbolAnchorType> getDefaultTextAnchor(); - DataDrivenPropertyValue<SymbolAnchorType> getTextAnchor() const; - void setTextAnchor(DataDrivenPropertyValue<SymbolAnchorType>); + static PropertyValue<SymbolAnchorType> getDefaultTextAnchor(); + PropertyValue<SymbolAnchorType> getTextAnchor() const; + void setTextAnchor(PropertyValue<SymbolAnchorType>); static PropertyValue<float> getDefaultTextMaxAngle(); PropertyValue<float> getTextMaxAngle() const; void setTextMaxAngle(PropertyValue<float>); - static DataDrivenPropertyValue<float> getDefaultTextRotate(); - DataDrivenPropertyValue<float> getTextRotate() const; - void setTextRotate(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultTextRotate(); + PropertyValue<float> getTextRotate() const; + void setTextRotate(PropertyValue<float>); static PropertyValue<float> getDefaultTextPadding(); PropertyValue<float> getTextPadding() const; @@ -162,13 +161,13 @@ public: PropertyValue<bool> getTextKeepUpright() const; void setTextKeepUpright(PropertyValue<bool>); - static DataDrivenPropertyValue<TextTransformType> getDefaultTextTransform(); - DataDrivenPropertyValue<TextTransformType> getTextTransform() const; - void setTextTransform(DataDrivenPropertyValue<TextTransformType>); + static PropertyValue<TextTransformType> getDefaultTextTransform(); + PropertyValue<TextTransformType> getTextTransform() const; + void setTextTransform(PropertyValue<TextTransformType>); - static DataDrivenPropertyValue<std::array<float, 2>> getDefaultTextOffset(); - DataDrivenPropertyValue<std::array<float, 2>> getTextOffset() const; - void setTextOffset(DataDrivenPropertyValue<std::array<float, 2>>); + static PropertyValue<std::array<float, 2>> getDefaultTextOffset(); + PropertyValue<std::array<float, 2>> getTextOffset() const; + void setTextOffset(PropertyValue<std::array<float, 2>>); static PropertyValue<bool> getDefaultTextAllowOverlap(); PropertyValue<bool> getTextAllowOverlap() const; @@ -184,33 +183,33 @@ public: // Paint properties - static DataDrivenPropertyValue<float> getDefaultIconOpacity(); - DataDrivenPropertyValue<float> getIconOpacity() const; - void setIconOpacity(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultIconOpacity(); + PropertyValue<float> getIconOpacity() const; + void setIconOpacity(PropertyValue<float>); void setIconOpacityTransition(const TransitionOptions&); TransitionOptions getIconOpacityTransition() const; - static DataDrivenPropertyValue<Color> getDefaultIconColor(); - DataDrivenPropertyValue<Color> getIconColor() const; - void setIconColor(DataDrivenPropertyValue<Color>); + static PropertyValue<Color> getDefaultIconColor(); + PropertyValue<Color> getIconColor() const; + void setIconColor(PropertyValue<Color>); void setIconColorTransition(const TransitionOptions&); TransitionOptions getIconColorTransition() const; - static DataDrivenPropertyValue<Color> getDefaultIconHaloColor(); - DataDrivenPropertyValue<Color> getIconHaloColor() const; - void setIconHaloColor(DataDrivenPropertyValue<Color>); + static PropertyValue<Color> getDefaultIconHaloColor(); + PropertyValue<Color> getIconHaloColor() const; + void setIconHaloColor(PropertyValue<Color>); void setIconHaloColorTransition(const TransitionOptions&); TransitionOptions getIconHaloColorTransition() const; - static DataDrivenPropertyValue<float> getDefaultIconHaloWidth(); - DataDrivenPropertyValue<float> getIconHaloWidth() const; - void setIconHaloWidth(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultIconHaloWidth(); + PropertyValue<float> getIconHaloWidth() const; + void setIconHaloWidth(PropertyValue<float>); void setIconHaloWidthTransition(const TransitionOptions&); TransitionOptions getIconHaloWidthTransition() const; - static DataDrivenPropertyValue<float> getDefaultIconHaloBlur(); - DataDrivenPropertyValue<float> getIconHaloBlur() const; - void setIconHaloBlur(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultIconHaloBlur(); + PropertyValue<float> getIconHaloBlur() const; + void setIconHaloBlur(PropertyValue<float>); void setIconHaloBlurTransition(const TransitionOptions&); TransitionOptions getIconHaloBlurTransition() const; @@ -226,33 +225,33 @@ public: void setIconTranslateAnchorTransition(const TransitionOptions&); TransitionOptions getIconTranslateAnchorTransition() const; - static DataDrivenPropertyValue<float> getDefaultTextOpacity(); - DataDrivenPropertyValue<float> getTextOpacity() const; - void setTextOpacity(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultTextOpacity(); + PropertyValue<float> getTextOpacity() const; + void setTextOpacity(PropertyValue<float>); void setTextOpacityTransition(const TransitionOptions&); TransitionOptions getTextOpacityTransition() const; - static DataDrivenPropertyValue<Color> getDefaultTextColor(); - DataDrivenPropertyValue<Color> getTextColor() const; - void setTextColor(DataDrivenPropertyValue<Color>); + static PropertyValue<Color> getDefaultTextColor(); + PropertyValue<Color> getTextColor() const; + void setTextColor(PropertyValue<Color>); void setTextColorTransition(const TransitionOptions&); TransitionOptions getTextColorTransition() const; - static DataDrivenPropertyValue<Color> getDefaultTextHaloColor(); - DataDrivenPropertyValue<Color> getTextHaloColor() const; - void setTextHaloColor(DataDrivenPropertyValue<Color>); + static PropertyValue<Color> getDefaultTextHaloColor(); + PropertyValue<Color> getTextHaloColor() const; + void setTextHaloColor(PropertyValue<Color>); void setTextHaloColorTransition(const TransitionOptions&); TransitionOptions getTextHaloColorTransition() const; - static DataDrivenPropertyValue<float> getDefaultTextHaloWidth(); - DataDrivenPropertyValue<float> getTextHaloWidth() const; - void setTextHaloWidth(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultTextHaloWidth(); + PropertyValue<float> getTextHaloWidth() const; + void setTextHaloWidth(PropertyValue<float>); void setTextHaloWidthTransition(const TransitionOptions&); TransitionOptions getTextHaloWidthTransition() const; - static DataDrivenPropertyValue<float> getDefaultTextHaloBlur(); - DataDrivenPropertyValue<float> getTextHaloBlur() const; - void setTextHaloBlur(DataDrivenPropertyValue<float>); + static PropertyValue<float> getDefaultTextHaloBlur(); + PropertyValue<float> getTextHaloBlur() const; + void setTextHaloBlur(PropertyValue<float>); void setTextHaloBlurTransition(const TransitionOptions&); TransitionOptions getTextHaloBlurTransition() const; diff --git a/include/mbgl/style/property_value.hpp b/include/mbgl/style/property_value.hpp index 1b0f3d2ab0..86812e2301 100644 --- a/include/mbgl/style/property_value.hpp +++ b/include/mbgl/style/property_value.hpp @@ -10,44 +10,80 @@ namespace style { template <class T> class PropertyValue { private: - using Value = variant<Undefined, T, PropertyExpression<T>>; + using Value = variant< + Undefined, + T, + PropertyExpression<T>>; + Value value; - friend bool operator==(const PropertyValue& lhs, const PropertyValue& rhs) { + friend bool operator==(const PropertyValue& lhs, + const PropertyValue& rhs) { return lhs.value == rhs.value; } - friend bool operator!=(const PropertyValue& lhs, const PropertyValue& rhs) { + friend bool operator!=(const PropertyValue& lhs, + const PropertyValue& rhs) { return !(lhs == rhs); } public: - PropertyValue() - : value() {} + PropertyValue() = default; PropertyValue(T constant) - : value(constant) {} + : value(std::move(constant)) {} PropertyValue(PropertyExpression<T> expression) - : value(expression) { - assert(expression.isFeatureConstant()); + : value(std::move(expression)) {} + + bool isUndefined() const { + return value.template is<Undefined>(); + } + + bool isConstant() const { + return value.template is<T>(); + } + + bool isExpression() const { + return value.template is<PropertyExpression<T>>(); + } + + bool isDataDriven() const { + return value.match( + [] (const Undefined&) { return false; }, + [] (const T&) { return false; }, + [] (const PropertyExpression<T>& fn) { return !fn.isFeatureConstant(); } + ); + } + + bool isZoomConstant() const { + return value.match( + [] (const Undefined&) { return true; }, + [] (const T&) { return true; }, + [] (const PropertyExpression<T>& fn) { return fn.isZoomConstant(); } + ); } - bool isUndefined() const { return value.which() == 0; } - bool isConstant() const { return value.which() == 1; } - bool isExpression() const { return value.which() == 2; } - bool isDataDriven() const { return false; } + const T& asConstant() const { + return value.template get<T>(); + } - const T & asConstant() const { return value.template get< T >(); } - const PropertyExpression<T>& asExpression() const { return value.template get<PropertyExpression<T>>(); } + const PropertyExpression<T>& asExpression() const { + return value.template get<PropertyExpression<T>>(); + } + + template <class... Ts> + auto match(Ts&&... ts) const { + return value.match(std::forward<Ts>(ts)...); + } template <typename Evaluator> auto evaluate(const Evaluator& evaluator, TimePoint = {}) const { return Value::visit(value, evaluator); } - bool hasDataDrivenPropertyDifference(const PropertyValue<T>&) const { - return false; + bool hasDataDrivenPropertyDifference(const PropertyValue<T>& other) const { + return *this != other && (isDataDriven() || other.isDataDriven()); } }; diff --git a/platform/android/scripts/generate-style-code.js b/platform/android/scripts/generate-style-code.js index b435351df5..888b9fca30 100755 --- a/platform/android/scripts/generate-style-code.js +++ b/platform/android/scripts/generate-style-code.js @@ -278,9 +278,6 @@ global.isLightProperty = function (property) { global.propertyValueType = function (property) { switch (property['property-type']) { - case 'data-driven': - case 'cross-faded-data-driven': - return `DataDrivenPropertyValue<${evaluatedType(property)}>`; default: return `PropertyValue<${evaluatedType(property)}>`; } diff --git a/platform/android/src/style/conversion/property_value.hpp b/platform/android/src/style/conversion/property_value.hpp index feed38b673..256647cddf 100644 --- a/platform/android/src/style/conversion/property_value.hpp +++ b/platform/android/src/style/conversion/property_value.hpp @@ -1,7 +1,6 @@ #pragma once #include <mbgl/style/color_ramp_property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/style/property_value.hpp> #include "../../conversion/conversion.hpp" #include "../../conversion/constant.hpp" @@ -52,18 +51,6 @@ struct Converter<jni::jobject*, mbgl::style::PropertyValue<T>> { }; /** - * Convert core data driven property values to java - */ -template <class T> -struct Converter<jni::jobject*, mbgl::style::DataDrivenPropertyValue<T>> { - - Result<jni::jobject*> operator()(jni::JNIEnv& env, const mbgl::style::DataDrivenPropertyValue<T>& value) const { - PropertyValueEvaluator<T> evaluator(env); - return value.evaluate(evaluator); - } -}; - -/** * Convert core heat map color property value to java */ template <> diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm index cc09ce4e11..890c485677 100644 --- a/platform/darwin/src/MGLBackgroundStyleLayer.mm +++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm @@ -35,7 +35,7 @@ - (void)setBackgroundColor:(NSExpression *)backgroundColor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(backgroundColor); + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(backgroundColor, false); self.rawLayer->setBackgroundColor(mbglValue); } @@ -70,7 +70,7 @@ - (void)setBackgroundOpacity:(NSExpression *)backgroundOpacity { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(backgroundOpacity); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(backgroundOpacity, false); self.rawLayer->setBackgroundOpacity(mbglValue); } @@ -105,7 +105,7 @@ - (void)setBackgroundPattern:(NSExpression *)backgroundPattern { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue<mbgl::style::PropertyValue<std::string>>(backgroundPattern); + auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue<mbgl::style::PropertyValue<std::string>>(backgroundPattern, false); self.rawLayer->setBackgroundPattern(mbglValue); } diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm index b03ab8a7a6..a391d72e7f 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.mm +++ b/platform/darwin/src/MGLCircleStyleLayer.mm @@ -90,7 +90,7 @@ namespace mbgl { - (void)setCircleBlur:(NSExpression *)circleBlur { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(circleBlur); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(circleBlur, true); self.rawLayer->setCircleBlur(mbglValue); } @@ -125,7 +125,7 @@ namespace mbgl { - (void)setCircleColor:(NSExpression *)circleColor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::Color>>(circleColor); + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(circleColor, true); self.rawLayer->setCircleColor(mbglValue); } @@ -160,7 +160,7 @@ namespace mbgl { - (void)setCircleOpacity:(NSExpression *)circleOpacity { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(circleOpacity); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(circleOpacity, true); self.rawLayer->setCircleOpacity(mbglValue); } @@ -195,7 +195,7 @@ namespace mbgl { - (void)setCirclePitchAlignment:(NSExpression *)circlePitchAlignment { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *, mbgl::style::AlignmentType, MGLCirclePitchAlignment>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::AlignmentType>>(circlePitchAlignment); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *, mbgl::style::AlignmentType, MGLCirclePitchAlignment>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::AlignmentType>>(circlePitchAlignment, false); self.rawLayer->setCirclePitchAlignment(mbglValue); } @@ -212,7 +212,7 @@ namespace mbgl { - (void)setCircleRadius:(NSExpression *)circleRadius { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(circleRadius); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(circleRadius, true); self.rawLayer->setCircleRadius(mbglValue); } @@ -247,7 +247,7 @@ namespace mbgl { - (void)setCircleScaleAlignment:(NSExpression *)circleScaleAlignment { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::CirclePitchScaleType, NSValue *, mbgl::style::CirclePitchScaleType, MGLCircleScaleAlignment>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::CirclePitchScaleType>>(circleScaleAlignment); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::CirclePitchScaleType, NSValue *, mbgl::style::CirclePitchScaleType, MGLCircleScaleAlignment>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::CirclePitchScaleType>>(circleScaleAlignment, false); self.rawLayer->setCirclePitchScale(mbglValue); } @@ -271,7 +271,7 @@ namespace mbgl { - (void)setCircleStrokeColor:(NSExpression *)circleStrokeColor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::Color>>(circleStrokeColor); + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(circleStrokeColor, true); self.rawLayer->setCircleStrokeColor(mbglValue); } @@ -306,7 +306,7 @@ namespace mbgl { - (void)setCircleStrokeOpacity:(NSExpression *)circleStrokeOpacity { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(circleStrokeOpacity); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(circleStrokeOpacity, true); self.rawLayer->setCircleStrokeOpacity(mbglValue); } @@ -341,7 +341,7 @@ namespace mbgl { - (void)setCircleStrokeWidth:(NSExpression *)circleStrokeWidth { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(circleStrokeWidth); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(circleStrokeWidth, true); self.rawLayer->setCircleStrokeWidth(mbglValue); } @@ -376,7 +376,7 @@ namespace mbgl { - (void)setCircleTranslation:(NSExpression *)circleTranslation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 2>>>(circleTranslation); + auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 2>>>(circleTranslation, false); self.rawLayer->setCircleTranslate(mbglValue); } @@ -418,7 +418,7 @@ namespace mbgl { - (void)setCircleTranslationAnchor:(NSExpression *)circleTranslationAnchor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLCircleTranslationAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType>>(circleTranslationAnchor); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLCircleTranslationAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType>>(circleTranslationAnchor, false); self.rawLayer->setCircleTranslateAnchor(mbglValue); } diff --git a/platform/darwin/src/MGLFillExtrusionStyleLayer.mm b/platform/darwin/src/MGLFillExtrusionStyleLayer.mm index 1cb059fae0..1b7896be9f 100644 --- a/platform/darwin/src/MGLFillExtrusionStyleLayer.mm +++ b/platform/darwin/src/MGLFillExtrusionStyleLayer.mm @@ -80,7 +80,7 @@ namespace mbgl { - (void)setFillExtrusionBase:(NSExpression *)fillExtrusionBase { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(fillExtrusionBase); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(fillExtrusionBase, true); self.rawLayer->setFillExtrusionBase(mbglValue); } @@ -115,7 +115,7 @@ namespace mbgl { - (void)setFillExtrusionColor:(NSExpression *)fillExtrusionColor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::Color>>(fillExtrusionColor); + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(fillExtrusionColor, true); self.rawLayer->setFillExtrusionColor(mbglValue); } @@ -150,7 +150,7 @@ namespace mbgl { - (void)setFillExtrusionHeight:(NSExpression *)fillExtrusionHeight { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(fillExtrusionHeight); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(fillExtrusionHeight, true); self.rawLayer->setFillExtrusionHeight(mbglValue); } @@ -185,7 +185,7 @@ namespace mbgl { - (void)setFillExtrusionOpacity:(NSExpression *)fillExtrusionOpacity { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(fillExtrusionOpacity); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(fillExtrusionOpacity, false); self.rawLayer->setFillExtrusionOpacity(mbglValue); } @@ -220,7 +220,7 @@ namespace mbgl { - (void)setFillExtrusionPattern:(NSExpression *)fillExtrusionPattern { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue<mbgl::style::PropertyValue<std::string>>(fillExtrusionPattern); + auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue<mbgl::style::PropertyValue<std::string>>(fillExtrusionPattern, false); self.rawLayer->setFillExtrusionPattern(mbglValue); } @@ -255,7 +255,7 @@ namespace mbgl { - (void)setFillExtrusionTranslation:(NSExpression *)fillExtrusionTranslation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 2>>>(fillExtrusionTranslation); + auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 2>>>(fillExtrusionTranslation, false); self.rawLayer->setFillExtrusionTranslate(mbglValue); } @@ -297,7 +297,7 @@ namespace mbgl { - (void)setFillExtrusionTranslationAnchor:(NSExpression *)fillExtrusionTranslationAnchor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLFillExtrusionTranslationAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType>>(fillExtrusionTranslationAnchor); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLFillExtrusionTranslationAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType>>(fillExtrusionTranslationAnchor, false); self.rawLayer->setFillExtrusionTranslateAnchor(mbglValue); } diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm index 2fb9849c42..7c36f7989b 100644 --- a/platform/darwin/src/MGLFillStyleLayer.mm +++ b/platform/darwin/src/MGLFillStyleLayer.mm @@ -80,7 +80,7 @@ namespace mbgl { - (void)setFillAntialiased:(NSExpression *)fillAntialiased { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(fillAntialiased); + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(fillAntialiased, false); self.rawLayer->setFillAntialias(mbglValue); } @@ -104,7 +104,7 @@ namespace mbgl { - (void)setFillColor:(NSExpression *)fillColor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::Color>>(fillColor); + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(fillColor, true); self.rawLayer->setFillColor(mbglValue); } @@ -139,7 +139,7 @@ namespace mbgl { - (void)setFillOpacity:(NSExpression *)fillOpacity { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(fillOpacity); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(fillOpacity, true); self.rawLayer->setFillOpacity(mbglValue); } @@ -174,7 +174,7 @@ namespace mbgl { - (void)setFillOutlineColor:(NSExpression *)fillOutlineColor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::Color>>(fillOutlineColor); + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(fillOutlineColor, true); self.rawLayer->setFillOutlineColor(mbglValue); } @@ -209,7 +209,7 @@ namespace mbgl { - (void)setFillPattern:(NSExpression *)fillPattern { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue<mbgl::style::PropertyValue<std::string>>(fillPattern); + auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue<mbgl::style::PropertyValue<std::string>>(fillPattern, false); self.rawLayer->setFillPattern(mbglValue); } @@ -244,7 +244,7 @@ namespace mbgl { - (void)setFillTranslation:(NSExpression *)fillTranslation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 2>>>(fillTranslation); + auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 2>>>(fillTranslation, false); self.rawLayer->setFillTranslate(mbglValue); } @@ -286,7 +286,7 @@ namespace mbgl { - (void)setFillTranslationAnchor:(NSExpression *)fillTranslationAnchor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLFillTranslationAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType>>(fillTranslationAnchor); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLFillTranslationAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType>>(fillTranslationAnchor, false); self.rawLayer->setFillTranslateAnchor(mbglValue); } diff --git a/platform/darwin/src/MGLHeatmapStyleLayer.mm b/platform/darwin/src/MGLHeatmapStyleLayer.mm index 5e6b5df319..c74869d408 100644 --- a/platform/darwin/src/MGLHeatmapStyleLayer.mm +++ b/platform/darwin/src/MGLHeatmapStyleLayer.mm @@ -88,7 +88,7 @@ - (void)setHeatmapIntensity:(NSExpression *)heatmapIntensity { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(heatmapIntensity); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(heatmapIntensity, false); self.rawLayer->setHeatmapIntensity(mbglValue); } @@ -123,7 +123,7 @@ - (void)setHeatmapOpacity:(NSExpression *)heatmapOpacity { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(heatmapOpacity); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(heatmapOpacity, false); self.rawLayer->setHeatmapOpacity(mbglValue); } @@ -158,7 +158,7 @@ - (void)setHeatmapRadius:(NSExpression *)heatmapRadius { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(heatmapRadius); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(heatmapRadius, true); self.rawLayer->setHeatmapRadius(mbglValue); } @@ -193,7 +193,7 @@ - (void)setHeatmapWeight:(NSExpression *)heatmapWeight { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(heatmapWeight); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(heatmapWeight, true); self.rawLayer->setHeatmapWeight(mbglValue); } diff --git a/platform/darwin/src/MGLHillshadeStyleLayer.mm b/platform/darwin/src/MGLHillshadeStyleLayer.mm index 70fab24e33..16d043f603 100644 --- a/platform/darwin/src/MGLHillshadeStyleLayer.mm +++ b/platform/darwin/src/MGLHillshadeStyleLayer.mm @@ -51,7 +51,7 @@ namespace mbgl { - (void)setHillshadeAccentColor:(NSExpression *)hillshadeAccentColor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(hillshadeAccentColor); + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(hillshadeAccentColor, false); self.rawLayer->setHillshadeAccentColor(mbglValue); } @@ -86,7 +86,7 @@ namespace mbgl { - (void)setHillshadeExaggeration:(NSExpression *)hillshadeExaggeration { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(hillshadeExaggeration); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(hillshadeExaggeration, false); self.rawLayer->setHillshadeExaggeration(mbglValue); } @@ -121,7 +121,7 @@ namespace mbgl { - (void)setHillshadeHighlightColor:(NSExpression *)hillshadeHighlightColor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(hillshadeHighlightColor); + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(hillshadeHighlightColor, false); self.rawLayer->setHillshadeHighlightColor(mbglValue); } @@ -156,7 +156,7 @@ namespace mbgl { - (void)setHillshadeIlluminationAnchor:(NSExpression *)hillshadeIlluminationAnchor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::HillshadeIlluminationAnchorType, NSValue *, mbgl::style::HillshadeIlluminationAnchorType, MGLHillshadeIlluminationAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::HillshadeIlluminationAnchorType>>(hillshadeIlluminationAnchor); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::HillshadeIlluminationAnchorType, NSValue *, mbgl::style::HillshadeIlluminationAnchorType, MGLHillshadeIlluminationAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::HillshadeIlluminationAnchorType>>(hillshadeIlluminationAnchor, false); self.rawLayer->setHillshadeIlluminationAnchor(mbglValue); } @@ -173,7 +173,7 @@ namespace mbgl { - (void)setHillshadeIlluminationDirection:(NSExpression *)hillshadeIlluminationDirection { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(hillshadeIlluminationDirection); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(hillshadeIlluminationDirection, false); self.rawLayer->setHillshadeIlluminationDirection(mbglValue); } @@ -190,7 +190,7 @@ namespace mbgl { - (void)setHillshadeShadowColor:(NSExpression *)hillshadeShadowColor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(hillshadeShadowColor); + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(hillshadeShadowColor, false); self.rawLayer->setHillshadeShadowColor(mbglValue); } diff --git a/platform/darwin/src/MGLLight.mm b/platform/darwin/src/MGLLight.mm index db2893ed44..0234e74d5b 100644 --- a/platform/darwin/src/MGLLight.mm +++ b/platform/darwin/src/MGLLight.mm @@ -18,14 +18,14 @@ namespace mbgl { { MGLLightAnchorMap, "map" }, { MGLLightAnchorViewport, "viewport" }, }); - + } NS_INLINE MGLTransition MGLTransitionFromOptions(const mbgl::style::TransitionOptions& options) { MGLTransition transition; transition.duration = MGLTimeIntervalFromDuration(options.duration.value_or(mbgl::Duration::zero())); transition.delay = MGLTimeIntervalFromDuration(options.delay.value_or(mbgl::Duration::zero())); - + return transition; } @@ -60,27 +60,21 @@ NS_INLINE mbgl::style::TransitionOptions MGLOptionsFromTransition(MGLTransition } else { _position = MGLStyleValueTransformer<mbgl::style::Position, NSValue *>().toExpression(positionValue); } - _positionTransition = MGLTransitionFromOptions(mbglLight->getPositionTransition()); - auto colorValue = mbglLight->getColor(); if (colorValue.isUndefined()) { _color = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toExpression(mbglLight->getDefaultColor()); } else { _color = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toExpression(colorValue); } - _colorTransition = MGLTransitionFromOptions(mbglLight->getColorTransition()); - auto intensityValue = mbglLight->getIntensity(); if (intensityValue.isUndefined()) { _intensity = MGLStyleValueTransformer<float, NSNumber *>().toExpression(mbglLight->getDefaultIntensity()); } else { _intensity = MGLStyleValueTransformer<float, NSNumber *>().toExpression(intensityValue); } - _intensityTransition = MGLTransitionFromOptions(mbglLight->getIntensityTransition()); - } return self; @@ -89,25 +83,25 @@ NS_INLINE mbgl::style::TransitionOptions MGLOptionsFromTransition(MGLTransition - (mbgl::style::Light)mbglLight { mbgl::style::Light mbglLight; - auto anchor = MGLStyleValueTransformer<mbgl::style::LightAnchorType, NSValue *, mbgl::style::LightAnchorType, MGLLightAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::LightAnchorType>>(self.anchor); + auto anchor = MGLStyleValueTransformer<mbgl::style::LightAnchorType, NSValue *, mbgl::style::LightAnchorType, MGLLightAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::LightAnchorType>>(self.anchor, false); mbglLight.setAnchor(anchor); - auto position = MGLStyleValueTransformer<mbgl::style::Position, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::Position>>(self.position); + auto position = MGLStyleValueTransformer<mbgl::style::Position, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::Position>>(self.position, false); mbglLight.setPosition(position); - + mbglLight.setPositionTransition(MGLOptionsFromTransition(self.positionTransition)); - auto color = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(self.color); + auto color = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(self.color, false); mbglLight.setColor(color); - + mbglLight.setColorTransition(MGLOptionsFromTransition(self.colorTransition)); - auto intensity = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(self.intensity); + auto intensity = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(self.intensity, false); mbglLight.setIntensity(intensity); - + mbglLight.setIntensityTransition(MGLOptionsFromTransition(self.intensityTransition)); - + return mbglLight; } diff --git a/platform/darwin/src/MGLLight.mm.ejs b/platform/darwin/src/MGLLight.mm.ejs index b241269519..24ab1d8138 100644 --- a/platform/darwin/src/MGLLight.mm.ejs +++ b/platform/darwin/src/MGLLight.mm.ejs @@ -26,14 +26,14 @@ namespace mbgl { <% } -%> <% } -%> }); - + } NS_INLINE MGLTransition MGLTransitionFromOptions(const mbgl::style::TransitionOptions& options) { MGLTransition transition; transition.duration = MGLTimeIntervalFromDuration(options.duration.value_or(mbgl::Duration::zero())); transition.delay = MGLTimeIntervalFromDuration(options.delay.value_or(mbgl::Duration::zero())); - + return transition; } @@ -76,9 +76,9 @@ NS_INLINE mbgl::style::TransitionOptions MGLOptionsFromTransition(MGLTransition } else { _<%- camelizeWithLeadingLowercase(property.name) -%> = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toExpression(<%- camelizeWithLeadingLowercase(property.name) -%>Value); } -<% if (property.transition) { -%> +<% if (property.transition) { -%> _<%- camelizeWithLeadingLowercase(property.name) -%>Transition = MGLTransitionFromOptions(mbglLight->get<%- camelize(property.name) -%>Transition()); -<% } -%> +<% } -%> <% } -%> <% } -%> <% } -%> @@ -93,13 +93,13 @@ NS_INLINE mbgl::style::TransitionOptions MGLOptionsFromTransition(MGLTransition <% if (properties.length) { -%> <% for (const property of properties) { -%> <% if (property.type == "enum") { -%> - auto <%- camelizeWithLeadingLowercase(property.name) -%> = MGLStyleValueTransformer<mbgl::style::Light<%- camelize(property.name) -%>Type, NSValue *, mbgl::style::Light<%- camelize(property.name) -%>Type, MGLLight<%- camelize(property.name) -%>>().toPropertyValue<mbgl::style::PropertyValue<<%- valueTransformerArguments(property)[0] %>>>(self.<%- camelizeWithLeadingLowercase(property.name) -%>); + auto <%- camelizeWithLeadingLowercase(property.name) -%> = MGLStyleValueTransformer<mbgl::style::Light<%- camelize(property.name) -%>Type, NSValue *, mbgl::style::Light<%- camelize(property.name) -%>Type, MGLLight<%- camelize(property.name) -%>>().toPropertyValue<mbgl::style::PropertyValue<<%- valueTransformerArguments(property)[0] %>>>(self.<%- camelizeWithLeadingLowercase(property.name) -%>, false); mbglLight.set<%- camelize(property.name) -%>(<%- camelizeWithLeadingLowercase(property.name) -%>); <% } else {-%> - auto <%- camelizeWithLeadingLowercase(property.name) -%> = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue<mbgl::style::PropertyValue<<%- valueTransformerArguments(property)[0] %>>>(self.<%- camelizeWithLeadingLowercase(property.name) -%>); + auto <%- camelizeWithLeadingLowercase(property.name) -%> = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue<mbgl::style::PropertyValue<<%- valueTransformerArguments(property)[0] %>>>(self.<%- camelizeWithLeadingLowercase(property.name) -%>, false); mbglLight.set<%- camelize(property.name) -%>(<%- camelizeWithLeadingLowercase(property.name) -%>); - + <% } -%> <% if (property.transition) { -%> mbglLight.set<%- camelize(property.name) -%>Transition(MGLOptionsFromTransition(self.<%- camelizeWithLeadingLowercase(property.name) -%>Transition)); @@ -107,7 +107,7 @@ NS_INLINE mbgl::style::TransitionOptions MGLOptionsFromTransition(MGLTransition <% } -%> <% } -%> <% } -%> - + return mbglLight; } diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm index e65a474829..3bad2a8b98 100644 --- a/platform/darwin/src/MGLLineStyleLayer.mm +++ b/platform/darwin/src/MGLLineStyleLayer.mm @@ -92,7 +92,7 @@ namespace mbgl { - (void)setLineCap:(NSExpression *)lineCap { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::LineCapType, NSValue *, mbgl::style::LineCapType, MGLLineCap>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::LineCapType>>(lineCap); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::LineCapType, NSValue *, mbgl::style::LineCapType, MGLLineCap>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::LineCapType>>(lineCap, false); self.rawLayer->setLineCap(mbglValue); } @@ -109,7 +109,7 @@ namespace mbgl { - (void)setLineJoin:(NSExpression *)lineJoin { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::LineJoinType, NSValue *, mbgl::style::LineJoinType, MGLLineJoin>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::style::LineJoinType>>(lineJoin); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::LineJoinType, NSValue *, mbgl::style::LineJoinType, MGLLineJoin>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::LineJoinType>>(lineJoin, true); self.rawLayer->setLineJoin(mbglValue); } @@ -126,7 +126,7 @@ namespace mbgl { - (void)setLineMiterLimit:(NSExpression *)lineMiterLimit { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(lineMiterLimit); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(lineMiterLimit, false); self.rawLayer->setLineMiterLimit(mbglValue); } @@ -143,7 +143,7 @@ namespace mbgl { - (void)setLineRoundLimit:(NSExpression *)lineRoundLimit { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(lineRoundLimit); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(lineRoundLimit, false); self.rawLayer->setLineRoundLimit(mbglValue); } @@ -162,7 +162,7 @@ namespace mbgl { - (void)setLineBlur:(NSExpression *)lineBlur { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(lineBlur); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(lineBlur, true); self.rawLayer->setLineBlur(mbglValue); } @@ -197,7 +197,7 @@ namespace mbgl { - (void)setLineColor:(NSExpression *)lineColor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::Color>>(lineColor); + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(lineColor, true); self.rawLayer->setLineColor(mbglValue); } @@ -232,7 +232,7 @@ namespace mbgl { - (void)setLineDashPattern:(NSExpression *)lineDashPattern { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::vector<float>, NSArray<NSNumber *> *, float>().toPropertyValue<mbgl::style::PropertyValue<std::vector<float>>>(lineDashPattern); + auto mbglValue = MGLStyleValueTransformer<std::vector<float>, NSArray<NSNumber *> *, float>().toPropertyValue<mbgl::style::PropertyValue<std::vector<float>>>(lineDashPattern, false); self.rawLayer->setLineDasharray(mbglValue); } @@ -274,7 +274,7 @@ namespace mbgl { - (void)setLineGapWidth:(NSExpression *)lineGapWidth { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(lineGapWidth); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(lineGapWidth, true); self.rawLayer->setLineGapWidth(mbglValue); } @@ -309,7 +309,7 @@ namespace mbgl { - (void)setLineOffset:(NSExpression *)lineOffset { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(lineOffset); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(lineOffset, true); self.rawLayer->setLineOffset(mbglValue); } @@ -344,7 +344,7 @@ namespace mbgl { - (void)setLineOpacity:(NSExpression *)lineOpacity { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(lineOpacity); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(lineOpacity, true); self.rawLayer->setLineOpacity(mbglValue); } @@ -379,7 +379,7 @@ namespace mbgl { - (void)setLinePattern:(NSExpression *)linePattern { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue<mbgl::style::PropertyValue<std::string>>(linePattern); + auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue<mbgl::style::PropertyValue<std::string>>(linePattern, false); self.rawLayer->setLinePattern(mbglValue); } @@ -414,7 +414,7 @@ namespace mbgl { - (void)setLineTranslation:(NSExpression *)lineTranslation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 2>>>(lineTranslation); + auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 2>>>(lineTranslation, false); self.rawLayer->setLineTranslate(mbglValue); } @@ -456,7 +456,7 @@ namespace mbgl { - (void)setLineTranslationAnchor:(NSExpression *)lineTranslationAnchor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLLineTranslationAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType>>(lineTranslationAnchor); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLLineTranslationAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType>>(lineTranslationAnchor, false); self.rawLayer->setLineTranslateAnchor(mbglValue); } @@ -480,7 +480,7 @@ namespace mbgl { - (void)setLineWidth:(NSExpression *)lineWidth { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(lineWidth); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(lineWidth, true); self.rawLayer->setLineWidth(mbglValue); } diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm index 96ed5ab513..c87355b04d 100644 --- a/platform/darwin/src/MGLRasterStyleLayer.mm +++ b/platform/darwin/src/MGLRasterStyleLayer.mm @@ -51,7 +51,7 @@ namespace mbgl { - (void)setMaximumRasterBrightness:(NSExpression *)maximumRasterBrightness { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(maximumRasterBrightness); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(maximumRasterBrightness, false); self.rawLayer->setRasterBrightnessMax(mbglValue); } @@ -93,7 +93,7 @@ namespace mbgl { - (void)setMinimumRasterBrightness:(NSExpression *)minimumRasterBrightness { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(minimumRasterBrightness); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(minimumRasterBrightness, false); self.rawLayer->setRasterBrightnessMin(mbglValue); } @@ -135,7 +135,7 @@ namespace mbgl { - (void)setRasterContrast:(NSExpression *)rasterContrast { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(rasterContrast); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(rasterContrast, false); self.rawLayer->setRasterContrast(mbglValue); } @@ -170,7 +170,7 @@ namespace mbgl { - (void)setRasterFadeDuration:(NSExpression *)rasterFadeDuration { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(rasterFadeDuration); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(rasterFadeDuration, false); self.rawLayer->setRasterFadeDuration(mbglValue); } @@ -187,7 +187,7 @@ namespace mbgl { - (void)setRasterHueRotation:(NSExpression *)rasterHueRotation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(rasterHueRotation); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(rasterHueRotation, false); self.rawLayer->setRasterHueRotate(mbglValue); } @@ -229,7 +229,7 @@ namespace mbgl { - (void)setRasterOpacity:(NSExpression *)rasterOpacity { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(rasterOpacity); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(rasterOpacity, false); self.rawLayer->setRasterOpacity(mbglValue); } @@ -264,7 +264,7 @@ namespace mbgl { - (void)setRasterResamplingMode:(NSExpression *)rasterResamplingMode { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::RasterResamplingType, NSValue *, mbgl::style::RasterResamplingType, MGLRasterResamplingMode>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::RasterResamplingType>>(rasterResamplingMode); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::RasterResamplingType, NSValue *, mbgl::style::RasterResamplingType, MGLRasterResamplingMode>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::RasterResamplingType>>(rasterResamplingMode, false); self.rawLayer->setRasterResampling(mbglValue); } @@ -288,7 +288,7 @@ namespace mbgl { - (void)setRasterSaturation:(NSExpression *)rasterSaturation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(rasterSaturation); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(rasterSaturation, false); self.rawLayer->setRasterSaturation(mbglValue); } diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs index b37fbc04bf..0707e573c4 100644 --- a/platform/darwin/src/MGLStyleLayer.mm.ejs +++ b/platform/darwin/src/MGLStyleLayer.mm.ejs @@ -125,16 +125,16 @@ namespace mbgl { if (<%- objCName(property) %> && <%- objCName(property) %>.expressionType == NSConstantValueExpressionType) { std::string string = ((NSString *)<%- objCName(property) %>.constantValue).UTF8String; if (mbgl::style::conversion::hasTokens(string)) { - self.rawLayer->set<%- camelize(originalPropertyName(property)) %>(mbgl::style::DataDrivenPropertyValue<std::string>( + self.rawLayer->set<%- camelize(originalPropertyName(property)) %>(mbgl::style::PropertyValue<std::string>( mbgl::style::conversion::convertTokenStringToExpression(string))); return; } } <% } -%> <% if (isDataDriven(property)) { -%> - auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<<%- valueTransformerArguments(property)[0] %>>>(<%- objCName(property) %>); + auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue<mbgl::style::PropertyValue<<%- valueTransformerArguments(property)[0] %>>>(<%- objCName(property) %>, true); <% } else { -%> - auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue<mbgl::style::PropertyValue<<%- valueTransformerArguments(property)[0] %>>>(<%- objCName(property) %>); + auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue<mbgl::style::PropertyValue<<%- valueTransformerArguments(property)[0] %>>>(<%- objCName(property) %>, false); <% } -%> self.rawLayer->set<%- camelize(originalPropertyName(property)) %>(mbglValue); } @@ -173,10 +173,10 @@ namespace mbgl { <% break case 'data-driven': case 'cross-faded-data-driven': -%> - auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<<%- valueTransformerArguments(property)[0] %>>>(<%- objCName(property) %>); + auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue<mbgl::style::PropertyValue<<%- valueTransformerArguments(property)[0] %>>>(<%- objCName(property) %>, true); <% break default: -%> - auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue<mbgl::style::PropertyValue<<%- valueTransformerArguments(property)[0] %>>>(<%- objCName(property) %>); + auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue<mbgl::style::PropertyValue<<%- valueTransformerArguments(property)[0] %>>>(<%- objCName(property) %>, false); <% } -%> self.rawLayer->set<%- camelize(originalPropertyName(property)) %>(mbglValue); } diff --git a/platform/darwin/src/MGLStyleValue_Private.h b/platform/darwin/src/MGLStyleValue_Private.h index d6e2edf3eb..75e422fb45 100644 --- a/platform/darwin/src/MGLStyleValue_Private.h +++ b/platform/darwin/src/MGLStyleValue_Private.h @@ -10,14 +10,10 @@ #import "MGLConversion.h" #include <mbgl/style/conversion/color_ramp_property_value.hpp> #include <mbgl/style/conversion/property_value.hpp> -#include <mbgl/style/conversion/data_driven_property_value.hpp> #include <mbgl/style/conversion/position.hpp> #import <mbgl/style/types.hpp> #import <mbgl/util/enum.hpp> - -#include <mbgl/style/data_driven_property_value.hpp> - #include <mbgl/util/interpolate.hpp> #if TARGET_OS_IPHONE @@ -39,20 +35,13 @@ id MGLJSONObjectFromMBGLExpression(const mbgl::style::expression::Expression &mb template <typename MBGLType, typename ObjCType, typename MBGLElement = MBGLType, typename ObjCEnum = ObjCType> class MGLStyleValueTransformer { public: - + /// Convert an mbgl property value into an mgl style value NSExpression *toExpression(const mbgl::style::PropertyValue<MBGLType> &mbglValue) { PropertyExpressionEvaluator evaluator; return mbglValue.evaluate(evaluator); } - - /// Convert an mbgl data driven property value into an mgl style value - template <typename MBGLEnum = MBGLType, typename MGLEnum = ObjCEnum> - NSExpression *toExpression(const mbgl::style::DataDrivenPropertyValue<MBGLEnum> &mbglValue) { - PropertyExpressionEvaluator evaluator; - return mbglValue.evaluate(evaluator); - } - + // Convert an mbgl heatmap color property value into an mgl style value NSExpression *toExpression(const mbgl::style::ColorRampPropertyValue &mbglValue) { if (mbglValue.isUndefined()) { @@ -66,11 +55,11 @@ public: */ template <typename MBGLValue> typename std::enable_if_t<!std::is_same<MBGLValue, mbgl::style::ColorRampPropertyValue>::value, - MBGLValue> toPropertyValue(NSExpression *expression) { + MBGLValue> toPropertyValue(NSExpression *expression, bool allowDataExpressions) { if (!expression) { return {}; } - + if (expression.expressionType == NSConstantValueExpressionType) { MBGLType mbglValue; getMBGLValue(expression.constantValue, mbglValue); @@ -81,21 +70,21 @@ public: getMBGLValue(expression.collection, mbglValue); return mbglValue; } - + NSArray *jsonExpression = expression.mgl_jsonExpressionObject; - + mbgl::style::conversion::Error valueError; auto value = mbgl::style::conversion::convert<MBGLValue>( - mbgl::style::conversion::makeConvertible(jsonExpression), valueError, false); + mbgl::style::conversion::makeConvertible(jsonExpression), valueError, allowDataExpressions, false); if (!value) { [NSException raise:NSInvalidArgumentException format:@"Invalid property value: %@", @(valueError.message.c_str())]; return {}; } - + return *value; } - + /** Converts an NSExpression to an mbgl property value. */ @@ -105,9 +94,9 @@ public: if (!expression) { return {}; } - + NSArray *jsonExpression = expression.mgl_jsonExpressionObject; - + mbgl::style::conversion::Error valueError; auto value = mbgl::style::conversion::convert<mbgl::style::ColorRampPropertyValue>( mbgl::style::conversion::makeConvertible(jsonExpression), valueError); @@ -116,12 +105,12 @@ public: format:@"Invalid property value: %@", @(valueError.message.c_str())]; return {}; } - + return *value; } private: // Private utilities for converting from mgl to mbgl values - + /** As hack to allow converting enum => string values, we accept a second, dummy parameter in the toRawStyleSpecValue() methods for converting 'atomic' (non-style-function) values. @@ -143,7 +132,7 @@ private: // Private utilities for converting from mgl to mbgl values // noop pass-through plain NSObject-based items return rawMGLValue; } - + template <typename MBGLEnum = MBGLType, class = typename std::enable_if<std::is_enum<MBGLEnum>::value>::type, typename MGLEnum = ObjCEnum, @@ -153,7 +142,7 @@ private: // Private utilities for converting from mgl to mbgl values [rawValue getValue:&mglEnum]; return @(mbgl::Enum<MGLEnum>::toString(mglEnum)); } - + NSObject* toRawStyleSpecValue(MGLColor *color, MBGLType &mbglValue) { return @(color.mgl_color.stringify().c_str()); } @@ -216,7 +205,7 @@ private: // Private utilities for converting from mgl to mbgl values mbglValue.push_back(mbglElement); } } - + void getMBGLValue(NSValue *rawValue, mbgl::style::Position &mbglValue) { auto spherical = rawValue.mgl_lightPositionArrayValue; mbgl::style::Position position(spherical); @@ -284,7 +273,7 @@ private: // Private utilities for converting from mbgl to mgl values } return array; } - + static NSValue *toMGLRawStyleValue(const mbgl::style::Position &mbglStopValue) { std::array<float, 3> spherical = mbglStopValue.getSpherical(); MGLSphericalPosition position = MGLSphericalPositionMake(spherical[0], spherical[1], spherical[2]); @@ -322,7 +311,7 @@ private: // Private utilities for converting from mbgl to mgl values } return [NSExpression expressionForConstantValue:constantValue]; } - + template <typename MBGLEnum = MBGLType, class = typename std::enable_if<std::is_enum<MBGLEnum>::value>::type, typename MGLEnum = ObjCEnum, diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm index 791bb5f894..ad023a1a03 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.mm +++ b/platform/darwin/src/MGLSymbolStyleLayer.mm @@ -158,7 +158,7 @@ namespace mbgl { - (void)setIconAllowsOverlap:(NSExpression *)iconAllowsOverlap { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(iconAllowsOverlap); + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(iconAllowsOverlap, false); self.rawLayer->setIconAllowOverlap(mbglValue); } @@ -182,7 +182,7 @@ namespace mbgl { - (void)setIconAnchor:(NSExpression *)iconAnchor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::SymbolAnchorType, NSValue *, mbgl::style::SymbolAnchorType, MGLIconAnchor>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::style::SymbolAnchorType>>(iconAnchor); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::SymbolAnchorType, NSValue *, mbgl::style::SymbolAnchorType, MGLIconAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::SymbolAnchorType>>(iconAnchor, true); self.rawLayer->setIconAnchor(mbglValue); } @@ -199,7 +199,7 @@ namespace mbgl { - (void)setIconIgnoresPlacement:(NSExpression *)iconIgnoresPlacement { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(iconIgnoresPlacement); + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(iconIgnoresPlacement, false); self.rawLayer->setIconIgnorePlacement(mbglValue); } @@ -226,12 +226,12 @@ namespace mbgl { if (iconImageName && iconImageName.expressionType == NSConstantValueExpressionType) { std::string string = ((NSString *)iconImageName.constantValue).UTF8String; if (mbgl::style::conversion::hasTokens(string)) { - self.rawLayer->setIconImage(mbgl::style::DataDrivenPropertyValue<std::string>( + self.rawLayer->setIconImage(mbgl::style::PropertyValue<std::string>( mbgl::style::conversion::convertTokenStringToExpression(string))); return; } } - auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<std::string>>(iconImageName); + auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue<mbgl::style::PropertyValue<std::string>>(iconImageName, true); self.rawLayer->setIconImage(mbglValue); } @@ -255,7 +255,7 @@ namespace mbgl { - (void)setIconOffset:(NSExpression *)iconOffset { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<std::array<float, 2>>>(iconOffset); + auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 2>>>(iconOffset, true); self.rawLayer->setIconOffset(mbglValue); } @@ -272,7 +272,7 @@ namespace mbgl { - (void)setIconOptional:(NSExpression *)iconOptional { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(iconOptional); + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(iconOptional, false); self.rawLayer->setIconOptional(mbglValue); } @@ -289,7 +289,7 @@ namespace mbgl { - (void)setIconPadding:(NSExpression *)iconPadding { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(iconPadding); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(iconPadding, false); self.rawLayer->setIconPadding(mbglValue); } @@ -306,7 +306,7 @@ namespace mbgl { - (void)setIconPitchAlignment:(NSExpression *)iconPitchAlignment { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *, mbgl::style::AlignmentType, MGLIconPitchAlignment>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::AlignmentType>>(iconPitchAlignment); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *, mbgl::style::AlignmentType, MGLIconPitchAlignment>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::AlignmentType>>(iconPitchAlignment, false); self.rawLayer->setIconPitchAlignment(mbglValue); } @@ -323,7 +323,7 @@ namespace mbgl { - (void)setIconRotation:(NSExpression *)iconRotation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(iconRotation); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(iconRotation, true); self.rawLayer->setIconRotate(mbglValue); } @@ -347,7 +347,7 @@ namespace mbgl { - (void)setIconRotationAlignment:(NSExpression *)iconRotationAlignment { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *, mbgl::style::AlignmentType, MGLIconRotationAlignment>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::AlignmentType>>(iconRotationAlignment); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *, mbgl::style::AlignmentType, MGLIconRotationAlignment>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::AlignmentType>>(iconRotationAlignment, false); self.rawLayer->setIconRotationAlignment(mbglValue); } @@ -364,7 +364,7 @@ namespace mbgl { - (void)setIconScale:(NSExpression *)iconScale { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(iconScale); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(iconScale, true); self.rawLayer->setIconSize(mbglValue); } @@ -388,7 +388,7 @@ namespace mbgl { - (void)setIconTextFit:(NSExpression *)iconTextFit { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::IconTextFitType, NSValue *, mbgl::style::IconTextFitType, MGLIconTextFit>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::IconTextFitType>>(iconTextFit); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::IconTextFitType, NSValue *, mbgl::style::IconTextFitType, MGLIconTextFit>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::IconTextFitType>>(iconTextFit, false); self.rawLayer->setIconTextFit(mbglValue); } @@ -405,7 +405,7 @@ namespace mbgl { - (void)setIconTextFitPadding:(NSExpression *)iconTextFitPadding { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::array<float, 4>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 4>>>(iconTextFitPadding); + auto mbglValue = MGLStyleValueTransformer<std::array<float, 4>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 4>>>(iconTextFitPadding, false); self.rawLayer->setIconTextFitPadding(mbglValue); } @@ -422,7 +422,7 @@ namespace mbgl { - (void)setKeepsIconUpright:(NSExpression *)keepsIconUpright { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(keepsIconUpright); + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(keepsIconUpright, false); self.rawLayer->setIconKeepUpright(mbglValue); } @@ -446,7 +446,7 @@ namespace mbgl { - (void)setKeepsTextUpright:(NSExpression *)keepsTextUpright { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(keepsTextUpright); + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(keepsTextUpright, false); self.rawLayer->setTextKeepUpright(mbglValue); } @@ -470,7 +470,7 @@ namespace mbgl { - (void)setMaximumTextAngle:(NSExpression *)maximumTextAngle { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(maximumTextAngle); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(maximumTextAngle, false); self.rawLayer->setTextMaxAngle(mbglValue); } @@ -494,7 +494,7 @@ namespace mbgl { - (void)setMaximumTextWidth:(NSExpression *)maximumTextWidth { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(maximumTextWidth); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(maximumTextWidth, true); self.rawLayer->setTextMaxWidth(mbglValue); } @@ -518,7 +518,7 @@ namespace mbgl { - (void)setSymbolAvoidsEdges:(NSExpression *)symbolAvoidsEdges { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(symbolAvoidsEdges); + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(symbolAvoidsEdges, false); self.rawLayer->setSymbolAvoidEdges(mbglValue); } @@ -542,7 +542,7 @@ namespace mbgl { - (void)setSymbolPlacement:(NSExpression *)symbolPlacement { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::SymbolPlacementType, NSValue *, mbgl::style::SymbolPlacementType, MGLSymbolPlacement>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::SymbolPlacementType>>(symbolPlacement); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::SymbolPlacementType, NSValue *, mbgl::style::SymbolPlacementType, MGLSymbolPlacement>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::SymbolPlacementType>>(symbolPlacement, false); self.rawLayer->setSymbolPlacement(mbglValue); } @@ -559,7 +559,7 @@ namespace mbgl { - (void)setSymbolSpacing:(NSExpression *)symbolSpacing { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(symbolSpacing); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(symbolSpacing, false); self.rawLayer->setSymbolSpacing(mbglValue); } @@ -579,12 +579,12 @@ namespace mbgl { if (text && text.expressionType == NSConstantValueExpressionType) { std::string string = ((NSString *)text.constantValue).UTF8String; if (mbgl::style::conversion::hasTokens(string)) { - self.rawLayer->setTextField(mbgl::style::DataDrivenPropertyValue<std::string>( + self.rawLayer->setTextField(mbgl::style::PropertyValue<std::string>( mbgl::style::conversion::convertTokenStringToExpression(string))); return; } } - auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<std::string>>(text); + auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue<mbgl::style::PropertyValue<std::string>>(text, true); self.rawLayer->setTextField(mbglValue); } @@ -608,7 +608,7 @@ namespace mbgl { - (void)setTextAllowsOverlap:(NSExpression *)textAllowsOverlap { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(textAllowsOverlap); + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(textAllowsOverlap, false); self.rawLayer->setTextAllowOverlap(mbglValue); } @@ -632,7 +632,7 @@ namespace mbgl { - (void)setTextAnchor:(NSExpression *)textAnchor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::SymbolAnchorType, NSValue *, mbgl::style::SymbolAnchorType, MGLTextAnchor>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::style::SymbolAnchorType>>(textAnchor); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::SymbolAnchorType, NSValue *, mbgl::style::SymbolAnchorType, MGLTextAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::SymbolAnchorType>>(textAnchor, true); self.rawLayer->setTextAnchor(mbglValue); } @@ -649,7 +649,7 @@ namespace mbgl { - (void)setTextFontNames:(NSExpression *)textFontNames { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::vector<std::string>, NSArray<NSString *> *, std::string>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<std::vector<std::string>>>(textFontNames); + auto mbglValue = MGLStyleValueTransformer<std::vector<std::string>, NSArray<NSString *> *, std::string>().toPropertyValue<mbgl::style::PropertyValue<std::vector<std::string>>>(textFontNames, true); self.rawLayer->setTextFont(mbglValue); } @@ -673,7 +673,7 @@ namespace mbgl { - (void)setTextFontSize:(NSExpression *)textFontSize { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(textFontSize); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(textFontSize, true); self.rawLayer->setTextSize(mbglValue); } @@ -697,7 +697,7 @@ namespace mbgl { - (void)setTextIgnoresPlacement:(NSExpression *)textIgnoresPlacement { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(textIgnoresPlacement); + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(textIgnoresPlacement, false); self.rawLayer->setTextIgnorePlacement(mbglValue); } @@ -721,7 +721,7 @@ namespace mbgl { - (void)setTextJustification:(NSExpression *)textJustification { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextJustifyType, NSValue *, mbgl::style::TextJustifyType, MGLTextJustification>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::style::TextJustifyType>>(textJustification); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextJustifyType, NSValue *, mbgl::style::TextJustifyType, MGLTextJustification>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::TextJustifyType>>(textJustification, true); self.rawLayer->setTextJustify(mbglValue); } @@ -745,7 +745,7 @@ namespace mbgl { - (void)setTextLetterSpacing:(NSExpression *)textLetterSpacing { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(textLetterSpacing); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(textLetterSpacing, true); self.rawLayer->setTextLetterSpacing(mbglValue); } @@ -762,7 +762,7 @@ namespace mbgl { - (void)setTextLineHeight:(NSExpression *)textLineHeight { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(textLineHeight); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(textLineHeight, false); self.rawLayer->setTextLineHeight(mbglValue); } @@ -779,7 +779,7 @@ namespace mbgl { - (void)setTextOffset:(NSExpression *)textOffset { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<std::array<float, 2>>>(textOffset); + auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 2>>>(textOffset, true); self.rawLayer->setTextOffset(mbglValue); } @@ -796,7 +796,7 @@ namespace mbgl { - (void)setTextOptional:(NSExpression *)textOptional { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(textOptional); + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<bool>>(textOptional, false); self.rawLayer->setTextOptional(mbglValue); } @@ -813,7 +813,7 @@ namespace mbgl { - (void)setTextPadding:(NSExpression *)textPadding { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(textPadding); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(textPadding, false); self.rawLayer->setTextPadding(mbglValue); } @@ -830,7 +830,7 @@ namespace mbgl { - (void)setTextPitchAlignment:(NSExpression *)textPitchAlignment { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *, mbgl::style::AlignmentType, MGLTextPitchAlignment>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::AlignmentType>>(textPitchAlignment); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *, mbgl::style::AlignmentType, MGLTextPitchAlignment>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::AlignmentType>>(textPitchAlignment, false); self.rawLayer->setTextPitchAlignment(mbglValue); } @@ -847,7 +847,7 @@ namespace mbgl { - (void)setTextRotation:(NSExpression *)textRotation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(textRotation); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(textRotation, true); self.rawLayer->setTextRotate(mbglValue); } @@ -871,7 +871,7 @@ namespace mbgl { - (void)setTextRotationAlignment:(NSExpression *)textRotationAlignment { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *, mbgl::style::AlignmentType, MGLTextRotationAlignment>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::AlignmentType>>(textRotationAlignment); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *, mbgl::style::AlignmentType, MGLTextRotationAlignment>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::AlignmentType>>(textRotationAlignment, false); self.rawLayer->setTextRotationAlignment(mbglValue); } @@ -888,7 +888,7 @@ namespace mbgl { - (void)setTextTransform:(NSExpression *)textTransform { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextTransformType, NSValue *, mbgl::style::TextTransformType, MGLTextTransform>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::style::TextTransformType>>(textTransform); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextTransformType, NSValue *, mbgl::style::TextTransformType, MGLTextTransform>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::TextTransformType>>(textTransform, true); self.rawLayer->setTextTransform(mbglValue); } @@ -907,7 +907,7 @@ namespace mbgl { - (void)setIconColor:(NSExpression *)iconColor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::Color>>(iconColor); + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(iconColor, true); self.rawLayer->setIconColor(mbglValue); } @@ -942,7 +942,7 @@ namespace mbgl { - (void)setIconHaloBlur:(NSExpression *)iconHaloBlur { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(iconHaloBlur); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(iconHaloBlur, true); self.rawLayer->setIconHaloBlur(mbglValue); } @@ -977,7 +977,7 @@ namespace mbgl { - (void)setIconHaloColor:(NSExpression *)iconHaloColor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::Color>>(iconHaloColor); + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(iconHaloColor, true); self.rawLayer->setIconHaloColor(mbglValue); } @@ -1012,7 +1012,7 @@ namespace mbgl { - (void)setIconHaloWidth:(NSExpression *)iconHaloWidth { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(iconHaloWidth); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(iconHaloWidth, true); self.rawLayer->setIconHaloWidth(mbglValue); } @@ -1047,7 +1047,7 @@ namespace mbgl { - (void)setIconOpacity:(NSExpression *)iconOpacity { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(iconOpacity); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(iconOpacity, true); self.rawLayer->setIconOpacity(mbglValue); } @@ -1082,7 +1082,7 @@ namespace mbgl { - (void)setIconTranslation:(NSExpression *)iconTranslation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 2>>>(iconTranslation); + auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 2>>>(iconTranslation, false); self.rawLayer->setIconTranslate(mbglValue); } @@ -1124,7 +1124,7 @@ namespace mbgl { - (void)setIconTranslationAnchor:(NSExpression *)iconTranslationAnchor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLIconTranslationAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType>>(iconTranslationAnchor); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLIconTranslationAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType>>(iconTranslationAnchor, false); self.rawLayer->setIconTranslateAnchor(mbglValue); } @@ -1148,7 +1148,7 @@ namespace mbgl { - (void)setTextColor:(NSExpression *)textColor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::Color>>(textColor); + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(textColor, true); self.rawLayer->setTextColor(mbglValue); } @@ -1183,7 +1183,7 @@ namespace mbgl { - (void)setTextHaloBlur:(NSExpression *)textHaloBlur { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(textHaloBlur); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(textHaloBlur, true); self.rawLayer->setTextHaloBlur(mbglValue); } @@ -1218,7 +1218,7 @@ namespace mbgl { - (void)setTextHaloColor:(NSExpression *)textHaloColor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<mbgl::Color>>(textHaloColor); + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::PropertyValue<mbgl::Color>>(textHaloColor, true); self.rawLayer->setTextHaloColor(mbglValue); } @@ -1253,7 +1253,7 @@ namespace mbgl { - (void)setTextHaloWidth:(NSExpression *)textHaloWidth { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(textHaloWidth); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(textHaloWidth, true); self.rawLayer->setTextHaloWidth(mbglValue); } @@ -1288,7 +1288,7 @@ namespace mbgl { - (void)setTextOpacity:(NSExpression *)textOpacity { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::DataDrivenPropertyValue<float>>(textOpacity); + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue<mbgl::style::PropertyValue<float>>(textOpacity, true); self.rawLayer->setTextOpacity(mbglValue); } @@ -1323,7 +1323,7 @@ namespace mbgl { - (void)setTextTranslation:(NSExpression *)textTranslation { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 2>>>(textTranslation); + auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue<mbgl::style::PropertyValue<std::array<float, 2>>>(textTranslation, false); self.rawLayer->setTextTranslate(mbglValue); } @@ -1365,7 +1365,7 @@ namespace mbgl { - (void)setTextTranslationAnchor:(NSExpression *)textTranslationAnchor { MGLAssertStyleLayerIsValid(); - auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLTextTranslationAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType>>(textTranslationAnchor); + auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLTextTranslationAnchor>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType>>(textTranslationAnchor, false); self.rawLayer->setTextTranslateAnchor(mbglValue); } diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.mm b/platform/darwin/test/MGLCircleStyleLayerTests.mm index 7bfccd65ef..853ec67968 100644 --- a/platform/darwin/test/MGLCircleStyleLayerTests.mm +++ b/platform/darwin/test/MGLCircleStyleLayerTests.mm @@ -57,7 +57,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.circleBlur = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getCircleBlur(), propertyValue, @"Setting circleBlur to a constant value expression should update circle-blur."); XCTAssertEqualObjects(layer.circleBlur, constantExpression, @@ -104,7 +104,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getCircleBlur(), propertyValue, @"Setting circleBlur to a camera-data expression should update circle-blur."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -135,7 +135,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"%@", [MGLColor redColor]]; layer.circleColor = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; + mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; XCTAssertEqual(rawLayer->getCircleColor(), propertyValue, @"Setting circleColor to a constant value expression should update circle-color."); XCTAssertEqualObjects(layer.circleColor, constantExpression, @@ -182,7 +182,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(mbgl::Color(1, 0, 0, 1)))) ); } - + XCTAssertEqual(rawLayer->getCircleColor(), propertyValue, @"Setting circleColor to a camera-data expression should update circle-color."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -213,7 +213,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.circleOpacity = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getCircleOpacity(), propertyValue, @"Setting circleOpacity to a constant value expression should update circle-opacity."); XCTAssertEqualObjects(layer.circleOpacity, constantExpression, @@ -260,7 +260,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getCircleOpacity(), propertyValue, @"Setting circleOpacity to a camera-data expression should update circle-opacity."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -335,7 +335,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.circleRadius = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getCircleRadius(), propertyValue, @"Setting circleRadius to a constant value expression should update circle-radius."); XCTAssertEqualObjects(layer.circleRadius, constantExpression, @@ -382,7 +382,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getCircleRadius(), propertyValue, @"Setting circleRadius to a camera-data expression should update circle-radius."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -457,7 +457,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"%@", [MGLColor redColor]]; layer.circleStrokeColor = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; + mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; XCTAssertEqual(rawLayer->getCircleStrokeColor(), propertyValue, @"Setting circleStrokeColor to a constant value expression should update circle-stroke-color."); XCTAssertEqualObjects(layer.circleStrokeColor, constantExpression, @@ -504,7 +504,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(mbgl::Color(1, 0, 0, 1)))) ); } - + XCTAssertEqual(rawLayer->getCircleStrokeColor(), propertyValue, @"Setting circleStrokeColor to a camera-data expression should update circle-stroke-color."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -535,7 +535,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.circleStrokeOpacity = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getCircleStrokeOpacity(), propertyValue, @"Setting circleStrokeOpacity to a constant value expression should update circle-stroke-opacity."); XCTAssertEqualObjects(layer.circleStrokeOpacity, constantExpression, @@ -582,7 +582,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getCircleStrokeOpacity(), propertyValue, @"Setting circleStrokeOpacity to a camera-data expression should update circle-stroke-opacity."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -613,7 +613,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.circleStrokeWidth = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getCircleStrokeWidth(), propertyValue, @"Setting circleStrokeWidth to a constant value expression should update circle-stroke-width."); XCTAssertEqualObjects(layer.circleStrokeWidth, constantExpression, @@ -660,7 +660,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getCircleStrokeWidth(), propertyValue, @"Setting circleStrokeWidth to a camera-data expression should update circle-stroke-width."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; diff --git a/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm b/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm index 6427d672e7..54808f6b3c 100644 --- a/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm +++ b/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm @@ -57,7 +57,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.fillExtrusionBase = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getFillExtrusionBase(), propertyValue, @"Setting fillExtrusionBase to a constant value expression should update fill-extrusion-base."); XCTAssertEqualObjects(layer.fillExtrusionBase, constantExpression, @@ -104,7 +104,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getFillExtrusionBase(), propertyValue, @"Setting fillExtrusionBase to a camera-data expression should update fill-extrusion-base."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -135,7 +135,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"%@", [MGLColor redColor]]; layer.fillExtrusionColor = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; + mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; XCTAssertEqual(rawLayer->getFillExtrusionColor(), propertyValue, @"Setting fillExtrusionColor to a constant value expression should update fill-extrusion-color."); XCTAssertEqualObjects(layer.fillExtrusionColor, constantExpression, @@ -182,7 +182,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(mbgl::Color(1, 0, 0, 1)))) ); } - + XCTAssertEqual(rawLayer->getFillExtrusionColor(), propertyValue, @"Setting fillExtrusionColor to a camera-data expression should update fill-extrusion-color."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -213,7 +213,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.fillExtrusionHeight = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getFillExtrusionHeight(), propertyValue, @"Setting fillExtrusionHeight to a constant value expression should update fill-extrusion-height."); XCTAssertEqualObjects(layer.fillExtrusionHeight, constantExpression, @@ -260,7 +260,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getFillExtrusionHeight(), propertyValue, @"Setting fillExtrusionHeight to a camera-data expression should update fill-extrusion-height."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; diff --git a/platform/darwin/test/MGLFillStyleLayerTests.mm b/platform/darwin/test/MGLFillStyleLayerTests.mm index 921b59416b..41ee820918 100644 --- a/platform/darwin/test/MGLFillStyleLayerTests.mm +++ b/platform/darwin/test/MGLFillStyleLayerTests.mm @@ -101,7 +101,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"%@", [MGLColor redColor]]; layer.fillColor = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; + mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; XCTAssertEqual(rawLayer->getFillColor(), propertyValue, @"Setting fillColor to a constant value expression should update fill-color."); XCTAssertEqualObjects(layer.fillColor, constantExpression, @@ -148,7 +148,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(mbgl::Color(1, 0, 0, 1)))) ); } - + XCTAssertEqual(rawLayer->getFillColor(), propertyValue, @"Setting fillColor to a camera-data expression should update fill-color."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -179,7 +179,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.fillOpacity = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getFillOpacity(), propertyValue, @"Setting fillOpacity to a constant value expression should update fill-opacity."); XCTAssertEqualObjects(layer.fillOpacity, constantExpression, @@ -226,7 +226,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getFillOpacity(), propertyValue, @"Setting fillOpacity to a camera-data expression should update fill-opacity."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -257,7 +257,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"%@", [MGLColor redColor]]; layer.fillOutlineColor = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; + mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; XCTAssertEqual(rawLayer->getFillOutlineColor(), propertyValue, @"Setting fillOutlineColor to a constant value expression should update fill-outline-color."); XCTAssertEqualObjects(layer.fillOutlineColor, constantExpression, @@ -304,7 +304,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(mbgl::Color(1, 0, 0, 1)))) ); } - + XCTAssertEqual(rawLayer->getFillOutlineColor(), propertyValue, @"Setting fillOutlineColor to a camera-data expression should update fill-outline-color."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; diff --git a/platform/darwin/test/MGLHeatmapStyleLayerTests.mm b/platform/darwin/test/MGLHeatmapStyleLayerTests.mm index a51a324cd9..76a2b0c87e 100644 --- a/platform/darwin/test/MGLHeatmapStyleLayerTests.mm +++ b/platform/darwin/test/MGLHeatmapStyleLayerTests.mm @@ -163,7 +163,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.heatmapRadius = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getHeatmapRadius(), propertyValue, @"Setting heatmapRadius to a constant value expression should update heatmap-radius."); XCTAssertEqualObjects(layer.heatmapRadius, constantExpression, @@ -210,7 +210,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getHeatmapRadius(), propertyValue, @"Setting heatmapRadius to a camera-data expression should update heatmap-radius."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -241,7 +241,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.heatmapWeight = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getHeatmapWeight(), propertyValue, @"Setting heatmapWeight to a constant value expression should update heatmap-weight."); XCTAssertEqualObjects(layer.heatmapWeight, constantExpression, @@ -288,7 +288,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getHeatmapWeight(), propertyValue, @"Setting heatmapWeight to a camera-data expression should update heatmap-weight."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; diff --git a/platform/darwin/test/MGLLineStyleLayerTests.mm b/platform/darwin/test/MGLLineStyleLayerTests.mm index 8ad354ef58..4c0f91ba3b 100644 --- a/platform/darwin/test/MGLLineStyleLayerTests.mm +++ b/platform/darwin/test/MGLLineStyleLayerTests.mm @@ -101,7 +101,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"'miter'"]; layer.lineJoin = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::style::LineJoinType> propertyValue = { mbgl::style::LineJoinType::Miter }; + mbgl::style::PropertyValue<mbgl::style::LineJoinType> propertyValue = { mbgl::style::LineJoinType::Miter }; XCTAssertEqual(rawLayer->getLineJoin(), propertyValue, @"Setting lineJoin to a constant value expression should update line-join."); XCTAssertEqualObjects(layer.lineJoin, constantExpression, @@ -227,7 +227,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.lineBlur = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getLineBlur(), propertyValue, @"Setting lineBlur to a constant value expression should update line-blur."); XCTAssertEqualObjects(layer.lineBlur, constantExpression, @@ -274,7 +274,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getLineBlur(), propertyValue, @"Setting lineBlur to a camera-data expression should update line-blur."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -305,7 +305,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"%@", [MGLColor redColor]]; layer.lineColor = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; + mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; XCTAssertEqual(rawLayer->getLineColor(), propertyValue, @"Setting lineColor to a constant value expression should update line-color."); XCTAssertEqualObjects(layer.lineColor, constantExpression, @@ -352,7 +352,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(mbgl::Color(1, 0, 0, 1)))) ); } - + XCTAssertEqual(rawLayer->getLineColor(), propertyValue, @"Setting lineColor to a camera-data expression should update line-color."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -427,7 +427,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.lineGapWidth = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getLineGapWidth(), propertyValue, @"Setting lineGapWidth to a constant value expression should update line-gap-width."); XCTAssertEqualObjects(layer.lineGapWidth, constantExpression, @@ -474,7 +474,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getLineGapWidth(), propertyValue, @"Setting lineGapWidth to a camera-data expression should update line-gap-width."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -505,7 +505,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.lineOffset = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getLineOffset(), propertyValue, @"Setting lineOffset to a constant value expression should update line-offset."); XCTAssertEqualObjects(layer.lineOffset, constantExpression, @@ -552,7 +552,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getLineOffset(), propertyValue, @"Setting lineOffset to a camera-data expression should update line-offset."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -583,7 +583,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.lineOpacity = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getLineOpacity(), propertyValue, @"Setting lineOpacity to a constant value expression should update line-opacity."); XCTAssertEqualObjects(layer.lineOpacity, constantExpression, @@ -630,7 +630,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getLineOpacity(), propertyValue, @"Setting lineOpacity to a camera-data expression should update line-opacity."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -808,7 +808,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.lineWidth = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getLineWidth(), propertyValue, @"Setting lineWidth to a constant value expression should update line-width."); XCTAssertEqualObjects(layer.lineWidth, constantExpression, @@ -855,7 +855,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getLineWidth(), propertyValue, @"Setting lineWidth to a camera-data expression should update line-width."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; diff --git a/platform/darwin/test/MGLStyleLayerTests.mm.ejs b/platform/darwin/test/MGLStyleLayerTests.mm.ejs index 02c4a04e6f..89b6cbe7e4 100644 --- a/platform/darwin/test/MGLStyleLayerTests.mm.ejs +++ b/platform/darwin/test/MGLStyleLayerTests.mm.ejs @@ -70,11 +70,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:<%- objCTestValue(property, type, true, 3) %>]; layer.<%- objCName(property) %> = constantExpression; -<% if (isDataDriven(property)) { -%> - mbgl::style::DataDrivenPropertyValue<<%- mbglType(property) %>> propertyValue = { <%- mbglTestValue(property, type) %> }; -<% } else { -%> mbgl::style::PropertyValue<<%- mbglType(property) %>> propertyValue = { <%- mbglTestValue(property, type) %> }; -<% } -%> XCTAssertEqual(rawLayer->get<%- camelize(originalPropertyName(property)) %>(), propertyValue, @"Setting <%- objCName(property) %> to a constant value expression should update <%- originalPropertyName(property) %>."); XCTAssertEqualObjects(layer.<%- objCName(property) %>, constantExpression, @@ -122,7 +118,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(<%- mbglExpressionTestValue(property, type) %>))) ); } - + XCTAssertEqual(rawLayer->get<%- camelize(originalPropertyName(property)) %>(), propertyValue, @"Setting <%- objCName(property) %> to a camera-data expression should update <%- originalPropertyName(property) %>."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.mm b/platform/darwin/test/MGLSymbolStyleLayerTests.mm index 9d772b6bd9..5c108a1ac3 100644 --- a/platform/darwin/test/MGLSymbolStyleLayerTests.mm +++ b/platform/darwin/test/MGLSymbolStyleLayerTests.mm @@ -101,7 +101,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"'bottom-right'"]; layer.iconAnchor = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::style::SymbolAnchorType> propertyValue = { mbgl::style::SymbolAnchorType::BottomRight }; + mbgl::style::PropertyValue<mbgl::style::SymbolAnchorType> propertyValue = { mbgl::style::SymbolAnchorType::BottomRight }; XCTAssertEqual(rawLayer->getIconAnchor(), propertyValue, @"Setting iconAnchor to a constant value expression should update icon-anchor."); XCTAssertEqualObjects(layer.iconAnchor, constantExpression, @@ -183,7 +183,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"'Icon Image'"]; layer.iconImageName = constantExpression; - mbgl::style::DataDrivenPropertyValue<std::string> propertyValue = { "Icon Image" }; + mbgl::style::PropertyValue<std::string> propertyValue = { "Icon Image" }; XCTAssertEqual(rawLayer->getIconImage(), propertyValue, @"Setting iconImageName to a constant value expression should update icon-image."); XCTAssertEqualObjects(layer.iconImageName, constantExpression, @@ -242,7 +242,7 @@ #endif ]; layer.iconOffset = constantExpression; - mbgl::style::DataDrivenPropertyValue<std::array<float, 2>> propertyValue = { { 1, 1 } }; + mbgl::style::PropertyValue<std::array<float, 2>> propertyValue = { { 1, 1 } }; XCTAssertEqual(rawLayer->getIconOffset(), propertyValue, @"Setting iconOffset to a constant value expression should update icon-offset."); XCTAssertEqualObjects(layer.iconOffset, constantExpression, @@ -289,7 +289,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal({ 1, 1 }))) ); } - + XCTAssertEqual(rawLayer->getIconOffset(), propertyValue, @"Setting iconOffset to a camera-data expression should update icon-offset."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -443,7 +443,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.iconRotation = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getIconRotate(), propertyValue, @"Setting iconRotation to a constant value expression should update icon-rotate."); XCTAssertEqualObjects(layer.iconRotation, constantExpression, @@ -490,7 +490,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getIconRotate(), propertyValue, @"Setting iconRotation to a camera-data expression should update icon-rotate."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -556,7 +556,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.iconScale = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getIconSize(), propertyValue, @"Setting iconScale to a constant value expression should update icon-size."); XCTAssertEqualObjects(layer.iconScale, constantExpression, @@ -603,7 +603,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getIconSize(), propertyValue, @"Setting iconScale to a camera-data expression should update icon-size."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -851,7 +851,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.maximumTextWidth = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getTextMaxWidth(), propertyValue, @"Setting maximumTextWidth to a constant value expression should update text-max-width."); XCTAssertEqualObjects(layer.maximumTextWidth, constantExpression, @@ -898,7 +898,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getTextMaxWidth(), propertyValue, @"Setting maximumTextWidth to a camera-data expression should update text-max-width."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -1052,7 +1052,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"'Text Field'"]; layer.text = constantExpression; - mbgl::style::DataDrivenPropertyValue<std::string> propertyValue = { "Text Field" }; + mbgl::style::PropertyValue<std::string> propertyValue = { "Text Field" }; XCTAssertEqual(rawLayer->getTextField(), propertyValue, @"Setting text to a constant value expression should update text-field."); XCTAssertEqualObjects(layer.text, constantExpression, @@ -1149,7 +1149,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"'bottom-right'"]; layer.textAnchor = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::style::SymbolAnchorType> propertyValue = { mbgl::style::SymbolAnchorType::BottomRight }; + mbgl::style::PropertyValue<mbgl::style::SymbolAnchorType> propertyValue = { mbgl::style::SymbolAnchorType::BottomRight }; XCTAssertEqual(rawLayer->getTextAnchor(), propertyValue, @"Setting textAnchor to a constant value expression should update text-anchor."); XCTAssertEqualObjects(layer.textAnchor, constantExpression, @@ -1187,7 +1187,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"{'Text Font', 'Tnof Txet'}"]; layer.textFontNames = constantExpression; - mbgl::style::DataDrivenPropertyValue<std::vector<std::string>> propertyValue = { { "Text Font", "Tnof Txet" } }; + mbgl::style::PropertyValue<std::vector<std::string>> propertyValue = { { "Text Font", "Tnof Txet" } }; XCTAssertEqual(rawLayer->getTextFont(), propertyValue, @"Setting textFontNames to a constant value expression should update text-font."); XCTAssertEqualObjects(layer.textFontNames, constantExpression, @@ -1225,7 +1225,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.textFontSize = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getTextSize(), propertyValue, @"Setting textFontSize to a constant value expression should update text-size."); XCTAssertEqualObjects(layer.textFontSize, constantExpression, @@ -1272,7 +1272,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getTextSize(), propertyValue, @"Setting textFontSize to a camera-data expression should update text-size."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -1338,7 +1338,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"'right'"]; layer.textJustification = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::style::TextJustifyType> propertyValue = { mbgl::style::TextJustifyType::Right }; + mbgl::style::PropertyValue<mbgl::style::TextJustifyType> propertyValue = { mbgl::style::TextJustifyType::Right }; XCTAssertEqual(rawLayer->getTextJustify(), propertyValue, @"Setting textJustification to a constant value expression should update text-justify."); XCTAssertEqualObjects(layer.textJustification, constantExpression, @@ -1376,7 +1376,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.textLetterSpacing = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getTextLetterSpacing(), propertyValue, @"Setting textLetterSpacing to a constant value expression should update text-letter-spacing."); XCTAssertEqualObjects(layer.textLetterSpacing, constantExpression, @@ -1423,7 +1423,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getTextLetterSpacing(), propertyValue, @"Setting textLetterSpacing to a camera-data expression should update text-letter-spacing."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -1495,7 +1495,7 @@ #endif ]; layer.textOffset = constantExpression; - mbgl::style::DataDrivenPropertyValue<std::array<float, 2>> propertyValue = { { 1, 1 } }; + mbgl::style::PropertyValue<std::array<float, 2>> propertyValue = { { 1, 1 } }; XCTAssertEqual(rawLayer->getTextOffset(), propertyValue, @"Setting textOffset to a constant value expression should update text-offset."); XCTAssertEqualObjects(layer.textOffset, constantExpression, @@ -1542,7 +1542,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal({ 1, 1 }))) ); } - + XCTAssertEqual(rawLayer->getTextOffset(), propertyValue, @"Setting textOffset to a camera-data expression should update text-offset."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -1696,7 +1696,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.textRotation = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getTextRotate(), propertyValue, @"Setting textRotation to a constant value expression should update text-rotate."); XCTAssertEqualObjects(layer.textRotation, constantExpression, @@ -1743,7 +1743,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getTextRotate(), propertyValue, @"Setting textRotation to a camera-data expression should update text-rotate."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -1809,7 +1809,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"'lowercase'"]; layer.textTransform = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::style::TextTransformType> propertyValue = { mbgl::style::TextTransformType::Lowercase }; + mbgl::style::PropertyValue<mbgl::style::TextTransformType> propertyValue = { mbgl::style::TextTransformType::Lowercase }; XCTAssertEqual(rawLayer->getTextTransform(), propertyValue, @"Setting textTransform to a constant value expression should update text-transform."); XCTAssertEqualObjects(layer.textTransform, constantExpression, @@ -1847,7 +1847,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"%@", [MGLColor redColor]]; layer.iconColor = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; + mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; XCTAssertEqual(rawLayer->getIconColor(), propertyValue, @"Setting iconColor to a constant value expression should update icon-color."); XCTAssertEqualObjects(layer.iconColor, constantExpression, @@ -1894,7 +1894,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(mbgl::Color(1, 0, 0, 1)))) ); } - + XCTAssertEqual(rawLayer->getIconColor(), propertyValue, @"Setting iconColor to a camera-data expression should update icon-color."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -1925,7 +1925,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.iconHaloBlur = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getIconHaloBlur(), propertyValue, @"Setting iconHaloBlur to a constant value expression should update icon-halo-blur."); XCTAssertEqualObjects(layer.iconHaloBlur, constantExpression, @@ -1972,7 +1972,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getIconHaloBlur(), propertyValue, @"Setting iconHaloBlur to a camera-data expression should update icon-halo-blur."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -2003,7 +2003,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"%@", [MGLColor redColor]]; layer.iconHaloColor = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; + mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; XCTAssertEqual(rawLayer->getIconHaloColor(), propertyValue, @"Setting iconHaloColor to a constant value expression should update icon-halo-color."); XCTAssertEqualObjects(layer.iconHaloColor, constantExpression, @@ -2050,7 +2050,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(mbgl::Color(1, 0, 0, 1)))) ); } - + XCTAssertEqual(rawLayer->getIconHaloColor(), propertyValue, @"Setting iconHaloColor to a camera-data expression should update icon-halo-color."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -2081,7 +2081,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.iconHaloWidth = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getIconHaloWidth(), propertyValue, @"Setting iconHaloWidth to a constant value expression should update icon-halo-width."); XCTAssertEqualObjects(layer.iconHaloWidth, constantExpression, @@ -2128,7 +2128,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getIconHaloWidth(), propertyValue, @"Setting iconHaloWidth to a camera-data expression should update icon-halo-width."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -2159,7 +2159,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.iconOpacity = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getIconOpacity(), propertyValue, @"Setting iconOpacity to a constant value expression should update icon-opacity."); XCTAssertEqualObjects(layer.iconOpacity, constantExpression, @@ -2206,7 +2206,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getIconOpacity(), propertyValue, @"Setting iconOpacity to a camera-data expression should update icon-opacity."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -2331,7 +2331,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"%@", [MGLColor redColor]]; layer.textColor = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; + mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; XCTAssertEqual(rawLayer->getTextColor(), propertyValue, @"Setting textColor to a constant value expression should update text-color."); XCTAssertEqualObjects(layer.textColor, constantExpression, @@ -2378,7 +2378,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(mbgl::Color(1, 0, 0, 1)))) ); } - + XCTAssertEqual(rawLayer->getTextColor(), propertyValue, @"Setting textColor to a camera-data expression should update text-color."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -2409,7 +2409,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.textHaloBlur = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getTextHaloBlur(), propertyValue, @"Setting textHaloBlur to a constant value expression should update text-halo-blur."); XCTAssertEqualObjects(layer.textHaloBlur, constantExpression, @@ -2456,7 +2456,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getTextHaloBlur(), propertyValue, @"Setting textHaloBlur to a camera-data expression should update text-halo-blur."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -2487,7 +2487,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"%@", [MGLColor redColor]]; layer.textHaloColor = constantExpression; - mbgl::style::DataDrivenPropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; + mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; XCTAssertEqual(rawLayer->getTextHaloColor(), propertyValue, @"Setting textHaloColor to a constant value expression should update text-halo-color."); XCTAssertEqualObjects(layer.textHaloColor, constantExpression, @@ -2534,7 +2534,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(mbgl::Color(1, 0, 0, 1)))) ); } - + XCTAssertEqual(rawLayer->getTextHaloColor(), propertyValue, @"Setting textHaloColor to a camera-data expression should update text-halo-color."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -2565,7 +2565,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.textHaloWidth = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getTextHaloWidth(), propertyValue, @"Setting textHaloWidth to a constant value expression should update text-halo-width."); XCTAssertEqualObjects(layer.textHaloWidth, constantExpression, @@ -2612,7 +2612,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getTextHaloWidth(), propertyValue, @"Setting textHaloWidth to a camera-data expression should update text-halo-width."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; @@ -2643,7 +2643,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:@"1"]; layer.textOpacity = constantExpression; - mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 1.0 }; + mbgl::style::PropertyValue<float> propertyValue = { 1.0 }; XCTAssertEqual(rawLayer->getTextOpacity(), propertyValue, @"Setting textOpacity to a constant value expression should update text-opacity."); XCTAssertEqualObjects(layer.textOpacity, constantExpression, @@ -2690,7 +2690,7 @@ interpolate(linear(), zoom(), 10.0, interpolate(linear(), number(get("keyName")), 18.0, literal(1.0))) ); } - + XCTAssertEqual(rawLayer->getTextOpacity(), propertyValue, @"Setting textOpacity to a camera-data expression should update text-opacity."); pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js index c92d25b7ef..db37a9b96f 100755 --- a/scripts/generate-style-code.js +++ b/scripts/generate-style-code.js @@ -96,9 +96,6 @@ global.paintPropertyType = function (property, type) { global.propertyValueType = function (property) { switch (property['property-type']) { - case 'data-driven': - case 'cross-faded-data-driven': - return `DataDrivenPropertyValue<${evaluatedType(property)}>`; case 'color-ramp': return `ColorRampPropertyValue`; default: diff --git a/src/mbgl/programs/symbol_program.cpp b/src/mbgl/programs/symbol_program.cpp index 07d07ff0dd..d73abd4fe1 100644 --- a/src/mbgl/programs/symbol_program.cpp +++ b/src/mbgl/programs/symbol_program.cpp @@ -14,7 +14,7 @@ using namespace style; static_assert(sizeof(SymbolLayoutVertex) == 16, "expected SymbolLayoutVertex size"); std::unique_ptr<SymbolSizeBinder> SymbolSizeBinder::create(const float tileZoom, - const style::DataDrivenPropertyValue<float>& sizeProperty, + const style::PropertyValue<float>& sizeProperty, const float defaultValue) { return sizeProperty.match( [&] (const Undefined& value) -> std::unique_ptr<SymbolSizeBinder> { @@ -46,7 +46,7 @@ Values makeValues(const bool isText, const float symbolFadeChange, Args&&... args) { std::array<float, 2> extrudeScale; - + if (values.pitchAlignment == AlignmentType::Map) { extrudeScale.fill(tile.id.pixelsToTileUnits(1, state.getZoom())); } else { @@ -59,7 +59,7 @@ Values makeValues(const bool isText, const float pixelsToTileUnits = tile.id.pixelsToTileUnits(1.0, state.getZoom()); const bool pitchWithMap = values.pitchAlignment == style::AlignmentType::Map; const bool rotateWithMap = values.rotationAlignment == style::AlignmentType::Map; - + // Line label rotation happens in `updateLineLabels` // Pitched point labels are automatically rotated by the labelPlaneMatrix projection // Unpitched point labels need to have their rotation applied after projection @@ -75,7 +75,7 @@ Values makeValues(const bool isText, } mat4 glCoordMatrix = getGlCoordMatrix(tile.matrix, pitchWithMap, rotateWithMap, state, pixelsToTileUnits); - + return Values { uniforms::u_matrix::Value{ tile.translatedMatrix(values.translate, values.translateAnchor, @@ -137,7 +137,7 @@ typename SymbolSDFProgram<PaintProperties>::UniformValues SymbolSDFProgram<Paint const float gammaScale = (values.pitchAlignment == AlignmentType::Map ? std::cos(state.getPitch()) * state.getCameraToCenterDistance() : 1.0); - + return makeValues<SymbolSDFProgram<PaintProperties>::UniformValues>( isText, values, diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp index 653fce9d4c..0378cc0970 100644 --- a/src/mbgl/programs/symbol_program.hpp +++ b/src/mbgl/programs/symbol_program.hpp @@ -92,7 +92,7 @@ struct SymbolOpacityAttributes : gl::Attributes<attributes::a_fade_opacity> { }; } }; - + struct ZoomEvaluatedSize { bool isZoomConstant; bool isFeatureConstant; @@ -114,9 +114,9 @@ public: uniforms::u_size_t, uniforms::u_size>; using UniformValues = Uniforms::Values; - + static std::unique_ptr<SymbolSizeBinder> create(const float tileZoom, - const style::DataDrivenPropertyValue<float>& sizeProperty, + const style::PropertyValue<float>& sizeProperty, const float defaultValue); virtual Range<float> getVertexSizeData(const GeometryTileFeature& feature) = 0; @@ -138,10 +138,10 @@ class ConstantSymbolSizeBinder final : public SymbolSizeBinder { public: ConstantSymbolSizeBinder(const float /*tileZoom*/, const float& size, const float /*defaultValue*/) : layoutSize(size) {} - + ConstantSymbolSizeBinder(const float /*tileZoom*/, const style::Undefined&, const float defaultValue) : layoutSize(defaultValue) {} - + ConstantSymbolSizeBinder(const float tileZoom, const style::PropertyExpression<float>& expression_, const float /*defaultValue*/) : layoutSize(expression_.evaluate(tileZoom + 1)), expression(expression_) { @@ -151,9 +151,9 @@ public: Range<float> { expression_.evaluate(zoomLevels.min), expression_.evaluate(zoomLevels.max) } ); } - + Range<float> getVertexSizeData(const GeometryTileFeature&) override { return { 0.0f, 0.0f }; }; - + ZoomEvaluatedSize evaluateForZoom(float currentZoom) const override { float size = layoutSize; bool isZoomConstant = !(coveringRanges || expression); @@ -177,7 +177,7 @@ public: const float unused = 0.0f; return { isZoomConstant, true, unused, size, layoutSize }; } - + float layoutSize; optional<std::tuple<Range<float>, Range<float>>> coveringRanges; optional<style::PropertyExpression<float>> expression; @@ -188,7 +188,7 @@ public: using Vertex = gl::detail::Vertex<gl::Attribute<uint16_t, 1>>; using VertexVector = gl::VertexVector<Vertex>; using VertexBuffer = gl::VertexBuffer<Vertex>; - + SourceFunctionSymbolSizeBinder(const float /*tileZoom*/, style::PropertyExpression<float> expression_, const float defaultValue_) : expression(std::move(expression_)), defaultValue(defaultValue_) { @@ -198,19 +198,19 @@ public: const float size = expression.evaluate(feature, defaultValue); return { size, size }; }; - + ZoomEvaluatedSize evaluateForZoom(float) const override { const float unused = 0.0f; return { true, false, unused, unused, unused }; } - + style::PropertyExpression<float> expression; const float defaultValue; }; class CompositeFunctionSymbolSizeBinder final : public SymbolSizeBinder { public: - + CompositeFunctionSymbolSizeBinder(const float tileZoom, style::PropertyExpression<float> expression_, const float defaultValue_) : expression(std::move(expression_)), defaultValue(defaultValue_), @@ -224,7 +224,7 @@ public: expression.evaluate(coveringZoomStops.max, feature, defaultValue) }; }; - + ZoomEvaluatedSize evaluateForZoom(float currentZoom) const override { float sizeInterpolationT = util::clamp( expression.interpolationFactor(coveringZoomStops, currentZoom), @@ -234,7 +234,7 @@ public: const float unused = 0.0f; return { false, false, sizeInterpolationT, unused, unused }; } - + style::PropertyExpression<float> expression; const float defaultValue; float layoutZoom; @@ -251,7 +251,7 @@ class SymbolProgram { public: using LayoutAttributes = LayoutAttrs; using LayoutVertex = typename LayoutAttributes::Vertex; - + using LayoutAndSizeAttributes = gl::ConcatenateAttributes<LayoutAttributes, gl::ConcatenateAttributes<SymbolDynamicLayoutAttributes, SymbolOpacityAttributes>>; using PaintProperties = PaintProps; @@ -421,11 +421,11 @@ public: uniforms::u_gamma_scale, uniforms::u_is_halo>, PaintProperties>; - + using UniformValues = typename BaseProgram::UniformValues; - - + + using BaseProgram::BaseProgram; static UniformValues uniformValues(const bool isText, diff --git a/src/mbgl/renderer/buckets/symbol_bucket.cpp b/src/mbgl/renderer/buckets/symbol_bucket.cpp index 0a1530ae74..027e864be5 100644 --- a/src/mbgl/renderer/buckets/symbol_bucket.cpp +++ b/src/mbgl/renderer/buckets/symbol_bucket.cpp @@ -12,8 +12,8 @@ SymbolBucket::SymbolBucket(style::SymbolLayoutProperties::PossiblyEvaluated layo const std::map<std::string, std::pair< style::IconPaintProperties::PossiblyEvaluated, style::TextPaintProperties::PossiblyEvaluated>>& layerPaintProperties, - const style::DataDrivenPropertyValue<float>& textSize, - const style::DataDrivenPropertyValue<float>& iconSize, + const style::PropertyValue<float>& textSize, + const style::PropertyValue<float>& iconSize, float zoom, bool sdfIcons_, bool iconsNeedLinear_, @@ -29,7 +29,7 @@ SymbolBucket::SymbolBucket(style::SymbolLayoutProperties::PossiblyEvaluated layo symbolInstances(std::move(symbolInstances_)), textSizeBinder(SymbolSizeBinder::create(zoom, textSize, TextSize::defaultValue())), iconSizeBinder(SymbolSizeBinder::create(zoom, iconSize, IconSize::defaultValue())) { - + for (const auto& pair : layerPaintProperties) { paintPropertyBinders.emplace( std::piecewise_construct, @@ -49,7 +49,7 @@ void SymbolBucket::upload(gl::Context& context) { } else if (!sortUploaded) { context.updateIndexBuffer(*text.indexBuffer, std::move(text.triangles)); } - + if (!dynamicUploaded) { text.dynamicVertexBuffer = context.createVertexBuffer(std::move(text.dynamicVertices), gl::BufferUsage::StreamDraw); } @@ -94,7 +94,7 @@ void SymbolBucket::upload(gl::Context& context) { } } } - + if (hasCollisionCircleData()) { if (!staticUploaded) { collisionCircle.indexBuffer = context.createIndexBuffer(std::move(collisionCircle.triangles)); @@ -115,7 +115,7 @@ void SymbolBucket::upload(gl::Context& context) { pair.second.second.upload(context); } } - + uploaded = true; staticUploaded = true; placementChangesUploaded = true; @@ -164,7 +164,7 @@ void SymbolBucket::sortFeatures(const float angle) { if (sortedAngle && *sortedAngle == angle) { return; } - + sortedAngle = angle; // The current approach to sorting doesn't sort across segments so don't try. @@ -172,7 +172,7 @@ void SymbolBucket::sortFeatures(const float angle) { if (text.segments.size() > 1 || icon.segments.size() > 1) { return; } - + sortUploaded = false; uploaded = false; @@ -186,7 +186,7 @@ void SymbolBucket::sortFeatures(const float angle) { for (size_t i = 0; i < symbolInstances.size(); i++) { symbolInstanceIndexes.push_back(i); } - + const float sin = std::sin(angle); const float cos = std::cos(angle); @@ -205,7 +205,7 @@ void SymbolBucket::sortFeatures(const float angle) { featureSortOrder = std::make_unique<std::vector<size_t>>(); featureSortOrder->reserve(symbolInstanceIndexes.size()); - + for (auto i : symbolInstanceIndexes) { const SymbolInstance& symbolInstance = symbolInstances[i]; featureSortOrder->push_back(symbolInstance.dataFeatureIndex); diff --git a/src/mbgl/renderer/buckets/symbol_bucket.hpp b/src/mbgl/renderer/buckets/symbol_bucket.hpp index 4f01cf4e1c..5addff40b2 100644 --- a/src/mbgl/renderer/buckets/symbol_bucket.hpp +++ b/src/mbgl/renderer/buckets/symbol_bucket.hpp @@ -41,8 +41,8 @@ class SymbolBucket : public Bucket { public: SymbolBucket(style::SymbolLayoutProperties::PossiblyEvaluated, const std::map<std::string, std::pair<style::IconPaintProperties::PossiblyEvaluated, style::TextPaintProperties::PossiblyEvaluated>>&, - const style::DataDrivenPropertyValue<float>& textSize, - const style::DataDrivenPropertyValue<float>& iconSize, + const style::PropertyValue<float>& textSize, + const style::PropertyValue<float>& iconSize, float zoom, bool sdfIcons, bool iconsNeedLinear, @@ -56,7 +56,7 @@ public: bool hasIconData() const; bool hasCollisionBoxData() const; bool hasCollisionCircleData() const; - + void updateOpacity(); void sortFeatures(const float angle); @@ -64,9 +64,9 @@ public: const bool sdfIcons; const bool iconsNeedLinear; const bool sortFeaturesByY; - + const std::string bucketLeaderID; - + optional<float> sortedAngle; bool staticUploaded = false; @@ -79,7 +79,7 @@ public: std::map<std::string, std::pair< SymbolIconProgram::PaintPropertyBinders, SymbolSDFTextProgram::PaintPropertyBinders>> paintPropertyBinders; - + std::unique_ptr<SymbolSizeBinder> textSizeBinder; struct TextBuffer { @@ -95,9 +95,9 @@ public: optional<gl::VertexBuffer<SymbolOpacityAttributes::Vertex>> opacityVertexBuffer; optional<gl::IndexBuffer<gl::Triangles>> indexBuffer; } text; - + std::unique_ptr<SymbolSizeBinder> iconSizeBinder; - + struct IconBuffer { gl::VertexVector<SymbolLayoutVertex> vertices; gl::VertexVector<SymbolDynamicLayoutAttributes::Vertex> dynamicVertices; @@ -126,7 +126,7 @@ public: gl::IndexVector<gl::Lines> lines; optional<gl::IndexBuffer<gl::Lines>> indexBuffer; } collisionBox; - + struct CollisionCircleBuffer : public CollisionBuffer { gl::IndexVector<gl::Triangles> triangles; optional<gl::IndexBuffer<gl::Triangles>> indexBuffer; @@ -134,7 +134,7 @@ public: uint32_t bucketInstanceId = 0; bool justReloaded = false; - + std::shared_ptr<std::vector<size_t>> featureSortOrder; }; diff --git a/src/mbgl/style/conversion/color_ramp_property_value.cpp b/src/mbgl/style/conversion/color_ramp_property_value.cpp index e792cf3fe4..f29438b6a2 100644 --- a/src/mbgl/style/conversion/color_ramp_property_value.cpp +++ b/src/mbgl/style/conversion/color_ramp_property_value.cpp @@ -10,7 +10,7 @@ namespace mbgl { namespace style { namespace conversion { -optional<ColorRampPropertyValue> Converter<ColorRampPropertyValue>::operator()(const Convertible& value, Error& error, bool) const { +optional<ColorRampPropertyValue> Converter<ColorRampPropertyValue>::operator()(const Convertible& value, Error& error, bool, bool) const { using namespace mbgl::style::expression; if (isUndefined(value)) { return ColorRampPropertyValue(); diff --git a/src/mbgl/style/conversion/light.cpp b/src/mbgl/style/conversion/light.cpp index 0a68f2396f..7b96c89a1c 100644 --- a/src/mbgl/style/conversion/light.cpp +++ b/src/mbgl/style/conversion/light.cpp @@ -18,7 +18,7 @@ optional<Light> Converter<Light>::operator()(const Convertible& value, Error& er const auto anchor = objectMember(value, "anchor"); if (anchor) { optional<PropertyValue<LightAnchorType>> convertedAnchor = - convert<PropertyValue<LightAnchorType>>(*anchor, error, false); + convert<PropertyValue<LightAnchorType>>(*anchor, error, false, false); if (convertedAnchor) { light.setAnchor(*convertedAnchor); @@ -41,7 +41,7 @@ optional<Light> Converter<Light>::operator()(const Convertible& value, Error& er const auto color = objectMember(value, "color"); if (color) { optional<PropertyValue<Color>> convertedColor = - convert<PropertyValue<Color>>(*color, error, false); + convert<PropertyValue<Color>>(*color, error, false, false); if (convertedColor) { light.setColor(*convertedColor); @@ -64,7 +64,7 @@ optional<Light> Converter<Light>::operator()(const Convertible& value, Error& er const auto position = objectMember(value, "position"); if (position) { optional<PropertyValue<Position>> convertedPosition = - convert<PropertyValue<Position>>(*position, error, false); + convert<PropertyValue<Position>>(*position, error, false, false); if (convertedPosition) { light.setPosition(*convertedPosition); @@ -87,7 +87,7 @@ optional<Light> Converter<Light>::operator()(const Convertible& value, Error& er const auto intensity = objectMember(value, "intensity"); if (intensity) { optional<PropertyValue<float>> convertedIntensity = - convert<PropertyValue<float>>(*intensity, error, false); + convert<PropertyValue<float>>(*intensity, error, false, false); if (convertedIntensity) { light.setIntensity(*convertedIntensity); diff --git a/src/mbgl/style/conversion/make_property_setters.hpp b/src/mbgl/style/conversion/make_property_setters.hpp index 64826106f0..ada0d53002 100644 --- a/src/mbgl/style/conversion/make_property_setters.hpp +++ b/src/mbgl/style/conversion/make_property_setters.hpp @@ -26,47 +26,47 @@ inline auto makeLayoutPropertySetters() { result["visibility"] = &setVisibility; - result["line-cap"] = &setProperty<LineLayer, PropertyValue<LineCapType>, &LineLayer::setLineCap>; - result["line-join"] = &setProperty<LineLayer, DataDrivenPropertyValue<LineJoinType>, &LineLayer::setLineJoin>; - result["line-miter-limit"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineMiterLimit>; - result["line-round-limit"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineRoundLimit>; - - result["symbol-placement"] = &setProperty<SymbolLayer, PropertyValue<SymbolPlacementType>, &SymbolLayer::setSymbolPlacement>; - result["symbol-spacing"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setSymbolSpacing>; - result["symbol-avoid-edges"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setSymbolAvoidEdges>; - result["icon-allow-overlap"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setIconAllowOverlap>; - result["icon-ignore-placement"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setIconIgnorePlacement>; - result["icon-optional"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setIconOptional>; - result["icon-rotation-alignment"] = &setProperty<SymbolLayer, PropertyValue<AlignmentType>, &SymbolLayer::setIconRotationAlignment>; - result["icon-size"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<float>, &SymbolLayer::setIconSize>; - result["icon-text-fit"] = &setProperty<SymbolLayer, PropertyValue<IconTextFitType>, &SymbolLayer::setIconTextFit>; - result["icon-text-fit-padding"] = &setProperty<SymbolLayer, PropertyValue<std::array<float, 4>>, &SymbolLayer::setIconTextFitPadding>; - result["icon-image"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<std::string>, &SymbolLayer::setIconImage, true>; - result["icon-rotate"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<float>, &SymbolLayer::setIconRotate>; - result["icon-padding"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setIconPadding>; - result["icon-keep-upright"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setIconKeepUpright>; - result["icon-offset"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<std::array<float, 2>>, &SymbolLayer::setIconOffset>; - result["icon-anchor"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<SymbolAnchorType>, &SymbolLayer::setIconAnchor>; - result["icon-pitch-alignment"] = &setProperty<SymbolLayer, PropertyValue<AlignmentType>, &SymbolLayer::setIconPitchAlignment>; - result["text-pitch-alignment"] = &setProperty<SymbolLayer, PropertyValue<AlignmentType>, &SymbolLayer::setTextPitchAlignment>; - result["text-rotation-alignment"] = &setProperty<SymbolLayer, PropertyValue<AlignmentType>, &SymbolLayer::setTextRotationAlignment>; - result["text-field"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<std::string>, &SymbolLayer::setTextField, true>; - result["text-font"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<std::vector<std::string>>, &SymbolLayer::setTextFont>; - result["text-size"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<float>, &SymbolLayer::setTextSize>; - result["text-max-width"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<float>, &SymbolLayer::setTextMaxWidth>; - result["text-line-height"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextLineHeight>; - result["text-letter-spacing"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<float>, &SymbolLayer::setTextLetterSpacing>; - result["text-justify"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<TextJustifyType>, &SymbolLayer::setTextJustify>; - result["text-anchor"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<SymbolAnchorType>, &SymbolLayer::setTextAnchor>; - result["text-max-angle"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextMaxAngle>; - result["text-rotate"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<float>, &SymbolLayer::setTextRotate>; - result["text-padding"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextPadding>; - result["text-keep-upright"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setTextKeepUpright>; - result["text-transform"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<TextTransformType>, &SymbolLayer::setTextTransform>; - result["text-offset"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<std::array<float, 2>>, &SymbolLayer::setTextOffset>; - result["text-allow-overlap"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setTextAllowOverlap>; - result["text-ignore-placement"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setTextIgnorePlacement>; - result["text-optional"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setTextOptional>; + result["line-cap"] = &setProperty<LineLayer, PropertyValue<LineCapType>, &LineLayer::setLineCap, false, false>; + result["line-join"] = &setProperty<LineLayer, PropertyValue<LineJoinType>, &LineLayer::setLineJoin, true, false>; + result["line-miter-limit"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineMiterLimit, false, false>; + result["line-round-limit"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineRoundLimit, false, false>; + + result["symbol-placement"] = &setProperty<SymbolLayer, PropertyValue<SymbolPlacementType>, &SymbolLayer::setSymbolPlacement, false, false>; + result["symbol-spacing"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setSymbolSpacing, false, false>; + result["symbol-avoid-edges"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setSymbolAvoidEdges, false, false>; + result["icon-allow-overlap"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setIconAllowOverlap, false, false>; + result["icon-ignore-placement"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setIconIgnorePlacement, false, false>; + result["icon-optional"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setIconOptional, false, false>; + result["icon-rotation-alignment"] = &setProperty<SymbolLayer, PropertyValue<AlignmentType>, &SymbolLayer::setIconRotationAlignment, false, false>; + result["icon-size"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setIconSize, true, false>; + result["icon-text-fit"] = &setProperty<SymbolLayer, PropertyValue<IconTextFitType>, &SymbolLayer::setIconTextFit, false, false>; + result["icon-text-fit-padding"] = &setProperty<SymbolLayer, PropertyValue<std::array<float, 4>>, &SymbolLayer::setIconTextFitPadding, false, false>; + result["icon-image"] = &setProperty<SymbolLayer, PropertyValue<std::string>, &SymbolLayer::setIconImage, true, true>; + result["icon-rotate"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setIconRotate, true, false>; + result["icon-padding"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setIconPadding, false, false>; + result["icon-keep-upright"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setIconKeepUpright, false, false>; + result["icon-offset"] = &setProperty<SymbolLayer, PropertyValue<std::array<float, 2>>, &SymbolLayer::setIconOffset, true, false>; + result["icon-anchor"] = &setProperty<SymbolLayer, PropertyValue<SymbolAnchorType>, &SymbolLayer::setIconAnchor, true, false>; + result["icon-pitch-alignment"] = &setProperty<SymbolLayer, PropertyValue<AlignmentType>, &SymbolLayer::setIconPitchAlignment, false, false>; + result["text-pitch-alignment"] = &setProperty<SymbolLayer, PropertyValue<AlignmentType>, &SymbolLayer::setTextPitchAlignment, false, false>; + result["text-rotation-alignment"] = &setProperty<SymbolLayer, PropertyValue<AlignmentType>, &SymbolLayer::setTextRotationAlignment, false, false>; + result["text-field"] = &setProperty<SymbolLayer, PropertyValue<std::string>, &SymbolLayer::setTextField, true, true>; + result["text-font"] = &setProperty<SymbolLayer, PropertyValue<std::vector<std::string>>, &SymbolLayer::setTextFont, true, false>; + result["text-size"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextSize, true, false>; + result["text-max-width"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextMaxWidth, true, false>; + result["text-line-height"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextLineHeight, false, false>; + result["text-letter-spacing"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextLetterSpacing, true, false>; + result["text-justify"] = &setProperty<SymbolLayer, PropertyValue<TextJustifyType>, &SymbolLayer::setTextJustify, true, false>; + result["text-anchor"] = &setProperty<SymbolLayer, PropertyValue<SymbolAnchorType>, &SymbolLayer::setTextAnchor, true, false>; + result["text-max-angle"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextMaxAngle, false, false>; + result["text-rotate"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextRotate, true, false>; + result["text-padding"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextPadding, false, false>; + result["text-keep-upright"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setTextKeepUpright, false, false>; + result["text-transform"] = &setProperty<SymbolLayer, PropertyValue<TextTransformType>, &SymbolLayer::setTextTransform, true, false>; + result["text-offset"] = &setProperty<SymbolLayer, PropertyValue<std::array<float, 2>>, &SymbolLayer::setTextOffset, true, false>; + result["text-allow-overlap"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setTextAllowOverlap, false, false>; + result["text-ignore-placement"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setTextIgnorePlacement, false, false>; + result["text-optional"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setTextOptional, false, false>; @@ -80,155 +80,155 @@ inline auto makeLayoutPropertySetters() { inline auto makePaintPropertySetters() { std::unordered_map<std::string, PropertySetter> result; - result["fill-antialias"] = &setProperty<FillLayer, PropertyValue<bool>, &FillLayer::setFillAntialias>; + result["fill-antialias"] = &setProperty<FillLayer, PropertyValue<bool>, &FillLayer::setFillAntialias, false, false>; result["fill-antialias-transition"] = &setTransition<FillLayer, &FillLayer::setFillAntialiasTransition>; - result["fill-opacity"] = &setProperty<FillLayer, DataDrivenPropertyValue<float>, &FillLayer::setFillOpacity>; + result["fill-opacity"] = &setProperty<FillLayer, PropertyValue<float>, &FillLayer::setFillOpacity, true, false>; result["fill-opacity-transition"] = &setTransition<FillLayer, &FillLayer::setFillOpacityTransition>; - result["fill-color"] = &setProperty<FillLayer, DataDrivenPropertyValue<Color>, &FillLayer::setFillColor>; + result["fill-color"] = &setProperty<FillLayer, PropertyValue<Color>, &FillLayer::setFillColor, true, false>; result["fill-color-transition"] = &setTransition<FillLayer, &FillLayer::setFillColorTransition>; - result["fill-outline-color"] = &setProperty<FillLayer, DataDrivenPropertyValue<Color>, &FillLayer::setFillOutlineColor>; + result["fill-outline-color"] = &setProperty<FillLayer, PropertyValue<Color>, &FillLayer::setFillOutlineColor, true, false>; result["fill-outline-color-transition"] = &setTransition<FillLayer, &FillLayer::setFillOutlineColorTransition>; - result["fill-translate"] = &setProperty<FillLayer, PropertyValue<std::array<float, 2>>, &FillLayer::setFillTranslate>; + result["fill-translate"] = &setProperty<FillLayer, PropertyValue<std::array<float, 2>>, &FillLayer::setFillTranslate, false, false>; result["fill-translate-transition"] = &setTransition<FillLayer, &FillLayer::setFillTranslateTransition>; - result["fill-translate-anchor"] = &setProperty<FillLayer, PropertyValue<TranslateAnchorType>, &FillLayer::setFillTranslateAnchor>; + result["fill-translate-anchor"] = &setProperty<FillLayer, PropertyValue<TranslateAnchorType>, &FillLayer::setFillTranslateAnchor, false, false>; result["fill-translate-anchor-transition"] = &setTransition<FillLayer, &FillLayer::setFillTranslateAnchorTransition>; - result["fill-pattern"] = &setProperty<FillLayer, PropertyValue<std::string>, &FillLayer::setFillPattern>; + result["fill-pattern"] = &setProperty<FillLayer, PropertyValue<std::string>, &FillLayer::setFillPattern, false, false>; result["fill-pattern-transition"] = &setTransition<FillLayer, &FillLayer::setFillPatternTransition>; - result["line-opacity"] = &setProperty<LineLayer, DataDrivenPropertyValue<float>, &LineLayer::setLineOpacity>; + result["line-opacity"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineOpacity, true, false>; result["line-opacity-transition"] = &setTransition<LineLayer, &LineLayer::setLineOpacityTransition>; - result["line-color"] = &setProperty<LineLayer, DataDrivenPropertyValue<Color>, &LineLayer::setLineColor>; + result["line-color"] = &setProperty<LineLayer, PropertyValue<Color>, &LineLayer::setLineColor, true, false>; result["line-color-transition"] = &setTransition<LineLayer, &LineLayer::setLineColorTransition>; - result["line-translate"] = &setProperty<LineLayer, PropertyValue<std::array<float, 2>>, &LineLayer::setLineTranslate>; + result["line-translate"] = &setProperty<LineLayer, PropertyValue<std::array<float, 2>>, &LineLayer::setLineTranslate, false, false>; result["line-translate-transition"] = &setTransition<LineLayer, &LineLayer::setLineTranslateTransition>; - result["line-translate-anchor"] = &setProperty<LineLayer, PropertyValue<TranslateAnchorType>, &LineLayer::setLineTranslateAnchor>; + result["line-translate-anchor"] = &setProperty<LineLayer, PropertyValue<TranslateAnchorType>, &LineLayer::setLineTranslateAnchor, false, false>; result["line-translate-anchor-transition"] = &setTransition<LineLayer, &LineLayer::setLineTranslateAnchorTransition>; - result["line-width"] = &setProperty<LineLayer, DataDrivenPropertyValue<float>, &LineLayer::setLineWidth>; + result["line-width"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineWidth, true, false>; result["line-width-transition"] = &setTransition<LineLayer, &LineLayer::setLineWidthTransition>; - result["line-gap-width"] = &setProperty<LineLayer, DataDrivenPropertyValue<float>, &LineLayer::setLineGapWidth>; + result["line-gap-width"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineGapWidth, true, false>; result["line-gap-width-transition"] = &setTransition<LineLayer, &LineLayer::setLineGapWidthTransition>; - result["line-offset"] = &setProperty<LineLayer, DataDrivenPropertyValue<float>, &LineLayer::setLineOffset>; + result["line-offset"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineOffset, true, false>; result["line-offset-transition"] = &setTransition<LineLayer, &LineLayer::setLineOffsetTransition>; - result["line-blur"] = &setProperty<LineLayer, DataDrivenPropertyValue<float>, &LineLayer::setLineBlur>; + result["line-blur"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineBlur, true, false>; result["line-blur-transition"] = &setTransition<LineLayer, &LineLayer::setLineBlurTransition>; - result["line-dasharray"] = &setProperty<LineLayer, PropertyValue<std::vector<float>>, &LineLayer::setLineDasharray>; + result["line-dasharray"] = &setProperty<LineLayer, PropertyValue<std::vector<float>>, &LineLayer::setLineDasharray, false, false>; result["line-dasharray-transition"] = &setTransition<LineLayer, &LineLayer::setLineDasharrayTransition>; - result["line-pattern"] = &setProperty<LineLayer, PropertyValue<std::string>, &LineLayer::setLinePattern>; + result["line-pattern"] = &setProperty<LineLayer, PropertyValue<std::string>, &LineLayer::setLinePattern, false, false>; result["line-pattern-transition"] = &setTransition<LineLayer, &LineLayer::setLinePatternTransition>; - result["icon-opacity"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<float>, &SymbolLayer::setIconOpacity>; + result["icon-opacity"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setIconOpacity, true, false>; result["icon-opacity-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setIconOpacityTransition>; - result["icon-color"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<Color>, &SymbolLayer::setIconColor>; + result["icon-color"] = &setProperty<SymbolLayer, PropertyValue<Color>, &SymbolLayer::setIconColor, true, false>; result["icon-color-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setIconColorTransition>; - result["icon-halo-color"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<Color>, &SymbolLayer::setIconHaloColor>; + result["icon-halo-color"] = &setProperty<SymbolLayer, PropertyValue<Color>, &SymbolLayer::setIconHaloColor, true, false>; result["icon-halo-color-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setIconHaloColorTransition>; - result["icon-halo-width"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<float>, &SymbolLayer::setIconHaloWidth>; + result["icon-halo-width"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setIconHaloWidth, true, false>; result["icon-halo-width-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setIconHaloWidthTransition>; - result["icon-halo-blur"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<float>, &SymbolLayer::setIconHaloBlur>; + result["icon-halo-blur"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setIconHaloBlur, true, false>; result["icon-halo-blur-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setIconHaloBlurTransition>; - result["icon-translate"] = &setProperty<SymbolLayer, PropertyValue<std::array<float, 2>>, &SymbolLayer::setIconTranslate>; + result["icon-translate"] = &setProperty<SymbolLayer, PropertyValue<std::array<float, 2>>, &SymbolLayer::setIconTranslate, false, false>; result["icon-translate-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setIconTranslateTransition>; - result["icon-translate-anchor"] = &setProperty<SymbolLayer, PropertyValue<TranslateAnchorType>, &SymbolLayer::setIconTranslateAnchor>; + result["icon-translate-anchor"] = &setProperty<SymbolLayer, PropertyValue<TranslateAnchorType>, &SymbolLayer::setIconTranslateAnchor, false, false>; result["icon-translate-anchor-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setIconTranslateAnchorTransition>; - result["text-opacity"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<float>, &SymbolLayer::setTextOpacity>; + result["text-opacity"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextOpacity, true, false>; result["text-opacity-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setTextOpacityTransition>; - result["text-color"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<Color>, &SymbolLayer::setTextColor>; + result["text-color"] = &setProperty<SymbolLayer, PropertyValue<Color>, &SymbolLayer::setTextColor, true, false>; result["text-color-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setTextColorTransition>; - result["text-halo-color"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<Color>, &SymbolLayer::setTextHaloColor>; + result["text-halo-color"] = &setProperty<SymbolLayer, PropertyValue<Color>, &SymbolLayer::setTextHaloColor, true, false>; result["text-halo-color-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setTextHaloColorTransition>; - result["text-halo-width"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<float>, &SymbolLayer::setTextHaloWidth>; + result["text-halo-width"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextHaloWidth, true, false>; result["text-halo-width-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setTextHaloWidthTransition>; - result["text-halo-blur"] = &setProperty<SymbolLayer, DataDrivenPropertyValue<float>, &SymbolLayer::setTextHaloBlur>; + result["text-halo-blur"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextHaloBlur, true, false>; result["text-halo-blur-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setTextHaloBlurTransition>; - result["text-translate"] = &setProperty<SymbolLayer, PropertyValue<std::array<float, 2>>, &SymbolLayer::setTextTranslate>; + result["text-translate"] = &setProperty<SymbolLayer, PropertyValue<std::array<float, 2>>, &SymbolLayer::setTextTranslate, false, false>; result["text-translate-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setTextTranslateTransition>; - result["text-translate-anchor"] = &setProperty<SymbolLayer, PropertyValue<TranslateAnchorType>, &SymbolLayer::setTextTranslateAnchor>; + result["text-translate-anchor"] = &setProperty<SymbolLayer, PropertyValue<TranslateAnchorType>, &SymbolLayer::setTextTranslateAnchor, false, false>; result["text-translate-anchor-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setTextTranslateAnchorTransition>; - result["circle-radius"] = &setProperty<CircleLayer, DataDrivenPropertyValue<float>, &CircleLayer::setCircleRadius>; + result["circle-radius"] = &setProperty<CircleLayer, PropertyValue<float>, &CircleLayer::setCircleRadius, true, false>; result["circle-radius-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleRadiusTransition>; - result["circle-color"] = &setProperty<CircleLayer, DataDrivenPropertyValue<Color>, &CircleLayer::setCircleColor>; + result["circle-color"] = &setProperty<CircleLayer, PropertyValue<Color>, &CircleLayer::setCircleColor, true, false>; result["circle-color-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleColorTransition>; - result["circle-blur"] = &setProperty<CircleLayer, DataDrivenPropertyValue<float>, &CircleLayer::setCircleBlur>; + result["circle-blur"] = &setProperty<CircleLayer, PropertyValue<float>, &CircleLayer::setCircleBlur, true, false>; result["circle-blur-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleBlurTransition>; - result["circle-opacity"] = &setProperty<CircleLayer, DataDrivenPropertyValue<float>, &CircleLayer::setCircleOpacity>; + result["circle-opacity"] = &setProperty<CircleLayer, PropertyValue<float>, &CircleLayer::setCircleOpacity, true, false>; result["circle-opacity-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleOpacityTransition>; - result["circle-translate"] = &setProperty<CircleLayer, PropertyValue<std::array<float, 2>>, &CircleLayer::setCircleTranslate>; + result["circle-translate"] = &setProperty<CircleLayer, PropertyValue<std::array<float, 2>>, &CircleLayer::setCircleTranslate, false, false>; result["circle-translate-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleTranslateTransition>; - result["circle-translate-anchor"] = &setProperty<CircleLayer, PropertyValue<TranslateAnchorType>, &CircleLayer::setCircleTranslateAnchor>; + result["circle-translate-anchor"] = &setProperty<CircleLayer, PropertyValue<TranslateAnchorType>, &CircleLayer::setCircleTranslateAnchor, false, false>; result["circle-translate-anchor-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleTranslateAnchorTransition>; - result["circle-pitch-scale"] = &setProperty<CircleLayer, PropertyValue<CirclePitchScaleType>, &CircleLayer::setCirclePitchScale>; + result["circle-pitch-scale"] = &setProperty<CircleLayer, PropertyValue<CirclePitchScaleType>, &CircleLayer::setCirclePitchScale, false, false>; result["circle-pitch-scale-transition"] = &setTransition<CircleLayer, &CircleLayer::setCirclePitchScaleTransition>; - result["circle-pitch-alignment"] = &setProperty<CircleLayer, PropertyValue<AlignmentType>, &CircleLayer::setCirclePitchAlignment>; + result["circle-pitch-alignment"] = &setProperty<CircleLayer, PropertyValue<AlignmentType>, &CircleLayer::setCirclePitchAlignment, false, false>; result["circle-pitch-alignment-transition"] = &setTransition<CircleLayer, &CircleLayer::setCirclePitchAlignmentTransition>; - result["circle-stroke-width"] = &setProperty<CircleLayer, DataDrivenPropertyValue<float>, &CircleLayer::setCircleStrokeWidth>; + result["circle-stroke-width"] = &setProperty<CircleLayer, PropertyValue<float>, &CircleLayer::setCircleStrokeWidth, true, false>; result["circle-stroke-width-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleStrokeWidthTransition>; - result["circle-stroke-color"] = &setProperty<CircleLayer, DataDrivenPropertyValue<Color>, &CircleLayer::setCircleStrokeColor>; + result["circle-stroke-color"] = &setProperty<CircleLayer, PropertyValue<Color>, &CircleLayer::setCircleStrokeColor, true, false>; result["circle-stroke-color-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleStrokeColorTransition>; - result["circle-stroke-opacity"] = &setProperty<CircleLayer, DataDrivenPropertyValue<float>, &CircleLayer::setCircleStrokeOpacity>; + result["circle-stroke-opacity"] = &setProperty<CircleLayer, PropertyValue<float>, &CircleLayer::setCircleStrokeOpacity, true, false>; result["circle-stroke-opacity-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleStrokeOpacityTransition>; - result["heatmap-radius"] = &setProperty<HeatmapLayer, DataDrivenPropertyValue<float>, &HeatmapLayer::setHeatmapRadius>; + result["heatmap-radius"] = &setProperty<HeatmapLayer, PropertyValue<float>, &HeatmapLayer::setHeatmapRadius, true, false>; result["heatmap-radius-transition"] = &setTransition<HeatmapLayer, &HeatmapLayer::setHeatmapRadiusTransition>; - result["heatmap-weight"] = &setProperty<HeatmapLayer, DataDrivenPropertyValue<float>, &HeatmapLayer::setHeatmapWeight>; + result["heatmap-weight"] = &setProperty<HeatmapLayer, PropertyValue<float>, &HeatmapLayer::setHeatmapWeight, true, false>; result["heatmap-weight-transition"] = &setTransition<HeatmapLayer, &HeatmapLayer::setHeatmapWeightTransition>; - result["heatmap-intensity"] = &setProperty<HeatmapLayer, PropertyValue<float>, &HeatmapLayer::setHeatmapIntensity>; + result["heatmap-intensity"] = &setProperty<HeatmapLayer, PropertyValue<float>, &HeatmapLayer::setHeatmapIntensity, false, false>; result["heatmap-intensity-transition"] = &setTransition<HeatmapLayer, &HeatmapLayer::setHeatmapIntensityTransition>; - result["heatmap-color"] = &setProperty<HeatmapLayer, ColorRampPropertyValue, &HeatmapLayer::setHeatmapColor>; + result["heatmap-color"] = &setProperty<HeatmapLayer, ColorRampPropertyValue, &HeatmapLayer::setHeatmapColor, false, false>; result["heatmap-color-transition"] = &setTransition<HeatmapLayer, &HeatmapLayer::setHeatmapColorTransition>; - result["heatmap-opacity"] = &setProperty<HeatmapLayer, PropertyValue<float>, &HeatmapLayer::setHeatmapOpacity>; + result["heatmap-opacity"] = &setProperty<HeatmapLayer, PropertyValue<float>, &HeatmapLayer::setHeatmapOpacity, false, false>; result["heatmap-opacity-transition"] = &setTransition<HeatmapLayer, &HeatmapLayer::setHeatmapOpacityTransition>; - result["fill-extrusion-opacity"] = &setProperty<FillExtrusionLayer, PropertyValue<float>, &FillExtrusionLayer::setFillExtrusionOpacity>; + result["fill-extrusion-opacity"] = &setProperty<FillExtrusionLayer, PropertyValue<float>, &FillExtrusionLayer::setFillExtrusionOpacity, false, false>; result["fill-extrusion-opacity-transition"] = &setTransition<FillExtrusionLayer, &FillExtrusionLayer::setFillExtrusionOpacityTransition>; - result["fill-extrusion-color"] = &setProperty<FillExtrusionLayer, DataDrivenPropertyValue<Color>, &FillExtrusionLayer::setFillExtrusionColor>; + result["fill-extrusion-color"] = &setProperty<FillExtrusionLayer, PropertyValue<Color>, &FillExtrusionLayer::setFillExtrusionColor, true, false>; result["fill-extrusion-color-transition"] = &setTransition<FillExtrusionLayer, &FillExtrusionLayer::setFillExtrusionColorTransition>; - result["fill-extrusion-translate"] = &setProperty<FillExtrusionLayer, PropertyValue<std::array<float, 2>>, &FillExtrusionLayer::setFillExtrusionTranslate>; + result["fill-extrusion-translate"] = &setProperty<FillExtrusionLayer, PropertyValue<std::array<float, 2>>, &FillExtrusionLayer::setFillExtrusionTranslate, false, false>; result["fill-extrusion-translate-transition"] = &setTransition<FillExtrusionLayer, &FillExtrusionLayer::setFillExtrusionTranslateTransition>; - result["fill-extrusion-translate-anchor"] = &setProperty<FillExtrusionLayer, PropertyValue<TranslateAnchorType>, &FillExtrusionLayer::setFillExtrusionTranslateAnchor>; + result["fill-extrusion-translate-anchor"] = &setProperty<FillExtrusionLayer, PropertyValue<TranslateAnchorType>, &FillExtrusionLayer::setFillExtrusionTranslateAnchor, false, false>; result["fill-extrusion-translate-anchor-transition"] = &setTransition<FillExtrusionLayer, &FillExtrusionLayer::setFillExtrusionTranslateAnchorTransition>; - result["fill-extrusion-pattern"] = &setProperty<FillExtrusionLayer, PropertyValue<std::string>, &FillExtrusionLayer::setFillExtrusionPattern>; + result["fill-extrusion-pattern"] = &setProperty<FillExtrusionLayer, PropertyValue<std::string>, &FillExtrusionLayer::setFillExtrusionPattern, false, false>; result["fill-extrusion-pattern-transition"] = &setTransition<FillExtrusionLayer, &FillExtrusionLayer::setFillExtrusionPatternTransition>; - result["fill-extrusion-height"] = &setProperty<FillExtrusionLayer, DataDrivenPropertyValue<float>, &FillExtrusionLayer::setFillExtrusionHeight>; + result["fill-extrusion-height"] = &setProperty<FillExtrusionLayer, PropertyValue<float>, &FillExtrusionLayer::setFillExtrusionHeight, true, false>; result["fill-extrusion-height-transition"] = &setTransition<FillExtrusionLayer, &FillExtrusionLayer::setFillExtrusionHeightTransition>; - result["fill-extrusion-base"] = &setProperty<FillExtrusionLayer, DataDrivenPropertyValue<float>, &FillExtrusionLayer::setFillExtrusionBase>; + result["fill-extrusion-base"] = &setProperty<FillExtrusionLayer, PropertyValue<float>, &FillExtrusionLayer::setFillExtrusionBase, true, false>; result["fill-extrusion-base-transition"] = &setTransition<FillExtrusionLayer, &FillExtrusionLayer::setFillExtrusionBaseTransition>; - result["raster-opacity"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterOpacity>; + result["raster-opacity"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterOpacity, false, false>; result["raster-opacity-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterOpacityTransition>; - result["raster-hue-rotate"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterHueRotate>; + result["raster-hue-rotate"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterHueRotate, false, false>; result["raster-hue-rotate-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterHueRotateTransition>; - result["raster-brightness-min"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterBrightnessMin>; + result["raster-brightness-min"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterBrightnessMin, false, false>; result["raster-brightness-min-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterBrightnessMinTransition>; - result["raster-brightness-max"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterBrightnessMax>; + result["raster-brightness-max"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterBrightnessMax, false, false>; result["raster-brightness-max-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterBrightnessMaxTransition>; - result["raster-saturation"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterSaturation>; + result["raster-saturation"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterSaturation, false, false>; result["raster-saturation-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterSaturationTransition>; - result["raster-contrast"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterContrast>; + result["raster-contrast"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterContrast, false, false>; result["raster-contrast-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterContrastTransition>; - result["raster-resampling"] = &setProperty<RasterLayer, PropertyValue<RasterResamplingType>, &RasterLayer::setRasterResampling>; + result["raster-resampling"] = &setProperty<RasterLayer, PropertyValue<RasterResamplingType>, &RasterLayer::setRasterResampling, false, false>; result["raster-resampling-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterResamplingTransition>; - result["raster-fade-duration"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterFadeDuration>; + result["raster-fade-duration"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterFadeDuration, false, false>; result["raster-fade-duration-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterFadeDurationTransition>; - result["hillshade-illumination-direction"] = &setProperty<HillshadeLayer, PropertyValue<float>, &HillshadeLayer::setHillshadeIlluminationDirection>; + result["hillshade-illumination-direction"] = &setProperty<HillshadeLayer, PropertyValue<float>, &HillshadeLayer::setHillshadeIlluminationDirection, false, false>; result["hillshade-illumination-direction-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeIlluminationDirectionTransition>; - result["hillshade-illumination-anchor"] = &setProperty<HillshadeLayer, PropertyValue<HillshadeIlluminationAnchorType>, &HillshadeLayer::setHillshadeIlluminationAnchor>; + result["hillshade-illumination-anchor"] = &setProperty<HillshadeLayer, PropertyValue<HillshadeIlluminationAnchorType>, &HillshadeLayer::setHillshadeIlluminationAnchor, false, false>; result["hillshade-illumination-anchor-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeIlluminationAnchorTransition>; - result["hillshade-exaggeration"] = &setProperty<HillshadeLayer, PropertyValue<float>, &HillshadeLayer::setHillshadeExaggeration>; + result["hillshade-exaggeration"] = &setProperty<HillshadeLayer, PropertyValue<float>, &HillshadeLayer::setHillshadeExaggeration, false, false>; result["hillshade-exaggeration-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeExaggerationTransition>; - result["hillshade-shadow-color"] = &setProperty<HillshadeLayer, PropertyValue<Color>, &HillshadeLayer::setHillshadeShadowColor>; + result["hillshade-shadow-color"] = &setProperty<HillshadeLayer, PropertyValue<Color>, &HillshadeLayer::setHillshadeShadowColor, false, false>; result["hillshade-shadow-color-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeShadowColorTransition>; - result["hillshade-highlight-color"] = &setProperty<HillshadeLayer, PropertyValue<Color>, &HillshadeLayer::setHillshadeHighlightColor>; + result["hillshade-highlight-color"] = &setProperty<HillshadeLayer, PropertyValue<Color>, &HillshadeLayer::setHillshadeHighlightColor, false, false>; result["hillshade-highlight-color-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeHighlightColorTransition>; - result["hillshade-accent-color"] = &setProperty<HillshadeLayer, PropertyValue<Color>, &HillshadeLayer::setHillshadeAccentColor>; + result["hillshade-accent-color"] = &setProperty<HillshadeLayer, PropertyValue<Color>, &HillshadeLayer::setHillshadeAccentColor, false, false>; result["hillshade-accent-color-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeAccentColorTransition>; - result["background-color"] = &setProperty<BackgroundLayer, PropertyValue<Color>, &BackgroundLayer::setBackgroundColor>; + result["background-color"] = &setProperty<BackgroundLayer, PropertyValue<Color>, &BackgroundLayer::setBackgroundColor, false, false>; result["background-color-transition"] = &setTransition<BackgroundLayer, &BackgroundLayer::setBackgroundColorTransition>; - result["background-pattern"] = &setProperty<BackgroundLayer, PropertyValue<std::string>, &BackgroundLayer::setBackgroundPattern>; + result["background-pattern"] = &setProperty<BackgroundLayer, PropertyValue<std::string>, &BackgroundLayer::setBackgroundPattern, false, false>; result["background-pattern-transition"] = &setTransition<BackgroundLayer, &BackgroundLayer::setBackgroundPatternTransition>; - result["background-opacity"] = &setProperty<BackgroundLayer, PropertyValue<float>, &BackgroundLayer::setBackgroundOpacity>; + result["background-opacity"] = &setProperty<BackgroundLayer, PropertyValue<float>, &BackgroundLayer::setBackgroundOpacity, false, false>; result["background-opacity-transition"] = &setTransition<BackgroundLayer, &BackgroundLayer::setBackgroundOpacityTransition>; return result; diff --git a/src/mbgl/style/conversion/make_property_setters.hpp.ejs b/src/mbgl/style/conversion/make_property_setters.hpp.ejs index 2b8925817d..fbf2f93fd6 100644 --- a/src/mbgl/style/conversion/make_property_setters.hpp.ejs +++ b/src/mbgl/style/conversion/make_property_setters.hpp.ejs @@ -21,7 +21,7 @@ inline auto makeLayoutPropertySetters() { <% for (const layer of locals.layers) { -%> <% for (const property of layer.layoutProperties) { -%> - result["<%- property.name %>"] = &setProperty<<%- camelize(layer.type) %>Layer, <%- propertyValueType(property) %>, &<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %><%- property.name === 'icon-image' || property.name === 'text-field' ? ', true' : '' %>>; + result["<%- property.name %>"] = &setProperty<<%- camelize(layer.type) %>Layer, <%- propertyValueType(property) %>, &<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>, <%- property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven' %>, <%- property.name === 'icon-image' || property.name === 'text-field' %>>; <% } -%> <% } -%> @@ -33,7 +33,7 @@ inline auto makePaintPropertySetters() { <% for (const layer of locals.layers) { -%> <% for (const property of layer.paintProperties) { -%> - result["<%- property.name %>"] = &setProperty<<%- camelize(layer.type) %>Layer, <%- propertyValueType(property) %>, &<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>>; + result["<%- property.name %>"] = &setProperty<<%- camelize(layer.type) %>Layer, <%- propertyValueType(property) %>, &<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>, <%- property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven' %>, <%- property.name === 'icon-image' || property.name === 'text-field' %>>; result["<%- property.name %>-transition"] = &setTransition<<%- camelize(layer.type) %>Layer, &<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>Transition>; <% } -%> diff --git a/src/mbgl/style/conversion/property_setter.hpp b/src/mbgl/style/conversion/property_setter.hpp index cdb585aa29..3c5c65f96a 100644 --- a/src/mbgl/style/conversion/property_setter.hpp +++ b/src/mbgl/style/conversion/property_setter.hpp @@ -6,7 +6,6 @@ #include <mbgl/style/conversion/color_ramp_property_value.hpp> #include <mbgl/style/conversion/constant.hpp> #include <mbgl/style/conversion/property_value.hpp> -#include <mbgl/style/conversion/data_driven_property_value.hpp> #include <mbgl/style/conversion/transition_options.hpp> #include <string> @@ -17,7 +16,7 @@ namespace conversion { using PropertySetter = optional<Error> (*) (Layer&, const Convertible&); -template <class L, class PropertyValue, void (L::*setter)(PropertyValue), bool convertTokens = false> +template <class L, class PropertyValue, void (L::*setter)(PropertyValue), bool allowDataExpressions, bool convertTokens> optional<Error> setProperty(Layer& layer, const Convertible& value) { auto* typedLayer = layer.as<L>(); if (!typedLayer) { @@ -25,7 +24,7 @@ optional<Error> setProperty(Layer& layer, const Convertible& value) { } Error error; - optional<PropertyValue> typedValue = convert<PropertyValue>(value, error, convertTokens); + optional<PropertyValue> typedValue = convert<PropertyValue>(value, error, allowDataExpressions, convertTokens); if (!typedValue) { return error; } diff --git a/src/mbgl/style/conversion/stringify.hpp b/src/mbgl/style/conversion/stringify.hpp index 77a39c51f9..3d188b6390 100644 --- a/src/mbgl/style/conversion/stringify.hpp +++ b/src/mbgl/style/conversion/stringify.hpp @@ -2,7 +2,6 @@ #include <mbgl/style/filter.hpp> #include <mbgl/style/property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/util/enum.hpp> #include <mbgl/util/color.hpp> #include <mbgl/util/feature.hpp> @@ -155,19 +154,6 @@ void stringify(Writer& writer, const PropertyValue<T>& value) { } } -template <class Writer, class T> -void stringify(Writer& writer, const DataDrivenPropertyValue<T>& v) { - v.evaluate([&] (const auto& v_) { stringify(writer, v_); }); -} - -template <class Property, class Writer, class T> -void stringify(Writer& writer, const DataDrivenPropertyValue<T>& value) { - if (!value.isUndefined()) { - writer.Key(Property::key); - stringify(writer, value); - } -} - } // namespace conversion } // namespace style } // namespace mbgl diff --git a/src/mbgl/style/layers/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp index 6dd744df1f..d435ce89e1 100644 --- a/src/mbgl/style/layers/circle_layer.cpp +++ b/src/mbgl/style/layers/circle_layer.cpp @@ -96,15 +96,15 @@ void CircleLayer::setMaxZoom(float maxZoom) { // Paint properties -DataDrivenPropertyValue<float> CircleLayer::getDefaultCircleRadius() { +PropertyValue<float> CircleLayer::getDefaultCircleRadius() { return { 5 }; } -DataDrivenPropertyValue<float> CircleLayer::getCircleRadius() const { +PropertyValue<float> CircleLayer::getCircleRadius() const { return impl().paint.template get<CircleRadius>().value; } -void CircleLayer::setCircleRadius(DataDrivenPropertyValue<float> value) { +void CircleLayer::setCircleRadius(PropertyValue<float> value) { if (value == getCircleRadius()) return; auto impl_ = mutableImpl(); @@ -123,15 +123,15 @@ TransitionOptions CircleLayer::getCircleRadiusTransition() const { return impl().paint.template get<CircleRadius>().options; } -DataDrivenPropertyValue<Color> CircleLayer::getDefaultCircleColor() { +PropertyValue<Color> CircleLayer::getDefaultCircleColor() { return { Color::black() }; } -DataDrivenPropertyValue<Color> CircleLayer::getCircleColor() const { +PropertyValue<Color> CircleLayer::getCircleColor() const { return impl().paint.template get<CircleColor>().value; } -void CircleLayer::setCircleColor(DataDrivenPropertyValue<Color> value) { +void CircleLayer::setCircleColor(PropertyValue<Color> value) { if (value == getCircleColor()) return; auto impl_ = mutableImpl(); @@ -150,15 +150,15 @@ TransitionOptions CircleLayer::getCircleColorTransition() const { return impl().paint.template get<CircleColor>().options; } -DataDrivenPropertyValue<float> CircleLayer::getDefaultCircleBlur() { +PropertyValue<float> CircleLayer::getDefaultCircleBlur() { return { 0 }; } -DataDrivenPropertyValue<float> CircleLayer::getCircleBlur() const { +PropertyValue<float> CircleLayer::getCircleBlur() const { return impl().paint.template get<CircleBlur>().value; } -void CircleLayer::setCircleBlur(DataDrivenPropertyValue<float> value) { +void CircleLayer::setCircleBlur(PropertyValue<float> value) { if (value == getCircleBlur()) return; auto impl_ = mutableImpl(); @@ -177,15 +177,15 @@ TransitionOptions CircleLayer::getCircleBlurTransition() const { return impl().paint.template get<CircleBlur>().options; } -DataDrivenPropertyValue<float> CircleLayer::getDefaultCircleOpacity() { +PropertyValue<float> CircleLayer::getDefaultCircleOpacity() { return { 1 }; } -DataDrivenPropertyValue<float> CircleLayer::getCircleOpacity() const { +PropertyValue<float> CircleLayer::getCircleOpacity() const { return impl().paint.template get<CircleOpacity>().value; } -void CircleLayer::setCircleOpacity(DataDrivenPropertyValue<float> value) { +void CircleLayer::setCircleOpacity(PropertyValue<float> value) { if (value == getCircleOpacity()) return; auto impl_ = mutableImpl(); @@ -312,15 +312,15 @@ TransitionOptions CircleLayer::getCirclePitchAlignmentTransition() const { return impl().paint.template get<CirclePitchAlignment>().options; } -DataDrivenPropertyValue<float> CircleLayer::getDefaultCircleStrokeWidth() { +PropertyValue<float> CircleLayer::getDefaultCircleStrokeWidth() { return { 0 }; } -DataDrivenPropertyValue<float> CircleLayer::getCircleStrokeWidth() const { +PropertyValue<float> CircleLayer::getCircleStrokeWidth() const { return impl().paint.template get<CircleStrokeWidth>().value; } -void CircleLayer::setCircleStrokeWidth(DataDrivenPropertyValue<float> value) { +void CircleLayer::setCircleStrokeWidth(PropertyValue<float> value) { if (value == getCircleStrokeWidth()) return; auto impl_ = mutableImpl(); @@ -339,15 +339,15 @@ TransitionOptions CircleLayer::getCircleStrokeWidthTransition() const { return impl().paint.template get<CircleStrokeWidth>().options; } -DataDrivenPropertyValue<Color> CircleLayer::getDefaultCircleStrokeColor() { +PropertyValue<Color> CircleLayer::getDefaultCircleStrokeColor() { return { Color::black() }; } -DataDrivenPropertyValue<Color> CircleLayer::getCircleStrokeColor() const { +PropertyValue<Color> CircleLayer::getCircleStrokeColor() const { return impl().paint.template get<CircleStrokeColor>().value; } -void CircleLayer::setCircleStrokeColor(DataDrivenPropertyValue<Color> value) { +void CircleLayer::setCircleStrokeColor(PropertyValue<Color> value) { if (value == getCircleStrokeColor()) return; auto impl_ = mutableImpl(); @@ -366,15 +366,15 @@ TransitionOptions CircleLayer::getCircleStrokeColorTransition() const { return impl().paint.template get<CircleStrokeColor>().options; } -DataDrivenPropertyValue<float> CircleLayer::getDefaultCircleStrokeOpacity() { +PropertyValue<float> CircleLayer::getDefaultCircleStrokeOpacity() { return { 1 }; } -DataDrivenPropertyValue<float> CircleLayer::getCircleStrokeOpacity() const { +PropertyValue<float> CircleLayer::getCircleStrokeOpacity() const { return impl().paint.template get<CircleStrokeOpacity>().value; } -void CircleLayer::setCircleStrokeOpacity(DataDrivenPropertyValue<float> value) { +void CircleLayer::setCircleStrokeOpacity(PropertyValue<float> value) { if (value == getCircleStrokeOpacity()) return; auto impl_ = mutableImpl(); diff --git a/src/mbgl/style/layers/fill_extrusion_layer.cpp b/src/mbgl/style/layers/fill_extrusion_layer.cpp index c5b4ef0ef3..829a24f354 100644 --- a/src/mbgl/style/layers/fill_extrusion_layer.cpp +++ b/src/mbgl/style/layers/fill_extrusion_layer.cpp @@ -123,15 +123,15 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionOpacityTransition() const return impl().paint.template get<FillExtrusionOpacity>().options; } -DataDrivenPropertyValue<Color> FillExtrusionLayer::getDefaultFillExtrusionColor() { +PropertyValue<Color> FillExtrusionLayer::getDefaultFillExtrusionColor() { return { Color::black() }; } -DataDrivenPropertyValue<Color> FillExtrusionLayer::getFillExtrusionColor() const { +PropertyValue<Color> FillExtrusionLayer::getFillExtrusionColor() const { return impl().paint.template get<FillExtrusionColor>().value; } -void FillExtrusionLayer::setFillExtrusionColor(DataDrivenPropertyValue<Color> value) { +void FillExtrusionLayer::setFillExtrusionColor(PropertyValue<Color> value) { if (value == getFillExtrusionColor()) return; auto impl_ = mutableImpl(); @@ -231,15 +231,15 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionPatternTransition() const return impl().paint.template get<FillExtrusionPattern>().options; } -DataDrivenPropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionHeight() { +PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionHeight() { return { 0 }; } -DataDrivenPropertyValue<float> FillExtrusionLayer::getFillExtrusionHeight() const { +PropertyValue<float> FillExtrusionLayer::getFillExtrusionHeight() const { return impl().paint.template get<FillExtrusionHeight>().value; } -void FillExtrusionLayer::setFillExtrusionHeight(DataDrivenPropertyValue<float> value) { +void FillExtrusionLayer::setFillExtrusionHeight(PropertyValue<float> value) { if (value == getFillExtrusionHeight()) return; auto impl_ = mutableImpl(); @@ -258,15 +258,15 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionHeightTransition() const { return impl().paint.template get<FillExtrusionHeight>().options; } -DataDrivenPropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionBase() { +PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionBase() { return { 0 }; } -DataDrivenPropertyValue<float> FillExtrusionLayer::getFillExtrusionBase() const { +PropertyValue<float> FillExtrusionLayer::getFillExtrusionBase() const { return impl().paint.template get<FillExtrusionBase>().value; } -void FillExtrusionLayer::setFillExtrusionBase(DataDrivenPropertyValue<float> value) { +void FillExtrusionLayer::setFillExtrusionBase(PropertyValue<float> value) { if (value == getFillExtrusionBase()) return; auto impl_ = mutableImpl(); diff --git a/src/mbgl/style/layers/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp index 99a2a51ed0..8eebd54e3c 100644 --- a/src/mbgl/style/layers/fill_layer.cpp +++ b/src/mbgl/style/layers/fill_layer.cpp @@ -123,15 +123,15 @@ TransitionOptions FillLayer::getFillAntialiasTransition() const { return impl().paint.template get<FillAntialias>().options; } -DataDrivenPropertyValue<float> FillLayer::getDefaultFillOpacity() { +PropertyValue<float> FillLayer::getDefaultFillOpacity() { return { 1 }; } -DataDrivenPropertyValue<float> FillLayer::getFillOpacity() const { +PropertyValue<float> FillLayer::getFillOpacity() const { return impl().paint.template get<FillOpacity>().value; } -void FillLayer::setFillOpacity(DataDrivenPropertyValue<float> value) { +void FillLayer::setFillOpacity(PropertyValue<float> value) { if (value == getFillOpacity()) return; auto impl_ = mutableImpl(); @@ -150,15 +150,15 @@ TransitionOptions FillLayer::getFillOpacityTransition() const { return impl().paint.template get<FillOpacity>().options; } -DataDrivenPropertyValue<Color> FillLayer::getDefaultFillColor() { +PropertyValue<Color> FillLayer::getDefaultFillColor() { return { Color::black() }; } -DataDrivenPropertyValue<Color> FillLayer::getFillColor() const { +PropertyValue<Color> FillLayer::getFillColor() const { return impl().paint.template get<FillColor>().value; } -void FillLayer::setFillColor(DataDrivenPropertyValue<Color> value) { +void FillLayer::setFillColor(PropertyValue<Color> value) { if (value == getFillColor()) return; auto impl_ = mutableImpl(); @@ -177,15 +177,15 @@ TransitionOptions FillLayer::getFillColorTransition() const { return impl().paint.template get<FillColor>().options; } -DataDrivenPropertyValue<Color> FillLayer::getDefaultFillOutlineColor() { +PropertyValue<Color> FillLayer::getDefaultFillOutlineColor() { return { {} }; } -DataDrivenPropertyValue<Color> FillLayer::getFillOutlineColor() const { +PropertyValue<Color> FillLayer::getFillOutlineColor() const { return impl().paint.template get<FillOutlineColor>().value; } -void FillLayer::setFillOutlineColor(DataDrivenPropertyValue<Color> value) { +void FillLayer::setFillOutlineColor(PropertyValue<Color> value) { if (value == getFillOutlineColor()) return; auto impl_ = mutableImpl(); diff --git a/src/mbgl/style/layers/heatmap_layer.cpp b/src/mbgl/style/layers/heatmap_layer.cpp index c2a1545a00..21016ee509 100644 --- a/src/mbgl/style/layers/heatmap_layer.cpp +++ b/src/mbgl/style/layers/heatmap_layer.cpp @@ -100,15 +100,15 @@ void HeatmapLayer::setMaxZoom(float maxZoom) { // Paint properties -DataDrivenPropertyValue<float> HeatmapLayer::getDefaultHeatmapRadius() { +PropertyValue<float> HeatmapLayer::getDefaultHeatmapRadius() { return { 30 }; } -DataDrivenPropertyValue<float> HeatmapLayer::getHeatmapRadius() const { +PropertyValue<float> HeatmapLayer::getHeatmapRadius() const { return impl().paint.template get<HeatmapRadius>().value; } -void HeatmapLayer::setHeatmapRadius(DataDrivenPropertyValue<float> value) { +void HeatmapLayer::setHeatmapRadius(PropertyValue<float> value) { if (value == getHeatmapRadius()) return; auto impl_ = mutableImpl(); @@ -127,15 +127,15 @@ TransitionOptions HeatmapLayer::getHeatmapRadiusTransition() const { return impl().paint.template get<HeatmapRadius>().options; } -DataDrivenPropertyValue<float> HeatmapLayer::getDefaultHeatmapWeight() { +PropertyValue<float> HeatmapLayer::getDefaultHeatmapWeight() { return { 1 }; } -DataDrivenPropertyValue<float> HeatmapLayer::getHeatmapWeight() const { +PropertyValue<float> HeatmapLayer::getHeatmapWeight() const { return impl().paint.template get<HeatmapWeight>().value; } -void HeatmapLayer::setHeatmapWeight(DataDrivenPropertyValue<float> value) { +void HeatmapLayer::setHeatmapWeight(PropertyValue<float> value) { if (value == getHeatmapWeight()) return; auto impl_ = mutableImpl(); diff --git a/src/mbgl/style/layers/line_layer.cpp b/src/mbgl/style/layers/line_layer.cpp index 56eac34c00..0cda849c0f 100644 --- a/src/mbgl/style/layers/line_layer.cpp +++ b/src/mbgl/style/layers/line_layer.cpp @@ -110,15 +110,15 @@ void LineLayer::setLineCap(PropertyValue<LineCapType> value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<LineJoinType> LineLayer::getDefaultLineJoin() { +PropertyValue<LineJoinType> LineLayer::getDefaultLineJoin() { return LineJoin::defaultValue(); } -DataDrivenPropertyValue<LineJoinType> LineLayer::getLineJoin() const { +PropertyValue<LineJoinType> LineLayer::getLineJoin() const { return impl().layout.get<LineJoin>(); } -void LineLayer::setLineJoin(DataDrivenPropertyValue<LineJoinType> value) { +void LineLayer::setLineJoin(PropertyValue<LineJoinType> value) { if (value == getLineJoin()) return; auto impl_ = mutableImpl(); @@ -161,15 +161,15 @@ void LineLayer::setLineRoundLimit(PropertyValue<float> value) { // Paint properties -DataDrivenPropertyValue<float> LineLayer::getDefaultLineOpacity() { +PropertyValue<float> LineLayer::getDefaultLineOpacity() { return { 1 }; } -DataDrivenPropertyValue<float> LineLayer::getLineOpacity() const { +PropertyValue<float> LineLayer::getLineOpacity() const { return impl().paint.template get<LineOpacity>().value; } -void LineLayer::setLineOpacity(DataDrivenPropertyValue<float> value) { +void LineLayer::setLineOpacity(PropertyValue<float> value) { if (value == getLineOpacity()) return; auto impl_ = mutableImpl(); @@ -188,15 +188,15 @@ TransitionOptions LineLayer::getLineOpacityTransition() const { return impl().paint.template get<LineOpacity>().options; } -DataDrivenPropertyValue<Color> LineLayer::getDefaultLineColor() { +PropertyValue<Color> LineLayer::getDefaultLineColor() { return { Color::black() }; } -DataDrivenPropertyValue<Color> LineLayer::getLineColor() const { +PropertyValue<Color> LineLayer::getLineColor() const { return impl().paint.template get<LineColor>().value; } -void LineLayer::setLineColor(DataDrivenPropertyValue<Color> value) { +void LineLayer::setLineColor(PropertyValue<Color> value) { if (value == getLineColor()) return; auto impl_ = mutableImpl(); @@ -269,15 +269,15 @@ TransitionOptions LineLayer::getLineTranslateAnchorTransition() const { return impl().paint.template get<LineTranslateAnchor>().options; } -DataDrivenPropertyValue<float> LineLayer::getDefaultLineWidth() { +PropertyValue<float> LineLayer::getDefaultLineWidth() { return { 1 }; } -DataDrivenPropertyValue<float> LineLayer::getLineWidth() const { +PropertyValue<float> LineLayer::getLineWidth() const { return impl().paint.template get<LineWidth>().value; } -void LineLayer::setLineWidth(DataDrivenPropertyValue<float> value) { +void LineLayer::setLineWidth(PropertyValue<float> value) { if (value == getLineWidth()) return; auto impl_ = mutableImpl(); @@ -296,15 +296,15 @@ TransitionOptions LineLayer::getLineWidthTransition() const { return impl().paint.template get<LineWidth>().options; } -DataDrivenPropertyValue<float> LineLayer::getDefaultLineGapWidth() { +PropertyValue<float> LineLayer::getDefaultLineGapWidth() { return { 0 }; } -DataDrivenPropertyValue<float> LineLayer::getLineGapWidth() const { +PropertyValue<float> LineLayer::getLineGapWidth() const { return impl().paint.template get<LineGapWidth>().value; } -void LineLayer::setLineGapWidth(DataDrivenPropertyValue<float> value) { +void LineLayer::setLineGapWidth(PropertyValue<float> value) { if (value == getLineGapWidth()) return; auto impl_ = mutableImpl(); @@ -323,15 +323,15 @@ TransitionOptions LineLayer::getLineGapWidthTransition() const { return impl().paint.template get<LineGapWidth>().options; } -DataDrivenPropertyValue<float> LineLayer::getDefaultLineOffset() { +PropertyValue<float> LineLayer::getDefaultLineOffset() { return { 0 }; } -DataDrivenPropertyValue<float> LineLayer::getLineOffset() const { +PropertyValue<float> LineLayer::getLineOffset() const { return impl().paint.template get<LineOffset>().value; } -void LineLayer::setLineOffset(DataDrivenPropertyValue<float> value) { +void LineLayer::setLineOffset(PropertyValue<float> value) { if (value == getLineOffset()) return; auto impl_ = mutableImpl(); @@ -350,15 +350,15 @@ TransitionOptions LineLayer::getLineOffsetTransition() const { return impl().paint.template get<LineOffset>().options; } -DataDrivenPropertyValue<float> LineLayer::getDefaultLineBlur() { +PropertyValue<float> LineLayer::getDefaultLineBlur() { return { 0 }; } -DataDrivenPropertyValue<float> LineLayer::getLineBlur() const { +PropertyValue<float> LineLayer::getLineBlur() const { return impl().paint.template get<LineBlur>().value; } -void LineLayer::setLineBlur(DataDrivenPropertyValue<float> value) { +void LineLayer::setLineBlur(PropertyValue<float> value) { if (value == getLineBlur()) return; auto impl_ = mutableImpl(); diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp index c940f3b00a..c416c6a6c5 100644 --- a/src/mbgl/style/layers/symbol_layer.cpp +++ b/src/mbgl/style/layers/symbol_layer.cpp @@ -206,15 +206,15 @@ void SymbolLayer::setIconRotationAlignment(PropertyValue<AlignmentType> value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<float> SymbolLayer::getDefaultIconSize() { +PropertyValue<float> SymbolLayer::getDefaultIconSize() { return IconSize::defaultValue(); } -DataDrivenPropertyValue<float> SymbolLayer::getIconSize() const { +PropertyValue<float> SymbolLayer::getIconSize() const { return impl().layout.get<IconSize>(); } -void SymbolLayer::setIconSize(DataDrivenPropertyValue<float> value) { +void SymbolLayer::setIconSize(PropertyValue<float> value) { if (value == getIconSize()) return; auto impl_ = mutableImpl(); @@ -254,15 +254,15 @@ void SymbolLayer::setIconTextFitPadding(PropertyValue<std::array<float, 4>> valu baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<std::string> SymbolLayer::getDefaultIconImage() { +PropertyValue<std::string> SymbolLayer::getDefaultIconImage() { return IconImage::defaultValue(); } -DataDrivenPropertyValue<std::string> SymbolLayer::getIconImage() const { +PropertyValue<std::string> SymbolLayer::getIconImage() const { return impl().layout.get<IconImage>(); } -void SymbolLayer::setIconImage(DataDrivenPropertyValue<std::string> value) { +void SymbolLayer::setIconImage(PropertyValue<std::string> value) { if (value == getIconImage()) return; auto impl_ = mutableImpl(); @@ -270,15 +270,15 @@ void SymbolLayer::setIconImage(DataDrivenPropertyValue<std::string> value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<float> SymbolLayer::getDefaultIconRotate() { +PropertyValue<float> SymbolLayer::getDefaultIconRotate() { return IconRotate::defaultValue(); } -DataDrivenPropertyValue<float> SymbolLayer::getIconRotate() const { +PropertyValue<float> SymbolLayer::getIconRotate() const { return impl().layout.get<IconRotate>(); } -void SymbolLayer::setIconRotate(DataDrivenPropertyValue<float> value) { +void SymbolLayer::setIconRotate(PropertyValue<float> value) { if (value == getIconRotate()) return; auto impl_ = mutableImpl(); @@ -318,15 +318,15 @@ void SymbolLayer::setIconKeepUpright(PropertyValue<bool> value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<std::array<float, 2>> SymbolLayer::getDefaultIconOffset() { +PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultIconOffset() { return IconOffset::defaultValue(); } -DataDrivenPropertyValue<std::array<float, 2>> SymbolLayer::getIconOffset() const { +PropertyValue<std::array<float, 2>> SymbolLayer::getIconOffset() const { return impl().layout.get<IconOffset>(); } -void SymbolLayer::setIconOffset(DataDrivenPropertyValue<std::array<float, 2>> value) { +void SymbolLayer::setIconOffset(PropertyValue<std::array<float, 2>> value) { if (value == getIconOffset()) return; auto impl_ = mutableImpl(); @@ -334,15 +334,15 @@ void SymbolLayer::setIconOffset(DataDrivenPropertyValue<std::array<float, 2>> va baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<SymbolAnchorType> SymbolLayer::getDefaultIconAnchor() { +PropertyValue<SymbolAnchorType> SymbolLayer::getDefaultIconAnchor() { return IconAnchor::defaultValue(); } -DataDrivenPropertyValue<SymbolAnchorType> SymbolLayer::getIconAnchor() const { +PropertyValue<SymbolAnchorType> SymbolLayer::getIconAnchor() const { return impl().layout.get<IconAnchor>(); } -void SymbolLayer::setIconAnchor(DataDrivenPropertyValue<SymbolAnchorType> value) { +void SymbolLayer::setIconAnchor(PropertyValue<SymbolAnchorType> value) { if (value == getIconAnchor()) return; auto impl_ = mutableImpl(); @@ -398,15 +398,15 @@ void SymbolLayer::setTextRotationAlignment(PropertyValue<AlignmentType> value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<std::string> SymbolLayer::getDefaultTextField() { +PropertyValue<std::string> SymbolLayer::getDefaultTextField() { return TextField::defaultValue(); } -DataDrivenPropertyValue<std::string> SymbolLayer::getTextField() const { +PropertyValue<std::string> SymbolLayer::getTextField() const { return impl().layout.get<TextField>(); } -void SymbolLayer::setTextField(DataDrivenPropertyValue<std::string> value) { +void SymbolLayer::setTextField(PropertyValue<std::string> value) { if (value == getTextField()) return; auto impl_ = mutableImpl(); @@ -414,15 +414,15 @@ void SymbolLayer::setTextField(DataDrivenPropertyValue<std::string> value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<std::vector<std::string>> SymbolLayer::getDefaultTextFont() { +PropertyValue<std::vector<std::string>> SymbolLayer::getDefaultTextFont() { return TextFont::defaultValue(); } -DataDrivenPropertyValue<std::vector<std::string>> SymbolLayer::getTextFont() const { +PropertyValue<std::vector<std::string>> SymbolLayer::getTextFont() const { return impl().layout.get<TextFont>(); } -void SymbolLayer::setTextFont(DataDrivenPropertyValue<std::vector<std::string>> value) { +void SymbolLayer::setTextFont(PropertyValue<std::vector<std::string>> value) { if (value == getTextFont()) return; auto impl_ = mutableImpl(); @@ -430,15 +430,15 @@ void SymbolLayer::setTextFont(DataDrivenPropertyValue<std::vector<std::string>> baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextSize() { +PropertyValue<float> SymbolLayer::getDefaultTextSize() { return TextSize::defaultValue(); } -DataDrivenPropertyValue<float> SymbolLayer::getTextSize() const { +PropertyValue<float> SymbolLayer::getTextSize() const { return impl().layout.get<TextSize>(); } -void SymbolLayer::setTextSize(DataDrivenPropertyValue<float> value) { +void SymbolLayer::setTextSize(PropertyValue<float> value) { if (value == getTextSize()) return; auto impl_ = mutableImpl(); @@ -446,15 +446,15 @@ void SymbolLayer::setTextSize(DataDrivenPropertyValue<float> value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextMaxWidth() { +PropertyValue<float> SymbolLayer::getDefaultTextMaxWidth() { return TextMaxWidth::defaultValue(); } -DataDrivenPropertyValue<float> SymbolLayer::getTextMaxWidth() const { +PropertyValue<float> SymbolLayer::getTextMaxWidth() const { return impl().layout.get<TextMaxWidth>(); } -void SymbolLayer::setTextMaxWidth(DataDrivenPropertyValue<float> value) { +void SymbolLayer::setTextMaxWidth(PropertyValue<float> value) { if (value == getTextMaxWidth()) return; auto impl_ = mutableImpl(); @@ -478,15 +478,15 @@ void SymbolLayer::setTextLineHeight(PropertyValue<float> value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextLetterSpacing() { +PropertyValue<float> SymbolLayer::getDefaultTextLetterSpacing() { return TextLetterSpacing::defaultValue(); } -DataDrivenPropertyValue<float> SymbolLayer::getTextLetterSpacing() const { +PropertyValue<float> SymbolLayer::getTextLetterSpacing() const { return impl().layout.get<TextLetterSpacing>(); } -void SymbolLayer::setTextLetterSpacing(DataDrivenPropertyValue<float> value) { +void SymbolLayer::setTextLetterSpacing(PropertyValue<float> value) { if (value == getTextLetterSpacing()) return; auto impl_ = mutableImpl(); @@ -494,15 +494,15 @@ void SymbolLayer::setTextLetterSpacing(DataDrivenPropertyValue<float> value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<TextJustifyType> SymbolLayer::getDefaultTextJustify() { +PropertyValue<TextJustifyType> SymbolLayer::getDefaultTextJustify() { return TextJustify::defaultValue(); } -DataDrivenPropertyValue<TextJustifyType> SymbolLayer::getTextJustify() const { +PropertyValue<TextJustifyType> SymbolLayer::getTextJustify() const { return impl().layout.get<TextJustify>(); } -void SymbolLayer::setTextJustify(DataDrivenPropertyValue<TextJustifyType> value) { +void SymbolLayer::setTextJustify(PropertyValue<TextJustifyType> value) { if (value == getTextJustify()) return; auto impl_ = mutableImpl(); @@ -510,15 +510,15 @@ void SymbolLayer::setTextJustify(DataDrivenPropertyValue<TextJustifyType> value) baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<SymbolAnchorType> SymbolLayer::getDefaultTextAnchor() { +PropertyValue<SymbolAnchorType> SymbolLayer::getDefaultTextAnchor() { return TextAnchor::defaultValue(); } -DataDrivenPropertyValue<SymbolAnchorType> SymbolLayer::getTextAnchor() const { +PropertyValue<SymbolAnchorType> SymbolLayer::getTextAnchor() const { return impl().layout.get<TextAnchor>(); } -void SymbolLayer::setTextAnchor(DataDrivenPropertyValue<SymbolAnchorType> value) { +void SymbolLayer::setTextAnchor(PropertyValue<SymbolAnchorType> value) { if (value == getTextAnchor()) return; auto impl_ = mutableImpl(); @@ -542,15 +542,15 @@ void SymbolLayer::setTextMaxAngle(PropertyValue<float> value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextRotate() { +PropertyValue<float> SymbolLayer::getDefaultTextRotate() { return TextRotate::defaultValue(); } -DataDrivenPropertyValue<float> SymbolLayer::getTextRotate() const { +PropertyValue<float> SymbolLayer::getTextRotate() const { return impl().layout.get<TextRotate>(); } -void SymbolLayer::setTextRotate(DataDrivenPropertyValue<float> value) { +void SymbolLayer::setTextRotate(PropertyValue<float> value) { if (value == getTextRotate()) return; auto impl_ = mutableImpl(); @@ -590,15 +590,15 @@ void SymbolLayer::setTextKeepUpright(PropertyValue<bool> value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<TextTransformType> SymbolLayer::getDefaultTextTransform() { +PropertyValue<TextTransformType> SymbolLayer::getDefaultTextTransform() { return TextTransform::defaultValue(); } -DataDrivenPropertyValue<TextTransformType> SymbolLayer::getTextTransform() const { +PropertyValue<TextTransformType> SymbolLayer::getTextTransform() const { return impl().layout.get<TextTransform>(); } -void SymbolLayer::setTextTransform(DataDrivenPropertyValue<TextTransformType> value) { +void SymbolLayer::setTextTransform(PropertyValue<TextTransformType> value) { if (value == getTextTransform()) return; auto impl_ = mutableImpl(); @@ -606,15 +606,15 @@ void SymbolLayer::setTextTransform(DataDrivenPropertyValue<TextTransformType> va baseImpl = std::move(impl_); observer->onLayerChanged(*this); } -DataDrivenPropertyValue<std::array<float, 2>> SymbolLayer::getDefaultTextOffset() { +PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultTextOffset() { return TextOffset::defaultValue(); } -DataDrivenPropertyValue<std::array<float, 2>> SymbolLayer::getTextOffset() const { +PropertyValue<std::array<float, 2>> SymbolLayer::getTextOffset() const { return impl().layout.get<TextOffset>(); } -void SymbolLayer::setTextOffset(DataDrivenPropertyValue<std::array<float, 2>> value) { +void SymbolLayer::setTextOffset(PropertyValue<std::array<float, 2>> value) { if (value == getTextOffset()) return; auto impl_ = mutableImpl(); @@ -673,15 +673,15 @@ void SymbolLayer::setTextOptional(PropertyValue<bool> value) { // Paint properties -DataDrivenPropertyValue<float> SymbolLayer::getDefaultIconOpacity() { +PropertyValue<float> SymbolLayer::getDefaultIconOpacity() { return { 1 }; } -DataDrivenPropertyValue<float> SymbolLayer::getIconOpacity() const { +PropertyValue<float> SymbolLayer::getIconOpacity() const { return impl().paint.template get<IconOpacity>().value; } -void SymbolLayer::setIconOpacity(DataDrivenPropertyValue<float> value) { +void SymbolLayer::setIconOpacity(PropertyValue<float> value) { if (value == getIconOpacity()) return; auto impl_ = mutableImpl(); @@ -700,15 +700,15 @@ TransitionOptions SymbolLayer::getIconOpacityTransition() const { return impl().paint.template get<IconOpacity>().options; } -DataDrivenPropertyValue<Color> SymbolLayer::getDefaultIconColor() { +PropertyValue<Color> SymbolLayer::getDefaultIconColor() { return { Color::black() }; } -DataDrivenPropertyValue<Color> SymbolLayer::getIconColor() const { +PropertyValue<Color> SymbolLayer::getIconColor() const { return impl().paint.template get<IconColor>().value; } -void SymbolLayer::setIconColor(DataDrivenPropertyValue<Color> value) { +void SymbolLayer::setIconColor(PropertyValue<Color> value) { if (value == getIconColor()) return; auto impl_ = mutableImpl(); @@ -727,15 +727,15 @@ TransitionOptions SymbolLayer::getIconColorTransition() const { return impl().paint.template get<IconColor>().options; } -DataDrivenPropertyValue<Color> SymbolLayer::getDefaultIconHaloColor() { +PropertyValue<Color> SymbolLayer::getDefaultIconHaloColor() { return { {} }; } -DataDrivenPropertyValue<Color> SymbolLayer::getIconHaloColor() const { +PropertyValue<Color> SymbolLayer::getIconHaloColor() const { return impl().paint.template get<IconHaloColor>().value; } -void SymbolLayer::setIconHaloColor(DataDrivenPropertyValue<Color> value) { +void SymbolLayer::setIconHaloColor(PropertyValue<Color> value) { if (value == getIconHaloColor()) return; auto impl_ = mutableImpl(); @@ -754,15 +754,15 @@ TransitionOptions SymbolLayer::getIconHaloColorTransition() const { return impl().paint.template get<IconHaloColor>().options; } -DataDrivenPropertyValue<float> SymbolLayer::getDefaultIconHaloWidth() { +PropertyValue<float> SymbolLayer::getDefaultIconHaloWidth() { return { 0 }; } -DataDrivenPropertyValue<float> SymbolLayer::getIconHaloWidth() const { +PropertyValue<float> SymbolLayer::getIconHaloWidth() const { return impl().paint.template get<IconHaloWidth>().value; } -void SymbolLayer::setIconHaloWidth(DataDrivenPropertyValue<float> value) { +void SymbolLayer::setIconHaloWidth(PropertyValue<float> value) { if (value == getIconHaloWidth()) return; auto impl_ = mutableImpl(); @@ -781,15 +781,15 @@ TransitionOptions SymbolLayer::getIconHaloWidthTransition() const { return impl().paint.template get<IconHaloWidth>().options; } -DataDrivenPropertyValue<float> SymbolLayer::getDefaultIconHaloBlur() { +PropertyValue<float> SymbolLayer::getDefaultIconHaloBlur() { return { 0 }; } -DataDrivenPropertyValue<float> SymbolLayer::getIconHaloBlur() const { +PropertyValue<float> SymbolLayer::getIconHaloBlur() const { return impl().paint.template get<IconHaloBlur>().value; } -void SymbolLayer::setIconHaloBlur(DataDrivenPropertyValue<float> value) { +void SymbolLayer::setIconHaloBlur(PropertyValue<float> value) { if (value == getIconHaloBlur()) return; auto impl_ = mutableImpl(); @@ -862,15 +862,15 @@ TransitionOptions SymbolLayer::getIconTranslateAnchorTransition() const { return impl().paint.template get<IconTranslateAnchor>().options; } -DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextOpacity() { +PropertyValue<float> SymbolLayer::getDefaultTextOpacity() { return { 1 }; } -DataDrivenPropertyValue<float> SymbolLayer::getTextOpacity() const { +PropertyValue<float> SymbolLayer::getTextOpacity() const { return impl().paint.template get<TextOpacity>().value; } -void SymbolLayer::setTextOpacity(DataDrivenPropertyValue<float> value) { +void SymbolLayer::setTextOpacity(PropertyValue<float> value) { if (value == getTextOpacity()) return; auto impl_ = mutableImpl(); @@ -889,15 +889,15 @@ TransitionOptions SymbolLayer::getTextOpacityTransition() const { return impl().paint.template get<TextOpacity>().options; } -DataDrivenPropertyValue<Color> SymbolLayer::getDefaultTextColor() { +PropertyValue<Color> SymbolLayer::getDefaultTextColor() { return { Color::black() }; } -DataDrivenPropertyValue<Color> SymbolLayer::getTextColor() const { +PropertyValue<Color> SymbolLayer::getTextColor() const { return impl().paint.template get<TextColor>().value; } -void SymbolLayer::setTextColor(DataDrivenPropertyValue<Color> value) { +void SymbolLayer::setTextColor(PropertyValue<Color> value) { if (value == getTextColor()) return; auto impl_ = mutableImpl(); @@ -916,15 +916,15 @@ TransitionOptions SymbolLayer::getTextColorTransition() const { return impl().paint.template get<TextColor>().options; } -DataDrivenPropertyValue<Color> SymbolLayer::getDefaultTextHaloColor() { +PropertyValue<Color> SymbolLayer::getDefaultTextHaloColor() { return { {} }; } -DataDrivenPropertyValue<Color> SymbolLayer::getTextHaloColor() const { +PropertyValue<Color> SymbolLayer::getTextHaloColor() const { return impl().paint.template get<TextHaloColor>().value; } -void SymbolLayer::setTextHaloColor(DataDrivenPropertyValue<Color> value) { +void SymbolLayer::setTextHaloColor(PropertyValue<Color> value) { if (value == getTextHaloColor()) return; auto impl_ = mutableImpl(); @@ -943,15 +943,15 @@ TransitionOptions SymbolLayer::getTextHaloColorTransition() const { return impl().paint.template get<TextHaloColor>().options; } -DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextHaloWidth() { +PropertyValue<float> SymbolLayer::getDefaultTextHaloWidth() { return { 0 }; } -DataDrivenPropertyValue<float> SymbolLayer::getTextHaloWidth() const { +PropertyValue<float> SymbolLayer::getTextHaloWidth() const { return impl().paint.template get<TextHaloWidth>().value; } -void SymbolLayer::setTextHaloWidth(DataDrivenPropertyValue<float> value) { +void SymbolLayer::setTextHaloWidth(PropertyValue<float> value) { if (value == getTextHaloWidth()) return; auto impl_ = mutableImpl(); @@ -970,15 +970,15 @@ TransitionOptions SymbolLayer::getTextHaloWidthTransition() const { return impl().paint.template get<TextHaloWidth>().options; } -DataDrivenPropertyValue<float> SymbolLayer::getDefaultTextHaloBlur() { +PropertyValue<float> SymbolLayer::getDefaultTextHaloBlur() { return { 0 }; } -DataDrivenPropertyValue<float> SymbolLayer::getTextHaloBlur() const { +PropertyValue<float> SymbolLayer::getTextHaloBlur() const { return impl().paint.template get<TextHaloBlur>().value; } -void SymbolLayer::setTextHaloBlur(DataDrivenPropertyValue<float> value) { +void SymbolLayer::setTextHaloBlur(PropertyValue<float> value) { if (value == getTextHaloBlur()) return; auto impl_ = mutableImpl(); diff --git a/src/mbgl/style/layout_property.hpp b/src/mbgl/style/layout_property.hpp index 8c59295ad2..0fcad30cc4 100644 --- a/src/mbgl/style/layout_property.hpp +++ b/src/mbgl/style/layout_property.hpp @@ -1,7 +1,6 @@ #pragma once #include <mbgl/style/property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/renderer/property_evaluator.hpp> #include <mbgl/renderer/data_driven_property_evaluator.hpp> @@ -23,7 +22,7 @@ template <class T> class DataDrivenLayoutProperty { public: using TransitionableType = std::nullptr_t; - using UnevaluatedType = DataDrivenPropertyValue<T>; + using UnevaluatedType = PropertyValue<T>; using EvaluatorType = DataDrivenPropertyEvaluator<T>; using PossiblyEvaluatedType = PossiblyEvaluatedPropertyValue<T>; using Type = T; diff --git a/src/mbgl/style/paint_property.hpp b/src/mbgl/style/paint_property.hpp index d51a6760c5..3d9d7710dc 100644 --- a/src/mbgl/style/paint_property.hpp +++ b/src/mbgl/style/paint_property.hpp @@ -3,7 +3,6 @@ #include <mbgl/style/color_ramp_property_value.hpp> #include <mbgl/style/properties.hpp> #include <mbgl/style/property_value.hpp> -#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/renderer/property_evaluator.hpp> #include <mbgl/renderer/cross_faded_property_evaluator.hpp> #include <mbgl/renderer/data_driven_property_evaluator.hpp> @@ -27,8 +26,8 @@ public: template <class T, class A, class U> class DataDrivenPaintProperty { public: - using TransitionableType = Transitionable<DataDrivenPropertyValue<T>>; - using UnevaluatedType = Transitioning<DataDrivenPropertyValue<T>>; + using TransitionableType = Transitionable<PropertyValue<T>>; + using UnevaluatedType = Transitioning<PropertyValue<T>>; using EvaluatorType = DataDrivenPropertyEvaluator<T>; using PossiblyEvaluatedType = PossiblyEvaluatedPropertyValue<T>; using Type = T; @@ -67,7 +66,7 @@ public: using PossiblyEvaluatedType = Color; using Type = Color; static constexpr bool IsDataDriven = false; - + static Color defaultValue() { return {}; } }; diff --git a/test/style/conversion/function.test.cpp b/test/style/conversion/function.test.cpp index 4612147f76..e63ad722cf 100644 --- a/test/style/conversion/function.test.cpp +++ b/test/style/conversion/function.test.cpp @@ -3,7 +3,6 @@ #include <mbgl/style/conversion/json.hpp> #include <mbgl/style/conversion/constant.hpp> #include <mbgl/style/conversion/property_value.hpp> -#include <mbgl/style/conversion/data_driven_property_value.hpp> #include <mbgl/style/expression/dsl.hpp> using namespace mbgl; @@ -14,7 +13,7 @@ TEST(StyleConversion, Function) { Error error; auto parseFunction = [&](const std::string& json) { - return convertJSON<PropertyValue<float>>(json, error); + return convertJSON<PropertyValue<float>>(json, error, false, false); }; auto fn1 = parseFunction(R"({"stops":[]})"); @@ -57,12 +56,12 @@ TEST(StyleConversion, CompositeFunctionExpression) { Error error; auto parseFunction = [&](const std::string& json) { - return convertJSON<DataDrivenPropertyValue<float>>(json, error, false); + return convertJSON<PropertyValue<float>>(json, error, true, false); }; auto fn1 = parseFunction(R"(["interpolate", ["linear"], ["zoom"], 0, ["number", ["get", "x"]], 10, 10])"); ASSERT_TRUE(fn1); - + auto fn2 = parseFunction(R"(["coalesce", ["interpolate", ["linear"], ["zoom"], 0, ["number", ["get", "x"]], 10, 10], 0])"); ASSERT_TRUE(fn2); diff --git a/test/style/conversion/property_value.test.cpp b/test/style/conversion/property_value.test.cpp index dcb08bcec7..e8a7d844cd 100644 --- a/test/style/conversion/property_value.test.cpp +++ b/test/style/conversion/property_value.test.cpp @@ -14,7 +14,7 @@ TEST(StyleConversion, PropertyValue) { JSDocument doc; doc.Parse<0>(R"(["literal", [1, 2]])"); auto expected = std::array<float, 2>{{1, 2}}; - auto result = convert<PropertyValue<std::array<float, 2>>>(doc, error); + auto result = convert<PropertyValue<std::array<float, 2>>>(doc, error, false, false); ASSERT_TRUE(result); ASSERT_TRUE(result->isConstant()); ASSERT_EQ(result->asConstant(), expected); diff --git a/test/style/properties.test.cpp b/test/style/properties.test.cpp index ef064ccba2..f3af1a92b2 100644 --- a/test/style/properties.test.cpp +++ b/test/style/properties.test.cpp @@ -27,7 +27,7 @@ float evaluate(Transitioning<PropertyValue<float>>& property, Duration delta = D return property.evaluate(evaluator, parameters.now); } -PossiblyEvaluatedPropertyValue<float> evaluate(Transitioning<DataDrivenPropertyValue<float>>& property, Duration delta = Duration::zero()) { +PossiblyEvaluatedPropertyValue<float> evaluateDataExpression(Transitioning<PropertyValue<float>>& property, Duration delta = Duration::zero()) { ZoomHistory zoomHistory; zoomHistory.update(0, TimePoint::min() + delta); @@ -36,12 +36,12 @@ PossiblyEvaluatedPropertyValue<float> evaluate(Transitioning<DataDrivenPropertyV TimePoint::min() + delta, Duration::zero() }; - + DataDrivenPropertyEvaluator<float> evaluator { parameters, 0.0f }; - + return property.evaluate(evaluator, parameters.now); } @@ -114,10 +114,10 @@ TEST(TransitioningDataDrivenPropertyValue, Evaluate) { TransitionOptions transition; transition.delay = { 1000ms }; transition.duration = { 1000ms }; - - Transitioning<DataDrivenPropertyValue<float>> t0 { - DataDrivenPropertyValue<float>(0.0f), - Transitioning<DataDrivenPropertyValue<float>>(), + + Transitioning<PropertyValue<float>> t0 { + PropertyValue<float>(0.0f), + Transitioning<PropertyValue<float>>(), TransitionOptions(), TimePoint::min() }; @@ -125,14 +125,14 @@ TEST(TransitioningDataDrivenPropertyValue, Evaluate) { using namespace mbgl::style::expression::dsl; PropertyExpression<float> expression(number(get("property_name"))); - Transitioning<DataDrivenPropertyValue<float>> t1 { - DataDrivenPropertyValue<float>(expression), + Transitioning<PropertyValue<float>> t1 { + PropertyValue<float>(expression), t0, transition, TimePoint::min() }; - - ASSERT_TRUE(evaluate(t0, 0ms).isConstant()); - ASSERT_FALSE(evaluate(t1, 0ms).isConstant()) << + + ASSERT_TRUE(evaluateDataExpression(t0, 0ms).isConstant()); + ASSERT_FALSE(evaluateDataExpression(t1, 0ms).isConstant()) << "A paint property transition to a data-driven evaluates immediately to the final value (see https://github.com/mapbox/mapbox-gl-native/issues/8237)."; } |