diff options
Diffstat (limited to 'include/mbgl/style/conversion/data_driven_property_value.hpp')
-rw-r--r-- | include/mbgl/style/conversion/data_driven_property_value.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/mbgl/style/conversion/data_driven_property_value.hpp b/include/mbgl/style/conversion/data_driven_property_value.hpp index 79b15dcfb0..ed8478a108 100644 --- a/include/mbgl/style/conversion/data_driven_property_value.hpp +++ b/include/mbgl/style/conversion/data_driven_property_value.hpp @@ -4,6 +4,8 @@ #include <mbgl/style/conversion.hpp> #include <mbgl/style/conversion/constant.hpp> #include <mbgl/style/conversion/function.hpp> +#include <mbgl/style/conversion/expression.hpp> +#include <mbgl/style/expression/value.hpp> namespace mbgl { namespace style { @@ -21,6 +23,18 @@ struct Converter<DataDrivenPropertyValue<T>> { return {}; } return DataDrivenPropertyValue<T>(*constant); + } else if (objectMember(value, "expression")) { + optional<std::unique_ptr<Expression>> expression = convert<std::unique_ptr<Expression>>(*objectMember(value, "expression"), error, valueTypeToExpressionType<T>()); + if (!expression) { + return {}; + } + if ((*expression)->isFeatureConstant()) { + return DataDrivenPropertyValue<T>(CameraFunction<T>(std::move(*expression))); + } else if ((*expression)->isZoomConstant()) { + return DataDrivenPropertyValue<T>(SourceFunction<T>(std::move(*expression))); + } else { + return DataDrivenPropertyValue<T>(CompositeFunction<T>(std::move(*expression))); + } } else if (!objectMember(value, "property")) { optional<CameraFunction<T>> function = convert<CameraFunction<T>>(value, error); if (!function) { |