Search in sources :

Example 1 with GroupOfStations

use of org.opentripplanner.model.GroupOfStations in project OpenTripPlanner by opentripplanner.

the class GroupOfStationsMapper method map.

GroupOfStations map(GroupOfStopPlaces groupOfStopPlaces) {
    GroupOfStations groupOfStations = new GroupOfStations();
    groupOfStations.setId(idFactory.createId(groupOfStopPlaces.getId()));
    groupOfStations.setName(groupOfStopPlaces.getName().getValue());
    WgsCoordinate coordinate = WgsCoordinateMapper.mapToDomain(groupOfStopPlaces.getCentroid());
    if (coordinate == null) {
        // TODO OTP2 - This should be an data import issue
        LOG.warn("MultiModal station {} does not contain any coordinates.", groupOfStations.getId());
    } else {
        groupOfStations.setCoordinate(coordinate);
    }
    connectChildStation(groupOfStopPlaces, groupOfStations);
    return groupOfStations;
}
Also used : WgsCoordinate(org.opentripplanner.model.WgsCoordinate) GroupOfStations(org.opentripplanner.model.GroupOfStations)

Example 2 with GroupOfStations

use of org.opentripplanner.model.GroupOfStations in project OpenTripPlanner by opentripplanner.

the class Graph method getStopsForId.

private Collection<Stop> getStopsForId(FeedScopedId id) {
    // GroupOfStations
    GroupOfStations groupOfStations = groupOfStationsById.get(id);
    if (groupOfStations != null) {
        return groupOfStations.getChildStops();
    }
    // Multimodal station
    MultiModalStation multiModalStation = multiModalStationById.get(id);
    if (multiModalStation != null) {
        return multiModalStation.getChildStops();
    }
    // Station
    Station station = stationById.get(id);
    if (station != null) {
        return station.getChildStops();
    }
    // Single stop
    Stop stop = index.getStopForId(id);
    if (stop != null) {
        return Collections.singleton(stop);
    }
    return null;
}
Also used : MultiModalStation(org.opentripplanner.model.MultiModalStation) Station(org.opentripplanner.model.Station) Stop(org.opentripplanner.model.Stop) MultiModalStation(org.opentripplanner.model.MultiModalStation) GroupOfStations(org.opentripplanner.model.GroupOfStations)

Aggregations

GroupOfStations (org.opentripplanner.model.GroupOfStations)2 MultiModalStation (org.opentripplanner.model.MultiModalStation)1 Station (org.opentripplanner.model.Station)1 Stop (org.opentripplanner.model.Stop)1 WgsCoordinate (org.opentripplanner.model.WgsCoordinate)1