diff --git a/routing/directions_engine.cpp b/routing/directions_engine.cpp index 42d2110dca..3084efc95f 100644 --- a/routing/directions_engine.cpp +++ b/routing/directions_engine.cpp @@ -16,6 +16,15 @@ #include #include +namespace +{ +bool IsFakeFeature(uint32_t featureId) +{ + return routing::FakeFeatureIds::IsGuidesFeature(featureId) || + routing::FakeFeatureIds::IsTransitFeature(featureId); +} +} // namespace + namespace routing { using namespace routing::turns; @@ -36,11 +45,6 @@ FeaturesLoaderGuard & DirectionsEngine::GetLoader(MwmSet::MwmId const & id) return *m_loader; } -bool IsFakeFeature(uint32_t featureId) -{ - return FakeFeatureIds::IsGuidesFeature(featureId) || FakeFeatureIds::IsTransitFeature(featureId); -} - void DirectionsEngine::LoadPathAttributes(FeatureID const & featureId, LoadedPathSegment & pathSegment) { diff --git a/routing/directions_engine.hpp b/routing/directions_engine.hpp index b7c4ec6fb8..7972781c13 100644 --- a/routing/directions_engine.hpp +++ b/routing/directions_engine.hpp @@ -44,6 +44,8 @@ public: std::vector & segments) = 0; void Clear(); + void SetIsTransit(bool isTransit) { m_isTransit = isTransit; } + protected: FeaturesLoaderGuard & GetLoader(MwmSet::MwmId const & id); void LoadPathAttributes(FeatureID const & featureId, LoadedPathSegment & pathSegment); @@ -68,5 +70,6 @@ protected: DataSource const & m_dataSource; std::shared_ptr m_numMwmIds; std::unique_ptr m_loader; + bool m_isTransit = false; }; } // namespace routing diff --git a/routing/index_router.cpp b/routing/index_router.cpp index 12ac3208b7..da00d6813a 100644 --- a/routing/index_router.cpp +++ b/routing/index_router.cpp @@ -121,8 +121,6 @@ unique_ptr CreateDirectionsEngine(VehicleType vehicleType, case VehicleType::Pedestrian: case VehicleType::Transit: return make_unique(dataSource, numMwmIds); case VehicleType::Bicycle: - // @TODO Bicycle turn generation engine is used now. It's ok for the time being. - // But later a special car turn generation engine should be implemented. case VehicleType::Car: return make_unique(dataSource, numMwmIds); case VehicleType::Count: CHECK(false, ("Can't create DirectionsEngine for", vehicleType)); @@ -1498,6 +1496,8 @@ RouterResultCode IndexRouter::RedressRoute(vector const & segments, } CHECK(m_directionsEngine, ()); + + m_directionsEngine->SetIsTransit(m_vehicleType == VehicleType::Transit); ReconstructRoute(*m_directionsEngine, roadGraph, m_trafficStash, cancellable, junctions, move(times), route); diff --git a/routing/pedestrian_directions.cpp b/routing/pedestrian_directions.cpp index d2831b507a..b3bca69e14 100644 --- a/routing/pedestrian_directions.cpp +++ b/routing/pedestrian_directions.cpp @@ -32,6 +32,18 @@ bool PedestrianDirectionsEngine::Generate(IndexRoadGraph const & graph, turns.clear(); streetNames.clear(); segments.clear(); + + vector routeEdges; + + if (m_isTransit) + { + routeGeometry = path; + graph.GetRouteSegments(segments); + graph.GetRouteEdges(routeEdges); + turns.emplace_back(routeEdges.size(), turns::PedestrianDirection::ReachedYourDestination); + return true; + } + routeGeometry.clear(); if (path.size() <= 1) @@ -39,7 +51,6 @@ bool PedestrianDirectionsEngine::Generate(IndexRoadGraph const & graph, size_t const pathSize = path.size(); - vector routeEdges; graph.GetRouteEdges(routeEdges); if (routeEdges.empty())