diff --git a/map/routing_manager.cpp b/map/routing_manager.cpp index 95fcc68621..f6e696bf6c 100644 --- a/map/routing_manager.cpp +++ b/map/routing_manager.cpp @@ -280,6 +280,9 @@ void RoutingManager::RemoveRoute(bool deactivateFollowing) if (m_drapeEngine == nullptr) return; + if (deactivateFollowing) + SetPointsFollowingMode(false /* enabled */); + std::lock_guard lock(m_drapeSubroutesMutex); if (deactivateFollowing) { @@ -373,6 +376,7 @@ void RoutingManager::FollowRoute() m_delegate.OnRouteFollow(m_currentRouterType); HideRoutePoint(RouteMarkType::Start); + SetPointsFollowingMode(true /* enabled */); } void RoutingManager::CloseRouting(bool removeRoutePoints) @@ -486,6 +490,14 @@ void RoutingManager::MoveRoutePoint(RouteMarkType currentType, int8_t currentInt routePoints.NotifyChanges(); } +void RoutingManager::SetPointsFollowingMode(bool enabled) +{ + ASSERT(m_bmManager != nullptr, ()); + RoutePointsLayout routePoints(m_bmManager->GetUserMarksController(UserMarkType::ROUTING_MARK)); + routePoints.SetFollowingMode(enabled); + routePoints.NotifyChanges(); +} + void RoutingManager::GenerateTurnNotifications(std::vector & turnNotifications) { if (m_currentRouterType == routing::RouterType::Taxi) diff --git a/map/routing_manager.hpp b/map/routing_manager.hpp index 0842a4e6ee..d039851c6b 100644 --- a/map/routing_manager.hpp +++ b/map/routing_manager.hpp @@ -229,6 +229,8 @@ private: location::RouteMatchingInfo GetRouteMatchingInfo(location::GpsInfo & info); uint32_t GenerateRoutePointsTransactionId() const; + void SetPointsFollowingMode(bool enabled); + RouteBuildingCallback m_routingCallback = nullptr; Callbacks m_callbacks; ref_ptr m_drapeEngine = nullptr; diff --git a/map/routing_mark.cpp b/map/routing_mark.cpp index 51aa870441..c0fda795fd 100644 --- a/map/routing_mark.cpp +++ b/map/routing_mark.cpp @@ -80,9 +80,21 @@ void RouteMarkPoint::SetMarkData(RouteMarkData && data) drape_ptr RouteMarkPoint::GetTitleDecl() const { + if (m_followingMode) + return nullptr; + return make_unique_dp(m_titleDecl); } +void RouteMarkPoint::SetFollowingMode(bool enabled) +{ + if (m_followingMode == enabled) + return; + + SetDirty(); + m_followingMode = enabled; +} + std::string RouteMarkPoint::GetSymbolName() const { switch (m_markData.m_pointType) @@ -254,6 +266,17 @@ void RoutePointsLayout::PassRoutePoint(RouteMarkType type, int8_t intermediateIn point->SetIsVisible(false); } +void RoutePointsLayout::SetFollowingMode(bool enabled) +{ + for (size_t i = 0, sz = m_routeMarks.GetUserMarkCount(); i < sz; ++i) + { + auto userMark = m_routeMarks.GetUserMarkForEdit(i); + ASSERT(dynamic_cast(userMark) != nullptr, ()); + RouteMarkPoint * mark = static_cast(userMark); + mark->SetFollowingMode(enabled); + } +} + RouteMarkPoint * RoutePointsLayout::GetRoutePoint(RouteMarkType type, int8_t intermediateIndex) { for (size_t i = 0, sz = m_routeMarks.GetUserMarkCount(); i < sz; ++i) diff --git a/map/routing_mark.hpp b/map/routing_mark.hpp index 0f517dea85..3104116a28 100644 --- a/map/routing_mark.hpp +++ b/map/routing_mark.hpp @@ -58,9 +58,12 @@ public: bool HasSymbolPriority() const override { return false; } bool HasTitlePriority() const override { return true; } + void SetFollowingMode(bool enabled); + private: RouteMarkData m_markData; dp::TitleDecl m_titleDecl; + bool m_followingMode = false; }; class RouteUserMarkContainer : public UserMarkContainer @@ -87,6 +90,7 @@ public: bool MoveRoutePoint(RouteMarkType currentType, int8_t currentIntermediateIndex, RouteMarkType destType, int8_t destIntermediateIndex); void PassRoutePoint(RouteMarkType type, int8_t intermediateIndex = 0); + void SetFollowingMode(bool enabled); void NotifyChanges(); private: