[core] Remove shape layers from the style (fixes #2405)
This commit is contained in:
@@ -51,7 +51,7 @@ void AnnotationManager::removeAnnotations(const AnnotationIDs& ids) {
|
||||
pointTree.remove(pointAnnotations.at(id));
|
||||
pointAnnotations.erase(id);
|
||||
} else if (shapeAnnotations.find(id) != shapeAnnotations.end()) {
|
||||
// TODO: remove style layer
|
||||
obsoleteShapeAnnotationLayers.push_back(shapeAnnotations.at(id)->layerID);
|
||||
shapeAnnotations.erase(id);
|
||||
}
|
||||
}
|
||||
@@ -132,6 +132,11 @@ void AnnotationManager::updateStyle(Style& style) {
|
||||
shape.second->updateStyle(style);
|
||||
}
|
||||
|
||||
for (const auto& layer : obsoleteShapeAnnotationLayers) {
|
||||
style.removeLayer(layer);
|
||||
}
|
||||
|
||||
obsoleteShapeAnnotationLayers.clear();
|
||||
style.getSource(SourceID)->invalidateTiles();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ private:
|
||||
PointAnnotationImpl::Tree pointTree;
|
||||
PointAnnotationImpl::Map pointAnnotations;
|
||||
ShapeAnnotationImpl::Map shapeAnnotations;
|
||||
std::vector<std::string> obsoleteShapeAnnotationLayers;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -24,10 +24,11 @@ public:
|
||||
void updateStyle(Style&);
|
||||
void updateTile(const TileID&, AnnotationTile&);
|
||||
|
||||
private:
|
||||
const AnnotationID id;
|
||||
const std::string layerID;
|
||||
const ShapeAnnotation shape;
|
||||
|
||||
private:
|
||||
mapbox::util::geojsonvt::GeoJSONVT shapeTiler;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user