Search in sources :

Example 16 with FeedScopedId

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);
            }
        }
    }
}
Also used : StopCollection(org.opentripplanner.model.StopCollection) StopPlaceRefStructure(org.rutebanken.netex.model.StopPlaceRefStructure) FeedScopedId(org.opentripplanner.model.FeedScopedId) StopPlaceRefs_RelStructure(org.rutebanken.netex.model.StopPlaceRefs_RelStructure)

Example 17 with FeedScopedId

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;
}
Also used : Notice(org.opentripplanner.model.Notice) TransitEntity(org.opentripplanner.model.TransitEntity) FeedScopedId(org.opentripplanner.model.FeedScopedId) TimetabledPassingTime(org.rutebanken.netex.model.TimetabledPassingTime)

Example 18 with FeedScopedId

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;
}
Also used : ShapePoint(org.opentripplanner.model.ShapePoint) ArrayList(java.util.ArrayList) FeedScopedId(org.opentripplanner.model.FeedScopedId)

Example 19 with FeedScopedId

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);
}
Also used : FeedScopedId(org.opentripplanner.model.FeedScopedId) FareZone(org.opentripplanner.model.FareZone)

Example 20 with FeedScopedId

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;
}
Also used : BitSet(java.util.BitSet) FeedScopedId(org.opentripplanner.model.FeedScopedId)

Aggregations

FeedScopedId (org.opentripplanner.model.FeedScopedId)117 Trip (org.opentripplanner.model.Trip)32 Test (org.junit.Test)29 Stop (org.opentripplanner.model.Stop)25 TripPattern (org.opentripplanner.model.TripPattern)25 ServiceDate (org.opentripplanner.model.calendar.ServiceDate)21 ArrayList (java.util.ArrayList)20 Route (org.opentripplanner.model.Route)15 HashSet (java.util.HashSet)11 List (java.util.List)11 Agency (org.opentripplanner.model.Agency)11 Collection (java.util.Collection)9 Map (java.util.Map)9 Collectors (java.util.stream.Collectors)9 ZonedDateTime (java.time.ZonedDateTime)8 TransitEntity (org.opentripplanner.model.TransitEntity)8 RoutingService (org.opentripplanner.routing.RoutingService)8 TripTimes (org.opentripplanner.routing.trippattern.TripTimes)8 Notice (org.opentripplanner.model.Notice)7 Station (org.opentripplanner.model.Station)7