public 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())); String[] stops = { "agency:A", "agency:B", "agency:C", "agency:D", "agency:E", "agency:entrance_a", "agency:entrance_b" }; for (int i = 0; i < stops.length; ++i) { TransitStop stop = (TransitStop) (graph.getVertex(stops[i])); IntersectionVertex front = new IntersectionVertex( graph, "near_1_" + stop.getStopId(), stop.getX() + 0.0001, stop.getY() + 0.0001); IntersectionVertex back = new IntersectionVertex( graph, "near_2_" + stop.getStopId(), stop.getX() - 0.0001, stop.getY() - 0.0001); StreetEdge street1 = new StreetEdge( front, back, GeometryUtils.makeLineString( stop.getX() + 0.0001, stop.getY() + 0.0001, stop.getX() - 0.0001, stop.getY() - 0.0001), "street", 100, StreetTraversalPermission.ALL, false); StreetEdge street2 = new StreetEdge( back, front, GeometryUtils.makeLineString( stop.getX() - 0.0001, stop.getY() - 0.0001, stop.getX() + 0.0001, stop.getY() + 0.0001), "street", 100, StreetTraversalPermission.ALL, true); } NetworkLinker nl = new NetworkLinker(graph); nl.createLinkage(); }
@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 : filter(graph.getVertices(), TransitStopDepart.class)) { for (TransitBoardAlight tba : filter(tsd.getOutgoing(), TransitBoardAlight.class)) { if (!tba.isBoarding()) continue; TripPattern pattern = tba.getPattern(); for (Trip trip : pattern.getTrips()) { patternIndex.put(trip.getId(), pattern); } } } pattern = patternIndex.get(new AgencyAndId("agency", "1.1")); timetable = pattern.scheduledTimetable; }
public void setUp() throws Exception { GtfsContext 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())); }
private void initBikeRental() { BikeRentalStationService service = new BikeRentalStationService(); BikeRentalStation station = new BikeRentalStation(); station.x = -122.637634; station.y = 45.513084; station.bikesAvailable = 5; station.spacesAvailable = 4; station.id = "1"; station.name = "bike rental station"; service.addStation(station); graph.putService(BikeRentalStationService.class, service); }