[all] Rationalize annotation API

This commit is contained in:
John Firebaugh
2016-05-31 17:34:11 -07:00
parent cfd6757ecc
commit 0fba70d5a8
32 changed files with 461 additions and 545 deletions

View File

@@ -3,8 +3,6 @@
#include <mbgl/map/view.hpp>
#include <mbgl/map/transform.hpp>
#include <mbgl/map/transform_state.hpp>
#include <mbgl/annotation/point_annotation.hpp>
#include <mbgl/annotation/shape_annotation.hpp>
#include <mbgl/annotation/annotation_manager.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/style_observer.hpp>
@@ -693,37 +691,19 @@ double Map::getTopOffsetPixelsForAnnotationIcon(const std::string& name) {
return impl->annotationManager->getTopOffsetPixelsForIcon(name);
}
AnnotationID Map::addPointAnnotation(const PointAnnotation& annotation) {
return addPointAnnotations({ annotation }).front();
}
AnnotationIDs Map::addPointAnnotations(const std::vector<PointAnnotation>& annotations) {
auto result = impl->annotationManager->addPointAnnotations(annotations, getMaxZoom());
AnnotationID Map::addAnnotation(const Annotation& annotation) {
auto result = impl->annotationManager->addAnnotation(annotation, getMaxZoom());
update(Update::Annotations);
return result;
}
AnnotationID Map::addShapeAnnotation(const ShapeAnnotation& annotation) {
return addShapeAnnotations({ annotation }).front();
}
AnnotationIDs Map::addShapeAnnotations(const std::vector<ShapeAnnotation>& annotations) {
auto result = impl->annotationManager->addShapeAnnotations(annotations, getMaxZoom());
update(Update::Annotations);
return result;
}
void Map::updatePointAnnotation(AnnotationID annotationId, const PointAnnotation& annotation) {
impl->annotationManager->updatePointAnnotation(annotationId, annotation, getMaxZoom());
void Map::updateAnnotation(AnnotationID id, const Annotation& annotation) {
impl->annotationManager->updateAnnotation(id, annotation, getMaxZoom());
update(Update::Annotations);
}
void Map::removeAnnotation(AnnotationID annotation) {
removeAnnotations({ annotation });
}
void Map::removeAnnotations(const AnnotationIDs& annotations) {
impl->annotationManager->removeAnnotations(annotations);
impl->annotationManager->removeAnnotation(annotation);
update(Update::Annotations);
}