示例#1
0
  @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 {

    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();
  }
 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()));
 }