diff options
author | zmiao <miao.zhao@mapbox.com> | 2020-02-12 12:28:05 +0200 |
---|---|---|
committer | zmiao <miao.zhao@mapbox.com> | 2020-02-12 17:35:18 +0200 |
commit | 759dfe8bf630b30173880551db70f54c43697b98 (patch) | |
tree | 504c1da77f53aa33dda0e71f3276a5491e1f3135 /src/mbgl/style/properties.hpp | |
parent | c57af518426acc99fada188990e831cacc8170fe (diff) | |
download | qtlocation-mapboxgl-759dfe8bf630b30173880551db70f54c43697b98.tar.gz |
[core] Support [within expression] with layout property
Diffstat (limited to 'src/mbgl/style/properties.hpp')
-rw-r--r-- | src/mbgl/style/properties.hpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/mbgl/style/properties.hpp b/src/mbgl/style/properties.hpp index 2fab53ad12..39b6672734 100644 --- a/src/mbgl/style/properties.hpp +++ b/src/mbgl/style/properties.hpp @@ -169,6 +169,11 @@ public: } template <class T> + static T evaluate(float, const GeometryTileFeature&, const CanonicalTileID&, const T& t, const T&) { + return t; + } + + template <class T> static T evaluate(float z, const GeometryTileFeature& feature, const PossiblyEvaluatedPropertyValue<T>& v, @@ -194,6 +199,30 @@ public: } template <class T> + static T evaluate(float z, + const GeometryTileFeature& feature, + const PossiblyEvaluatedPropertyValue<T>& v, + const T& defaultValue, + const std::set<std::string>& availableImages, + const CanonicalTileID& canonical) { + return v.match([&](const T& t) { return t; }, + [&](const PropertyExpression<T>& t) { + return t.evaluate(z, feature, availableImages, canonical, defaultValue); + }); + } + + template <class T> + static T evaluate(float z, + const GeometryTileFeature& feature, + const CanonicalTileID& canonical, + const PossiblyEvaluatedPropertyValue<T>& v, + const T& defaultValue) { + return v.match( + [&](const T& t) { return t; }, + [&](const PropertyExpression<T>& t) { return t.evaluate(z, feature, canonical, defaultValue); }); + } + + template <class T> static T evaluate(float z, const GeometryTileFeature& feature, const FeatureState& state, const PossiblyEvaluatedPropertyValue<T>& v, const T& defaultValue) { return v.match([&](const T& t) { return t; }, @@ -220,6 +249,14 @@ public: return evaluate(z, feature, this->template get<P>(), P::defaultValue(), availableImages); } + template <class P> + auto evaluate(float z, + const GeometryTileFeature& feature, + const std::set<std::string>& availableImages, + const CanonicalTileID& canonical) const { + return evaluate(z, feature, this->template get<P>(), P::defaultValue(), availableImages, canonical); + } + Evaluated evaluate(float z, const GeometryTileFeature& feature) const { return Evaluated { evaluate<Ps>(z, feature)... |