From dd0e6e0257eee0b3c56190f7771e27f49813c7cf Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 21 Sep 2015 16:45:06 -0700 Subject: [PATCH] Inline AnnotationManager::addTileFeature --- src/mbgl/map/annotation.cpp | 52 +++++++++++-------------------------- src/mbgl/map/annotation.hpp | 9 ------- 2 files changed, 15 insertions(+), 46 deletions(-) diff --git a/src/mbgl/map/annotation.cpp b/src/mbgl/map/annotation.cpp index 9cfb857bc..917dc2f98 100644 --- a/src/mbgl/map/annotation.cpp +++ b/src/mbgl/map/annotation.cpp @@ -77,27 +77,6 @@ vec2 AnnotationManager::projectPoint(const LatLng& point) { return { x, y }; } -std::unordered_set -AnnotationManager::addTileFeature(const uint32_t annotationID, - const AnnotationSegments& segments, - const std::vector>>& projectedFeature, - const AnnotationType& type, - const StyleProperties& styleProperties, - const std::unordered_map& featureProperties, - const uint8_t maxZoom) { - - assert(type != AnnotationType::Any); - - // track the annotation global ID and its original geometry - annotations.emplace(annotationID, std::make_unique(type, segments, styleProperties)); - - if (type == AnnotationType::Shape) { - return addShapeFeature(annotationID, segments, styleProperties, maxZoom); - } else { - return addPointFeature(annotationID, projectedFeature, featureProperties, maxZoom); - } -} - std::unordered_set AnnotationManager::addShapeFeature(const uint32_t annotationID, const AnnotationSegments& segments, @@ -233,16 +212,17 @@ AnnotationManager::addPointAnnotations(const std::vector& point pointFeatureProperties.emplace("sprite", defaultPointAnnotationSymbol); } - // add individual point tile feature - auto featureAffectedTiles = addTileFeature( - pointAnnotationID, - AnnotationSegments({{ point.position }}), - std::vector>>({{ pp }}), + // track the annotation global ID and its original geometry + annotations.emplace(pointAnnotationID, std::make_unique( AnnotationType::Point, - {{ }}, + AnnotationSegments({{ point.position }}), + StyleProperties({{ }}))); + + auto featureAffectedTiles = addPointFeature( + pointAnnotationID, + std::vector>>({{ pp }}), pointFeatureProperties, - maxZoom - ); + maxZoom); std::copy(featureAffectedTiles.begin(), featureAffectedTiles.end(), std::inserter(affectedTiles, affectedTiles.begin())); @@ -273,15 +253,13 @@ AnnotationManager::addShapeAnnotations(const std::vector& shape // current shape tiles are on-the-fly, so we don't get any "affected tiles" // and just expire all annotation tiles for shape adds - addTileFeature( - shapeAnnotationID, - shape.segments, - {{ }}, + // track the annotation global ID and its original geometry + annotations.emplace(shapeAnnotationID, std::make_unique( AnnotationType::Shape, - shape.styleProperties, - {{ }}, - maxZoom - ); + shape.segments, + shape.styleProperties)); + + addShapeFeature(shapeAnnotationID, shape.segments, shape.styleProperties, maxZoom); annotationIDs.push_back(shapeAnnotationID); } diff --git a/src/mbgl/map/annotation.hpp b/src/mbgl/map/annotation.hpp index 7691e4508..ddae05b6f 100644 --- a/src/mbgl/map/annotation.hpp +++ b/src/mbgl/map/annotation.hpp @@ -81,15 +81,6 @@ private: inline uint32_t nextID(); static vec2 projectPoint(const LatLng& point); - std::unordered_set - addTileFeature(const uint32_t annotationID, - const AnnotationSegments&, - const std::vector>>& projectedFeature, - const AnnotationType&, - const StyleProperties&, - const std::unordered_map& featureProperties, - const uint8_t maxZoom); - std::unordered_set addShapeFeature(const uint32_t annotationID, const AnnotationSegments& segments,