private Trip doMap(org.onebusaway.gtfs.model.Trip rhs) { Trip lhs = new Trip(); lhs.setId(AgencyAndIdMapper.mapAgencyAndId(rhs.getId())); lhs.setRoute(routeMapper.map(rhs.getRoute())); lhs.setServiceId(AgencyAndIdMapper.mapAgencyAndId(rhs.getServiceId())); lhs.setTripShortName(rhs.getTripShortName()); lhs.setTripHeadsign(rhs.getTripHeadsign()); lhs.setRouteShortName(rhs.getRouteShortName()); lhs.setDirectionId(rhs.getDirectionId()); lhs.setBlockId(rhs.getBlockId()); lhs.setShapeId(AgencyAndIdMapper.mapAgencyAndId(rhs.getShapeId())); lhs.setWheelchairAccessible(rhs.getWheelchairAccessible()); lhs.setTripBikesAllowed(rhs.getTripBikesAllowed()); lhs.setBikesAllowed(rhs.getBikesAllowed()); lhs.setFareId(rhs.getFareId()); return lhs; }
if (t.getShapeId().getId().equals(shapeId) && !t.getDirectionId().equals(shapeDirection)) { tripsToTransform.add(t);
@Override public void run() { logger.header("gtfs_trips_with_missing_shape_ids.csv", "agency_id,trip_id"); for (Trip trip : _dao.getAllTrips()) { if (trip.getShapeId() == null) { logger.log("gtfs_trips_with_missing_shape_ids.csv", trip.getId().getAgencyId(), trip.getId().getId()); } } }
return; AgencyAndId shapeId = trip.getShapeId(); if (shapeId == null || !shapeId.hasValues()) { return;
Set<AgencyAndId> shapeIds = new HashSet<AgencyAndId>(dao.getAllShapeIds()); for (Trip trip : dao.getAllTrips()) { shapeIds.remove(trip.getShapeId());
return; AgencyAndId shapeId = trip.getShapeId(); if (shapeId == null || !shapeId.hasValues()) { return;
if (trip.getShapeId() != null) shapePoints = _shapePointsHelper.getShapePointsForShapeId(trip.getShapeId()); tripEntry.setShapeId(unique(trip.getShapeId()));
Set<AgencyAndId> shapeIds = new HashSet<AgencyAndId>(dao.getAllShapeIds()); for (Trip trip : dao.getAllTrips()) { shapeIds.remove(trip.getShapeId());
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 String areTripsEquivalent(Trip tripA, Trip tripB) { if (!equals(tripA.getDirectionId(), tripB.getDirectionId())) return "directionId"; if (!equals(tripA.getRoute(), tripB.getRoute())) return "route"; if (!equals(tripA.getRouteShortName(), tripB.getRouteShortName())) return "routeShortName"; if (!equals(tripA.getShapeId(), tripB.getShapeId())) return "shapeId"; if (!equals(tripA.getTripHeadsign(), tripB.getTripHeadsign())) return "tripHeadsign"; if (!equals(tripA.getTripShortName(), tripB.getTripShortName())) return "tripShortName"; return null; }
AgencyAndId shapeAgencyAndId = trip.getShapeId(); if (shapeAgencyAndId != null && !isEmpty(shapeAgencyAndId.getId())) { List<ShapePoint> tripShape = mShapePoints.get(shapeAgencyAndId.getId());
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; }
private Trip createTrip(GtfsMutableRelationalDao dao, Trip referenceTrip, Trip atisTrip) { Trip trip = new Trip(); trip.setRoute(atisTrip.getRoute()); trip.setId(referenceTrip.getId()); trip.setTripHeadsign(atisTrip.getTripHeadsign()); trip.setDirectionId(atisTrip.getDirectionId()); trip.setShapeId(atisTrip.getShapeId()); trip.setPeakOffpeak(atisTrip.getPeakOffpeak()); trip.setMtaTripId(referenceTrip.getId().getId()); dao.saveOrUpdateEntity(trip); //_log.info("Created new trip: {}", trip.getId().getId()); return trip; }
private void retainTrip(Trip trip, boolean retainUp) { if (retainUp) { for (StopTime stopTime : _dao.getStopTimesForTrip(trip)) retainUp(stopTime); if (_retainBlocks && trip.getBlockId() != null) { AgencyAndId blockId = new AgencyAndId(trip.getId().getAgencyId(), trip.getBlockId()); retainUp(new BlockIdKey(blockId)); } for (Frequency frequency : _dao.getFrequenciesForTrip(trip)) retainUp(frequency); } else { retainDown(trip.getRoute()); retainDown(new ServiceIdKey(trip.getServiceId())); AgencyAndId shapeId = trip.getShapeId(); if (shapeId != null && shapeId.hasValues()) retainDown(new ShapeIdKey(shapeId)); } }
Hop hop = new Hop(startJourneyDepart, endJourneyArrive, st0, st1); hop.setFareContext(fareContext); hop.setGeometry(getHopGeometry(trip.getShapeId(), st0, st1, startJourneyDepart, endJourneyArrive)); hops.add(hop);
tripPattern); hop.setFareContext(fareContext); hop.setGeometry(getHopGeometry(trip.getShapeId(), st0, st1, startJourneyDepart, endJourneyArrive));