Package org.opentripplanner.routing.vertextype

Examples of org.opentripplanner.routing.vertextype.TransitStationStop


            if (type == 3) // type 3 = transfer not possible
                continue;
            if (transfer.getFromStop().equals(transfer.getToStop())) {
                continue;
            }
            TransitStationStop fromv = context.stationStopNodes.get(transfer.getFromStop());
            TransitStationStop tov = context.stationStopNodes.get(transfer.getToStop());

            double distance = distanceLibrary.distance(fromv.getCoordinate(), tov.getCoordinate());
            int time;
            if (transfer.getTransferType() == 2) {
                time = transfer.getMinTransferTime();
            } else {
                time = (int) distance; // fixme: handle timed transfers
            }

            TransferEdge transferEdge = new TransferEdge(fromv, tov, distance, time);
            CoordinateSequence sequence = new PackedCoordinateSequence.Double(new Coordinate[] {
                    fromv.getCoordinate(), tov.getCoordinate() }, 2);
            LineString geometry = _geometryFactory.createLineString(sequence);
            transferEdge.setGeometry(geometry);
        }
    }
View Full Code Here


    public void run() {
        // Create a mapping from StopId to StopVertices
        Map<AgencyAndId, TransitStationStop> stopNodes = new HashMap<AgencyAndId, TransitStationStop>();
        for (Vertex v : graph.getVertices()) {
            if (v instanceof TransitStationStop) {
                TransitStationStop transitStationStop = (TransitStationStop) v;
                Stop stop = transitStationStop.getStop();
                stopNodes.put(stop.getId(), transitStationStop);
            }
        }
       
        // Create edges
        for (TransferTable.Transfer transfer : graph.getTransferTable().getAllFirstSpecificTransfers()) {
            TransitStationStop fromVertex = stopNodes.get(transfer.fromStopId);
            TransitStationStop toVertex = stopNodes.get(transfer.toStopId);

            double distance = distanceLibrary.distance(fromVertex.getCoordinate(),
                    toVertex.getCoordinate());
            TransferEdge edge = null;
            switch (transfer.seconds) {
                case StopTransfer.FORBIDDEN_TRANSFER:
                case StopTransfer.UNKNOWN_TRANSFER:
                    break;
                case StopTransfer.PREFERRED_TRANSFER:
                case StopTransfer.TIMED_TRANSFER:
                    edge = new TransferEdge(fromVertex,
                            toVertex, distance);
                    break;
                default:
                    edge = new TransferEdge(fromVertex,
                            toVertex, distance, transfer.seconds);
            }
           
            if (edge != null) {
                LineString geometry = GeometryUtils.getGeometryFactory().createLineString(new Coordinate[] {
                        fromVertex.getCoordinate(),
                        toVertex.getCoordinate() });
                edge.setGeometry(geometry);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.vertextype.TransitStationStop

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.