summaryrefslogtreecommitdiff
path: root/include/mbgl/style/function/composite_exponential_stops.hpp
blob: f1ad32a04d9f188fcb5f52388f3888f175cb4f05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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