[core] Remove StyleSourcedAnnotation support
The functionality this provided has been subsumed by the runtime styling API.
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
#include <mbgl/annotation/symbol_annotation_impl.hpp>
|
||||
#include <mbgl/annotation/line_annotation_impl.hpp>
|
||||
#include <mbgl/annotation/fill_annotation_impl.hpp>
|
||||
#include <mbgl/annotation/style_sourced_annotation_impl.hpp>
|
||||
#include <mbgl/style/style.hpp>
|
||||
#include <mbgl/style/layers/symbol_layer.hpp>
|
||||
#include <mbgl/style/layers/symbol_layer_impl.hpp>
|
||||
@@ -72,12 +71,6 @@ void AnnotationManager::add(const AnnotationID& id, const FillAnnotation& annota
|
||||
obsoleteShapeAnnotationLayers.erase(impl.layerID);
|
||||
}
|
||||
|
||||
void AnnotationManager::add(const AnnotationID& id, const StyleSourcedAnnotation& annotation, const uint8_t maxZoom) {
|
||||
ShapeAnnotationImpl& impl = *shapeAnnotations.emplace(id,
|
||||
std::make_unique<StyleSourcedAnnotationImpl>(id, annotation, maxZoom)).first->second;
|
||||
obsoleteShapeAnnotationLayers.erase(impl.layerID);
|
||||
}
|
||||
|
||||
Update AnnotationManager::update(const AnnotationID& id, const SymbolAnnotation& annotation, const uint8_t maxZoom) {
|
||||
Update result = Update::Nothing;
|
||||
|
||||
@@ -124,16 +117,6 @@ Update AnnotationManager::update(const AnnotationID& id, const FillAnnotation& a
|
||||
return Update::AnnotationData | Update::AnnotationStyle;
|
||||
}
|
||||
|
||||
Update AnnotationManager::update(const AnnotationID& id, const StyleSourcedAnnotation& annotation, const uint8_t maxZoom) {
|
||||
auto it = shapeAnnotations.find(id);
|
||||
if (it == shapeAnnotations.end()) {
|
||||
assert(false); // Attempt to update a non-existent shape annotation
|
||||
return Update::Nothing;
|
||||
}
|
||||
removeAndAdd(id, annotation, maxZoom);
|
||||
return Update::AnnotationData | Update::AnnotationStyle;
|
||||
}
|
||||
|
||||
void AnnotationManager::removeAndAdd(const AnnotationID& id, const Annotation& annotation, const uint8_t maxZoom) {
|
||||
removeAnnotation(id);
|
||||
Annotation::visit(annotation, [&] (const auto& annotation_) {
|
||||
|
||||
@@ -50,12 +50,10 @@ private:
|
||||
void add(const AnnotationID&, const SymbolAnnotation&, const uint8_t);
|
||||
void add(const AnnotationID&, const LineAnnotation&, const uint8_t);
|
||||
void add(const AnnotationID&, const FillAnnotation&, const uint8_t);
|
||||
void add(const AnnotationID&, const StyleSourcedAnnotation&, const uint8_t);
|
||||
|
||||
Update update(const AnnotationID&, const SymbolAnnotation&, const uint8_t);
|
||||
Update update(const AnnotationID&, const LineAnnotation&, const uint8_t);
|
||||
Update update(const AnnotationID&, const FillAnnotation&, const uint8_t);
|
||||
Update update(const AnnotationID&, const StyleSourcedAnnotation&, const uint8_t);
|
||||
|
||||
void removeAndAdd(const AnnotationID&, const Annotation&, const uint8_t);
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
#include <mbgl/annotation/style_sourced_annotation_impl.hpp>
|
||||
#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>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
StyleSourcedAnnotationImpl::StyleSourcedAnnotationImpl(AnnotationID id_, StyleSourcedAnnotation annotation_, uint8_t maxZoom_)
|
||||
: ShapeAnnotationImpl(id_, maxZoom_),
|
||||
annotation(std::move(annotation_)) {
|
||||
}
|
||||
|
||||
void StyleSourcedAnnotationImpl::updateStyle(Style& style) const {
|
||||
if (style.getLayer(layerID))
|
||||
return;
|
||||
|
||||
const Layer* sourceLayer = style.getLayer(annotation.layerID);
|
||||
if (!sourceLayer)
|
||||
return;
|
||||
|
||||
if (sourceLayer->is<LineLayer>()) {
|
||||
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->baseImpl->copy(layerID, AnnotationManager::SourceID);
|
||||
layer->as<FillLayer>()->setSourceLayer(layerID);
|
||||
layer->as<FillLayer>()->setVisibility(VisibilityType::Visible);
|
||||
style.addLayer(std::move(layer), sourceLayer->getID());
|
||||
}
|
||||
}
|
||||
|
||||
const ShapeAnnotationGeometry& StyleSourcedAnnotationImpl::geometry() const {
|
||||
return annotation.geometry;
|
||||
}
|
||||
|
||||
} // namespace mbgl
|
||||
@@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/annotation/shape_annotation_impl.hpp>
|
||||
#include <mbgl/annotation/annotation.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class StyleSourcedAnnotationImpl : public ShapeAnnotationImpl {
|
||||
public:
|
||||
StyleSourcedAnnotationImpl(AnnotationID, StyleSourcedAnnotation, uint8_t maxZoom);
|
||||
|
||||
void updateStyle(style::Style&) const final;
|
||||
const ShapeAnnotationGeometry& geometry() const final;
|
||||
|
||||
private:
|
||||
const StyleSourcedAnnotation annotation;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
@@ -3,14 +3,6 @@
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
std::unique_ptr<Layer> Layer::Impl::copy(const std::string& id_,
|
||||
const std::string& source_) const {
|
||||
std::unique_ptr<Layer> result = clone();
|
||||
result->baseImpl->id = id_;
|
||||
result->baseImpl->source = source_;
|
||||
return result;
|
||||
}
|
||||
|
||||
void Layer::Impl::setObserver(LayerObserver* observer_) {
|
||||
observer = observer_ ? observer_ : &nullObserver;
|
||||
}
|
||||
|
||||
@@ -34,11 +34,6 @@ class Layer::Impl {
|
||||
public:
|
||||
virtual ~Impl() = default;
|
||||
|
||||
// Create a new layer with the specified `id` and `sourceID`. All other properties
|
||||
// are copied from this layer.
|
||||
std::unique_ptr<Layer> copy(const std::string& id,
|
||||
const std::string& sourceID) const;
|
||||
|
||||
// Create an identical copy of this layer.
|
||||
virtual std::unique_ptr<Layer> clone() const = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user