#pragma once #include #include #include #include #include #include #include #include #include #include #include namespace mbgl { class LatLngBounds; class AnnotationTile; class AnnotationTileData; class SymbolAnnotationImpl; class ShapeAnnotationImpl; class AnnotationManager : private util::noncopyable { public: 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(std::unique_ptr); void removeImage(const std::string&); double getTopOffsetPixelsForImage(const std::string&); void updateStyle(style::Style::Impl&); void updateData(); void addTile(AnnotationTile&); void removeTile(AnnotationTile&); static const std::string SourceID; static const std::string PointLayerID; 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); 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); void removeAndAdd(const AnnotationID&, const Annotation&, const uint8_t); void remove(const AnnotationID&); std::unique_ptr getTileData(const CanonicalTileID&); std::mutex mutex; AnnotationID nextID = 0; using SymbolAnnotationTree = boost::geometry::index::rtree, boost::geometry::index::rstar<16, 4>>; // Unlike std::unordered_map, std::map is guaranteed to sort by AnnotationID, ensuring that older annotations are below newer annotations. // using SymbolAnnotationMap = std::map>; using ShapeAnnotationMap = std::map>; using ImageMap = std::unordered_map; SymbolAnnotationTree symbolTree; SymbolAnnotationMap symbolAnnotations; ShapeAnnotationMap shapeAnnotations; ImageMap images; std::unordered_set obsoleteShapeAnnotationLayers; std::unordered_set obsoleteImages; std::unordered_set tiles; friend class AnnotationTile; }; } // namespace mbgl