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