diff options
Diffstat (limited to 'src/mbgl/style/layout_property.hpp')
-rw-r--r-- | src/mbgl/style/layout_property.hpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/mbgl/style/layout_property.hpp b/src/mbgl/style/layout_property.hpp index 6ea06ce556..25cff4b92d 100644 --- a/src/mbgl/style/layout_property.hpp +++ b/src/mbgl/style/layout_property.hpp @@ -1,6 +1,9 @@ #pragma once +#include <mbgl/style/property_value.hpp> +#include <mbgl/style/data_driven_property_value.hpp> #include <mbgl/style/property_evaluator.hpp> +#include <mbgl/style/data_driven_property_evaluator.hpp> #include <mbgl/util/indexed_tuple.hpp> namespace mbgl { @@ -11,9 +14,19 @@ class PropertyEvaluationParameters; template <class T> class LayoutProperty { public: - using EvaluatorType = PropertyEvaluator<T>; using UnevaluatedType = PropertyValue<T>; + using EvaluatorType = PropertyEvaluator<T>; using EvaluatedType = T; + using Type = T; +}; + +template <class T> +class DataDrivenLayoutProperty { +public: + using UnevaluatedType = DataDrivenPropertyValue<T>; + using EvaluatorType = DataDrivenPropertyEvaluator<T>; + using EvaluatedType = PossiblyEvaluatedPropertyValue<T>; + using Type = T; }; template <class... Ps> @@ -29,6 +42,15 @@ public: class Evaluated : public Tuple<EvaluatedTypes> { public: using Tuple<EvaluatedTypes>::Tuple; + + template <class P> + typename P::Type evaluate(float z, const GeometryTileFeature& feature) const { + using T = typename P::Type; + return this->template get<P>().match( + [&] (const T& t) { return t; }, + [&] (const SourceFunction<T>& t) { return t.evaluate(feature, P::defaultValue()); }, + [&] (const CompositeFunction<T>& t) { return t.evaluate(z, feature, P::defaultValue()); }); + } }; class Unevaluated : public Tuple<UnevaluatedTypes> { |