diff --git a/map/routing_manager.cpp b/map/routing_manager.cpp index fab7dd21e..09962fd9b 100644 --- a/map/routing_manager.cpp +++ b/map/routing_manager.cpp @@ -328,7 +328,6 @@ RoutingManager::RoutingManager(Callbacks && callbacks, Delegate & delegate) nullptr #endif ); - m_routingSession.SetRoutingCallbacks( [this](Route const & route, RouterResultCode code) { OnBuildRouteReady(route, code); }, [this](Route const & route, RouterResultCode code) { OnRebuildRouteReady(route, code); }, @@ -554,8 +553,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) @@ -954,6 +955,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/map/routing_manager.hpp b/map/routing_manager.hpp index 0141d16ab..0ae6f2eb6 100644 --- a/map/routing_manager.hpp +++ b/map/routing_manager.hpp @@ -354,6 +354,8 @@ private: void SetPointsFollowingMode(bool enabled); + void RemovePassedPoints(); + void ReorderIntermediatePoints(); m2::RectD ShowPreviewSegments(std::vector const & routePoints); diff --git a/map/routing_mark.cpp b/map/routing_mark.cpp index 9c4b00d1b..5f4924cba 100644 --- a/map/routing_mark.cpp +++ b/map/routing_mark.cpp @@ -353,6 +353,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/map/routing_mark.hpp b/map/routing_mark.hpp index a77764fef..9d0f12ec7 100644 --- a/map/routing_mark.hpp +++ b/map/routing_mark.hpp @@ -97,7 +97,7 @@ public: RouteMarkType destType, 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);