diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-07-17 14:32:35 -0700 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-07-17 14:32:35 -0700 |
commit | 68f595a32bc746d958490c91aa7e165048491c37 (patch) | |
tree | 5401d4b124ab4bd4eb04154f49f410ec872dc061 /include | |
parent | d44742f11579c593642d12d03f3ed8c46c9bb056 (diff) | |
download | qtlocation-mapboxgl-68f595a32bc746d958490c91aa7e165048491c37.tar.gz |
consolidate functions to only use stops
refs mapbox/mapbox-gl-style-spec#96
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/style/function_properties.hpp | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/include/mbgl/style/function_properties.hpp b/include/mbgl/style/function_properties.hpp index 74ac80f83c..8cd7ce6e28 100644 --- a/include/mbgl/style/function_properties.hpp +++ b/include/mbgl/style/function_properties.hpp @@ -17,43 +17,19 @@ private: }; template <typename T> -struct LinearFunction { - inline LinearFunction(const T &value, float z_base, float slope, const T &min, const T &max) - : value(value), min(min), max(max), z_base(z_base), slope(slope) {} - T evaluate(float z) const; - -private: - const T value, min, max; - const float z_base, slope; -}; - -template <typename T> -struct ExponentialFunction { - inline ExponentialFunction(const T &value, float z_base, float exp_base, float slope, const T &min, - const T &max) - : value(value), min(min), max(max), z_base(z_base), exp_base(exp_base), slope(slope) {} - T evaluate(float z) const; - -private: - const T value, min, max; - const float z_base, exp_base, slope; -}; - -template <typename T> struct StopsFunction { - inline StopsFunction(const std::vector<std::pair<float, T>> &values) : values(values) {} + inline StopsFunction(const std::vector<std::pair<float, T>> &values, float base) : values(values), base(base) {} T evaluate(float z) const; private: const std::vector<std::pair<float, T>> values; + const float base; }; template <typename T> using Function = util::variant< std::false_type, ConstantFunction<T>, - LinearFunction<T>, - ExponentialFunction<T>, StopsFunction<T> >; |