Package org.opentripplanner.routing.vertextype

Examples of org.opentripplanner.routing.vertextype.TransitStop


            // Determine the set of pathway/transfer destinations
            Set<TransitStop> pathwayDestinations = new HashSet<TransitStop>();
            for (Edge e : ts.getOutgoing()) {
                if (e instanceof PathwayEdge || e instanceof SimpleTransfer) {
                    if (e.getToVertex() instanceof TransitStop) {
                        TransitStop to = (TransitStop) e.getToVertex();
                        pathwayDestinations.add(to);
                    }
                }
            }

            int n = 0;
            RoutingRequest routingRequest = new RoutingRequest(TraverseMode.WALK);
            routingRequest.clampInitialWait = (0L);
            routingRequest.setRoutingContext(graph, ts, null);
            routingRequest.rctx.pathParsers = parser;
            ShortestPathTree spt = earliestArrivalSPTService.getShortestPathTree(routingRequest);

            if (spt != null) {
                for (State state : spt.getAllStates()) {
                    Vertex vertex = state.getVertex();
                    if (ts == vertex) continue;

                    if (vertex instanceof TransitStop) {
                        TransitStop other = (TransitStop) vertex;
                        if (!other.isStreetLinkable())
                            continue;
                        if (pathwayDestinations.contains(other)) {
                            LOG.trace("Skipping '{}', {}, already connected.", other.getStop(),
                                    other);
                            continue;
                        }
                        double distance = 0.0;
                        GraphPath graphPath = new GraphPath(state, false);
                        CoordinateArrayListSequence coordinates = new CoordinateArrayListSequence();

                        for (Edge edge : graphPath.edges) {
                            if (edge instanceof StreetEdge) {
                                LineString geometry = edge.getGeometry();

                                if (geometry != null) {
                                    if (coordinates.size() == 0) {
                                        coordinates.extend(geometry.getCoordinates());
                                    } else {
                                        coordinates.extend(geometry.getCoordinates(), 1);
                                    }
                                }

                                distance += edge.getDistance();
                            }
                        }

                        if (coordinates.size() < 2) {   // Otherwise the walk step generator breaks.
                            ArrayList<Coordinate> coordinateList = new ArrayList<Coordinate>(2);
                            coordinateList.add(graphPath.states.get(1).getVertex().getCoordinate());
                            State lastState = graphPath.states.getLast().getBackState();
                            coordinateList.add(lastState.getVertex().getCoordinate());
                            coordinates = new CoordinateArrayListSequence(coordinateList);
                        }

                        LineString geometry = geometryFactory.createLineString(new
                                PackedCoordinateSequence.Double(coordinates.toCoordinateArray()));
                        LOG.trace("  to stop: '{}' {} ({}m) [{}]", other.getStop(), other, distance, geometry);
                        new SimpleTransfer(ts, other, distance, geometry);
                        n++;
                    }
                }
            }
View Full Code Here


                if ( ! addIfNondominated(r1)) continue; // abandon this ride if it is dominated by some existing ride at the same location
                // We have a new, nondominated, completed ride. Record its lower and upper bounds at the arrival stop.
                if (request.analyst) {
                    for (Stop s : r1.to.children) {
                        // TODO This could be done at the end now that we are retaining all rides.
                        TransitStop tstop = graph.index.stopVertexForStop.get(s);
                        int tsidx = tstop.getIndex();
                        int lb = r1.durationLowerBound();
                        int ub = r1.durationUpperBound();
                        if (mins[tsidx] == TimeSurface.UNREACHABLE || mins[tsidx] > lb)
                            mins[tsidx] = lb;
                        if (maxs[tsidx] == TimeSurface.UNREACHABLE || maxs[tsidx] > ub) // Yes, we want the _minimum_ upper bound.
View Full Code Here

        this.state = state;
        etime = (int) state.getElapsedTimeSeconds();
        /* This mode is not reliable for drive to transit (which ends with walking), reset in caller. */
        mode = state.getNonTransitMode();
        if (state.getVertex() instanceof TransitStop) {
            TransitStop tstop = (TransitStop) state.getVertex();
            stop = state.getOptions().rctx.graph.index.stopClusterForStop.get(tstop.getStop());
        }
    }
View Full Code Here

TOP

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

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.