summaryrefslogtreecommitdiff
path: root/src/mbgl/style
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style')
-rw-r--r--src/mbgl/style/function.hpp28
-rw-r--r--src/mbgl/style/function_evaluator.hpp2
-rw-r--r--src/mbgl/style/layout_property.hpp2
-rw-r--r--src/mbgl/style/paint_property.hpp2
-rw-r--r--src/mbgl/style/property_parsing.cpp3
-rw-r--r--src/mbgl/style/property_parsing.hpp1
-rw-r--r--src/mbgl/style/render_item.hpp6
-rw-r--r--src/mbgl/style/style.cpp58
-rw-r--r--src/mbgl/style/style.hpp10
-rw-r--r--src/mbgl/style/style_layer.cpp17
-rw-r--r--src/mbgl/style/style_layer.hpp102
-rw-r--r--src/mbgl/style/style_parser.cpp65
-rw-r--r--src/mbgl/style/style_parser.hpp13
13 files changed, 81 insertions, 228 deletions
diff --git a/src/mbgl/style/function.hpp b/src/mbgl/style/function.hpp
deleted file mode 100644
index a04fc8bb4f..0000000000
--- a/src/mbgl/style/function.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#pragma once
-
-#include <vector>
-#include <utility>
-
-namespace mbgl {
-
-template <typename T>
-class Function {
-public:
- using Stop = std::pair<float, T>;
- using Stops = std::vector<Stop>;
-
- explicit Function(const T& constant)
- : stops({{ 0, constant }}) {}
-
- explicit Function(const Stops& stops_, float base_)
- : base(base_), stops(stops_) {}
-
- float getBase() const { return base; }
- const std::vector<std::pair<float, T>>& getStops() const { return stops; }
-
-private:
- float base = 1;
- std::vector<std::pair<float, T>> stops;
-};
-
-} // namespace mbgl
diff --git a/src/mbgl/style/function_evaluator.hpp b/src/mbgl/style/function_evaluator.hpp
index 43549179df..de49e79f98 100644
--- a/src/mbgl/style/function_evaluator.hpp
+++ b/src/mbgl/style/function_evaluator.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include <mbgl/style/function.hpp>
+#include <mbgl/style/types.hpp>
#include <mbgl/util/interpolate.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/layout_property.hpp b/src/mbgl/style/layout_property.hpp
index 1df780be52..a856e7589c 100644
--- a/src/mbgl/style/layout_property.hpp
+++ b/src/mbgl/style/layout_property.hpp
@@ -1,7 +1,6 @@
#pragma once
#include <mbgl/style/property_parsing.hpp>
-#include <mbgl/style/function.hpp>
#include <mbgl/style/function_evaluator.hpp>
#include <mbgl/util/rapidjson.hpp>
@@ -27,7 +26,6 @@ public:
}
}
- void operator=(const T& v) { value = v; }
operator T() const { return value; }
optional<Function<T>> parsedValue;
diff --git a/src/mbgl/style/paint_property.hpp b/src/mbgl/style/paint_property.hpp
index 256f045d0d..4bbc564398 100644
--- a/src/mbgl/style/paint_property.hpp
+++ b/src/mbgl/style/paint_property.hpp
@@ -2,7 +2,6 @@
#include <mbgl/style/class_dictionary.hpp>
#include <mbgl/style/property_parsing.hpp>
-#include <mbgl/style/function.hpp>
#include <mbgl/style/function_evaluator.hpp>
#include <mbgl/style/property_transition.hpp>
#include <mbgl/style/style_cascade_parameters.hpp>
@@ -97,7 +96,6 @@ public:
return cascaded->prior.operator bool();
}
- void operator=(const T& v) { values.emplace(ClassID::Default, Fn(v)); }
operator T() const { return value; }
std::map<ClassID, Fn> values;
diff --git a/src/mbgl/style/property_parsing.cpp b/src/mbgl/style/property_parsing.cpp
index 362b0d7b5a..67baa3ec8d 100644
--- a/src/mbgl/style/property_parsing.cpp
+++ b/src/mbgl/style/property_parsing.cpp
@@ -1,4 +1,7 @@
#include <mbgl/style/property_parsing.hpp>
+#include <mbgl/style/property_transition.hpp>
+
+#include <mbgl/platform/log.hpp>
#include <csscolorparser/csscolorparser.hpp>
diff --git a/src/mbgl/style/property_parsing.hpp b/src/mbgl/style/property_parsing.hpp
index 8deb58c00b..17c9bf6ba8 100644
--- a/src/mbgl/style/property_parsing.hpp
+++ b/src/mbgl/style/property_parsing.hpp
@@ -1,7 +1,6 @@
#pragma once
#include <mbgl/style/types.hpp>
-#include <mbgl/style/function.hpp>
#include <mbgl/style/property_transition.hpp>
#include <mbgl/util/rapidjson.hpp>
diff --git a/src/mbgl/style/render_item.hpp b/src/mbgl/style/render_item.hpp
index a70c92f620..ebf6799828 100644
--- a/src/mbgl/style/render_item.hpp
+++ b/src/mbgl/style/render_item.hpp
@@ -2,12 +2,12 @@
namespace mbgl {
-class StyleLayer;
+class Layer;
class Tile;
class Bucket;
struct RenderItem {
- inline RenderItem(const StyleLayer& layer_,
+ inline RenderItem(const Layer& layer_,
const Tile* tile_ = nullptr,
Bucket* bucket_ = nullptr)
: tile(tile_), bucket(bucket_), layer(layer_) {
@@ -15,7 +15,7 @@ struct RenderItem {
const Tile* const tile;
Bucket* const bucket;
- const StyleLayer& layer;
+ const Layer& layer;
};
} // namespace mbgl
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index bc2a1d9a40..ee847ccf57 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -4,10 +4,14 @@
#include <mbgl/tile/tile.hpp>
#include <mbgl/map/transform_state.hpp>
#include <mbgl/layer/symbol_layer.hpp>
+#include <mbgl/layer/symbol_layer_impl.hpp>
#include <mbgl/layer/custom_layer.hpp>
+#include <mbgl/layer/custom_layer_impl.hpp>
+#include <mbgl/layer/background_layer.hpp>
+#include <mbgl/layer/background_layer_impl.hpp>
#include <mbgl/sprite/sprite_store.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
-#include <mbgl/style/style_layer.hpp>
+#include <mbgl/layer/layer_impl.hpp>
#include <mbgl/style/style_parser.hpp>
#include <mbgl/style/property_transition.hpp>
#include <mbgl/style/class_dictionary.hpp>
@@ -19,7 +23,6 @@
#include <mbgl/util/constants.hpp>
#include <mbgl/util/string.hpp>
#include <mbgl/platform/log.hpp>
-#include <mbgl/layer/background_layer.hpp>
#include <mbgl/math/minmax.hpp>
#include <csscolorparser/csscolorparser.hpp>
@@ -109,35 +112,35 @@ void Style::addSource(std::unique_ptr<Source> source) {
sources.emplace_back(std::move(source));
}
-std::vector<std::unique_ptr<StyleLayer>> Style::getLayers() const {
- std::vector<std::unique_ptr<StyleLayer>> result;
+std::vector<std::unique_ptr<Layer>> Style::getLayers() const {
+ std::vector<std::unique_ptr<Layer>> result;
result.reserve(layers.size());
for (const auto& layer : layers) {
- result.push_back(layer->clone());
+ result.push_back(layer->baseImpl->clone());
}
return result;
}
-std::vector<std::unique_ptr<StyleLayer>>::const_iterator Style::findLayer(const std::string& id) const {
+std::vector<std::unique_ptr<Layer>>::const_iterator Style::findLayer(const std::string& id) const {
return std::find_if(layers.begin(), layers.end(), [&](const auto& layer) {
- return layer->id == id;
+ return layer->baseImpl->id == id;
});
}
-StyleLayer* Style::getLayer(const std::string& id) const {
+Layer* Style::getLayer(const std::string& id) const {
auto it = findLayer(id);
return it != layers.end() ? it->get() : nullptr;
}
-void Style::addLayer(std::unique_ptr<StyleLayer> layer, optional<std::string> before) {
+void Style::addLayer(std::unique_ptr<Layer> layer, optional<std::string> before) {
if (SymbolLayer* symbolLayer = layer->as<SymbolLayer>()) {
- if (!symbolLayer->spriteAtlas) {
- symbolLayer->spriteAtlas = spriteAtlas.get();
+ if (!symbolLayer->impl->spriteAtlas) {
+ symbolLayer->impl->spriteAtlas = spriteAtlas.get();
}
}
if (CustomLayer* customLayer = layer->as<CustomLayer>()) {
- customLayer->initialize();
+ customLayer->impl->initialize();
}
layers.emplace(before ? findLayer(*before) : layers.end(), std::move(layer));
@@ -187,7 +190,7 @@ void Style::cascade(const TimePoint& timePoint, MapMode mode) {
transitionProperties = {};
for (const auto& layer : layers) {
- layer->cascade(parameters);
+ layer->baseImpl->cascade(parameters);
}
}
@@ -207,10 +210,10 @@ void Style::recalculate(float z, const TimePoint& timePoint, MapMode mode) {
hasPendingTransitions = false;
for (const auto& layer : layers) {
- hasPendingTransitions |= layer->recalculate(parameters);
+ hasPendingTransitions |= layer->baseImpl->recalculate(parameters);
- Source* source = getSource(layer->source);
- if (source && layer->needsRendering()) {
+ Source* source = getSource(layer->baseImpl->source);
+ if (source && layer->baseImpl->needsRendering()) {
source->enabled = true;
if (!source->loaded && !source->isLoading()) {
source->load(fileSource);
@@ -257,17 +260,18 @@ RenderData Style::getRenderData() const {
}
for (const auto& layer : layers) {
- if (layer->visibility == VisibilityType::None)
+ if (layer->baseImpl->visibility == VisibilityType::None)
continue;
if (const BackgroundLayer* background = layer->as<BackgroundLayer>()) {
- if (layer.get() == layers[0].get() && background->paint.backgroundPattern.value.from.empty()) {
+ const BackgroundPaintProperties& paint = background->impl->paint;
+ if (layer.get() == layers[0].get() && paint.backgroundPattern.value.from.empty()) {
// This is a solid background. We can use glClear().
- result.backgroundColor = background->paint.backgroundColor;
- result.backgroundColor[0] *= background->paint.backgroundOpacity;
- result.backgroundColor[1] *= background->paint.backgroundOpacity;
- result.backgroundColor[2] *= background->paint.backgroundOpacity;
- result.backgroundColor[3] *= background->paint.backgroundOpacity;
+ result.backgroundColor = paint.backgroundColor;
+ result.backgroundColor[0] *= paint.backgroundOpacity;
+ result.backgroundColor[1] *= paint.backgroundOpacity;
+ result.backgroundColor[2] *= paint.backgroundOpacity;
+ result.backgroundColor[3] *= paint.backgroundOpacity;
} else {
// This is a textured background, or not the bottommost layer. We need to render it with a quad.
result.order.emplace_back(*layer);
@@ -280,9 +284,9 @@ RenderData Style::getRenderData() const {
continue;
}
- Source* source = getSource(layer->source);
+ Source* source = getSource(layer->baseImpl->source);
if (!source) {
- Log::Warning(Event::Render, "can't find source for layer '%s'", layer->id.c_str());
+ Log::Warning(Event::Render, "can't find source for layer '%s'", layer->baseImpl->id.c_str());
continue;
}
@@ -333,7 +337,7 @@ std::vector<Feature> Style::queryRenderedFeatures(const StyleQueryParameters& pa
// Combine all results based on the style layer order.
for (const auto& layer : layers) {
- auto it = resultsByLayer.find(layer->id);
+ auto it = resultsByLayer.find(layer->baseImpl->id);
if (it != resultsByLayer.end()) {
std::move(it->second.begin(), it->second.end(), std::back_inserter(result));
}
@@ -345,7 +349,7 @@ std::vector<Feature> Style::queryRenderedFeatures(const StyleQueryParameters& pa
float Style::getQueryRadius() const {
float additionalRadius = 0;
for (auto& layer : layers) {
- additionalRadius = util::max(additionalRadius, layer->getQueryRadius());
+ additionalRadius = util::max(additionalRadius, layer->baseImpl->getQueryRadius());
}
return additionalRadius;
}
diff --git a/src/mbgl/style/style.hpp b/src/mbgl/style/style.hpp
index 5fdd6cdc8e..6892f4967a 100644
--- a/src/mbgl/style/style.hpp
+++ b/src/mbgl/style/style.hpp
@@ -69,9 +69,9 @@ public:
Source* getSource(const std::string& id) const;
void addSource(std::unique_ptr<Source>);
- std::vector<std::unique_ptr<StyleLayer>> getLayers() const;
- StyleLayer* getLayer(const std::string& id) const;
- void addLayer(std::unique_ptr<StyleLayer>,
+ std::vector<std::unique_ptr<Layer>> getLayers() const;
+ Layer* getLayer(const std::string& id) const;
+ void addLayer(std::unique_ptr<Layer>,
optional<std::string> beforeLayerID = {});
void removeLayer(const std::string& layerID);
@@ -101,11 +101,11 @@ public:
private:
std::vector<std::unique_ptr<Source>> sources;
- std::vector<std::unique_ptr<StyleLayer>> layers;
+ std::vector<std::unique_ptr<Layer>> layers;
std::vector<std::string> classes;
optional<PropertyTransition> transitionProperties;
- std::vector<std::unique_ptr<StyleLayer>>::const_iterator findLayer(const std::string& layerID) const;
+ std::vector<std::unique_ptr<Layer>>::const_iterator findLayer(const std::string& layerID) const;
// GlyphStoreObserver implementation.
void onGlyphsLoaded(const FontStack&, const GlyphRange&) override;
diff --git a/src/mbgl/style/style_layer.cpp b/src/mbgl/style/style_layer.cpp
deleted file mode 100644
index defdfca110..0000000000
--- a/src/mbgl/style/style_layer.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <mbgl/style/style_layer.hpp>
-
-namespace mbgl {
-
-const std::string& StyleLayer::bucketName() const {
- return ref.empty() ? id : ref;
-}
-
-bool StyleLayer::hasRenderPass(RenderPass pass) const {
- return bool(passes & pass);
-}
-
-bool StyleLayer::needsRendering() const {
- return passes != RenderPass::None && visibility != VisibilityType::None;
-}
-
-} // namespace mbgl
diff --git a/src/mbgl/style/style_layer.hpp b/src/mbgl/style/style_layer.hpp
deleted file mode 100644
index 1388cbcb5a..0000000000
--- a/src/mbgl/style/style_layer.hpp
+++ /dev/null
@@ -1,102 +0,0 @@
-#pragma once
-
-#include <mbgl/style/types.hpp>
-#include <mbgl/style/filter.hpp>
-#include <mbgl/renderer/render_pass.hpp>
-#include <mbgl/util/noncopyable.hpp>
-#include <mbgl/util/rapidjson.hpp>
-#include <mbgl/tile/geometry_tile.hpp>
-
-#include <memory>
-#include <string>
-#include <limits>
-
-namespace mbgl {
-
-class StyleCascadeParameters;
-class StyleCalculationParameters;
-class StyleBucketParameters;
-class Bucket;
-
-class StyleLayer {
-public:
- virtual ~StyleLayer() = default;
-
- // Check whether this layer is of the given subtype.
- template <class T>
- bool is() const;
-
- // Dynamically cast this layer to the given subtype.
- template <class T>
- T* as() {
- return is<T>() ? reinterpret_cast<T*>(this) : nullptr;
- }
- template <class T>
- const T* as() const {
- return is<T>() ? reinterpret_cast<const T*>(this) : nullptr;
- }
-
- // Create a copy of this layer.
- virtual std::unique_ptr<StyleLayer> clone() const = 0;
-
- virtual void parseLayout(const JSValue& value) = 0;
- virtual void parsePaints(const JSValue& value) = 0;
-
- // If the layer has a ref, the ref. Otherwise, the id.
- const std::string& bucketName() const;
-
- // Partially evaluate paint properties based on a set of classes.
- virtual void cascade(const StyleCascadeParameters&) = 0;
-
- // Fully evaluate cascaded paint properties based on a zoom level.
- // Returns true if any paint properties have active transitions.
- virtual bool recalculate(const StyleCalculationParameters&) = 0;
-
- virtual std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const = 0;
-
- // Checks whether this layer needs to be rendered in the given render pass.
- bool hasRenderPass(RenderPass) const;
-
- // Checks whether this layer can be rendered.
- bool needsRendering() const;
-
- virtual float getQueryRadius() const { return 0; }
- virtual bool queryIntersectsGeometry(
- const GeometryCollection&,
- const GeometryCollection&,
- const float,
- const float) const { return false; };
-
-public:
- std::string id;
- std::string ref;
- std::string source;
- std::string sourceLayer;
- Filter filter;
- float minZoom = -std::numeric_limits<float>::infinity();
- float maxZoom = std::numeric_limits<float>::infinity();
- VisibilityType visibility = VisibilityType::Visible;
-
-protected:
- enum class Type {
- Fill,
- Line,
- Circle,
- Symbol,
- Raster,
- Background,
- Custom,
- };
-
- StyleLayer(Type type_) : type(type_) {}
- StyleLayer(const StyleLayer&) = default;
- StyleLayer& operator=(const StyleLayer&) = delete;
-
- const Type type;
-
- // Stores what render passes this layer is currently enabled for. This depends on the
- // evaluated StyleProperties object and is updated accordingly.
- RenderPass passes = RenderPass::None;
-};
-
-} // namespace mbgl
diff --git a/src/mbgl/style/style_parser.cpp b/src/mbgl/style/style_parser.cpp
index 4f081e7d85..6a67ea9daa 100644
--- a/src/mbgl/style/style_parser.cpp
+++ b/src/mbgl/style/style_parser.cpp
@@ -5,6 +5,8 @@
#include <mbgl/layer/symbol_layer.hpp>
#include <mbgl/layer/raster_layer.hpp>
#include <mbgl/layer/background_layer.hpp>
+#include <mbgl/layer/layer_impl.hpp>
+#include <mbgl/layer/symbol_layer_impl.hpp>
#include <mbgl/platform/log.hpp>
@@ -331,7 +333,7 @@ void StyleParser::parseLayers(const JSValue& value) {
continue;
}
- layersMap.emplace(layerID, std::pair<const JSValue&, std::unique_ptr<StyleLayer>> { layerValue, nullptr });
+ layersMap.emplace(layerID, std::pair<const JSValue&, std::unique_ptr<Layer>> { layerValue, nullptr });
ids.push_back(layerID);
}
@@ -352,7 +354,7 @@ void StyleParser::parseLayers(const JSValue& value) {
}
}
-void StyleParser::parseLayer(const std::string& id, const JSValue& value, std::unique_ptr<StyleLayer>& layer) {
+void StyleParser::parseLayer(const std::string& id, const JSValue& value, std::unique_ptr<Layer>& layer) {
if (layer) {
// Skip parsing this again. We already have a valid layer definition.
return;
@@ -386,15 +388,13 @@ void StyleParser::parseLayer(const std::string& id, const JSValue& value, std::u
it->second.second);
stack.pop_front();
- StyleLayer* reference = it->second.second.get();
+ Layer* reference = it->second.second.get();
if (!reference) {
return;
}
- layer = reference->clone();
- layer->id = id;
- layer->ref = ref;
-
+ layer = reference->copy(id, ref);
+ layer->baseImpl->parsePaints(value);
} else {
// Otherwise, parse the source/source-layer/filter/render keys to form the bucket.
if (!value.HasMember("type")) {
@@ -411,75 +411,75 @@ void StyleParser::parseLayer(const std::string& id, const JSValue& value, std::u
std::string type { typeVal.GetString(), typeVal.GetStringLength() };
if (type == "fill") {
- layer = std::make_unique<FillLayer>();
+ layer = std::make_unique<FillLayer>(id);
} else if (type == "line") {
- layer = std::make_unique<LineLayer>();
+ layer = std::make_unique<LineLayer>(id);
} else if (type == "circle") {
- layer = std::make_unique<CircleLayer>();
+ layer = std::make_unique<CircleLayer>(id);
} else if (type == "symbol") {
- layer = std::make_unique<SymbolLayer>();
+ layer = std::make_unique<SymbolLayer>(id);
} else if (type == "raster") {
- layer = std::make_unique<RasterLayer>();
+ layer = std::make_unique<RasterLayer>(id);
} else if (type == "background") {
- layer = std::make_unique<BackgroundLayer>();
+ layer = std::make_unique<BackgroundLayer>(id);
} else {
Log::Warning(Event::ParseStyle, "unknown type '%s' for layer '%s'", type.c_str(), id.c_str());
return;
}
- layer->id = id;
+ Layer::Impl* impl = layer->baseImpl.get();
if (value.HasMember("source")) {
const JSValue& value_source = value["source"];
if (value_source.IsString()) {
- layer->source = { value_source.GetString(), value_source.GetStringLength() };
- auto source_it = sourcesMap.find(layer->source);
+ impl->source = { value_source.GetString(), value_source.GetStringLength() };
+ auto source_it = sourcesMap.find(impl->source);
if (source_it == sourcesMap.end()) {
- Log::Warning(Event::ParseStyle, "can't find source '%s' required for layer '%s'", layer->source.c_str(), layer->id.c_str());
+ Log::Warning(Event::ParseStyle, "can't find source '%s' required for layer '%s'", impl->source.c_str(), impl->id.c_str());
}
} else {
- Log::Warning(Event::ParseStyle, "source of layer '%s' must be a string", layer->id.c_str());
+ Log::Warning(Event::ParseStyle, "source of layer '%s' must be a string", impl->id.c_str());
}
}
if (value.HasMember("source-layer")) {
const JSValue& value_source_layer = value["source-layer"];
if (value_source_layer.IsString()) {
- layer->sourceLayer = { value_source_layer.GetString(), value_source_layer.GetStringLength() };
+ impl->sourceLayer = { value_source_layer.GetString(), value_source_layer.GetStringLength() };
} else {
- Log::Warning(Event::ParseStyle, "source-layer of layer '%s' must be a string", layer->id.c_str());
+ Log::Warning(Event::ParseStyle, "source-layer of layer '%s' must be a string", impl->id.c_str());
}
}
if (value.HasMember("filter")) {
- layer->filter = parseFilter(value["filter"]);
+ impl->filter = parseFilter(value["filter"]);
}
if (value.HasMember("minzoom")) {
const JSValue& min_zoom = value["minzoom"];
if (min_zoom.IsNumber()) {
- layer->minZoom = min_zoom.GetDouble();
+ impl->minZoom = min_zoom.GetDouble();
} else {
- Log::Warning(Event::ParseStyle, "minzoom of layer %s must be numeric", layer->id.c_str());
+ Log::Warning(Event::ParseStyle, "minzoom of layer %s must be numeric", impl->id.c_str());
}
}
if (value.HasMember("maxzoom")) {
const JSValue& max_zoom = value["maxzoom"];
if (max_zoom.IsNumber()) {
- layer->maxZoom = max_zoom.GetDouble();
+ impl->maxZoom = max_zoom.GetDouble();
} else {
- Log::Warning(Event::ParseStyle, "maxzoom of layer %s must be numeric", layer->id.c_str());
+ Log::Warning(Event::ParseStyle, "maxzoom of layer %s must be numeric", impl->id.c_str());
}
}
if (value.HasMember("layout")) {
parseVisibility(*layer, value["layout"]);
- layer->parseLayout(value["layout"]);
+ impl->parseLayout(value["layout"]);
}
- }
- layer->parsePaints(value);
+ impl->parsePaints(value);
+ }
}
MBGL_DEFINE_ENUM_CLASS(VisibilityTypeClass, VisibilityType, {
@@ -487,15 +487,16 @@ MBGL_DEFINE_ENUM_CLASS(VisibilityTypeClass, VisibilityType, {
{ VisibilityType::None, "none" },
});
-void StyleParser::parseVisibility(StyleLayer& layer, const JSValue& value) {
+void StyleParser::parseVisibility(Layer& layer, const JSValue& value) {
+ Layer::Impl& impl = *layer.baseImpl;
if (!value.HasMember("visibility")) {
return;
} else if (!value["visibility"].IsString()) {
Log::Warning(Event::ParseStyle, "value of 'visibility' must be a string");
- layer.visibility = VisibilityType::Visible;
+ impl.visibility = VisibilityType::Visible;
return;
}
- layer.visibility = VisibilityTypeClass({ value["visibility"].GetString(), value["visibility"].GetStringLength() });
+ impl.visibility = VisibilityTypeClass({ value["visibility"].GetString(), value["visibility"].GetStringLength() });
}
Value parseFeatureType(const Value& value) {
@@ -669,7 +670,7 @@ std::vector<FontStack> StyleParser::fontStacks() const {
for (const auto& layer : layers) {
if (layer->is<SymbolLayer>()) {
- LayoutProperty<FontStack> property = layer->as<SymbolLayer>()->layout.textFont;
+ LayoutProperty<FontStack> property = layer->as<SymbolLayer>()->impl->layout.textFont;
if (property.parsedValue) {
for (const auto& stop : property.parsedValue->getStops()) {
result.insert(stop.second);
diff --git a/src/mbgl/style/style_parser.hpp b/src/mbgl/style/style_parser.hpp
index 98481aec51..b5445bbfb3 100644
--- a/src/mbgl/style/style_parser.hpp
+++ b/src/mbgl/style/style_parser.hpp
@@ -1,7 +1,7 @@
#pragma once
#include <mbgl/style/types.hpp>
-#include <mbgl/style/style_layer.hpp>
+#include <mbgl/style/layer.hpp>
#include <mbgl/source/source.hpp>
#include <mbgl/style/filter.hpp>
#include <mbgl/util/rapidjson.hpp>
@@ -14,9 +14,6 @@
namespace mbgl {
-class StyleLayer;
-class Source;
-
Filter parseFilter(const JSValue&);
class StyleParser {
@@ -29,7 +26,7 @@ public:
std::string glyphURL;
std::vector<std::unique_ptr<Source>> sources;
- std::vector<std::unique_ptr<StyleLayer>> layers;
+ std::vector<std::unique_ptr<Layer>> layers;
// Statically evaluate layer properties to determine what font stacks are used.
std::vector<FontStack> fontStacks() const;
@@ -42,11 +39,11 @@ public:
private:
void parseSources(const JSValue&);
void parseLayers(const JSValue&);
- void parseLayer(const std::string& id, const JSValue&, std::unique_ptr<StyleLayer>&);
- void parseVisibility(StyleLayer&, const JSValue& value);
+ void parseLayer(const std::string& id, const JSValue&, std::unique_ptr<Layer>&);
+ void parseVisibility(Layer&, const JSValue& value);
std::unordered_map<std::string, const Source*> sourcesMap;
- std::unordered_map<std::string, std::pair<const JSValue&, std::unique_ptr<StyleLayer>>> layersMap;
+ std::unordered_map<std::string, std::pair<const JSValue&, std::unique_ptr<Layer>>> layersMap;
// Store a stack of layer IDs we're parsing right now. This is to prevent reference cycles.
std::forward_list<std::string> stack;