diff --git a/libs/map/routing_manager.cpp b/libs/map/routing_manager.cpp index 9fd6f2adf..75f56827e 100644 --- a/libs/map/routing_manager.cpp +++ b/libs/map/routing_manager.cpp @@ -546,8 +546,10 @@ void RoutingManager::RemoveRoute(bool deactivateFollowing) es.ClearGroup(UserMark::Type::SPEED_CAM); es.ClearGroup(UserMark::Type::ROAD_WARNING); } - if (deactivateFollowing) - SetPointsFollowingMode(false /* enabled */); + if (deactivateFollowing) { + SetPointsFollowingMode(false /* enabled */); + RemovePassedPoints(); + } }); if (deactivateFollowing) @@ -937,6 +939,13 @@ void RoutingManager::SetPointsFollowingMode(bool enabled) routePoints.SetFollowingMode(enabled); } +void RoutingManager::RemovePassedPoints() +{ + ASSERT(m_bmManager != nullptr, ()); + RoutePointsLayout routePoints(*m_bmManager); + routePoints.RemovePassedPoints(); +} + void RoutingManager::ReorderIntermediatePoints() { vector prevPoints; diff --git a/libs/map/routing_manager.hpp b/libs/map/routing_manager.hpp index 8e3261ac8..59fc30e85 100644 --- a/libs/map/routing_manager.hpp +++ b/libs/map/routing_manager.hpp @@ -332,6 +332,8 @@ private: void SetPointsFollowingMode(bool enabled); + void RemovePassedPoints(); + void ReorderIntermediatePoints(); m2::RectD ShowPreviewSegments(std::vector const & routePoints); diff --git a/libs/map/routing_mark.cpp b/libs/map/routing_mark.cpp index eedd14b35..95a50b0f1 100644 --- a/libs/map/routing_mark.cpp +++ b/libs/map/routing_mark.cpp @@ -347,6 +347,16 @@ void RoutePointsLayout::SetFollowingMode(bool enabled) m_editSession.GetMarkForEdit(markId)->SetFollowingMode(enabled); } +void RoutePointsLayout::RemovePassedPoints() +{ + for (auto markId : m_manager.GetUserMarkIds(UserMark::Type::ROUTING)) { + auto * mark = m_editSession.GetMarkForEdit(markId); + if (mark->IsPassed()) + m_editSession.DeleteUserMark(mark->GetId()); + } +} + + RouteMarkPoint const * RoutePointsLayout::GetRoutePoint(RouteMarkType type, size_t intermediateIndex) const { for (auto markId : m_manager.GetUserMarkIds(UserMark::Type::ROUTING)) diff --git a/libs/map/routing_mark.hpp b/libs/map/routing_mark.hpp index e722fa505..e28e2ea14 100644 --- a/libs/map/routing_mark.hpp +++ b/libs/map/routing_mark.hpp @@ -97,7 +97,7 @@ public: size_t destIntermediateIndex); void PassRoutePoint(RouteMarkType type, size_t intermediateIndex = 0); void SetFollowingMode(bool enabled); - + void RemovePassedPoints(); private: using TRoutePointCallback = std::function; void ForEachIntermediatePoint(TRoutePointCallback const & fn);