summaryrefslogtreecommitdiff
path: root/include/mbgl/style/function/composite_exponential_stops.hpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-02-07 12:35:27 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-02-09 11:16:26 -0600
commitf35ca0d9dfc8a6ba88273edbeda43e633ae0adce (patch)
tree74c11b9c7125c22516a5cbc46322763a72964c43 /include/mbgl/style/function/composite_exponential_stops.hpp
parent9df24addfbfd922baada7d9778f402b91e69ed33 (diff)
downloadqtlocation-mapboxgl-f35ca0d9dfc8a6ba88273edbeda43e633ae0adce.tar.gz
[core, ios, macos] Refactor composite stop types and conversions
Diffstat (limited to 'include/mbgl/style/function/composite_exponential_stops.hpp')
-rw-r--r--include/mbgl/style/function/composite_exponential_stops.hpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/mbgl/style/function/composite_exponential_stops.hpp b/include/mbgl/style/function/composite_exponential_stops.hpp
new file mode 100644
index 0000000000..f1ad32a04d
--- /dev/null
+++ b/include/mbgl/style/function/composite_exponential_stops.hpp
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <mbgl/style/function/exponential_stops.hpp>
+
+#include <map>
+
+namespace mbgl {
+namespace style {
+
+template <class T>
+class CompositeExponentialStops {
+public:
+ using Stops = std::map<float, std::map<float, T>>;
+
+ Stops stops;
+ float base = 1.0f;
+
+ CompositeExponentialStops() = default;
+ CompositeExponentialStops(Stops stops_, float base_ = 1.0f)
+ : stops(std::move(stops_)),
+ base(base_) {
+ }
+
+ ExponentialStops<T> innerStops(const std::map<float, T>& stops_) const {
+ return ExponentialStops<T>(stops_, base);
+ }
+
+ friend bool operator==(const CompositeExponentialStops& lhs,
+ const CompositeExponentialStops& rhs) {
+ return lhs.stops == rhs.stops && lhs.base == rhs.base;
+ }
+};
+
+} // namespace style
+} // namespace mbgl