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/annotation/style_sourced_annotation_impl.cpp | |
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/annotation/style_sourced_annotation_impl.cpp')
-rw-r--r-- | src/mbgl/annotation/style_sourced_annotation_impl.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mbgl/annotation/style_sourced_annotation_impl.cpp b/src/mbgl/annotation/style_sourced_annotation_impl.cpp index d828014606..d3212da12d 100644 --- a/src/mbgl/annotation/style_sourced_annotation_impl.cpp +++ b/src/mbgl/annotation/style_sourced_annotation_impl.cpp @@ -2,6 +2,7 @@ #include <mbgl/annotation/annotation_manager.hpp> #include <mbgl/style/style.hpp> #include <mbgl/style/layer.hpp> +#include <mbgl/style/layer_impl.hpp> #include <mbgl/style/layers/line_layer.hpp> #include <mbgl/style/layers/fill_layer.hpp> @@ -23,13 +24,13 @@ void StyleSourcedAnnotationImpl::updateStyle(Style& style) const { return; if (sourceLayer->is<LineLayer>()) { - std::unique_ptr<Layer> layer = sourceLayer->copy(layerID, ""); - layer->as<LineLayer>()->setSource(AnnotationManager::SourceID, layerID); + std::unique_ptr<Layer> layer = sourceLayer->baseImpl->copy(layerID, "", AnnotationManager::SourceID); + layer->as<LineLayer>()->setSourceLayer(layerID); layer->as<LineLayer>()->setVisibility(VisibilityType::Visible); style.addLayer(std::move(layer), sourceLayer->getID()); } else if (sourceLayer->is<FillLayer>()) { - std::unique_ptr<Layer> layer = sourceLayer->copy(layerID, ""); - layer->as<FillLayer>()->setSource(AnnotationManager::SourceID, layerID); + std::unique_ptr<Layer> layer = sourceLayer->baseImpl->copy(layerID, "", AnnotationManager::SourceID); + layer->as<FillLayer>()->setSourceLayer(layerID); layer->as<FillLayer>()->setVisibility(VisibilityType::Visible); style.addLayer(std::move(layer), sourceLayer->getID()); } |