summaryrefslogtreecommitdiff
path: root/src/mbgl/annotation/annotation_manager.hpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-10-14 18:08:02 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-10-20 13:54:19 -0700
commitc5b95032a5cb9d3c7c39a7a74656f33de1c68d6e (patch)
tree6c73190d5f86b40c55e810bc244d30766051acdc /src/mbgl/annotation/annotation_manager.hpp
parent597b2b48511b68c7a6494386b414da479c436bd7 (diff)
downloadqtlocation-mapboxgl-c5b95032a5cb9d3c7c39a7a74656f33de1c68d6e.tar.gz
[core] Annotation refactor
Diffstat (limited to 'src/mbgl/annotation/annotation_manager.hpp')
-rw-r--r--src/mbgl/annotation/annotation_manager.hpp49
1 files changed, 14 insertions, 35 deletions
diff --git a/src/mbgl/annotation/annotation_manager.hpp b/src/mbgl/annotation/annotation_manager.hpp
index 2173442da8..1251585b00 100644
--- a/src/mbgl/annotation/annotation_manager.hpp
+++ b/src/mbgl/annotation/annotation_manager.hpp
@@ -1,66 +1,45 @@
-#ifndef MBGL_MAP_ANNOTATIONS
-#define MBGL_MAP_ANNOTATIONS
+#ifndef MBGL_ANNOTATION_MANAGER
+#define MBGL_ANNOTATION_MANAGER
#include <mbgl/annotation/annotation.hpp>
-#include <mbgl/map/geometry_tile.hpp>
-#include <mbgl/map/tile_id.hpp>
-#include <mbgl/style/style_properties.hpp>
-#include <mbgl/style/types.hpp>
+#include <mbgl/annotation/point_annotation_impl.hpp>
+#include <mbgl/annotation/shape_annotation_impl.hpp>
#include <mbgl/util/geo.hpp>
-#include <mbgl/util/geojsonvt/geojsonvt.hpp>
#include <mbgl/util/noncopyable.hpp>
-#include <mbgl/util/vec.hpp>
#include <string>
#include <vector>
-#include <memory>
-#include <unordered_map>
-#include <unordered_set>
namespace mbgl {
-class Annotation;
class PointAnnotation;
class ShapeAnnotation;
-class LiveTile;
+class AnnotationTile;
class Style;
-using GeoJSONVT = mapbox::util::geojsonvt::GeoJSONVT;
-
class AnnotationManager : private util::noncopyable {
public:
AnnotationManager();
~AnnotationManager();
- void setDefaultPointAnnotationSymbol(const std::string& symbol);
-
AnnotationIDs addPointAnnotations(const std::vector<PointAnnotation>&, const uint8_t maxZoom);
AnnotationIDs addShapeAnnotations(const std::vector<ShapeAnnotation>&, const uint8_t maxZoom);
- void removeAnnotations(const AnnotationIDs&, const uint8_t maxZoom);
+ void removeAnnotations(const AnnotationIDs&);
- AnnotationIDs getAnnotationsInBounds(const LatLngBounds&, const uint8_t maxZoom, const AnnotationType& = AnnotationType::Any) const;
+ AnnotationIDs getPointAnnotationsInBounds(const LatLngBounds&) const;
LatLngBounds getBoundsForAnnotations(const AnnotationIDs&) const;
void updateStyle(Style&);
- const LiveTile* getTile(const TileID& id);
+ std::unique_ptr<AnnotationTile> getTile(const TileID&);
- static const std::string PointSourceID;
- static const std::string ShapeSourceID;
+ static const std::string SourceID;
+ static const std::string PointLayerID;
private:
- inline uint32_t nextID();
- static vec2<double> projectPoint(const LatLng& point);
-
- uint32_t addShapeAnnotation(const ShapeAnnotation&, const uint8_t maxZoom);
- uint32_t addPointAnnotation(const PointAnnotation&, const uint8_t maxZoom);
-
- std::string defaultPointAnnotationSymbol;
- std::unordered_map<uint32_t, std::unique_ptr<Annotation>> annotations;
- std::vector<uint32_t> orderedShapeAnnotations;
- std::unordered_map<TileID, std::pair<std::unordered_set<uint32_t>, std::unique_ptr<LiveTile>>, TileID::Hash> tiles;
- std::unordered_map<uint32_t, std::unique_ptr<GeoJSONVT>> shapeTilers;
- std::unordered_set<TileID, TileID::Hash> stalePointTileIDs;
- uint32_t nextID_ = 0;
+ AnnotationID nextID = 0;
+ PointAnnotationImpl::Tree pointTree;
+ PointAnnotationImpl::Map pointAnnotations;
+ ShapeAnnotationImpl::Map shapeAnnotations;
};
}