Package org.onebusaway.transit_data_federation.services.transit_graph

Examples of org.onebusaway.transit_data_federation.services.transit_graph.StopEntry


    }
  }

  private int computeTransferTime(TraverseOptions options) {

    StopEntry from = getFromStop();
    StopEntry to = getToStop();

    if (from == to)
      return 0;

    StopTransfer transfer = _reverse ? findForwardTransfer(to, from)
        : findForwardTransfer(from, to);

    /**
     * No transfer found, even though we expected one
     */
    if (transfer == null) {
      _log.warn("expected transfer path between stops " + from.getId()
          + " and " + to.getId());
      return 0;
    }

    return ItineraryWeightingLibrary.computeTransferTime(transfer, options);
  }
View Full Code Here


  public Id getStopId(String stopId) {

    for (String agencyId : _agencyIds) {
      AgencyAndId id = new AgencyAndId(agencyId, stopId);
      StopEntry stop = _transitGraphDao.getStopEntryForId(id);
      if (stop != null)
        return ServiceAlertLibrary.id(id);
    }

    try {
      AgencyAndId id = AgencyAndId.convertFromString(stopId);
      StopEntry stop = _transitGraphDao.getStopEntryForId(id);
      if (stop != null)
        return ServiceAlertLibrary.id(id);
    } catch (IllegalArgumentException ex) {

    }
View Full Code Here

      // No matter what our active trip is, we let our current trip be the the
      // trip of our next stop
      BlockTripEntry activeBlockTrip = nextBlockStop.getTrip();
      TripEntry activeTrip = activeBlockTrip.getTrip();
      StopTimeEntry nextStopTime = nextBlockStop.getStopTime();
      StopEntry stop = nextStopTime.getStop();

      TripUpdate.Builder tripUpdate = TripUpdate.newBuilder();

      StopTimeUpdate.Builder stopTimeUpdate = StopTimeUpdate.newBuilder();
      stopTimeUpdate.setStopId(AgencyAndId.convertToString(stop.getId()));
      stopTimeUpdate.setStopSequence(nextStopTime.getSequence());
      stopTimeUpdate.setScheduleRelationship(com.google.transit.realtime.GtfsRealtime.TripUpdate.StopTimeUpdate.ScheduleRelationship.SCHEDULED);
      tripUpdate.addStopTimeUpdate(stopTimeUpdate);

      StopTimeEvent.Builder stopTimeEvent = StopTimeEvent.newBuilder();
View Full Code Here

  }

  private ScheduledBlockLocation getScheduledBlockLocationWhenAtStopTime(
      BlockStopTimeEntry blockStopTime, BlockStopTimeEntry previousBlockStopTime,
      StopTimeEntry stopTime, int scheduleTime, int stopTimeIndex) {
    StopEntry stop = stopTime.getStop();

    ScheduledBlockLocation result = new ScheduledBlockLocation();

    int shapePointIndex = stopTime.getShapePointIndex();

    PointAndOrientation po = getLocationAlongShape(blockStopTime.getTrip(),
        blockStopTime.getDistanceAlongBlock(), shapePointIndex,
        shapePointIndex + 1);
    if (po != null) {
      result.setLocation(po.getPoint());
      result.setOrientation(po.getOrientation());
    } else {
      CoordinatePoint location = new CoordinatePoint(stop.getStopLat(),
          stop.getStopLon());
      result.setLocation(location);
      result.setOrientation(0);
    }

    result.setClosestStop(blockStopTime);
View Full Code Here

      result.setLocation(po.getPoint());
      result.setOrientation(po.getOrientation());
      return result;
    }

    StopEntry beforeStop = before.getStop();
    StopEntry afterStop = after.getStop();
    double latFrom = beforeStop.getStopLat();
    double lonFrom = beforeStop.getStopLon();
    double latTo = afterStop.getStopLat();
    double lonTo = afterStop.getStopLon();
    double lat = (latTo - latFrom) * ratio + latFrom;
    double lon = (lonTo - lonFrom) * ratio + lonFrom;

    CoordinatePoint location = new CoordinatePoint(lat, lon);
    result.setLocation(location);
View Full Code Here

    try {
      BufferedReader reader = new BufferedReader(new FileReader(path));
      String line = null;
      while ((line = reader.readLine()) != null) {
        AgencyAndId stopId = AgencyAndIdLibrary.convertFromString(line);
        StopEntry stop = _transitGraphDao.getStopEntryForId(stopId, true);
        stops.add(stop);
      }
    } catch (IOException ex) {
      throw new IllegalStateException("error reading hub stops", ex);
    }
View Full Code Here

        while ((line = reader.readLine()) != null) {
          int index = line.indexOf('\t');
          if (index != -1)
            line = line.substring(index + 1);
          AgencyAndId stopId = AgencyAndIdLibrary.convertFromString(line);
          StopEntry stop = _transitGraphDao.getStopEntryForId(stopId, true);
          hubStops.add(stop);
        }
      } catch (IOException ex) {
        throw new IllegalStateException("error loading HubStops file: " + path,
            ex);
View Full Code Here

    for (Vertex v : spt.getVeritces()) {
      if (!(v instanceof TPOfflineBlockArrivalVertex))
        continue;

      TPOfflineBlockArrivalVertex bav = (TPOfflineBlockArrivalVertex) v;
      StopEntry stop = bav.getStop();
      arrivalsByStop.get(stop).add(bav);
    }

    for (Map.Entry<StopEntry, List<TPOfflineBlockArrivalVertex>> entry : arrivalsByStop.entrySet()) {
      processArrivalsForStop(entry.getKey(), entry.getValue(), originStop, spt,
View Full Code Here

      for (State state : states) {

        if (verbose)
          System.out.println("  " + state);

        StopEntry actualOriginStop = getActualOriginStop(state,
            actualOriginStops);
        boolean properOrigins = originStop == actualOriginStop;

        if (verbose)
          System.out.println("  origins=" + properOrigins);
View Full Code Here

  }

  private StopEntry getActualOriginStop(State state,
      Map<State, StopEntry> actualOriginStops) {

    StopEntry actual = actualOriginStops.get(state);
    if (actual == null) {
      Vertex v = state.getVertex();
      if (v instanceof TPOfflineNearbyStopsVertex) {
        TPOfflineNearbyStopsVertex nsv = (TPOfflineNearbyStopsVertex) v;
        actual = nsv.getStop();
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data_federation.services.transit_graph.StopEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.