diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-04-12 12:31:51 +0300 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-04-19 17:21:28 -0700 |
commit | 7ddca3b6116903bae9ecde1d49d29a8f1fedcec3 (patch) | |
tree | efbdeda27dca8238965f6b7e1c263938ebe800d0 /src/mbgl/style/possibly_evaluated_property_value.hpp | |
parent | d752235ec790f8c2d4e646c32648253ec64a60c4 (diff) | |
download | qtlocation-mapboxgl-7ddca3b6116903bae9ecde1d49d29a8f1fedcec3.tar.gz |
[core] account for property functions in query rendered features
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 |