Search in sources :

Example 1 with BoardingArea

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

the class AddTransitModelEntitiesToGraph method addBoardingAreasToGraph.

private void addBoardingAreasToGraph(Graph graph) {
    for (BoardingArea boardingArea : transitService.getAllBoardingAreas()) {
        TransitBoardingAreaVertex boardingAreaVertex = new TransitBoardingAreaVertex(graph, boardingArea);
        stationElementNodes.put(boardingArea, boardingAreaVertex);
        if (boardingArea.getParentStop() != null) {
            new PathwayEdge(boardingAreaVertex, stationElementNodes.get(boardingArea.getParentStop()), boardingArea.getName());
            new PathwayEdge(stationElementNodes.get(boardingArea.getParentStop()), boardingAreaVertex, boardingArea.getName());
        }
    }
}
Also used : TransitBoardingAreaVertex(org.opentripplanner.routing.vertextype.TransitBoardingAreaVertex) PathwayEdge(org.opentripplanner.routing.edgetype.PathwayEdge) BoardingArea(org.opentripplanner.model.BoardingArea)

Example 2 with BoardingArea

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

the class GTFSToOtpTransitServiceMapper method mapGtfsStopsToOtpTypes.

private void mapGtfsStopsToOtpTypes(GtfsRelationalDao data, OtpTransitServiceBuilder builder) {
    StopToParentStationLinker stopToParentStationLinker = new StopToParentStationLinker(issueStore);
    for (org.onebusaway.gtfs.model.Stop it : data.getAllStops()) {
        if (it.getLocationType() == org.onebusaway.gtfs.model.Stop.LOCATION_TYPE_STOP) {
            Stop stop = stopMapper.map(it);
            builder.getStops().add(stop);
            stopToParentStationLinker.addStationElement(stop, it.getParentStation());
        } else if (it.getLocationType() == org.onebusaway.gtfs.model.Stop.LOCATION_TYPE_STATION) {
            Station station = stationMapper.map(it);
            builder.getStations().add(station);
            stopToParentStationLinker.addStation(station);
        } else if (it.getLocationType() == org.onebusaway.gtfs.model.Stop.LOCATION_TYPE_ENTRANCE_EXIT) {
            Entrance entrance = entranceMapper.map(it);
            builder.getEntrances().add(entrance);
            stopToParentStationLinker.addStationElement(entrance, it.getParentStation());
        } else if (it.getLocationType() == org.onebusaway.gtfs.model.Stop.LOCATION_TYPE_NODE) {
            PathwayNode pathwayNode = pathwayNodeMapper.map(it);
            builder.getPathwayNodes().add(pathwayNode);
            stopToParentStationLinker.addStationElement(pathwayNode, it.getParentStation());
        } else if (it.getLocationType() == org.onebusaway.gtfs.model.Stop.LOCATION_TYPE_BOARDING_AREA) {
            BoardingArea boardingArea = boardingAreaMapper.map(it);
            builder.getBoardingAreas().add(boardingArea);
            stopToParentStationLinker.addBoardingArea(boardingArea, it.getParentStation());
        }
    }
    stopToParentStationLinker.link();
}
Also used : Station(org.opentripplanner.model.Station) Entrance(org.opentripplanner.model.Entrance) Stop(org.opentripplanner.model.Stop) PathwayNode(org.opentripplanner.model.PathwayNode) BoardingArea(org.opentripplanner.model.BoardingArea)

Example 3 with BoardingArea

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

the class StopToParentStationLinker method link.

void link() {
    for (Map.Entry<StationElement, FeedScopedId> entry : stationElementsToStations.entrySet()) {
        StationElement stationElement = entry.getKey();
        FeedScopedId stationId = entry.getValue();
        Station otpStation = otpStations.get(stationId);
        if (otpStation == null) {
            issueStore.add(new ParentStationNotFound(stationElement, stationId.getId()));
        } else {
            stationElement.setParentStation(otpStation);
            if (stationElement instanceof Stop) {
                otpStation.addChildStop((Stop) stationElement);
            }
        }
    }
    for (Map.Entry<BoardingArea, FeedScopedId> entry : boardingAreasToStops.entrySet()) {
        BoardingArea boardingArea = entry.getKey();
        FeedScopedId stopId = entry.getValue();
        StationElement otpStop = otpStationElements.get(stopId);
        if (!(otpStop instanceof Stop)) {
            issueStore.add(new ParentStationNotFound(boardingArea, stopId.getId()));
        } else {
            boardingArea.setParentStop((Stop) otpStop);
            ((Stop) otpStop).addBoardingArea(boardingArea);
            boardingArea.setParentStation(otpStop.getParentStation());
        }
    }
}
Also used : Station(org.opentripplanner.model.Station) Stop(org.opentripplanner.model.Stop) StationElement(org.opentripplanner.model.StationElement) FeedScopedId(org.opentripplanner.model.FeedScopedId) Map(java.util.Map) HashMap(java.util.HashMap) ParentStationNotFound(org.opentripplanner.graph_builder.issues.ParentStationNotFound) BoardingArea(org.opentripplanner.model.BoardingArea)

Aggregations

BoardingArea (org.opentripplanner.model.BoardingArea)3 Station (org.opentripplanner.model.Station)2 Stop (org.opentripplanner.model.Stop)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ParentStationNotFound (org.opentripplanner.graph_builder.issues.ParentStationNotFound)1 Entrance (org.opentripplanner.model.Entrance)1 FeedScopedId (org.opentripplanner.model.FeedScopedId)1 PathwayNode (org.opentripplanner.model.PathwayNode)1 StationElement (org.opentripplanner.model.StationElement)1 PathwayEdge (org.opentripplanner.routing.edgetype.PathwayEdge)1 TransitBoardingAreaVertex (org.opentripplanner.routing.vertextype.TransitBoardingAreaVertex)1