diff --git a/routing/async_router.cpp b/routing/async_router.cpp index 746a97857d..d45e7e591c 100644 --- a/routing/async_router.cpp +++ b/routing/async_router.cpp @@ -298,7 +298,8 @@ void AsyncRouter::CalculateRoute() try { - LOG(LINFO, ("Calculating the route,", checkpoints, "startDirection", startDirection)); + LOG(LINFO, ("Calculating the route. checkpoints:", checkpoints, "startDirection:", + startDirection, "router name:", router->GetName())); if (absentFetcher) absentFetcher->GenerateRequest(checkpoints); diff --git a/routing/directions_engine.hpp b/routing/directions_engine.hpp index 0131d2b0ee..a1c3fa4bf9 100644 --- a/routing/directions_engine.hpp +++ b/routing/directions_engine.hpp @@ -21,6 +21,9 @@ public: // @TODO(bykoianko) When fields |m_turns|, |m_times|, |m_streets| and |m_traffic| // are removed from class Route the method Generate() should fill // vector instead of corresponding arguments. + /// \brief Generates all args which are passed by reference. + /// \param path is points of the route. It should not be empty. + /// \note If |routeGeometry| is empty after a call fo the method it shows an error. virtual void Generate(RoadGraphBase const & graph, vector const & path, my::Cancellable const & cancellable, Route::TTurns & turns, Route::TStreets & streetNames, vector & routeGeometry, diff --git a/routing/pedestrian_directions.cpp b/routing/pedestrian_directions.cpp index 9329fe4066..5c1229d231 100644 --- a/routing/pedestrian_directions.cpp +++ b/routing/pedestrian_directions.cpp @@ -48,9 +48,10 @@ void PedestrianDirectionsEngine::Generate(RoadGraphBase const & graph, { turns.clear(); streetNames.clear(); - routeGeometry.clear(); segments.clear(); + routeGeometry = path; + if (path.size() <= 1) return; @@ -58,6 +59,7 @@ void PedestrianDirectionsEngine::Generate(RoadGraphBase const & graph, if (!ReconstructPath(graph, path, routeEdges, cancellable)) { LOG(LDEBUG, ("Couldn't reconstruct path.")); + routeGeometry.clear(); // use only "arrival" direction turns.emplace_back(path.size() - 1, turns::PedestrianDirection::ReachedYourDestination); return; @@ -69,7 +71,7 @@ void PedestrianDirectionsEngine::Generate(RoadGraphBase const & graph, for (Edge const & e : routeEdges) segments.push_back(ConvertEdgeToSegment(*m_numMwmIds, e)); - routeGeometry = path; + } void PedestrianDirectionsEngine::CalculateTurns(RoadGraphBase const & graph, diff --git a/routing/routing_helpers.cpp b/routing/routing_helpers.cpp index 2ab098bb41..cc3239b774 100644 --- a/routing/routing_helpers.cpp +++ b/routing/routing_helpers.cpp @@ -117,9 +117,6 @@ void ReconstructRoute(IDirectionsEngine & engine, RoadGraphBase const & graph, vector segments; engine.Generate(graph, path, cancellable, turnsDir, streetNames, junctions, segments); - CHECK_EQUAL(path.size(), junctions.size(), ()); - - if (cancellable.IsCancelled()) return; @@ -130,6 +127,9 @@ void ReconstructRoute(IDirectionsEngine & engine, RoadGraphBase const & graph, return; } + CHECK_EQUAL(path.size(), junctions.size(), + ("Size of path:", path.size(), "size of junctions:", junctions.size())); + vector segmentInfo; FillSegmentInfo(segments, junctions, turnsDir, streetNames, times, trafficStash, segmentInfo); CHECK_EQUAL(segmentInfo.size(), segments.size(), ());