[core, android, darwin] Move layer factories to separate files

This commit is contained in:
Mikhail Pozdnyakov
2018-12-10 17:21:08 +02:00
parent cbcd0875e3
commit ebd87a5442
76 changed files with 493 additions and 377 deletions

View File

@@ -95,10 +95,30 @@ src/mbgl/gl/vertex_array_extension.hpp
src/mbgl/gl/vertex_buffer.hpp
# layermanager
include/mbgl/layermanager/background_layer_factory.hpp
include/mbgl/layermanager/circle_layer_factory.hpp
include/mbgl/layermanager/custom_layer_factory.hpp
include/mbgl/layermanager/fill_extrusion_layer_factory.hpp
include/mbgl/layermanager/fill_layer_factory.hpp
include/mbgl/layermanager/heatmap_layer_factory.hpp
include/mbgl/layermanager/hillshade_layer_factory.hpp
include/mbgl/layermanager/layer_factory.hpp
include/mbgl/layermanager/layer_manager.hpp
include/mbgl/layermanager/line_layer_factory.hpp
include/mbgl/layermanager/raster_layer_factory.hpp
include/mbgl/layermanager/symbol_layer_factory.hpp
src/mbgl/layermanager/background_layer_factory.cpp
src/mbgl/layermanager/circle_layer_factory.cpp
src/mbgl/layermanager/custom_layer_factory.cpp
src/mbgl/layermanager/fill_extrusion_layer_factory.cpp
src/mbgl/layermanager/fill_layer_factory.cpp
src/mbgl/layermanager/heatmap_layer_factory.cpp
src/mbgl/layermanager/hillshade_layer_factory.cpp
src/mbgl/layermanager/layer_factory.cpp
src/mbgl/layermanager/layer_manager.cpp
src/mbgl/layermanager/line_layer_factory.cpp
src/mbgl/layermanager/raster_layer_factory.cpp
src/mbgl/layermanager/symbol_layer_factory.cpp
# layout
src/mbgl/layout/clip_lines.cpp

View File

@@ -0,0 +1,14 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
namespace mbgl {
class BackgroundLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -0,0 +1,14 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
namespace mbgl {
class CircleLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -0,0 +1,17 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
#include <mbgl/style/layer.hpp>
#include <array>
namespace mbgl {
class CustomLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -0,0 +1,14 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
namespace mbgl {
class FillExtrusionLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -0,0 +1,14 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
namespace mbgl {
class FillLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -0,0 +1,14 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
namespace mbgl {
class HeatmapLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -0,0 +1,14 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
namespace mbgl {
class HillshadeLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -0,0 +1,14 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
namespace mbgl {
class LineLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -0,0 +1,14 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
namespace mbgl {
class RasterLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -0,0 +1,14 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
namespace mbgl {
class SymbolLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -2,7 +2,6 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
#include <mbgl/style/layer.hpp>
#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
@@ -57,12 +56,4 @@ protected:
};
} // namespace style
class BackgroundLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -2,7 +2,6 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
#include <mbgl/style/layer.hpp>
#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
@@ -105,12 +104,4 @@ protected:
};
} // namespace style
class CircleLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -1,6 +1,5 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
#include <mbgl/style/layer.hpp>
#include <array>
@@ -87,12 +86,4 @@ public:
};
} // namespace style
class CustomLayerFactory : public LayerFactory {
// LayerFactory overrides.
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -2,7 +2,6 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
#include <mbgl/style/layer.hpp>
#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
@@ -87,12 +86,4 @@ protected:
};
} // namespace style
class FillExtrusionLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -2,7 +2,6 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
#include <mbgl/style/layer.hpp>
#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
@@ -81,12 +80,4 @@ protected:
};
} // namespace style
class FillLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -2,7 +2,6 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
#include <mbgl/style/color_ramp_property_value.hpp>
#include <mbgl/style/layer.hpp>
#include <mbgl/style/filter.hpp>
@@ -70,12 +69,4 @@ protected:
};
} // namespace style
class HeatmapLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -2,7 +2,6 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
#include <mbgl/style/layer.hpp>
#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
@@ -75,12 +74,4 @@ protected:
};
} // namespace style
class HillshadeLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -7,7 +7,6 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
<% if (type === 'heatmap' || type === 'line') { -%>
#include <mbgl/style/color_ramp_property_value.hpp>
<% } -%>
@@ -73,12 +72,4 @@ protected:
};
} // namespace style
class <%- camelize(type) %>LayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -2,7 +2,6 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
#include <mbgl/style/color_ramp_property_value.hpp>
#include <mbgl/style/layer.hpp>
#include <mbgl/style/filter.hpp>
@@ -126,12 +125,4 @@ protected:
};
} // namespace style
class LineLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -2,7 +2,6 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
#include <mbgl/style/layer.hpp>
#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
@@ -87,12 +86,4 @@ protected:
};
} // namespace style
class RasterLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -2,7 +2,6 @@
#pragma once
#include <mbgl/layermanager/layer_factory.hpp>
#include <mbgl/style/layer.hpp>
#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
@@ -275,12 +274,4 @@ protected:
};
} // namespace style
class SymbolLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};
} // namespace mbgl

