summaryrefslogtreecommitdiff
path: root/src/mbgl/style/possibly_evaluated_property_value.hpp
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-04-12 12:31:51 +0300
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-04-19 17:21:28 -0700
commit7ddca3b6116903bae9ecde1d49d29a8f1fedcec3 (patch)
treeefbdeda27dca8238965f6b7e1c263938ebe800d0 /src/mbgl/style/possibly_evaluated_property_value.hpp
parentd752235ec790f8c2d4e646c32648253ec64a60c4 (diff)
downloadqtlocation-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.hpp15
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