diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-06-22 12:31:49 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-06-24 09:39:15 -0700 |
commit | c4e4cc5081965d03132eea754c27ece3c95961cb (patch) | |
tree | 3aa4f722ead3273b1faaed5f30449bb8654cf23d /src/mbgl/style/layers/layer.cpp.ejs | |
parent | 089c4e413fbe80711ebd874520d3b8fdcb997112 (diff) | |
download | qtlocation-mapboxgl-c4e4cc5081965d03132eea754c27ece3c95961cb.tar.gz |
[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.
Diffstat (limited to 'src/mbgl/style/layers/layer.cpp.ejs')
-rw-r--r-- | src/mbgl/style/layers/layer.cpp.ejs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs index 633d673804..4f78d6b55e 100644 --- a/src/mbgl/style/layers/layer.cpp.ejs +++ b/src/mbgl/style/layers/layer.cpp.ejs @@ -11,11 +11,20 @@ namespace mbgl { namespace style { +<% if (type === 'background') { -%> <%- camelize(type) %>Layer::<%- camelize(type) %>Layer(const std::string& layerID) : Layer(Type::<%- camelize(type) %>, std::make_unique<Impl>()) , impl(static_cast<Impl*>(baseImpl.get())) { impl->id = layerID; } +<% } else { -%> +<%- camelize(type) %>Layer::<%- camelize(type) %>Layer(const std::string& layerID, const std::string& sourceID) + : Layer(Type::<%- camelize(type) %>, std::make_unique<Impl>()) + , impl(static_cast<Impl*>(baseImpl.get())) { + impl->id = layerID; + impl->source = sourceID; +} +<% } -%> <%- camelize(type) %>Layer::<%- camelize(type) %>Layer(const Impl& other) : Layer(Type::<%- camelize(type) %>, std::make_unique<Impl>(other)) @@ -28,28 +37,18 @@ std::unique_ptr<Layer> <%- camelize(type) %>Layer::Impl::clone() const { return std::make_unique<<%- camelize(type) %>Layer>(*this); } -<% if (type === 'raster') { -%> +<% if (type !== 'background') { -%> // Source -void <%- camelize(type) %>Layer::setSource(const std::string& sourceID) { - impl->source = sourceID; -} - const std::string& <%- camelize(type) %>Layer::getSourceID() const { return impl->source; } -<% } else if (type !== 'background') { -%> -// Source -void <%- camelize(type) %>Layer::setSource(const std::string& sourceID, const std::string& sourceLayer) { - impl->source = sourceID; +<% if (type !== 'raster') { -%> +void <%- camelize(type) %>Layer::setSourceLayer(const std::string& sourceLayer) { impl->sourceLayer = sourceLayer; } -const std::string& <%- camelize(type) %>Layer::getSourceID() const { - return impl->source; -} - const std::string& <%- camelize(type) %>Layer::getSourceLayer() const { return impl->sourceLayer; } @@ -64,6 +63,7 @@ const Filter& <%- camelize(type) %>Layer::getFilter() const { return impl->filter; } <% } -%> +<% } -%> // Layout properties |