Search in sources :

Example 1 with TripStopTimeBean

use of org.onebusaway.transit_data.model.TripStopTimeBean in project onebusaway-application-modules by camsys.

the class TripStopTimesBeanServiceImpl method getStopTimesForTrip.

/**
 **
 * Private Methods
 ***
 */
private TripStopTimesBean getStopTimesForTrip(TripEntry trip) {
    AgencyAndId tripId = trip.getId();
    TripStopTimesBean bean = new TripStopTimesBean();
    TimeZone tz = _agencyService.getTimeZoneForAgencyId(tripId.getAgencyId());
    bean.setTimeZone(tz.getID());
    for (StopTimeEntry stopTime : trip.getStopTimes()) {
        TripStopTimeBean stBean = new TripStopTimeBean();
        stBean.setArrivalTime(stopTime.getArrivalTime());
        stBean.setDepartureTime(stopTime.getDepartureTime());
        StopEntry stopEntry = stopTime.getStop();
        StopBean stopBean = _stopBeanService.getStopForId(stopEntry.getId());
        stBean.setStop(stopBean);
        stBean.setDistanceAlongTrip(stopTime.getShapeDistTraveled());
        bean.addStopTime(stBean);
    }
    return bean;
}
Also used : TimeZone(java.util.TimeZone) AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) StopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry) TripStopTimeBean(org.onebusaway.transit_data.model.TripStopTimeBean) StopEntry(org.onebusaway.transit_data_federation.services.transit_graph.StopEntry) StopBean(org.onebusaway.transit_data.model.StopBean) TripStopTimesBean(org.onebusaway.transit_data.model.TripStopTimesBean)

Example 2 with TripStopTimeBean

use of org.onebusaway.transit_data.model.TripStopTimeBean in project onebusaway-application-modules by camsys.

the class BeanFactoryV2 method getTripStopTimes.

public TripStopTimesV2Bean getTripStopTimes(TripStopTimesBean tripStopTimes) {
    TripStopTimesV2Bean bean = new TripStopTimesV2Bean();
    bean.setTimeZone(tripStopTimes.getTimeZone());
    List<TripStopTimeV2Bean> instances = new ArrayList<TripStopTimeV2Bean>();
    for (TripStopTimeBean sti : tripStopTimes.getStopTimes()) {
        TripStopTimeV2Bean stiBean = new TripStopTimeV2Bean();
        stiBean.setArrivalTime(sti.getArrivalTime());
        stiBean.setDepartureTime(sti.getDepartureTime());
        stiBean.setStopHeadsign(sti.getStopHeadsign());
        stiBean.setDistanceAlongTrip(sti.getDistanceAlongTrip());
        stiBean.setStopId(sti.getStop().getId());
        addToReferences(sti.getStop());
        instances.add(stiBean);
    }
    bean.setStopTimes(instances);
    TripBean nextTrip = tripStopTimes.getNextTrip();
    if (nextTrip != null) {
        bean.setNextTripId(nextTrip.getId());
        addToReferences(nextTrip);
    }
    TripBean prevTrip = tripStopTimes.getPreviousTrip();
    if (prevTrip != null) {
        bean.setPreviousTripId(prevTrip.getId());
        addToReferences(prevTrip);
    }
    FrequencyBean freq = tripStopTimes.getFrequency();
    if (freq != null)
        bean.setFrequency(getFrequency(freq));
    return bean;
}
Also used : FrequencyBean(org.onebusaway.transit_data.model.schedule.FrequencyBean) ArrayList(java.util.ArrayList) TripStopTimeBean(org.onebusaway.transit_data.model.TripStopTimeBean) BlockTripBean(org.onebusaway.transit_data.model.blocks.BlockTripBean) TripBean(org.onebusaway.transit_data.model.trips.TripBean)

Aggregations

TripStopTimeBean (org.onebusaway.transit_data.model.TripStopTimeBean)2 ArrayList (java.util.ArrayList)1 TimeZone (java.util.TimeZone)1 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)1 StopBean (org.onebusaway.transit_data.model.StopBean)1 TripStopTimesBean (org.onebusaway.transit_data.model.TripStopTimesBean)1 BlockTripBean (org.onebusaway.transit_data.model.blocks.BlockTripBean)1 FrequencyBean (org.onebusaway.transit_data.model.schedule.FrequencyBean)1 TripBean (org.onebusaway.transit_data.model.trips.TripBean)1 StopEntry (org.onebusaway.transit_data_federation.services.transit_graph.StopEntry)1 StopTimeEntry (org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry)1