use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class GroupOfStationsMapper method connectChildStation.
private void connectChildStation(GroupOfStopPlaces groupOfStopPlaces, GroupOfStations groupOfStations) {
StopPlaceRefs_RelStructure members = groupOfStopPlaces.getMembers();
if (members != null) {
List<StopPlaceRefStructure> memberList = members.getStopPlaceRef();
for (StopPlaceRefStructure stopPlaceRefStructure : memberList) {
FeedScopedId stationId = idFactory.createId(stopPlaceRefStructure.getRef());
StopCollection station = lookupStation(stationId);
if (station != null) {
groupOfStations.addChildStation(station);
} else {
LOG.warn("GroupOfStation {} child not found: {}", groupOfStations.getId(), stationId);
}
}
}
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class NoticeAssignmentMapper method map.
Multimap<TransitEntity<?>, Notice> map(NoticeAssignment noticeAssignment) {
// TODO OTP2 - Idealy this should en up as one key,value pair.
// The `StopPointInJourneyPattern` witch result in more than one key/valye pair,
// can be replaced with a new compound key type.
Multimap<TransitEntity<?>, Notice> noticiesByEntity = ArrayListMultimap.create();
String noticedObjectId = noticeAssignment.getNoticedObjectRef().getRef();
Notice otpNotice = getOrMapNotice(noticeAssignment);
if (otpNotice == null) {
LOG.warn("Notice in notice assignment is missing for assignment {}", noticeAssignment);
return noticiesByEntity;
}
// Special case for StopPointInJourneyPattern. The OTP model do not have this element, so we
// attach the notice to all StopTimes for the pattern at the given stop.
Collection<TimetabledPassingTime> times = passingTimeByStopPointId.lookup(noticedObjectId);
if (!times.isEmpty()) {
for (TimetabledPassingTime time : times) {
noticiesByEntity.put(lookupStopTimeKey(time.getId()), otpNotice);
}
} else if (stopTimesByNetexId.containsKey(noticedObjectId)) {
noticiesByEntity.put(lookupStopTimeKey(noticedObjectId), otpNotice);
} else {
FeedScopedId otpId = idFactory.createId(noticedObjectId);
if (routesById.containsKey(otpId)) {
noticiesByEntity.put(routesById.get(otpId), otpNotice);
} else if (tripsById.containsKey(otpId)) {
noticiesByEntity.put(tripsById.get(otpId), otpNotice);
} else {
LOG.warn("Could not map noticeAssignment for element with id {}", noticedObjectId);
}
}
return noticiesByEntity;
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class ServiceLinkMapper method mapServiceLink.
private Collection<ShapePoint> mapServiceLink(ServiceLink serviceLink, JourneyPattern journeyPattern, MutableInt sequenceCounter, MutableDouble distanceCounter, ReadOnlyHierarchicalMap<String, String> quayIdByStopPointRef, ReadOnlyHierarchicalVersionMapById<Quay> quayById) {
Collection<ShapePoint> shapePoints = new ArrayList<>();
FeedScopedId shapePointIdFromJourneyPatternId = createShapePointIdFromJourneyPatternId(idFactory.createId(journeyPattern.getId()));
if (serviceLink.getProjections() == null || serviceLink.getProjections().getProjectionRefOrProjection() == null) {
addStraightLine(serviceLink, sequenceCounter, distanceCounter, quayIdByStopPointRef, quayById, shapePoints, shapePointIdFromJourneyPatternId);
} else {
mapCoordinates(serviceLink, sequenceCounter, distanceCounter, shapePoints, shapePointIdFromJourneyPatternId);
}
return shapePoints;
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class TariffZoneMapper method mapTariffZone.
/**
* Map Netex TariffZone to OTP TariffZone
*/
public FareZone mapTariffZone(org.rutebanken.netex.model.TariffZone tariffZone) {
FeedScopedId id = idFactory.createId(tariffZone.getId());
String name = tariffZone.getName().getValue();
return new FareZone(id, name);
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class Graph method getServicesRunningForDate.
/**
* An OBA Service Date is a local date without timezone, only year month and day.
*/
public BitSet getServicesRunningForDate(ServiceDate date) {
BitSet services = new BitSet(calendarService.getServiceIds().size());
for (FeedScopedId serviceId : calendarService.getServiceIdsOnDate(date)) {
int n = serviceCodes.get(serviceId);
if (n < 0)
continue;
services.set(n);
}
return services;
}
Aggregations