[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:
John Firebaugh
2016-06-22 12:31:49 -07:00
parent 089c4e413f
commit c4e4cc5081
24 changed files with 176 additions and 182 deletions

View File

@@ -6,10 +6,11 @@
namespace mbgl {
namespace style {
FillLayer::FillLayer(const std::string& layerID)
FillLayer::FillLayer(const std::string& layerID, const std::string& sourceID)
: Layer(Type::Fill, std::make_unique<Impl>())
, impl(static_cast<Impl*>(baseImpl.get())) {
impl->id = layerID;
impl->source = sourceID;
}
FillLayer::FillLayer(const Impl& other)
@@ -25,15 +26,14 @@ std::unique_ptr<Layer> FillLayer::Impl::clone() const {
// Source
void FillLayer::setSource(const std::string& sourceID, const std::string& sourceLayer) {
impl->source = sourceID;
impl->sourceLayer = sourceLayer;
}
const std::string& FillLayer::getSourceID() const {
return impl->source;
}
void FillLayer::setSourceLayer(const std::string& sourceLayer) {
impl->sourceLayer = sourceLayer;
}
const std::string& FillLayer::getSourceLayer() const {
return impl->sourceLayer;
}