diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-01-31 15:44:18 +0200 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-02-02 09:44:42 -0800 |
commit | 8a5bff8ee630673c6ebc496322eab94a41ae9353 (patch) | |
tree | 8bb6428cd9c3d591c237d77f94d4b0e56efb0ee0 /src/mbgl/style/layout_property.hpp | |
parent | 141e995806576364d185626176c1b993fc519291 (diff) | |
download | qtlocation-mapboxgl-8a5bff8ee630673c6ebc496322eab94a41ae9353.tar.gz |
[core] default value support in categorical function conversion
Diffstat (limited to 'src/mbgl/style/layout_property.hpp')
-rw-r--r-- | src/mbgl/style/layout_property.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mbgl/style/layout_property.hpp b/src/mbgl/style/layout_property.hpp index 7ce2ecc7b8..25cff4b92d 100644 --- a/src/mbgl/style/layout_property.hpp +++ b/src/mbgl/style/layout_property.hpp @@ -17,6 +17,7 @@ public: using UnevaluatedType = PropertyValue<T>; using EvaluatorType = PropertyEvaluator<T>; using EvaluatedType = T; + using Type = T; }; template <class T> @@ -25,6 +26,7 @@ public: using UnevaluatedType = DataDrivenPropertyValue<T>; using EvaluatorType = DataDrivenPropertyEvaluator<T>; using EvaluatedType = PossiblyEvaluatedPropertyValue<T>; + using Type = T; }; template <class... Ps> @@ -40,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> { |