#ifndef MBGL_MAP_ANNOTATIONS #define MBGL_MAP_ANNOTATIONS #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace mbgl { class Annotation; class PointAnnotation; class ShapeAnnotation; class LiveTile; class LiveTileFeature; using GeoJSONVT = mapbox::util::geojsonvt::GeoJSONVT; class Annotation : private util::noncopyable { friend class AnnotationManager; public: Annotation(AnnotationType, const AnnotationSegments&, const StyleProperties&); public: const StyleProperties styleProperties; private: LatLng getPoint() const; LatLngBounds getBounds() const { return bounds; } private: const AnnotationType type = AnnotationType::Point; const AnnotationSegments geometry; std::unordered_map, TileID::Hash> tilePointFeatures; const LatLngBounds bounds; }; class AnnotationManager : private util::noncopyable { public: AnnotationManager(); ~AnnotationManager(); void markStaleTiles(std::unordered_set); size_t getStaleTileCount() const { return staleTiles.size(); } std::unordered_set resetStaleTiles(); void setDefaultPointAnnotationSymbol(const std::string& symbol); std::pair, AnnotationIDs> addPointAnnotations(const std::vector&, const uint8_t maxZoom); std::pair, AnnotationIDs> addShapeAnnotations(const std::vector&, const uint8_t maxZoom); std::unordered_set removeAnnotations(const AnnotationIDs&, const uint8_t maxZoom); AnnotationIDs getOrderedShapeAnnotations() const { return orderedShapeAnnotations; } const StyleProperties getAnnotationStyleProperties(uint32_t) const; AnnotationIDs getAnnotationsInBounds(const LatLngBounds&, const uint8_t maxZoom, const AnnotationType& = AnnotationType::Any) const; LatLngBounds getBoundsForAnnotations(const AnnotationIDs&) const; const LiveTile* getTile(const TileID& id); static const std::string PointLayerID; static const std::string ShapeLayerID; 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); private: std::string defaultPointAnnotationSymbol; std::unordered_map> annotations; std::vector orderedShapeAnnotations; std::unordered_map, std::unique_ptr>, TileID::Hash> tiles; std::unordered_map> shapeTilers; std::unordered_set staleTiles; uint32_t nextID_ = 0; }; } #endif