summaryrefslogtreecommitdiff
path: root/src/mbgl
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 /src/mbgl
parent9df24addfbfd922baada7d9778f402b91e69ed33 (diff)
downloadqtlocation-mapboxgl-f35ca0d9dfc8a6ba88273edbeda43e633ae0adce.tar.gz
[core, ios, macos] Refactor composite stop types and conversions
Diffstat (limited to 'src/mbgl')
-rw-r--r--src/mbgl/style/conversion/stringify.hpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/mbgl/style/conversion/stringify.hpp b/src/mbgl/style/conversion/stringify.hpp
index 5aab1076fd..4b9cf6d26e 100644
--- a/src/mbgl/style/conversion/stringify.hpp
+++ b/src/mbgl/style/conversion/stringify.hpp
@@ -257,31 +257,29 @@ public:
}
template <class T>
- void operator()(const std::map<float, ExponentialStops<T>>& f) {
+ void operator()(const CompositeExponentialStops<T>& f) {
writer.Key("type");
writer.String("exponential");
- if (!f.empty()) {
- writer.Key("base");
- writer.Double(f.begin()->second.base);
- }
+ writer.Key("base");
+ writer.Double(f.base);
writer.Key("stops");
- stringifyCompositeStops(f);
+ stringifyCompositeStops(f.stops);
}
template <class T>
- void operator()(const std::map<float, IntervalStops<T>>& f) {
+ void operator()(const CompositeIntervalStops<T>& f) {
writer.Key("type");
writer.String("interval");
writer.Key("stops");
- stringifyCompositeStops(f);
+ stringifyCompositeStops(f.stops);
}
template <class T>
- void operator()(const std::map<float, CategoricalStops<T>>& f) {
+ void operator()(const CompositeCategoricalStops<T>& f) {
writer.Key("type");
writer.String("categorical");
writer.Key("stops");
- stringifyCompositeStops(f);
+ stringifyCompositeStops(f.stops);
}
private:
@@ -301,7 +299,7 @@ private:
void stringifyCompositeStops(const std::map<float, InnerStops>& stops) {
writer.StartArray();
for (const auto& outer : stops) {
- for (const auto& inner : outer.second.stops) {
+ for (const auto& inner : outer.second) {
writer.StartArray();
writer.StartObject();
writer.Key("zoom");