View File

@@ -4,6 +4,7 @@
#include "layer.hpp"
#include "../transition_options.hpp"
#include <mbgl/layermanager/background_layer_factory.hpp>
#include <mbgl/style/layers/background_layer.hpp>
#include <jni/jni.hpp>

View File

@@ -4,6 +4,7 @@
#include "layer.hpp"
#include "../transition_options.hpp"
#include <mbgl/layermanager/circle_layer_factory.hpp>
#include <mbgl/style/layers/circle_layer.hpp>
#include <jni/jni.hpp>

View File

@@ -1,6 +1,7 @@
#pragma once
#include "layer.hpp"
#include <mbgl/layermanager/custom_layer_factory.hpp>
#include <mbgl/style/layers/custom_layer.hpp>
#include <jni/jni.hpp>

View File

@@ -4,6 +4,7 @@
#include "layer.hpp"
#include "../transition_options.hpp"
#include <mbgl/layermanager/fill_extrusion_layer_factory.hpp>
#include <mbgl/style/layers/fill_extrusion_layer.hpp>
#include <jni/jni.hpp>

View File

@@ -4,6 +4,7 @@
#include "layer.hpp"
#include "../transition_options.hpp"
#include <mbgl/layermanager/fill_layer_factory.hpp>
#include <mbgl/style/layers/fill_layer.hpp>
#include <jni/jni.hpp>

View File

@@ -4,6 +4,7 @@
#include "layer.hpp"
#include "../transition_options.hpp"
#include <mbgl/layermanager/heatmap_layer_factory.hpp>
#include <mbgl/style/layers/heatmap_layer.hpp>
#include <jni/jni.hpp>

View File

@@ -4,6 +4,7 @@
#include "layer.hpp"
#include "../transition_options.hpp"
#include <mbgl/layermanager/hillshade_layer_factory.hpp>
#include <mbgl/style/layers/hillshade_layer.hpp>
#include <jni/jni.hpp>

View File

@@ -8,6 +8,7 @@
#include "layer.hpp"
#include "../transition_options.hpp"
#include <mbgl/layermanager/<%- type.replace('-', '_') %>_layer_factory.hpp>
#include <mbgl/style/layers/<%- type.replace('-', '_') %>_layer.hpp>
#include <jni/jni.hpp>

View File

@@ -4,6 +4,7 @@
#include "layer.hpp"
#include "../transition_options.hpp"
#include <mbgl/layermanager/line_layer_factory.hpp>
#include <mbgl/style/layers/line_layer.hpp>
#include <jni/jni.hpp>

View File

@@ -4,6 +4,7 @@
#include "layer.hpp"
#include "../transition_options.hpp"
#include <mbgl/layermanager/raster_layer_factory.hpp>
#include <mbgl/style/layers/raster_layer.hpp>
#include <jni/jni.hpp>

View File

@@ -4,6 +4,7 @@
#include "layer.hpp"
#include "../transition_options.hpp"
#include <mbgl/layermanager/symbol_layer_factory.hpp>
#include <mbgl/style/layers/symbol_layer.hpp>
#include <jni/jni.hpp>

View File

