#pragma once #include "drape_frontend/tile_key.hpp" #include "drape_frontend/user_mark_shapes.hpp" #include "drape/pointers.hpp" #include #include #include #include #include namespace df { using MarksIDGroups = std::map>; using MarksIndex = std::map>; class UserMarkGenerator { public: using TFlushFn = std::function; explicit UserMarkGenerator(TFlushFn const & flushFn); void SetUserMarks(drape_ptr && marks); void SetUserLines(drape_ptr && lines); void SetRemovedUserMarks(drape_ptr && ids); void SetCreatedUserMarks(drape_ptr && ids); void SetGroup(kml::MarkGroupId groupId, drape_ptr && ids); void RemoveGroup(kml::MarkGroupId groupId); void SetGroupVisibility(kml::MarkGroupId groupId, bool isVisible); void GenerateUserMarksGeometry(TileKey const & tileKey, ref_ptr textures); private: void UpdateIndex(kml::MarkGroupId groupId); ref_ptr GetIdCollection(TileKey const & tileKey, kml::MarkGroupId groupId); void CleanIndex(); int GetNearestLineIndexZoom(int zoom) const; ref_ptr GetUserMarksGroups(TileKey const & tileKey); ref_ptr GetUserLinesGroups(TileKey const & tileKey); void CacheUserMarks(TileKey const & tileKey, MarksIDGroups const & indexesGroups, ref_ptr textures, dp::Batcher & batcher); void CacheUserLines(TileKey const & tileKey, MarksIDGroups const & indexesGroups, ref_ptr textures, dp::Batcher & batcher); std::unordered_set m_groupsVisibility; MarksIDGroups m_groups; UserMarksRenderCollection m_marks; UserLinesRenderCollection m_lines; MarksIndex m_index; TFlushFn m_flushFn; }; } // namespace df