diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-11-30 10:31:55 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-12-06 15:05:45 -0800 |
commit | cc6e5c9df9b7b42eba9cdb51bea529c1d5c3a497 (patch) | |
tree | 91b85aaa13e4e34539923a59d08f316c4cb49562 | |
parent | 05b0dcd0f87b90d179d9d0aeeb6a618b9f836a79 (diff) | |
download | qtlocation-mapboxgl-cc6e5c9df9b7b42eba9cdb51bea529c1d5c3a497.tar.gz |
[core] Move CrossFadedPropertyEvaluator to its own file
-rw-r--r-- | cmake/core-files.cmake | 3 | ||||
-rw-r--r-- | src/mbgl/programs/fill_program.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/style/cross_faded_property_evaluator.cpp (renamed from src/mbgl/style/property_evaluator.cpp) | 2 | ||||
-rw-r--r-- | src/mbgl/style/cross_faded_property_evaluator.hpp | 48 | ||||
-rw-r--r-- | src/mbgl/style/paint_property.hpp | 1 | ||||
-rw-r--r-- | src/mbgl/style/property_evaluator.hpp | 38 |
6 files changed, 53 insertions, 41 deletions
diff --git a/cmake/core-files.cmake b/cmake/core-files.cmake index a819675f4f..6a87be8b5f 100644 --- a/cmake/core-files.cmake +++ b/cmake/core-files.cmake @@ -218,6 +218,8 @@ set(MBGL_CORE_FILES src/mbgl/style/cascade_parameters.hpp src/mbgl/style/class_dictionary.cpp src/mbgl/style/class_dictionary.hpp + src/mbgl/style/cross_faded_property_evaluator.cpp + src/mbgl/style/cross_faded_property_evaluator.hpp src/mbgl/style/function.cpp src/mbgl/style/layer.cpp src/mbgl/style/layer_impl.cpp @@ -229,7 +231,6 @@ set(MBGL_CORE_FILES src/mbgl/style/parser.cpp src/mbgl/style/parser.hpp src/mbgl/style/property_evaluation_parameters.hpp - src/mbgl/style/property_evaluator.cpp src/mbgl/style/property_evaluator.hpp src/mbgl/style/property_parsing.cpp src/mbgl/style/property_parsing.hpp diff --git a/src/mbgl/programs/fill_program.cpp b/src/mbgl/programs/fill_program.cpp index 90c09a995c..a8154d08f9 100644 --- a/src/mbgl/programs/fill_program.cpp +++ b/src/mbgl/programs/fill_program.cpp @@ -1,6 +1,6 @@ #include <mbgl/programs/fill_program.hpp> #include <mbgl/sprite/sprite_atlas.hpp> -#include <mbgl/style/property_evaluator.hpp> +#include <mbgl/style/cross_faded_property_evaluator.hpp> #include <mbgl/tile/tile_id.hpp> #include <mbgl/map/transform_state.hpp> diff --git a/src/mbgl/style/property_evaluator.cpp b/src/mbgl/style/cross_faded_property_evaluator.cpp index b8e07ff116..4de939576e 100644 --- a/src/mbgl/style/property_evaluator.cpp +++ b/src/mbgl/style/cross_faded_property_evaluator.cpp @@ -1,4 +1,4 @@ -#include <mbgl/style/property_evaluator.hpp> +#include <mbgl/style/cross_faded_property_evaluator.hpp> #include <mbgl/util/chrono.hpp> #include <cmath> diff --git a/src/mbgl/style/cross_faded_property_evaluator.hpp b/src/mbgl/style/cross_faded_property_evaluator.hpp new file mode 100644 index 0000000000..70c8c0c978 --- /dev/null +++ b/src/mbgl/style/cross_faded_property_evaluator.hpp @@ -0,0 +1,48 @@ +#pragma once + +#include <mbgl/style/property_value.hpp> +#include <mbgl/style/property_evaluation_parameters.hpp> +#include <mbgl/util/interpolate.hpp> + +namespace mbgl { +namespace style { + +template <typename T> +class Faded { +public: + T from; + T to; + float fromScale; + float toScale; + float t; +}; + +template <typename T> +class CrossFadedPropertyEvaluator { +public: + using ResultType = Faded<T>; + + CrossFadedPropertyEvaluator(const PropertyEvaluationParameters& parameters_, T defaultValue_) + : parameters(parameters_), + defaultValue(std::move(defaultValue_)) {} + + Faded<T> operator()(const Undefined&) const; + Faded<T> operator()(const T& constant) const; + Faded<T> operator()(const Function<T>&) const; + +private: + Faded<T> calculate(const T& min, const T& mid, const T& max) const; + + const PropertyEvaluationParameters& parameters; + T defaultValue; +}; + +} // namespace style + +namespace util { +template <typename T> +struct Interpolator<style::Faded<T>> + : Uninterpolated {}; +} // namespace util + +} // namespace mbgl diff --git a/src/mbgl/style/paint_property.hpp b/src/mbgl/style/paint_property.hpp index bd25877d11..15df2a77c7 100644 --- a/src/mbgl/style/paint_property.hpp +++ b/src/mbgl/style/paint_property.hpp @@ -2,6 +2,7 @@ #include <mbgl/style/class_dictionary.hpp> #include <mbgl/style/property_evaluator.hpp> +#include <mbgl/style/cross_faded_property_evaluator.hpp> #include <mbgl/style/transition_options.hpp> #include <mbgl/style/cascade_parameters.hpp> #include <mbgl/style/property_evaluation_parameters.hpp> diff --git a/src/mbgl/style/property_evaluator.hpp b/src/mbgl/style/property_evaluator.hpp index 1c5a201413..ca4962d948 100644 --- a/src/mbgl/style/property_evaluator.hpp +++ b/src/mbgl/style/property_evaluator.hpp @@ -2,7 +2,6 @@ #include <mbgl/style/property_value.hpp> #include <mbgl/style/property_evaluation_parameters.hpp> -#include <mbgl/util/interpolate.hpp> namespace mbgl { namespace style { @@ -25,42 +24,5 @@ private: T defaultValue; }; -template <typename T> -class Faded { -public: - T from; - T to; - float fromScale; - float toScale; - float t; -}; - -template <typename T> -class CrossFadedPropertyEvaluator { -public: - using ResultType = Faded<T>; - - CrossFadedPropertyEvaluator(const PropertyEvaluationParameters& parameters_, T defaultValue_) - : parameters(parameters_), - defaultValue(std::move(defaultValue_)) {} - - Faded<T> operator()(const Undefined&) const; - Faded<T> operator()(const T& constant) const; - Faded<T> operator()(const Function<T>&) const; - -private: - Faded<T> calculate(const T& min, const T& mid, const T& max) const; - - const PropertyEvaluationParameters& parameters; - T defaultValue; -}; - } // namespace style - -namespace util { -template <typename T> -struct Interpolator<style::Faded<T>> - : Uninterpolated {}; -} // namespace util - } // namespace mbgl |