forked from maplibre/maplibre-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsymbol_layer_factory.cpp
35 lines (28 loc) · 1.39 KB
/
symbol_layer_factory.cpp
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
#include <mbgl/layermanager/symbol_layer_factory.hpp>
#include <mbgl/layout/symbol_layout.hpp>
#include <mbgl/renderer/layers/render_symbol_layer.hpp>
#include <mbgl/style/layers/symbol_layer.hpp>
#include <mbgl/style/layers/symbol_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* SymbolLayerFactory::getTypeInfo() const noexcept {
return style::SymbolLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> SymbolLayerFactory::createLayer(const std::string& id,
const style::conversion::Convertible& value) noexcept {
std::optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
return std::unique_ptr<style::Layer>(new style::SymbolLayer(id, *source));
}
std::unique_ptr<Layout> SymbolLayerFactory::createLayout(
const LayoutParameters& parameters,
std::unique_ptr<GeometryTileLayer> tileLayer,
const std::vector<Immutable<style::LayerProperties>>& group) noexcept {
return std::make_unique<SymbolLayout>(parameters.bucketParameters, group, std::move(tileLayer), parameters);
}
std::unique_ptr<RenderLayer> SymbolLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderSymbolLayer>(staticImmutableCast<style::SymbolLayer::Impl>(impl));
}
} // namespace mbgl