[core] Layer manager is responsible for buckets and layouts creation

This is a step to stop using of render layers in tile worker thread.
This commit is contained in:
Mikhail Pozdnyakov
2019-01-25 23:57:47 +02:00
parent fee22273be
commit e800f37547
41 changed files with 131 additions and 145 deletions

View File

@@ -8,6 +8,7 @@ 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<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};

View File

@@ -8,6 +8,7 @@ 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<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<const RenderLayer*>&) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};

View File

@@ -8,6 +8,7 @@ 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<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<const RenderLayer*>&) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};

View File

@@ -8,6 +8,7 @@ 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<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};

View File

@@ -2,8 +2,15 @@
#include <mbgl/style/layer.hpp>
#include <vector>
namespace mbgl {
class Bucket;
class BucketParameters;
class GeometryTileLayer;
class Layout;
class LayoutParameters;
class RenderLayer;
/**
@@ -16,10 +23,14 @@ public:
virtual ~LayerFactory() = default;
/// Returns the layer type data.
virtual const style::LayerTypeInfo* getTypeInfo() const noexcept = 0;
/// Returns a new Layer instance on success call; returns `nulltptr` otherwise.
/// Returns a new Layer instance on success call; returns `nullptr` otherwise.
virtual std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept = 0;
/// Returns a new RenderLayer instance on success call; returns `nulltptr` otherwise.
/// Returns a new RenderLayer instance.
virtual std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept = 0;
/// Returns a new Bucket instance on success call; returns `nullptr` otherwise.
virtual std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) noexcept;
/// Returns a new Layout instance on success call; returns `nullptr` otherwise.
virtual std::unique_ptr<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<const RenderLayer*>&) noexcept;
protected:
optional<std::string> getSource(const style::conversion::Convertible& value) const noexcept;

View File

@@ -2,10 +2,16 @@
#include <mbgl/style/layer.hpp>
namespace mbgl {
#include <vector>
namespace mbgl {
class GeometryTileLayer;
class LayerFactory;
class RenderLayer;
class Bucket;
class BucketParameters;
class Layout;
class LayoutParameters;
/**
* @brief A singleton class responsible for creating layer instances.
@@ -25,11 +31,15 @@ public:
*/
static LayerManager* get() noexcept;
/// Returns a new Layer instance on success call; returns `nulltptr` otherwise.
/// Returns a new Layer instance on success call; returns `nullptr` otherwise.
std::unique_ptr<style::Layer> createLayer(const std::string& type, const std::string& id,
const style::conversion::Convertible& value, style::conversion::Error& error) noexcept;
/// Returns a new RenderLayer instance on success call; returns `nulltptr` otherwise.
/// Returns a new RenderLayer instance on success call; returns `nullptr` otherwise.
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept;
/// Returns a new Bucket instance on success call; returns `nullptr` otherwise.
std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) noexcept;
/// Returns a new Layout instance on success call; returns `nullptr` otherwise.
std::unique_ptr<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<const RenderLayer*>&) noexcept;
/**
* @brief a build-time flag to enable/disable annotations in mapbox-gl-native core.

View File

@@ -8,6 +8,9 @@ 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<Layout> createLayout(const LayoutParameters& parameters,
std::unique_ptr<GeometryTileLayer> tileLayer,
const std::vector<const RenderLayer*>& group) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};

View File

@@ -8,6 +8,9 @@ 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<Layout> createLayout(const LayoutParameters& parameters,
std::unique_ptr<GeometryTileLayer> tileLayer,
const std::vector<const RenderLayer*>& group) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};