summaryrefslogtreecommitdiff
path: root/src/mbgl/map/annotation.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/map/annotation.hpp')
-rw-r--r--src/mbgl/map/annotation.hpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/mbgl/map/annotation.hpp b/src/mbgl/map/annotation.hpp
new file mode 100644
index 0000000000..f1596dbdff
--- /dev/null
+++ b/src/mbgl/map/annotation.hpp
@@ -0,0 +1,55 @@
+#ifndef MBGL_MAP_ANNOTATIONS
+#define MBGL_MAP_ANNOTATIONS
+
+#include <mbgl/map/tile_id.hpp>
+#include <mbgl/util/geo.hpp>
+#include <mbgl/util/noncopyable.hpp>
+#include <mbgl/util/std.hpp>
+#include <mbgl/util/vec.hpp>
+
+#include <string>
+#include <vector>
+#include <mutex>
+#include <memory>
+#include <unordered_map>
+#include <unordered_set>
+
+namespace mbgl {
+
+class Annotation;
+class Map;
+class LiveTile;
+
+using AnnotationIDs = std::vector<uint32_t>;
+
+class AnnotationManager : private util::noncopyable {
+public:
+ AnnotationManager();
+ ~AnnotationManager();
+
+ void setDefaultPointAnnotationSymbol(const std::string& symbol);
+ std::pair<std::vector<TileID>, AnnotationIDs> addPointAnnotations(
+ const std::vector<LatLng>&, const std::vector<std::string>& symbols, const Map&);
+ std::vector<TileID> removeAnnotations(const AnnotationIDs&, const Map&);
+ AnnotationIDs getAnnotationsInBounds(const LatLngBounds&, const Map&) const;
+ LatLngBounds getBoundsForAnnotations(const AnnotationIDs&) const;
+
+ const LiveTile* getTile(const TileID& id);
+
+ static const std::string layerID;
+
+private:
+ inline uint32_t nextID();
+ static vec2<double> projectPoint(const LatLng& point);
+
+private:
+ mutable std::mutex mtx;
+ std::string defaultPointAnnotationSymbol;
+ std::unordered_map<uint32_t, std::unique_ptr<Annotation>> annotations;
+ std::unordered_map<TileID, std::pair<std::unordered_set<uint32_t>, std::unique_ptr<LiveTile>>, TileID::Hash> tiles;
+ uint32_t nextID_ = 0;
+};
+
+}
+
+#endif