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();
  }
コード例 #2
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;
  }
コード例 #3
0
 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()));
 }
コード例 #4
0
 public String getName() {
   return GtfsLibrary.getRouteName(getPattern().getExemplar().getRoute());
 }
コード例 #5
0
 public TraverseMode getMode() {
   return GtfsLibrary.getTraverseMode(getPattern().getExemplar().getRoute());
 }
コード例 #6
0
 public String toString() {
   return GtfsLibrary.getRouteName(boards[0][0].getPattern().getExemplar().getRoute())
       + " from "
       + stops[0].stopVertex.getLabel();
 }