Refer corresponding LayerFactory instance from the Layer::Impl
This commit is contained in:
@@ -40,7 +40,7 @@ public:
|
||||
Layer& operator=(const Layer&) = delete;
|
||||
|
||||
virtual ~Layer();
|
||||
|
||||
// Note: LayerType is deprecated, do not use it.
|
||||
LayerType getType() const;
|
||||
std::string getID() const;
|
||||
// Source
|
||||
@@ -82,11 +82,11 @@ public:
|
||||
// object here, so that separately-obtained references to this object share
|
||||
// identical platform-native peers.
|
||||
util::peer peer;
|
||||
Layer(Immutable<Impl>);
|
||||
protected:
|
||||
Layer(Immutable<Impl>);
|
||||
virtual Mutable<Impl> mutableBaseImpl() const = 0;
|
||||
|
||||
LayerObserver* observer = nullptr;
|
||||
LayerObserver* observer;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -97,10 +97,11 @@ protected:
|
||||
class LayerFactory {
|
||||
public:
|
||||
virtual ~LayerFactory() = default;
|
||||
/// Returns the type of the layers, created by this factory.
|
||||
virtual const char* type() const = 0;
|
||||
/// Returns \c true if this factory can produce layers of the given type of the layers; returns \c false otherwise.
|
||||
virtual bool supportsType(const std::string& type) const = 0;
|
||||
/// Returns a new Layer instance on success call; returns `nulltptr` otherwise.
|
||||
virtual std::unique_ptr<Layer> createLayer(const std::string& id, const conversion::Convertible& value) = 0;
|
||||
|
||||
protected:
|
||||
optional<std::string> getSource(const conversion::Convertible& value) const;
|
||||
bool initSourceLayerAndFilter(Layer*, const conversion::Convertible& value) const;
|
||||
|
||||
@@ -57,11 +57,17 @@ protected:
|
||||
};
|
||||
|
||||
class BackgroundLayerFactory : public LayerFactory {
|
||||
protected:
|
||||
public:
|
||||
BackgroundLayerFactory();
|
||||
// LayerFactory overrides.
|
||||
~BackgroundLayerFactory() override;
|
||||
const char* type() const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) override;
|
||||
bool supportsType(const std::string& type) const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
|
||||
|
||||
static BackgroundLayerFactory* get();
|
||||
|
||||
private:
|
||||
static BackgroundLayerFactory* instance;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
|
||||
@@ -105,11 +105,17 @@ protected:
|
||||
};
|
||||
|
||||
class CircleLayerFactory : public LayerFactory {
|
||||
protected:
|
||||
public:
|
||||
CircleLayerFactory();
|
||||
// LayerFactory overrides.
|
||||
~CircleLayerFactory() override;
|
||||
const char* type() const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) override;
|
||||
bool supportsType(const std::string& type) const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
|
||||
|
||||
static CircleLayerFactory* get();
|
||||
|
||||
private:
|
||||
static CircleLayerFactory* instance;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
|
||||
@@ -85,5 +85,19 @@ public:
|
||||
Mutable<Layer::Impl> mutableBaseImpl() const final;
|
||||
};
|
||||
|
||||
class CustomLayerFactory : public LayerFactory {
|
||||
public:
|
||||
CustomLayerFactory();
|
||||
// LayerFactory overrides.
|
||||
~CustomLayerFactory() override;
|
||||
bool supportsType(const std::string& type) const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
|
||||
|
||||
static CustomLayerFactory* get();
|
||||
|
||||
private:
|
||||
static CustomLayerFactory* instance;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -81,11 +81,17 @@ protected:
|
||||
};
|
||||
|
||||
class FillExtrusionLayerFactory : public LayerFactory {
|
||||
protected:
|
||||
public:
|
||||
FillExtrusionLayerFactory();
|
||||
// LayerFactory overrides.
|
||||
~FillExtrusionLayerFactory() override;
|
||||
const char* type() const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) override;
|
||||
bool supportsType(const std::string& type) const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
|
||||
|
||||
static FillExtrusionLayerFactory* get();
|
||||
|
||||
private:
|
||||
static FillExtrusionLayerFactory* instance;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
|
||||
@@ -81,11 +81,17 @@ protected:
|
||||
};
|
||||
|
||||
class FillLayerFactory : public LayerFactory {
|
||||
protected:
|
||||
public:
|
||||
FillLayerFactory();
|
||||
// LayerFactory overrides.
|
||||
~FillLayerFactory() override;
|
||||
const char* type() const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) override;
|
||||
bool supportsType(const std::string& type) const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
|
||||
|
||||
static FillLayerFactory* get();
|
||||
|
||||
private:
|
||||
static FillLayerFactory* instance;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
|
||||
@@ -70,11 +70,17 @@ protected:
|
||||
};
|
||||
|
||||
class HeatmapLayerFactory : public LayerFactory {
|
||||
protected:
|
||||
public:
|
||||
HeatmapLayerFactory();
|
||||
// LayerFactory overrides.
|
||||
~HeatmapLayerFactory() override;
|
||||
const char* type() const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) override;
|
||||
bool supportsType(const std::string& type) const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
|
||||
|
||||
static HeatmapLayerFactory* get();
|
||||
|
||||
private:
|
||||
static HeatmapLayerFactory* instance;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
|
||||
@@ -75,11 +75,17 @@ protected:
|
||||
};
|
||||
|
||||
class HillshadeLayerFactory : public LayerFactory {
|
||||
protected:
|
||||
public:
|
||||
HillshadeLayerFactory();
|
||||
// LayerFactory overrides.
|
||||
~HillshadeLayerFactory() override;
|
||||
const char* type() const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) override;
|
||||
bool supportsType(const std::string& type) const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
|
||||
|
||||
static HillshadeLayerFactory* get();
|
||||
|
||||
private:
|
||||
static HillshadeLayerFactory* instance;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
|
||||
@@ -73,11 +73,17 @@ protected:
|
||||
};
|
||||
|
||||
class <%- camelize(type) %>LayerFactory : public LayerFactory {
|
||||
protected:
|
||||
public:
|
||||
<%- camelize(type) %>LayerFactory();
|
||||
// LayerFactory overrides.
|
||||
~<%- camelize(type) %>LayerFactory() override;
|
||||
const char* type() const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) override;
|
||||
bool supportsType(const std::string& type) const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
|
||||
|
||||
static <%- camelize(type) %>LayerFactory* get();
|
||||
|
||||
private:
|
||||
static <%- camelize(type) %>LayerFactory* instance;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
|
||||
@@ -126,11 +126,17 @@ protected:
|
||||
};
|
||||
|
||||
class LineLayerFactory : public LayerFactory {
|
||||
protected:
|
||||
public:
|
||||
LineLayerFactory();
|
||||
// LayerFactory overrides.
|
||||
~LineLayerFactory() override;
|
||||
const char* type() const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) override;
|
||||
bool supportsType(const std::string& type) const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
|
||||
|
||||
static LineLayerFactory* get();
|
||||
|
||||
private:
|
||||
static LineLayerFactory* instance;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
|
||||
@@ -87,11 +87,17 @@ protected:
|
||||
};
|
||||
|
||||
class RasterLayerFactory : public LayerFactory {
|
||||
protected:
|
||||
public:
|
||||
RasterLayerFactory();
|
||||
// LayerFactory overrides.
|
||||
~RasterLayerFactory() override;
|
||||
const char* type() const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) override;
|
||||
bool supportsType(const std::string& type) const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
|
||||
|
||||
static RasterLayerFactory* get();
|
||||
|
||||
private:
|
||||
static RasterLayerFactory* instance;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
|
||||
@@ -275,11 +275,17 @@ protected:
|
||||
};
|
||||
|
||||
class SymbolLayerFactory : public LayerFactory {
|
||||
protected:
|
||||
public:
|
||||
SymbolLayerFactory();
|
||||
// LayerFactory overrides.
|
||||
~SymbolLayerFactory() override;
|
||||
const char* type() const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) override;
|
||||
bool supportsType(const std::string& type) const final;
|
||||
std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;
|
||||
|
||||
static SymbolLayerFactory* get();
|
||||
|
||||
private:
|
||||
static SymbolLayerFactory* instance;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
|
||||
Reference in New Issue
Block a user