diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-10-28 16:39:50 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-02-02 09:44:42 -0800 |
commit | 141e995806576364d185626176c1b993fc519291 (patch) | |
tree | ecdc41fc7699f2a1a9e9456157348451ebe99597 /src/mbgl/style/cross_faded_property_evaluator.cpp | |
parent | 6a6bddb4537004cc1bfc506e76772de74d33f3f7 (diff) | |
download | qtlocation-mapboxgl-141e995806576364d185626176c1b993fc519291.tar.gz |
[core] Add support for data-driven styling
Diffstat (limited to 'src/mbgl/style/cross_faded_property_evaluator.cpp')
-rw-r--r-- | src/mbgl/style/cross_faded_property_evaluator.cpp | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/mbgl/style/cross_faded_property_evaluator.cpp b/src/mbgl/style/cross_faded_property_evaluator.cpp index 4de939576e..796ca00bbf 100644 --- a/src/mbgl/style/cross_faded_property_evaluator.cpp +++ b/src/mbgl/style/cross_faded_property_evaluator.cpp @@ -17,21 +17,10 @@ Faded<T> CrossFadedPropertyEvaluator<T>::operator()(const T& constant) const { } template <typename T> -T getBiggestStopLessThan(const Function<T>& function, float z) { - const auto& stops = function.getStops(); - for (uint32_t i = 0; i < stops.size(); i++) { - if (stops[i].first > z) { - return stops[i == 0 ? i : i - 1].second; - } - } - return stops.at(stops.size() - 1).second; -} - -template <typename T> -Faded<T> CrossFadedPropertyEvaluator<T>::operator()(const Function<T>& function) const { - return calculate(getBiggestStopLessThan(function, parameters.z - 1.0f), - getBiggestStopLessThan(function, parameters.z), - getBiggestStopLessThan(function, parameters.z + 1.0f)); +Faded<T> CrossFadedPropertyEvaluator<T>::operator()(const CameraFunction<T>& function) const { + return calculate(function.evaluate(parameters.z - 1.0f), + function.evaluate(parameters.z), + function.evaluate(parameters.z + 1.0f)); } template <typename T> |