[core] Adjust layer source properties to better reflect reality
* Layer source ID is immutable; must be provided to the constructor * Layer source layer is mutable * Layers with GeoJSON sources do not have a source layer While here, make Layer::copy impl-private.
This commit is contained in:
@@ -55,11 +55,6 @@ public:
|
||||
float getMaxZoom() const;
|
||||
void setMaxZoom(float) const;
|
||||
|
||||
// Create a new layer with the specified `id` and `ref`. All other properties
|
||||
// are copied from this layer.
|
||||
std::unique_ptr<Layer> copy(const std::string& id,
|
||||
const std::string& ref) const;
|
||||
|
||||
// Private implementation
|
||||
class Impl;
|
||||
const std::unique_ptr<Impl> baseImpl;
|
||||
|
||||
@@ -13,14 +13,13 @@ namespace style {
|
||||
|
||||
class CircleLayer : public Layer {
|
||||
public:
|
||||
CircleLayer(const std::string& layerID);
|
||||
CircleLayer(const std::string& layerID, const std::string& sourceID);
|
||||
~CircleLayer() final;
|
||||
|
||||
// Source
|
||||
|
||||
void setSource(const std::string& sourceID, const std::string& sourceLayer);
|
||||
const std::string& getSourceID() const;
|
||||
const std::string& getSourceLayer() const;
|
||||
void setSourceLayer(const std::string& sourceLayer);
|
||||
|
||||
void setFilter(const Filter&);
|
||||
const Filter& getFilter() const;
|
||||
|
||||
@@ -13,14 +13,13 @@ namespace style {
|
||||
|
||||
class FillLayer : public Layer {
|
||||
public:
|
||||
FillLayer(const std::string& layerID);
|
||||
FillLayer(const std::string& layerID, const std::string& sourceID);
|
||||
~FillLayer() final;
|
||||
|
||||
// Source
|
||||
|
||||
void setSource(const std::string& sourceID, const std::string& sourceLayer);
|
||||
const std::string& getSourceID() const;
|
||||
const std::string& getSourceLayer() const;
|
||||
void setSourceLayer(const std::string& sourceLayer);
|
||||
|
||||
void setFilter(const Filter&);
|
||||
const Filter& getFilter() const;
|
||||
|
||||
@@ -22,24 +22,23 @@ namespace style {
|
||||
|
||||
class <%- camelize(type) %>Layer : public Layer {
|
||||
public:
|
||||
<% if (type === 'background') { -%>
|
||||
<%- camelize(type) %>Layer(const std::string& layerID);
|
||||
<% } else { -%>
|
||||
<%- camelize(type) %>Layer(const std::string& layerID, const std::string& sourceID);
|
||||
<% } -%>
|
||||
~<%- camelize(type) %>Layer() final;
|
||||
|
||||
<% if (type === 'raster') { -%>
|
||||
<% if (type !== 'background') { -%>
|
||||
// Source
|
||||
|
||||
void setSource(const std::string& sourceID);
|
||||
const std::string& getSourceID() const;
|
||||
|
||||
<% } else if (type !== 'background') { -%>
|
||||
// Source
|
||||
|
||||
void setSource(const std::string& sourceID, const std::string& sourceLayer);
|
||||
const std::string& getSourceID() const;
|
||||
<% if (type !== 'raster') { -%>
|
||||
const std::string& getSourceLayer() const;
|
||||
void setSourceLayer(const std::string& sourceLayer);
|
||||
|
||||
void setFilter(const Filter&);
|
||||
const Filter& getFilter() const;
|
||||
<% } -%>
|
||||
|
||||
<% } -%>
|
||||
<% if (layoutProperties.length) { -%>
|
||||
|
||||
@@ -15,14 +15,13 @@ namespace style {
|
||||
|
||||
class LineLayer : public Layer {
|
||||
public:
|
||||
LineLayer(const std::string& layerID);
|
||||
LineLayer(const std::string& layerID, const std::string& sourceID);
|
||||
~LineLayer() final;
|
||||
|
||||
// Source
|
||||
|
||||
void setSource(const std::string& sourceID, const std::string& sourceLayer);
|
||||
const std::string& getSourceID() const;
|
||||
const std::string& getSourceLayer() const;
|
||||
void setSourceLayer(const std::string& sourceLayer);
|
||||
|
||||
void setFilter(const Filter&);
|
||||
const Filter& getFilter() const;
|
||||
|
||||
@@ -13,12 +13,10 @@ namespace style {
|
||||
|
||||
class RasterLayer : public Layer {
|
||||
public:
|
||||
RasterLayer(const std::string& layerID);
|
||||
RasterLayer(const std::string& layerID, const std::string& sourceID);
|
||||
~RasterLayer() final;
|
||||
|
||||
// Source
|
||||
|
||||
void setSource(const std::string& sourceID);
|
||||
const std::string& getSourceID() const;
|
||||
|
||||
// Paint properties
|
||||
|
||||
@@ -15,14 +15,13 @@ namespace style {
|
||||
|
||||
class SymbolLayer : public Layer {
|
||||
public:
|
||||
SymbolLayer(const std::string& layerID);
|
||||
SymbolLayer(const std::string& layerID, const std::string& sourceID);
|
||||
~SymbolLayer() final;
|
||||
|
||||
// Source
|
||||
|
||||
void setSource(const std::string& sourceID, const std::string& sourceLayer);
|
||||
const std::string& getSourceID() const;
|
||||
const std::string& getSourceLayer() const;
|
||||
void setSourceLayer(const std::string& sourceLayer);
|
||||
|
||||
void setFilter(const Filter&);
|
||||
const Filter& getFilter() const;
|
||||
|
||||
Reference in New Issue
Block a user