@@ -10,6 +10,7 @@
#import "MGLLoggingConfiguration_Private.h"
#import "MGLBackgroundStyleLayer_Private.h"
#include <mbgl/style/layers/background_layer.hpp>
#include <mbgl/style/transition_options.hpp>

View File

@@ -4,7 +4,7 @@
#include "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/background_layer.hpp>
#include <mbgl/layermanager/background_layer_factory.hpp>
namespace mbgl {

View File

@@ -10,6 +10,7 @@
#import "MGLLoggingConfiguration_Private.h"
#import "MGLCircleStyleLayer_Private.h"
#include <mbgl/style/layers/circle_layer.hpp>
#include <mbgl/style/transition_options.hpp>

View File

@@ -4,7 +4,7 @@
#include "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/circle_layer.hpp>
#include <mbgl/layermanager/circle_layer_factory.hpp>
namespace mbgl {

View File

@@ -10,6 +10,7 @@
#import "MGLLoggingConfiguration_Private.h"
#import "MGLFillExtrusionStyleLayer_Private.h"
#include <mbgl/style/layers/fill_extrusion_layer.hpp>
#include <mbgl/style/transition_options.hpp>

View File

@@ -4,7 +4,7 @@
#include "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/fill_extrusion_layer.hpp>
#include <mbgl/layermanager/fill_extrusion_layer_factory.hpp>
namespace mbgl {

View File

@@ -10,6 +10,7 @@
#import "MGLLoggingConfiguration_Private.h"
#import "MGLFillStyleLayer_Private.h"
#include <mbgl/style/layers/fill_layer.hpp>
#include <mbgl/style/transition_options.hpp>

View File

@@ -4,7 +4,7 @@
#include "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/fill_layer.hpp>
#include <mbgl/layermanager/fill_layer_factory.hpp>
namespace mbgl {

View File

@@ -10,6 +10,7 @@
#import "MGLLoggingConfiguration_Private.h"
#import "MGLHeatmapStyleLayer_Private.h"
#include <mbgl/style/layers/heatmap_layer.hpp>
#include <mbgl/style/transition_options.hpp>

View File

@@ -4,7 +4,7 @@
#include "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/heatmap_layer.hpp>
#include <mbgl/layermanager/heatmap_layer_factory.hpp>
namespace mbgl {

View File

@@ -10,6 +10,7 @@
#import "MGLLoggingConfiguration_Private.h"
#import "MGLHillshadeStyleLayer_Private.h"
#include <mbgl/style/layers/hillshade_layer.hpp>
#include <mbgl/style/transition_options.hpp>

View File

@@ -4,7 +4,7 @@
#include "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/hillshade_layer.hpp>
#include <mbgl/layermanager/hillshade_layer_factory.hpp>
namespace mbgl {

View File

@@ -10,6 +10,7 @@
#import "MGLLoggingConfiguration_Private.h"
#import "MGLLineStyleLayer_Private.h"
#include <mbgl/style/layers/line_layer.hpp>
#include <mbgl/style/transition_options.hpp>

View File

@@ -4,7 +4,7 @@
#include "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/line_layer.hpp>
#include <mbgl/layermanager/line_layer_factory.hpp>
namespace mbgl {

View File

@@ -2,7 +2,7 @@
#include "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/custom_layer.hpp>
#include <mbgl/layermanager/custom_layer_factory.hpp>
namespace mbgl {

View File

@@ -10,6 +10,7 @@
#import "MGLLoggingConfiguration_Private.h"
#import "MGLRasterStyleLayer_Private.h"
#include <mbgl/style/layers/raster_layer.hpp>
#include <mbgl/style/transition_options.hpp>

View File

@@ -4,7 +4,7 @@
#include "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/raster_layer.hpp>
#include <mbgl/layermanager/raster_layer_factory.hpp>
namespace mbgl {

View File

@@ -16,6 +16,7 @@
#import "MGLLoggingConfiguration_Private.h"
#import "MGL<%- camelize(type) %>StyleLayer_Private.h"
#include <mbgl/style/layers/<%- type.replace('-', '_') %>_layer.hpp>
#include <mbgl/style/transition_options.hpp>
<% if (enumProperties) { -%>

View File

@@ -11,7 +11,7 @@
#include "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/<%- type.replace('-', '_') %>_layer.hpp>
#include <mbgl/layermanager/<%- type.replace('-', '_') %>_layer_factory.hpp>
namespace mbgl {

View File

@@ -10,6 +10,7 @@
#import "MGLLoggingConfiguration_Private.h"
#import "MGLSymbolStyleLayer_Private.h"
#include <mbgl/style/layers/symbol_layer.hpp>
#include <mbgl/style/transition_options.hpp>

View File

@@ -4,7 +4,7 @@
#include "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/symbol_layer.hpp>
#include <mbgl/layermanager/symbol_layer_factory.hpp>
namespace mbgl {

View File

@@ -1,14 +1,15 @@
#include <mbgl/layermanager/layer_manager.hpp>
#include <mbgl/style/layers/background_layer.hpp>
#include <mbgl/style/layers/circle_layer.hpp>
#include <mbgl/style/layers/custom_layer.hpp>
#include <mbgl/style/layers/fill_extrusion_layer.hpp>
#include <mbgl/style/layers/fill_layer.hpp>
#include <mbgl/style/layers/heatmap_layer.hpp>
#include <mbgl/style/layers/hillshade_layer.hpp>
#include <mbgl/style/layers/line_layer.hpp>
#include <mbgl/style/layers/raster_layer.hpp>
#include <mbgl/style/layers/symbol_layer.hpp>
#include <mbgl/layermanager/background_layer_factory.hpp>
#include <mbgl/layermanager/circle_layer_factory.hpp>
#include <mbgl/layermanager/custom_layer_factory.hpp>
#include <mbgl/layermanager/fill_extrusion_layer_factory.hpp>
#include <mbgl/layermanager/fill_layer_factory.hpp>
#include <mbgl/layermanager/heatmap_layer_factory.hpp>
#include <mbgl/layermanager/hillshade_layer_factory.hpp>
#include <mbgl/layermanager/line_layer_factory.hpp>
#include <mbgl/layermanager/raster_layer_factory.hpp>
#include <mbgl/layermanager/symbol_layer_factory.hpp>
#include <map>
#include <memory>

View File

@@ -0,0 +1,23 @@
#include <mbgl/layermanager/background_layer_factory.hpp>
#include <mbgl/renderer/layers/render_background_layer.hpp>
#include <mbgl/style/layers/background_layer.hpp>
#include <mbgl/style/layers/background_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* BackgroundLayerFactory::getTypeInfo() const noexcept {
return style::BackgroundLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> BackgroundLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
(void)value;
return std::unique_ptr<style::Layer>(new style::BackgroundLayer(id));
}
std::unique_ptr<RenderLayer> BackgroundLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderBackgroundLayer>(staticImmutableCast<style::BackgroundLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,31 @@
#include <mbgl/layermanager/circle_layer_factory.hpp>
#include <mbgl/renderer/layers/render_circle_layer.hpp>
#include <mbgl/style/layers/circle_layer.hpp>
#include <mbgl/style/layers/circle_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* CircleLayerFactory::getTypeInfo() const noexcept {
return style::CircleLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> CircleLayerFactory::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::CircleLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> CircleLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderCircleLayer>(staticImmutableCast<style::CircleLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,22 @@
#include <mbgl/layermanager/custom_layer_factory.hpp>
#include <mbgl/renderer/layers/render_custom_layer.hpp>
#include <mbgl/style/layers/custom_layer.hpp>
#include <mbgl/style/layers/custom_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* CustomLayerFactory::getTypeInfo() const noexcept {
return style::CustomLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> CustomLayerFactory::createLayer(const std::string&, const style::conversion::Convertible&) noexcept {
assert(false);
return nullptr;
}
std::unique_ptr<RenderLayer> CustomLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
return std::make_unique<RenderCustomLayer>(staticImmutableCast<style::CustomLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,31 @@
#include <mbgl/layermanager/fill_extrusion_layer_factory.hpp>
#include <mbgl/renderer/layers/render_fill_extrusion_layer.hpp>
#include <mbgl/style/layers/fill_extrusion_layer.hpp>
#include <mbgl/style/layers/fill_extrusion_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* FillExtrusionLayerFactory::getTypeInfo() const noexcept {
return style::FillExtrusionLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> FillExtrusionLayerFactory::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::FillExtrusionLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> FillExtrusionLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderFillExtrusionLayer>(staticImmutableCast<style::FillExtrusionLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,31 @@
#include <mbgl/layermanager/fill_layer_factory.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<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

View File

@@ -0,0 +1,31 @@
#include <mbgl/layermanager/heatmap_layer_factory.hpp>
#include <mbgl/renderer/layers/render_heatmap_layer.hpp>
#include <mbgl/style/layers/heatmap_layer.hpp>
#include <mbgl/style/layers/heatmap_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* HeatmapLayerFactory::getTypeInfo() const noexcept {
return style::HeatmapLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> HeatmapLayerFactory::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::HeatmapLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> HeatmapLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderHeatmapLayer>(staticImmutableCast<style::HeatmapLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,28 @@
#include <mbgl/layermanager/hillshade_layer_factory.hpp>
#include <mbgl/renderer/layers/render_hillshade_layer.hpp>
#include <mbgl/style/layers/hillshade_layer.hpp>
#include <mbgl/style/layers/hillshade_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* HillshadeLayerFactory::getTypeInfo() const noexcept {
return style::HillshadeLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> HillshadeLayerFactory::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::HillshadeLayer(id, *source));
return layer;
}
std::unique_ptr<RenderLayer> HillshadeLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderHillshadeLayer>(staticImmutableCast<style::HillshadeLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,31 @@
#include <mbgl/layermanager/line_layer_factory.hpp>
#include <mbgl/renderer/layers/render_line_layer.hpp>
#include <mbgl/style/layers/line_layer.hpp>
#include <mbgl/style/layers/line_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* LineLayerFactory::getTypeInfo() const noexcept {
return style::LineLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> LineLayerFactory::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::LineLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> LineLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderLineLayer>(staticImmutableCast<style::LineLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,28 @@
#include <mbgl/layermanager/raster_layer_factory.hpp>
#include <mbgl/renderer/layers/render_raster_layer.hpp>
#include <mbgl/style/layers/raster_layer.hpp>
#include <mbgl/style/layers/raster_layer_impl.hpp>
namespace mbgl {
const style::LayerTypeInfo* RasterLayerFactory::getTypeInfo() const noexcept {
return style::RasterLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> RasterLayerFactory::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::RasterLayer(id, *source));
return layer;
}
std::unique_ptr<RenderLayer> RasterLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderRasterLayer>(staticImmutableCast<style::RasterLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -0,0 +1,31 @@
#include <mbgl/layermanager/symbol_layer_factory.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 {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::SymbolLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
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>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_background_layer.hpp>
namespace mbgl {
namespace style {
@@ -287,19 +285,4 @@ Mutable<Layer::Impl> BackgroundLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* BackgroundLayerFactory::getTypeInfo() const noexcept {
return style::BackgroundLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> BackgroundLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
(void)value;
return std::unique_ptr<style::Layer>(new style::BackgroundLayer(id));
}
std::unique_ptr<RenderLayer> BackgroundLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderBackgroundLayer>(staticImmutableCast<style::BackgroundLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_circle_layer.hpp>
namespace mbgl {
namespace style {
@@ -704,27 +702,4 @@ Mutable<Layer::Impl> CircleLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* CircleLayerFactory::getTypeInfo() const noexcept {
return style::CircleLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> CircleLayerFactory::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::CircleLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> CircleLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderCircleLayer>(staticImmutableCast<style::CircleLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -56,18 +56,4 @@ const LayerTypeInfo* CustomLayer::Impl::staticTypeInfo() noexcept {
}
} // namespace style
const style::LayerTypeInfo* CustomLayerFactory::getTypeInfo() const noexcept {
return &style::typeInfoCustom;
}
std::unique_ptr<style::Layer> CustomLayerFactory::createLayer(const std::string&, const style::conversion::Convertible&) noexcept {
assert(false);
return nullptr;
}
std::unique_ptr<RenderLayer> CustomLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
return std::make_unique<RenderCustomLayer>(staticImmutableCast<style::CustomLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_fill_extrusion_layer.hpp>
namespace mbgl {
namespace style {
@@ -562,27 +560,4 @@ Mutable<Layer::Impl> FillExtrusionLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* FillExtrusionLayerFactory::getTypeInfo() const noexcept {
return style::FillExtrusionLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> FillExtrusionLayerFactory::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::FillExtrusionLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> FillExtrusionLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderFillExtrusionLayer>(staticImmutableCast<style::FillExtrusionLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_fill_layer.hpp>
namespace mbgl {
namespace style {
@@ -506,27 +504,4 @@ Mutable<Layer::Impl> FillLayer::mutableBaseImpl() const {
}
} // namespace style
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<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

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_heatmap_layer.hpp>
namespace mbgl {
namespace style {
@@ -391,27 +389,4 @@ Mutable<Layer::Impl> HeatmapLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* HeatmapLayerFactory::getTypeInfo() const noexcept {
return style::HeatmapLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> HeatmapLayerFactory::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::HeatmapLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> HeatmapLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderHeatmapLayer>(staticImmutableCast<style::HeatmapLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_hillshade_layer.hpp>
namespace mbgl {
namespace style {
@@ -438,24 +436,4 @@ Mutable<Layer::Impl> HillshadeLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* HillshadeLayerFactory::getTypeInfo() const noexcept {
return style::HillshadeLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> HillshadeLayerFactory::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::HillshadeLayer(id, *source));
return layer;
}
std::unique_ptr<RenderLayer> HillshadeLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderHillshadeLayer>(staticImmutableCast<style::HillshadeLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -16,8 +16,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_<%- type.replace('-', '_') %>_layer.hpp>
namespace mbgl {
namespace style {
@@ -314,34 +312,4 @@ Mutable<Layer::Impl> <%- camelize(type) %>Layer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* <%- camelize(type) %>LayerFactory::getTypeInfo() const noexcept {
return style::<%- camelize(type) %>Layer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> <%- camelize(type) %>LayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
<% if (type === 'background') { -%>
(void)value;
return std::unique_ptr<style::Layer>(new style::<%- camelize(type) %>Layer(id));
<% } else { -%>
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::<%- camelize(type) %>Layer(id, *source));
<% if (type !== 'raster' && type !== 'hillshade') { -%>
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
<% } -%>
return layer;
<% } -%>
}
std::unique_ptr<RenderLayer> <%- camelize(type) %>LayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<Render<%- camelize(type) %>Layer>(staticImmutableCast<style::<%- camelize(type) %>Layer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_line_layer.hpp>
namespace mbgl {
namespace style {
@@ -845,27 +843,4 @@ Mutable<Layer::Impl> LineLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* LineLayerFactory::getTypeInfo() const noexcept {
return style::LineLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> LineLayerFactory::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::LineLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
std::unique_ptr<RenderLayer> LineLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderLineLayer>(staticImmutableCast<style::LineLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_raster_layer.hpp>
namespace mbgl {
namespace style {
@@ -527,24 +525,4 @@ Mutable<Layer::Impl> RasterLayer::mutableBaseImpl() const {
}
} // namespace style
const style::LayerTypeInfo* RasterLayerFactory::getTypeInfo() const noexcept {
return style::RasterLayer::Impl::staticTypeInfo();
}
std::unique_ptr<style::Layer> RasterLayerFactory::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::RasterLayer(id, *source));
return layer;
}
std::unique_ptr<RenderLayer> RasterLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
assert(impl->getTypeInfo() == getTypeInfo());
return std::make_unique<RenderRasterLayer>(staticImmutableCast<style::RasterLayer::Impl>(std::move(impl)));
}
} // namespace mbgl

View File

@@ -11,8 +11,6 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
#include <mbgl/renderer/layers/render_symbol_layer.hpp>
namespace mbgl {
namespace style {
@@ -1995,27 +1993,4 @@ Mutable<Layer::Impl> SymbolLayer::mutableBaseImpl() const {
}
} // namespace style
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 {
optional<std::string> source = getSource(value);
if (!source) {
return nullptr;
}
std::unique_ptr<style::Layer> layer = std::unique_ptr<style::Layer>(new style::SymbolLayer(id, *source));
if (!initSourceLayerAndFilter(layer.get(), value)) {
return nullptr;
}
return layer;
}
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>(std::move(impl)));
}
} // namespace mbgl