diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2018-06-29 12:52:08 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2018-07-13 13:37:27 -0700 |
commit | a6727921fc1608d341c086cd70341e6df5e79a2b (patch) | |
tree | 3d856db5fc934256962a75808ec1a821c457aa02 /include/mbgl/style/function/interval_stops.hpp | |
parent | bea8f8d177905bfb74e8b5c2d5e7750b3d6bad8e (diff) | |
download | qtlocation-mapboxgl-a6727921fc1608d341c086cd70341e6df5e79a2b.tar.gz |
[core] Convert legacy functions directly to expressions
Diffstat (limited to 'include/mbgl/style/function/interval_stops.hpp')
-rw-r--r-- | include/mbgl/style/function/interval_stops.hpp | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/include/mbgl/style/function/interval_stops.hpp b/include/mbgl/style/function/interval_stops.hpp deleted file mode 100644 index 45e2dc6f2e..0000000000 --- a/include/mbgl/style/function/interval_stops.hpp +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -#include <mbgl/util/feature.hpp> - -#include <map> - -namespace mbgl { -namespace style { - -template <class T> -class IntervalStops { -public: - using Stops = std::map<float, T>; - Stops stops; - - IntervalStops() = default; - IntervalStops(Stops stops_) - : stops(std::move(stops_)) { - } - - optional<T> evaluate(float z) const { - if (stops.empty()) { - return {}; - } - - auto it = stops.upper_bound(z); - if (it == stops.end()) { - return stops.rbegin()->second; - } else if (it == stops.begin()) { - return stops.begin()->second; - } else { - return std::prev(it)->second; - } - } - - optional<T> evaluate(const Value& value) const { - optional<float> z = numericValue<float>(value); - if (!z) { - return {}; - } - return evaluate(*z); - } - - friend bool operator==(const IntervalStops& lhs, - const IntervalStops& rhs) { - return lhs.stops == rhs.stops; - } -}; - -} // namespace style -} // namespace mbgl |