summaryrefslogtreecommitdiff
path: root/src/mbgl/style/property_evaluator.hpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-10-30 11:06:59 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-11-17 15:13:38 -0800
commit38fcbe21d48186c4630a3b8a76d1b20e156faadd (patch)
tree098f73bfea98deb5202fe1c13b1277e43e322755 /src/mbgl/style/property_evaluator.hpp
parentd4fc66af3924805d40576989c1e139ddafcc4670 (diff)
downloadqtlocation-mapboxgl-38fcbe21d48186c4630a3b8a76d1b20e156faadd.tar.gz
[core] Convert style properties to a tuple-based approach
This converts the style property classes (CirclePaintProperties and so on) to the same tuple-based approach as gl::Attribute and gl::Uniform. The approach is outlined in https://github.com/mapbox/cpp/blob/master/C%2B%2B%20Structural%20Metaprogramming.md. The main advantage of this approach is it allows writing algorithms that work on sets of style properties, without resorting to code generation or manually repetitive code. This lets us iterate on approaches to data-driven properties more easily. Another advantage is that the cascading, unevaluated, and evaluated states of a set of properties exist as independent structures, instead of individual properties holding their own state. This is a more functional approach that makes data flow clearer and reduces state.
Diffstat (limited to 'src/mbgl/style/property_evaluator.hpp')
-rw-r--r--src/mbgl/style/property_evaluator.hpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mbgl/style/property_evaluator.hpp b/src/mbgl/style/property_evaluator.hpp
index 3f657fe3f4..c93a11a4e1 100644
--- a/src/mbgl/style/property_evaluator.hpp
+++ b/src/mbgl/style/property_evaluator.hpp
@@ -6,14 +6,14 @@
namespace mbgl {
namespace style {
-class CalculationParameters;
+class PropertyEvaluationParameters;
template <typename T>
class PropertyEvaluator {
public:
using ResultType = T;
- PropertyEvaluator(const CalculationParameters& parameters_, T defaultValue_)
+ PropertyEvaluator(const PropertyEvaluationParameters& parameters_, T defaultValue_)
: parameters(parameters_),
defaultValue(std::move(defaultValue_)) {}
@@ -22,7 +22,7 @@ public:
T operator()(const Function<T>&) const;
private:
- const CalculationParameters& parameters;
+ const PropertyEvaluationParameters& parameters;
T defaultValue;
};
@@ -41,7 +41,7 @@ class CrossFadedPropertyEvaluator {
public:
using ResultType = Faded<T>;
- CrossFadedPropertyEvaluator(const CalculationParameters& parameters_, T defaultValue_)
+ CrossFadedPropertyEvaluator(const PropertyEvaluationParameters& parameters_, T defaultValue_)
: parameters(parameters_),
defaultValue(std::move(defaultValue_)) {}
@@ -52,7 +52,7 @@ public:
private:
Faded<T> calculate(const T& min, const T& mid, const T& max) const;
- const CalculationParameters& parameters;
+ const PropertyEvaluationParameters& parameters;
T defaultValue;
};