use of org.opentripplanner.model.plan.Itinerary in project OpenTripPlanner by opentripplanner.
the class DirectStreetRouter method route.
public static List<Itinerary> route(Router router, RoutingRequest request) {
request.setRoutingContext(router.graph);
try {
if (request.modes.directMode == null) {
return Collections.emptyList();
}
if (!streetDistanceIsReasonable(request)) {
return Collections.emptyList();
}
RoutingRequest nonTransitRequest = request.getStreetSearchRequest(request.modes.directMode);
// we could also get a persistent router-scoped GraphPathFinder but there's no setup cost here
GraphPathFinder gpFinder = new GraphPathFinder(router);
List<GraphPath> paths = gpFinder.graphPathFinderEntryPoint(nonTransitRequest);
// Convert the internal GraphPaths to itineraries
List<Itinerary> response = GraphPathToItineraryMapper.mapItineraries(paths, request);
ItinerariesHelper.decorateItinerariesWithRequestData(response, request);
return response;
} catch (PathNotFoundException e) {
return Collections.emptyList();
}
}
Aggregations