[core] Add support for updating point annotations
This commit is contained in:
committed by
John Firebaugh
parent
9841f94074
commit
d742c2d3eb
@@ -161,6 +161,8 @@ public:
|
||||
AnnotationID addShapeAnnotation(const ShapeAnnotation&);
|
||||
AnnotationIDs addShapeAnnotations(const std::vector<ShapeAnnotation>&);
|
||||
|
||||
void updatePointAnnotation(AnnotationID, const PointAnnotation&);
|
||||
|
||||
void removeAnnotation(AnnotationID);
|
||||
void removeAnnotations(const AnnotationIDs&);
|
||||
|
||||
|
||||
@@ -48,6 +48,16 @@ AnnotationManager::addShapeAnnotations(const std::vector<ShapeAnnotation>& shape
|
||||
return annotationIDs;
|
||||
}
|
||||
|
||||
void AnnotationManager::updatePointAnnotation(const AnnotationID& id, const PointAnnotation& point, const uint8_t) {
|
||||
auto foundAnnotation = pointAnnotations.find(id);
|
||||
if (foundAnnotation != pointAnnotations.end()) {
|
||||
auto updatedAnnotation = std::make_shared<PointAnnotationImpl>(id, point);
|
||||
pointTree.remove(foundAnnotation->second);
|
||||
pointTree.insert(updatedAnnotation);
|
||||
foundAnnotation->second = updatedAnnotation;
|
||||
}
|
||||
}
|
||||
|
||||
void AnnotationManager::removeAnnotations(const AnnotationIDs& ids) {
|
||||
for (const auto& id : ids) {
|
||||
if (pointAnnotations.find(id) != pointAnnotations.end()) {
|
||||
|
||||
@@ -28,6 +28,7 @@ public:
|
||||
|
||||
AnnotationIDs addPointAnnotations(const std::vector<PointAnnotation>&, const uint8_t maxZoom);
|
||||
AnnotationIDs addShapeAnnotations(const std::vector<ShapeAnnotation>&, const uint8_t maxZoom);
|
||||
void updatePointAnnotation(const AnnotationID&, const PointAnnotation&, const uint8_t maxZoom);
|
||||
void removeAnnotations(const AnnotationIDs&);
|
||||
|
||||
AnnotationIDs getPointAnnotationsInBounds(const LatLngBounds&) const;
|
||||
|
||||
@@ -452,6 +452,11 @@ AnnotationIDs Map::addShapeAnnotations(const std::vector<ShapeAnnotation>& annot
|
||||
return result;
|
||||
}
|
||||
|
||||
void Map::updatePointAnnotation(AnnotationID annotationId, const PointAnnotation& annotation) {
|
||||
data->getAnnotationManager()->updatePointAnnotation(annotationId, annotation, getMaxZoom());
|
||||
update(Update::Annotations);
|
||||
}
|
||||
|
||||
void Map::removeAnnotation(AnnotationID annotation) {
|
||||
removeAnnotations({ annotation });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user