use of org.opentripplanner.model.Stop in project OpenTripPlanner by opentripplanner.
the class LegacyGraphQLNodeTypeResolver method getType.
@Override
public GraphQLObjectType getType(TypeResolutionEnvironment environment) {
Object o = environment.getObject();
GraphQLSchema schema = environment.getSchema();
if (o instanceof Agency)
return schema.getObjectType("Agency");
if (o instanceof TransitAlert)
return schema.getObjectType("Alert");
if (o instanceof BikePark)
return schema.getObjectType("BikePark");
if (o instanceof BikeRentalStation)
return schema.getObjectType("BikeRentalStation");
// if (o instanceof Cluster) return schema.getObjectType("Cluster");
if (o instanceof PatternAtStop)
return schema.getObjectType("DepartureRow");
if (o instanceof TripPattern)
return schema.getObjectType("Pattern");
if (o instanceof PlaceAtDistance)
return schema.getObjectType("placeAtDistance");
if (o instanceof Route)
return schema.getObjectType("Route");
if (o instanceof Stop)
return schema.getObjectType("Stop");
if (o instanceof Station)
return schema.getObjectType("Stop");
if (o instanceof TripTimeShort)
return schema.getObjectType("Stoptime");
if (o instanceof StopAtDistance)
return schema.getObjectType("stopAtDistance");
if (o instanceof FareRuleSet)
return schema.getObjectType("TicketType");
if (o instanceof Trip)
return schema.getObjectType("Trip");
return null;
}
use of org.opentripplanner.model.Stop in project OpenTripPlanner by opentripplanner.
the class IndexAPI method getStoptimesForStopAndDate.
/**
* Return upcoming vehicle arrival/departure times at the given stop.
* @param date in YYYYMMDD or YYYY-MM-DD format
*/
@GET
@Path("/stops/{stopId}/stoptimes/{date}")
public List<ApiStopTimesInPattern> getStoptimesForStopAndDate(@PathParam("stopId") String stopId, @PathParam("date") String date, @QueryParam("omitNonPickups") boolean omitNonPickups) {
RoutingService routingService = createRoutingService();
Stop stop = getStop(routingService, stopId);
ServiceDate serviceDate = parseServiceDate("date", date);
List<StopTimesInPattern> stopTimes = routingService.getStopTimesForStop(stop, serviceDate, omitNonPickups);
return StopTimesInPatternMapper.mapToApi(stopTimes);
}
use of org.opentripplanner.model.Stop in project OpenTripPlanner by opentripplanner.
the class IndexAPI method getTransfers.
/**
* Return the generated transfers a stop in the graph, by stop ID
*/
@GET
@Path("/stops/{stopId}/transfers")
public Collection<ApiTransfer> getTransfers(@PathParam("stopId") String stopId) {
RoutingService routingService = createRoutingService();
Stop stop = getStop(routingService, stopId);
// get the transfers for the stop
return routingService.getTransfersByStop(stop).stream().map(TransferMapper::mapToApi).collect(Collectors.toList());
}
use of org.opentripplanner.model.Stop in project OpenTripPlanner by opentripplanner.
the class IndexAPI method getStopsForRoute.
/**
* Return all stops in any pattern on a given route.
*/
@GET
@Path("/routes/{routeId}/stops")
public List<ApiStopShort> getStopsForRoute(@PathParam("routeId") String routeId) {
RoutingService routingService = createRoutingService();
Route route = getRoute(routingService, routeId);
Set<Stop> stops = new HashSet<>();
Collection<TripPattern> patterns = routingService.getPatternsForRoute().get(route);
for (TripPattern pattern : patterns) {
stops.addAll(pattern.getStops());
}
return StopMapper.mapToApiShort(stops);
}
use of org.opentripplanner.model.Stop in project OpenTripPlanner by opentripplanner.
the class TransferMapper method doMap.
private Collection<Transfer> doMap(org.onebusaway.gtfs.model.Transfer rhs) {
Trip fromTrip = tripMapper.map(rhs.getFromTrip());
Trip toTrip = tripMapper.map(rhs.getToTrip());
Route fromRoute = routeMapper.map(rhs.getFromRoute());
Route toRoute = routeMapper.map(rhs.getToRoute());
TransferType transferType = TransferType.valueOfGtfsCode(rhs.getTransferType());
int transferTime = rhs.getMinTransferTime();
// Transfers may be specified using parent stations
// (https://developers.google.com/transit/gtfs/reference/transfers-file)
// "If the stop ID refers to a station that contains multiple stops, this transfer rule
// applies to all stops in that station." we thus expand transfers that use parent stations
// to all the member stops.
Collection<Stop> fromStops = getStopOrChildStops(rhs.getFromStop());
Collection<Stop> toStops = getStopOrChildStops(rhs.getToStop());
Collection<Transfer> lhs = new ArrayList<>();
for (Stop fromStop : fromStops) {
for (Stop toStop : toStops) {
lhs.add(new Transfer(fromStop, toStop, fromRoute, toRoute, fromTrip, toTrip, transferType, transferTime));
}
}
return lhs;
}
Aggregations