diff options
author | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2019-05-14 17:50:37 +0300 |
---|---|---|
committer | Tatiana Yan <tatiana.kondakova@gmail.com> | 2019-05-15 11:33:44 +0300 |
commit | a575fe24000b014a13ec1a72faca59c045d4fcc8 (patch) | |
tree | cc01fcda91092f02da733e6e8d82137c1a905c57 /routing | |
parent | d535b63e7c17b7dfb69bf60c9463b09718ccd8df (diff) |
Clearing handles after route building.
Diffstat (limited to 'routing')
-rw-r--r-- | routing/index_router.cpp | 10 | ||||
-rw-r--r-- | routing/index_router.hpp | 1 | ||||
-rw-r--r-- | routing/pedestrian_directions.hpp | 1 |
3 files changed, 12 insertions, 0 deletions
diff --git a/routing/index_router.cpp b/routing/index_router.cpp index e9130049f2..a0ad8573c2 100644 --- a/routing/index_router.cpp +++ b/routing/index_router.cpp @@ -302,6 +302,12 @@ bool IndexRouter::FindBestSegment(m2::PointD const & point, m2::PointD const & d dummy /* best segment is almost codirectional */); } +void IndexRouter::ClearState() +{ + m_roadGraph.ClearState(); + m_directionsEngine->Clear(); +} + RouterResultCode IndexRouter::CalculateRoute(Checkpoints const & checkpoints, m2::PointD const & startDirection, bool adjustToPrevRoute, @@ -323,6 +329,10 @@ RouterResultCode IndexRouter::CalculateRoute(Checkpoints const & checkpoints, try { + SCOPE_GUARD(featureRoadGraphClear, [this]{ + this->ClearState(); + }); + if (adjustToPrevRoute && m_lastRoute && m_lastFakeEdges && finalPoint == m_lastRoute->GetFinish()) { diff --git a/routing/index_router.hpp b/routing/index_router.hpp index d071054ba6..275b52a65a 100644 --- a/routing/index_router.hpp +++ b/routing/index_router.hpp @@ -78,6 +78,7 @@ public: // IRouter overrides: std::string GetName() const override { return m_name; } + void ClearState() override; RouterResultCode CalculateRoute(Checkpoints const & checkpoints, m2::PointD const & startDirection, bool adjustToPrevRoute, RouterDelegate const & delegate, Route & route) override; diff --git a/routing/pedestrian_directions.hpp b/routing/pedestrian_directions.hpp index ec889cc082..0e5f9f98bb 100644 --- a/routing/pedestrian_directions.hpp +++ b/routing/pedestrian_directions.hpp @@ -19,6 +19,7 @@ public: base::Cancellable const & cancellable, Route::TTurns & turns, Route::TStreets & streetNames, vector<Junction> & routeGeometry, vector<Segment> & segments) override; + void Clear() override {} private: void CalculateTurns(IndexRoadGraph const & graph, std::vector<Edge> const & routeEdges, |