#include #include #include #include #include #include namespace mbgl { using namespace style; StyleSourcedAnnotationImpl::StyleSourcedAnnotationImpl(const AnnotationID id_, const StyleSourcedAnnotation& annotation_, const uint8_t maxZoom_) : ShapeAnnotationImpl(id_, maxZoom_), annotation(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()) { std::unique_ptr layer = sourceLayer->copy(layerID, ""); layer->as()->setSource(AnnotationManager::SourceID, layerID); layer->as()->setVisibility(VisibilityType::Visible); style.addLayer(std::move(layer), sourceLayer->getID()); } else if (sourceLayer->is()) { std::unique_ptr layer = sourceLayer->copy(layerID, ""); layer->as()->setSource(AnnotationManager::SourceID, layerID); layer->as()->setVisibility(VisibilityType::Visible); style.addLayer(std::move(layer), sourceLayer->getID()); } } const ShapeAnnotationGeometry& StyleSourcedAnnotationImpl::geometry() const { return annotation.geometry; } } // namespace mbgl