use of org.opentripplanner.graph_builder.annotation.NonStationParentStation in project OpenTripPlanner by opentripplanner.
the class GTFSPatternHopFactory method linkStopsToParentStations.
/**
* Links the vertices representing parent stops to their child stops bidirectionally. This is
* not intended to provide implicit transfers (i.e. child stop to parent station to another
* child stop) but instead to allow beginning or ending a path (itinerary) at a parent station.
*
* Currently this linking is only intended for use in the long distance path service. The
* pathparsers should ensure that it is effectively ignored in other path services, and even in
* the long distance path service anywhere but the beginning or end of a path.
*/
public void linkStopsToParentStations(Graph graph) {
for (Stop stop : _dao.getAllStops()) {
String parentStation = stop.getParentStation();
if (parentStation != null) {
TransitStop stopVertex = (TransitStop) context.stationStopNodes.get(stop);
String agencyId = stop.getId().getAgencyId();
AgencyAndId parentStationId = new AgencyAndId(agencyId, parentStation);
Stop parentStop = _dao.getStopForId(parentStationId);
if (context.stationStopNodes.get(parentStop) instanceof TransitStation) {
TransitStation parentStopVertex = (TransitStation) context.stationStopNodes.get(parentStop);
new StationStopEdge(parentStopVertex, stopVertex);
new StationStopEdge(stopVertex, parentStopVertex);
} else {
LOG.warn(graph.addBuilderAnnotation(new NonStationParentStation(stopVertex)));
}
}
}
}
Aggregations