private Route doMap(org.onebusaway.gtfs.model.Route rhs) { Route lhs = new Route(); lhs.setId(AgencyAndIdMapper.mapAgencyAndId(rhs.getId())); lhs.setAgency(agencyMapper.map(rhs.getAgency())); lhs.setShortName(rhs.getShortName()); lhs.setLongName(rhs.getLongName()); lhs.setType(rhs.getType()); lhs.setDesc(rhs.getDesc()); lhs.setUrl(rhs.getUrl()); lhs.setColor(rhs.getColor()); lhs.setTextColor(rhs.getTextColor()); lhs.setRouteBikesAllowed(rhs.getRouteBikesAllowed()); lhs.setBikesAllowed(rhs.getBikesAllowed()); lhs.setSortOrder(rhs.getSortOrder()); lhs.setBrandingUrl(rhs.getBrandingUrl()); return lhs; } }
private void retainRoute(Route route, boolean retainUp) { if (retainUp) { for (Trip trip : _dao.getTripsForRoute(route)) retainUp(trip); } else { retainDown(route.getAgency()); } }
shapePoints = _shapePointsHelper.getShapePointsForShapeId(trip.getShapeId()); Agency agency = trip.getRoute().getAgency(); TimeZone tz = TimeZone.getTimeZone(agency.getTimezone()); LocalizedServiceId lsid = new LocalizedServiceId(trip.getServiceId(), tz);
private TripEntryImpl processTrip(TransitGraphImpl graph, Trip trip) { List<StopTime> stopTimes = _gtfsDao.getStopTimesForTrip(trip); // A trip without stop times is a trip we don't care about if (stopTimes.isEmpty()) return null; ShapePoints shapePoints = null; if (trip.getShapeId() != null) shapePoints = _shapePointsHelper.getShapePointsForShapeId(trip.getShapeId()); Agency agency = trip.getRoute().getAgency(); TimeZone tz = TimeZone.getTimeZone(agency.getTimezone()); LocalizedServiceId lsid = new LocalizedServiceId(trip.getServiceId(), tz); TripEntryImpl tripEntry = new TripEntryImpl(); tripEntry.setId(trip.getId()); tripEntry.setDirectionId(unique(trip.getDirectionId())); tripEntry.setServiceId(unique(lsid)); // Only set the shape id for a trip if there are actually shape points to // back it up if (!(shapePoints == null || shapePoints.isEmpty())) tripEntry.setShapeId(unique(trip.getShapeId())); List<StopTimeEntryImpl> stopTimesForTrip = _stopTimeEntriesFactory.processStopTimes( graph, stopTimes, tripEntry, shapePoints); double tripDistance = getTripDistance(stopTimesForTrip, shapePoints); tripEntry.setTotalTripDistance(tripDistance); tripEntry.setStopTimes(cast(stopTimesForTrip)); graph.putTripEntry(tripEntry); return tripEntry; }
private TripEntryImpl processTrip(TransitGraphImpl graph, Trip trip) { List<StopTime> stopTimes = _gtfsDao.getStopTimesForTrip(trip); // A trip without stop times is a trip we don't care about if (stopTimes.isEmpty()) return null; ShapePoints shapePoints = null; if (trip.getShapeId() != null) shapePoints = _shapePointsService.getShapePointsForShapeId(trip.getShapeId()); Agency agency = trip.getRoute().getAgency(); TimeZone tz = TimeZone.getTimeZone(agency.getTimezone()); LocalizedServiceId lsid = new LocalizedServiceId(trip.getServiceId(), tz); TripEntryImpl tripEntry = new TripEntryImpl(); tripEntry.setId(trip.getId()); tripEntry.setRouteId(unique(trip.getRoute().getId())); tripEntry.setDirectionId(unique(trip.getDirectionId())); tripEntry.setServiceId(unique(lsid)); // Only set the shape id for a trip if there are actually shape points to // back it up if (!(shapePoints == null || shapePoints.isEmpty())) tripEntry.setShapeId(unique(trip.getShapeId())); List<StopTimeEntryImpl> stopTimesForTrip = _stopTimeEntriesFactory.processStopTimes( graph, stopTimes, tripEntry, shapePoints); double tripDistance = getTripDistance(stopTimesForTrip, shapePoints); tripEntry.setTotalTripDistance(tripDistance); tripEntry.setStopTimes(cast(stopTimesForTrip)); graph.putTripEntry(tripEntry); return tripEntry; }