From e421a6fcc4ad57b80eed1ad049d69ef3f72bf900 Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Tue, 27 Aug 2019 11:13:53 +0300 Subject: [PATCH] [routing] Taking into account gps position independently for route mode. --- map/routing_manager.cpp | 4 ++-- routing/routing_session.cpp | 11 +++++++++++ routing/routing_session.hpp | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/map/routing_manager.cpp b/map/routing_manager.cpp index 1c605d532d..240cd9103e 100644 --- a/map/routing_manager.cpp +++ b/map/routing_manager.cpp @@ -1028,8 +1028,8 @@ void RoutingManager::BuildRoute(uint32_t timeoutSec) void RoutingManager::SetUserCurrentPosition(m2::PointD const & position) { - // @TODO(bykoianko) PositionAccumulator should be filled even if there's no route. - // That means IsRoutingActive() returns false. + m_routingSession.PushPositionAccumulator(position); + if (IsRoutingActive()) m_routingSession.SetUserCurrentPosition(position); diff --git a/routing/routing_session.cpp b/routing/routing_session.cpp index e5f355bab7..9a547d20a5 100644 --- a/routing/routing_session.cpp +++ b/routing/routing_session.cpp @@ -610,9 +610,20 @@ void RoutingSession::SetUserCurrentPosition(m2::PointD const & position) m_userCurrentPosition = position; m_userCurrentPositionValid = true; +} + +void RoutingSession::PushPositionAccumulator(m2::PointD const & position) +{ + CHECK_THREAD_CHECKER(m_threadChecker, ()); m_positionAccumulator.PushNextPoint(position); } +void RoutingSession::ClearPositionAccumulator() +{ + CHECK_THREAD_CHECKER(m_threadChecker, ()); + + m_positionAccumulator.Clear(); +} void RoutingSession::EnableTurnNotifications(bool enable) { diff --git a/routing/routing_session.hpp b/routing/routing_session.hpp index cb4fcfafea..af01c2ef3b 100644 --- a/routing/routing_session.hpp +++ b/routing/routing_session.hpp @@ -106,7 +106,8 @@ public: void SetUserCurrentPosition(m2::PointD const & position); - void ClearPositionAccumulator() { m_positionAccumulator.Clear(); } + void PushPositionAccumulator(m2::PointD const & position); + void ClearPositionAccumulator(); void ActivateAdditionalFeatures() {}