summaryrefslogtreecommitdiff
path: root/src/mbgl/style/class_properties.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/class_properties.hpp')
-rw-r--r--src/mbgl/style/class_properties.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mbgl/style/class_properties.hpp b/src/mbgl/style/class_properties.hpp
index d115f14d50..84b91d769e 100644
--- a/src/mbgl/style/class_properties.hpp
+++ b/src/mbgl/style/class_properties.hpp
@@ -3,6 +3,7 @@
#include <mbgl/style/property_key.hpp>
#include <mbgl/style/property_value.hpp>
+#include <mbgl/style/property_evaluator.hpp>
#include <mbgl/style/property_transition.hpp>
#include <map>
@@ -29,6 +30,15 @@ public:
return properties.end();
}
+ template <typename T>
+ void calculate(PropertyKey key, T& target, const float z) const {
+ auto it = properties.find(key);
+ if (it != properties.end()) {
+ const PropertyEvaluator<T> evaluator(z);
+ target = mapbox::util::apply_visitor(evaluator, it->second);
+ }
+ }
+
public:
std::map<PropertyKey, PropertyValue> properties;
std::map<PropertyKey, PropertyTransition> transitions;