diff options
Diffstat (limited to 'src/mbgl/style/properties.hpp')
-rw-r--r-- | src/mbgl/style/properties.hpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mbgl/style/properties.hpp b/src/mbgl/style/properties.hpp index 7f58ff223d..9d66f850de 100644 --- a/src/mbgl/style/properties.hpp +++ b/src/mbgl/style/properties.hpp @@ -9,6 +9,8 @@ #include <mbgl/util/indexed_tuple.hpp> #include <mbgl/util/ignore.hpp> +#include <bitset> + namespace mbgl { class GeometryTileFeature; @@ -102,6 +104,22 @@ struct IsDataDriven : std::integral_constant<bool, P::IsDataDriven> {}; template <class P> struct IsOverridable : std::integral_constant<bool, P::IsOverridable> {}; +template <class Ps> +struct ConstantsMask; + +template <class... Ps> +struct ConstantsMask<TypeList<Ps...>> { + template <class Properties> + static unsigned long getMask(const Properties& properties) { + std::bitset<sizeof... (Ps)> result; + util::ignore({ + result.set(TypeIndex<Ps, Ps...>::value, + properties.template get<Ps>().isConstant())... + }); + return result.to_ulong(); + } +}; + template <class... Ps> class Properties { public: @@ -172,6 +190,10 @@ public: evaluate<Ps>(z, feature)... }; } + + unsigned long constantsMask() const { + return ConstantsMask<DataDrivenProperties>::getMask(*this); + } }; class Unevaluated : public Tuple<UnevaluatedTypes> { |