diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-04-21 09:19:47 -0700 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-04-25 17:23:54 -0700 |
commit | 3c175adf30546fe58713b8fed29ac35a85e150be (patch) | |
tree | 5666e9bcf311ed1b86a13444e50dc7a030c10da9 /src/mbgl/style/paint_property.hpp | |
parent | ea8ec38df156c6683c886253dbb1f6bc828686ff (diff) | |
download | qtlocation-mapboxgl-3c175adf30546fe58713b8fed29ac35a85e150be.tar.gz |
[core] split off render layers
Diffstat (limited to 'src/mbgl/style/paint_property.hpp')
-rw-r--r-- | src/mbgl/style/paint_property.hpp | 80 |
1 files changed, 31 insertions, 49 deletions
diff --git a/src/mbgl/style/paint_property.hpp b/src/mbgl/style/paint_property.hpp index 623acef804..7f7018748c 100644 --- a/src/mbgl/style/paint_property.hpp +++ b/src/mbgl/style/paint_property.hpp @@ -203,62 +203,44 @@ public: class Unevaluated : public Tuple<UnevaluatedTypes> { public: using Tuple<UnevaluatedTypes>::Tuple; - }; - class Cascading : public Tuple<CascadingTypes> { - public: - using Tuple<CascadingTypes>::Tuple; - }; - - template <class P> - auto get(const optional<std::string>& klass) const { - return cascading.template get<P>().get(klass); - } - - template <class P> - void set(const typename P::ValueType& value, const optional<std::string>& klass) { - cascading.template get<P>().set(value, klass); - } + bool hasTransition() const { + bool result = false; + util::ignore({ result |= this->template get<Ps>().hasTransition()... }); + return result; + } - template <class P> - void setTransition(const TransitionOptions& value, const optional<std::string>& klass) { - cascading.template get<P>().setTransition(value, klass); - } - - template <class P> - auto getTransition(const optional<std::string>& klass) const { - return cascading.template get<P>().getTransition(klass); - } + template <class P> + auto evaluate(const PropertyEvaluationParameters& parameters) { + using Evaluator = typename P::EvaluatorType; - void cascade(const CascadeParameters& parameters) { - unevaluated = Unevaluated { - cascading.template get<Ps>().cascade(parameters, - std::move(unevaluated.template get<Ps>()))... - }; - } + return this->template get<P>().evaluate( + Evaluator(parameters, P::defaultValue()), + parameters.now + ); + } - template <class P> - auto evaluate(const PropertyEvaluationParameters& parameters) { - using Evaluator = typename P::EvaluatorType; - return unevaluated.template get<P>() - .evaluate(Evaluator(parameters, P::defaultValue()), parameters.now); - } + Evaluated evaluate(const PropertyEvaluationParameters& parameters) { + return Evaluated { + evaluate<Ps>(parameters)... + }; + } - void evaluate(const PropertyEvaluationParameters& parameters) { - evaluated = Evaluated { - evaluate<Ps>(parameters)... - }; - } + }; - bool hasTransition() const { - bool result = false; - util::ignore({ result |= unevaluated.template get<Ps>().hasTransition()... }); - return result; - } + class Cascading : public Tuple<CascadingTypes> { + public: + using Tuple<CascadingTypes>::Tuple; - Cascading cascading; - Unevaluated unevaluated; - Evaluated evaluated; + Unevaluated cascade(const CascadeParameters& parameters, Unevaluated&& prior) const { + return Unevaluated { + this->template get<Ps>().cascade( + parameters, + std::move(prior.template get<Ps>()) + )... + }; + } + }; }; } // namespace style |