diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp index da1634b613..f6b274a6be 100644 --- a/map/bookmark_manager.cpp +++ b/map/bookmark_manager.cpp @@ -1232,7 +1232,8 @@ void BookmarkManager::SetTrackInfoMark(kml::TrackId trackId, m2::PointD const & auto es = GetEditSession(); auto trackInfoMark = es.GetMarkForEdit(m_trackInfoMarkId); trackInfoMark->SetPosition(pt); - trackInfoMark->SetIsVisible(true); + auto const isVisible = IsVisible(GetTrack(trackId)->GetGroupId()); + trackInfoMark->SetIsVisible(isVisible); trackInfoMark->SetTrackId(trackId); } @@ -1323,7 +1324,8 @@ void BookmarkManager::OnTrackDeselected(kml::TrackId trackId) auto es = GetEditSession(); auto * trackSelectionMark = es.GetMarkForEdit(markId); - trackSelectionMark->SetIsVisible(true); + auto const isVisible = IsVisible(GetTrack(trackId)->GetGroupId()); + trackSelectionMark->SetIsVisible(isVisible); } void BookmarkManager::PrepareBookmarksAddresses(std::vector & bookmarksForSort, @@ -1865,6 +1867,7 @@ void BookmarkManager::SetIsVisible(kml::MarkGroupId groupId, bool visible) { CHECK_THREAD_CHECKER(m_threadChecker, ()); GetGroup(groupId)->SetIsVisible(visible); + UpdateTrackMarksVisibility(groupId); } bool BookmarkManager::IsVisible(kml::MarkGroupId groupId) const @@ -1901,17 +1904,35 @@ void BookmarkManager::PrepareForSearch(kml::MarkGroupId groupId) m_callbacks.m_getSearchAPI().EnableIndexingOfBookmarkGroup(groupId, true /* enable */); } -void BookmarkManager::UpdateTrackMarks() +void BookmarkManager::UpdateTrackMarksMinZoom() { auto es = GetEditSession(); - auto const marks = GetUserMarkIds(UserMark::TRACK_SELECTION); - for (auto markId : marks) + auto const marksIds = GetUserMarkIds(UserMark::TRACK_SELECTION); + for (auto markId : marksIds) { auto mark = es.GetMarkForEdit(markId); mark->SetMinVisibleZoom(GetTrackSelectionMarkMinZoom(mark->GetTrackId())); } } +void BookmarkManager::UpdateTrackMarksVisibility(kml::MarkGroupId groupId) +{ + auto es = GetEditSession(); + auto const isVisible = IsVisible(groupId); + auto const tracksIds = GetTrackIds(groupId); + auto infoMark = es.GetMarkForEdit(m_trackInfoMarkId); + for (auto trackId : tracksIds) + { + auto markId = GetTrackSelectionMarkId(trackId); + if (markId == kml::kInvalidMarkId) + continue; + if (infoMark->GetTrackId() == trackId && infoMark->IsVisible()) + infoMark->SetIsVisible(isVisible); + auto mark = es.GetMarkForEdit(markId); + mark->SetIsVisible(isVisible); + } +} + void BookmarkManager::RequestSymbolSizes() { std::vector symbols; @@ -1938,7 +1959,7 @@ void BookmarkManager::SetDrapeEngine(ref_ptr engine) m_drapeEngine.Set(engine); m_firstDrapeNotification = true; - UpdateTrackMarks(); + UpdateTrackMarksMinZoom(); RequestSymbolSizes(); } @@ -2809,7 +2830,7 @@ void BookmarkManager::CreateCategories(KMLDataCollection && dataCollection, bool if (t->IsInteractive()) SetDefaultTrackSelection(t->GetId(), false /* showInfoSign */); } - + UpdateTrackMarksVisibility(groupId); UserMarkIdStorage::Instance().EnableSaving(true); } m_restoringCache.clear(); diff --git a/map/bookmark_manager.hpp b/map/bookmark_manager.hpp index fa1891b6f6..cc374e33ce 100644 --- a/map/bookmark_manager.hpp +++ b/map/bookmark_manager.hpp @@ -766,7 +766,8 @@ private: void SetTrackInfoMark(kml::TrackId trackId, m2::PointD const & pt); void ResetTrackInfoMark(kml::TrackId trackId); - void UpdateTrackMarks(); + void UpdateTrackMarksMinZoom(); + void UpdateTrackMarksVisibility(kml::MarkGroupId groupId); void RequestSymbolSizes(); ThreadChecker m_threadChecker; diff --git a/map/framework.cpp b/map/framework.cpp index d225080c10..d72449a479 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -2769,7 +2769,10 @@ UserMark const * Framework::FindUserMarkInTapPosition(place_page::BuildInfo cons return df::TapInfo::GetDefaultSearchRect(buildInfo.m_mercator, m_currentModelView); }, - [](UserMark::Type) { return false; }); + [](UserMark::Type type) + { + return type == UserMark::Type::TRACK_INFO || type == UserMark::Type::TRACK_SELECTION; + }); return mark; } diff --git a/map/track.cpp b/map/track.cpp index 153ef818bf..1e5f4c95a8 100644 --- a/map/track.cpp +++ b/map/track.cpp @@ -202,11 +202,6 @@ void Track::Detach() m_groupID = kml::kInvalidMarkGroupId; } -void Track::SetSelectionMarkId(kml::MarkId markId) -{ - m_selectionMarkId = markId; -} - bool Track::GetPoint(double distanceInMeters, m2::PointD & pt) const { if (m_interactionData) diff --git a/map/track.hpp b/map/track.hpp index 349393f27c..3720d7f856 100644 --- a/map/track.hpp +++ b/map/track.hpp @@ -37,8 +37,6 @@ public: void Attach(kml::MarkGroupId groupId); void Detach(); - kml::MarkId GetSelectionMarkId() const { return m_selectionMarkId; } - void SetSelectionMarkId(kml::MarkId markId); bool GetPoint(double distanceInMeters, m2::PointD & pt) const; private: @@ -49,7 +47,6 @@ private: kml::TrackData m_data; kml::MarkGroupId m_groupID = kml::kInvalidMarkGroupId; - kml::MarkId m_selectionMarkId = kml::kInvalidMarkId; struct InteractionData {