summaryrefslogtreecommitdiff
path: root/src/mbgl/annotation/annotation_manager.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/annotation/annotation_manager.hpp')
-rw-r--r--src/mbgl/annotation/annotation_manager.hpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/mbgl/annotation/annotation_manager.hpp b/src/mbgl/annotation/annotation_manager.hpp
index 0ab43bec15..6906791db7 100644
--- a/src/mbgl/annotation/annotation_manager.hpp
+++ b/src/mbgl/annotation/annotation_manager.hpp
@@ -2,13 +2,16 @@
#include <mbgl/annotation/annotation.hpp>
#include <mbgl/annotation/symbol_annotation_impl.hpp>
-#include <mbgl/sprite/sprite_atlas.hpp>
+#include <mbgl/style/image.hpp>
#include <mbgl/map/update.hpp>
+#include <mbgl/style/style.hpp>
#include <mbgl/util/noncopyable.hpp>
+#include <mutex>
#include <string>
#include <vector>
#include <unordered_set>
+#include <unordered_map>
namespace mbgl {
@@ -18,26 +21,20 @@ class AnnotationTileData;
class SymbolAnnotationImpl;
class ShapeAnnotationImpl;
-namespace style {
-class Style;
-class Image;
-} // namespace style
-
class AnnotationManager : private util::noncopyable {
public:
- AnnotationManager(float pixelRatio);
+ AnnotationManager();
~AnnotationManager();
AnnotationID addAnnotation(const Annotation&, const uint8_t maxZoom);
Update updateAnnotation(const AnnotationID&, const Annotation&, const uint8_t maxZoom);
void removeAnnotation(const AnnotationID&);
- void addImage(const std::string&, std::unique_ptr<style::Image>);
+ void addImage(std::unique_ptr<style::Image>);
void removeImage(const std::string&);
double getTopOffsetPixelsForImage(const std::string&);
- SpriteAtlas& getSpriteAtlas() { return spriteAtlas; }
- void updateStyle(style::Style&);
+ void updateStyle(style::Style::Impl&);
void updateData();
void addTile(AnnotationTile&);
@@ -50,17 +47,19 @@ private:
void add(const AnnotationID&, const SymbolAnnotation&, const uint8_t);
void add(const AnnotationID&, const LineAnnotation&, const uint8_t);
void add(const AnnotationID&, const FillAnnotation&, const uint8_t);
- void add(const AnnotationID&, const StyleSourcedAnnotation&, const uint8_t);
Update update(const AnnotationID&, const SymbolAnnotation&, const uint8_t);
Update update(const AnnotationID&, const LineAnnotation&, const uint8_t);
Update update(const AnnotationID&, const FillAnnotation&, const uint8_t);
- Update update(const AnnotationID&, const StyleSourcedAnnotation&, const uint8_t);
void removeAndAdd(const AnnotationID&, const Annotation&, const uint8_t);
+ void remove(const AnnotationID&);
+
std::unique_ptr<AnnotationTileData> getTileData(const CanonicalTileID&);
+ std::mutex mutex;
+
AnnotationID nextID = 0;
using SymbolAnnotationTree = boost::geometry::index::rtree<std::shared_ptr<const SymbolAnnotationImpl>, boost::geometry::index::rstar<16, 4>>;
@@ -68,13 +67,15 @@ private:
// <https://github.com/mapbox/mapbox-gl-native/issues/5691>
using SymbolAnnotationMap = std::map<AnnotationID, std::shared_ptr<SymbolAnnotationImpl>>;
using ShapeAnnotationMap = std::map<AnnotationID, std::unique_ptr<ShapeAnnotationImpl>>;
+ using ImageMap = std::unordered_map<std::string, style::Image>;
SymbolAnnotationTree symbolTree;
SymbolAnnotationMap symbolAnnotations;
ShapeAnnotationMap shapeAnnotations;
+ ImageMap images;
std::unordered_set<std::string> obsoleteShapeAnnotationLayers;
+ std::unordered_set<std::string> obsoleteImages;
std::unordered_set<AnnotationTile*> tiles;
- SpriteAtlas spriteAtlas;
friend class AnnotationTile;
};