Search in sources :

Example 1 with StationStopEdge

use of org.opentripplanner.routing.edgetype.StationStopEdge 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)));
            }
        }
    }
}
Also used : TransitStop(org.opentripplanner.routing.vertextype.TransitStop) AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) TransitStop(org.opentripplanner.routing.vertextype.TransitStop) Stop(org.onebusaway.gtfs.model.Stop) TransitStationStop(org.opentripplanner.routing.vertextype.TransitStationStop) NonStationParentStation(org.opentripplanner.graph_builder.annotation.NonStationParentStation) LineString(com.vividsolutions.jts.geom.LineString) TransitStation(org.opentripplanner.routing.vertextype.TransitStation) StationStopEdge(org.opentripplanner.routing.edgetype.StationStopEdge)

Aggregations

LineString (com.vividsolutions.jts.geom.LineString)1 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)1 Stop (org.onebusaway.gtfs.model.Stop)1 NonStationParentStation (org.opentripplanner.graph_builder.annotation.NonStationParentStation)1 StationStopEdge (org.opentripplanner.routing.edgetype.StationStopEdge)1 TransitStation (org.opentripplanner.routing.vertextype.TransitStation)1 TransitStationStop (org.opentripplanner.routing.vertextype.TransitStationStop)1 TransitStop (org.opentripplanner.routing.vertextype.TransitStop)1