summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layout_property.hpp
diff options
context:
space:
mode:
authorJesse Crocker <jesse@gaiagps.com>2017-03-01 11:15:11 -0700
committerJesse Crocker <jesse@gaiagps.com>2017-03-01 11:15:11 -0700
commit9e8dc9a9e3e86adb9987ae69766cc42c7d9efece (patch)
treef5f0abd4d342c89ad0405d01969f9d6caecc1c90 /src/mbgl/style/layout_property.hpp
parent16fb0672e64a72b7400c321d55858b73cd5d8c3f (diff)
parentf28d75dccd9bf4a7615df87faccc5cf5eff8df89 (diff)
downloadqtlocation-mapboxgl-9e8dc9a9e3e86adb9987ae69766cc42c7d9efece.tar.gz
Merge remote-tracking branch 'origin/master' into feature/custom-vector-source
Diffstat (limited to 'src/mbgl/style/layout_property.hpp')
-rw-r--r--src/mbgl/style/layout_property.hpp24
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> {