Search in sources :

Example 6 with TransitStopDepart

use of org.opentripplanner.routing.vertextype.TransitStopDepart in project OpenTripPlanner by opentripplanner.

the class TimetableSnapshotTest method setUp.

@BeforeClass
public static void setUp() throws Exception {
    context = GtfsLibrary.readGtfs(new File(ConstantsForTests.FAKE_GTFS));
    graph = new Graph();
    GTFSPatternHopFactory factory = new GTFSPatternHopFactory(context);
    factory.run(graph);
    graph.putService(CalendarServiceData.class, GtfsLibrary.createCalendarServiceData(context.getDao()));
    patternIndex = new HashMap<AgencyAndId, TripPattern>();
    for (TransitStopDepart tsd : Iterables.filter(graph.getVertices(), TransitStopDepart.class)) {
        for (TransitBoardAlight tba : Iterables.filter(tsd.getOutgoing(), TransitBoardAlight.class)) {
            if (!tba.boarding)
                continue;
            TripPattern pattern = tba.getPattern();
            for (Trip trip : pattern.getTrips()) {
                patternIndex.put(trip.getId(), pattern);
            }
        }
    }
}
Also used : Trip(org.onebusaway.gtfs.model.Trip) Graph(org.opentripplanner.routing.graph.Graph) AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) GTFSPatternHopFactory(org.opentripplanner.routing.edgetype.factory.GTFSPatternHopFactory) File(java.io.File) TransitStopDepart(org.opentripplanner.routing.vertextype.TransitStopDepart) BeforeClass(org.junit.BeforeClass)

Aggregations

TransitStopDepart (org.opentripplanner.routing.vertextype.TransitStopDepart)6 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)4 Trip (org.onebusaway.gtfs.model.Trip)4 Stop (org.onebusaway.gtfs.model.Stop)3 Graph (org.opentripplanner.routing.graph.Graph)3 TripUpdate (com.google.transit.realtime.GtfsRealtime.TripUpdate)2 StopTimeUpdate (com.google.transit.realtime.GtfsRealtime.TripUpdate.StopTimeUpdate)2 File (java.io.File)2 BeforeClass (org.junit.BeforeClass)2 Route (org.onebusaway.gtfs.model.Route)2 ServiceDate (org.onebusaway.gtfs.model.calendar.ServiceDate)2 RoutingRequest (org.opentripplanner.routing.core.RoutingRequest)2 TimetableSnapshot (org.opentripplanner.routing.edgetype.TimetableSnapshot)2 TransitBoardAlight (org.opentripplanner.routing.edgetype.TransitBoardAlight)2 TripPattern (org.opentripplanner.routing.edgetype.TripPattern)2 TransitStop (org.opentripplanner.routing.vertextype.TransitStop)2 TransitStopArrive (org.opentripplanner.routing.vertextype.TransitStopArrive)2 TripDescriptor (com.google.transit.realtime.GtfsRealtime.TripDescriptor)1 StopTimeEvent (com.google.transit.realtime.GtfsRealtime.TripUpdate.StopTimeEvent)1 Coordinate (com.vividsolutions.jts.geom.Coordinate)1