blob: 60a1818585a198594198f12bb0f772c6c37d2eb6 (
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
36
37
38
39
|
#include <mbgl/layermanager/fill_layer_factory.hpp>
#include <mbgl/renderer/buckets/fill_bucket.hpp>
#include <mbgl/renderer/layers/render_fill_layer.hpp>
#include <mbgl/style/layers/fill_layer.hpp>
#include <mbgl/style/layers/fill_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* FillLayerFactory::getTypeInfo() const noexcept {
return style::FillLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> FillLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::FillLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<Layout>
FillLayerFactory::createLayout(const LayoutParameters& parameters,
std::unique_ptr<GeometryTileLayer> layer,
const std::vector<const RenderLayer*>& group) noexcept {
return std::make_unique<PatternLayout<FillBucket>>(parameters.bucketParameters, group, std::move(layer), parameters.imageDependencies);
}
std::unique_ptr<RenderLayer> FillLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderFillLayer>(staticImmutableCast<style::FillLayer::Impl>(std::move(impl)));
}
} // namespace mbgl
|