#pragma once #include "routing/directions_engine.hpp" #include "routing/road_graph.hpp" #include "routing/route.hpp" #include "routing/traffic_stash.hpp" #include "traffic/traffic_info.hpp" #include "routing_common/bicycle_model.hpp" #include "routing_common/car_model.hpp" #include "routing_common/pedestrian_model.hpp" #include "base/cancellable.hpp" #include "std/queue.hpp" #include "std/set.hpp" #include "std/shared_ptr.hpp" #include "std/vector.hpp" namespace routing { /// \returns true when there exists a routing mode where the feature with |types| can be used. template bool IsRoad(TTypes const & types) { return CarModel::AllLimitsInstance().HasRoadType(types) || PedestrianModel::AllLimitsInstance().HasRoadType(types) || BicycleModel::AllLimitsInstance().HasRoadType(types); } void ReconstructRoute(IDirectionsEngine & engine, RoadGraphBase const & graph, shared_ptr const & trafficStash, my::Cancellable const & cancellable, bool hasAltitude, vector & path, Route & route); /// \brief Checks is edge connected with world graph. Function does BFS while it finds some number /// of edges, /// if graph ends before this number is reached then junction is assumed as not connected to the /// world graph. template bool CheckGraphConnectivity(typename Graph::Vertex const & start, size_t limit, Graph & graph, GetVertexByEdgeFn && getVertexByEdgeFn, GetOutgoingEdgesFn && getOutgoingEdgesFn) { queue q; q.push(start); set marked; marked.insert(start); vector edges; while (!q.empty() && marked.size() < limit) { auto const u = q.front(); q.pop(); edges.clear(); getOutgoingEdgesFn(graph, u, edges); for (auto const & edge : edges) { auto const & v = getVertexByEdgeFn(edge); if (marked.count(v) == 0) { q.push(v); marked.insert(v); } } } return marked.size() >= limit; } } // namespace rouing