diff options
Diffstat (limited to 'src/mbgl/style/possibly_evaluated_property_value.hpp')
-rw-r--r-- | src/mbgl/style/possibly_evaluated_property_value.hpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mbgl/style/possibly_evaluated_property_value.hpp b/src/mbgl/style/possibly_evaluated_property_value.hpp index 8c3f1780a6..9cb5f6e81b 100644 --- a/src/mbgl/style/possibly_evaluated_property_value.hpp +++ b/src/mbgl/style/possibly_evaluated_property_value.hpp @@ -7,8 +7,6 @@ namespace mbgl { -class GeometryTileFeature; - namespace style { template <class T> @@ -43,6 +41,19 @@ public: auto match(Ts&&... ts) const { return value.match(std::forward<Ts>(ts)...); } + + template <class Feature> + T evaluate(const Feature& feature, float zoom, T defaultValue) const { + return this->match( + [&] (const T& constant) { return constant; }, + [&] (const SourceFunction<T>& function) { + return function.evaluate(feature, defaultValue); + }, + [&] (const CompositeFunction<T>& function) { + return function.evaluate(zoom, feature, defaultValue); + } + ); + } }; } // namespace style |