[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 {
CircleLayer::CircleLayer(const std::string& layerID)
CircleLayer::CircleLayer(const std::string& layerID, const std::string& sourceID)
: Layer(Type::Circle, std::make_unique<Impl>())
, impl(static_cast<Impl*>(baseImpl.get())) {
impl->id = layerID;
impl->source = sourceID;
}
CircleLayer::CircleLayer(const Impl& other)
@@ -25,15 +26,14 @@ std::unique_ptr<Layer> CircleLayer::Impl::clone() const {
// Source
void CircleLayer::setSource(const std::string& sourceID, const std::string& sourceLayer) {
impl->source = sourceID;
impl->sourceLayer = sourceLayer;
}
const std::string& CircleLayer::getSourceID() const {
return impl->source;
}
void CircleLayer::setSourceLayer(const std::string& sourceLayer) {
impl->sourceLayer = sourceLayer;
}
const std::string& CircleLayer::getSourceLayer() const {
return impl->sourceLayer;
}