Examples of TransitStop


Examples of org.opentripplanner.routing.vertextype.TransitStop

            }
        }
       
        if (opt.startingTransitStopId != null) {
            Stop stop = graph.index.stopForId.get(opt.startingTransitStopId);
            TransitStop tstop = graph.index.stopVertexForStop.get(stop);
            startingStop = tstop.departVertex;
        }
        origin = opt.arriveBy ? toVertex : fromVertex;
        originBackEdge = opt.arriveBy ? toBackEdge : fromBackEdge;
        target = opt.arriveBy ? fromVertex : toVertex;
View Full Code Here

Examples of org.opentripplanner.routing.vertextype.TransitStop

    }

    // this could be handled by method overloading on Vertex
    public boolean isWheelchairAccessible(Vertex v) {
        if (v instanceof TransitStop) {
            TransitStop ts = (TransitStop) v;
            return ts.hasWheelchairEntrance();
        } else if (v instanceof StreetLocation) {
            StreetLocation sl = (StreetLocation) v;
            return sl.isWheelchairAccessible();
        }
        return true;
View Full Code Here

Examples of org.opentripplanner.routing.vertextype.TransitStop

            }
        }
        for (Vertex vertex : vertices) {
            vertexForId.put(vertex.getLabel(), vertex);
            if (vertex instanceof TransitStop) {
                TransitStop transitStop = (TransitStop) vertex;
                Stop stop = transitStop.getStop();
                stopForId.put(stop.getId(), stop);
                stopVertexForStop.put(stop, transitStop);
                stopsForParentStation.put(stop.getParentStation(), stop);
            }
        }
View Full Code Here

Examples of org.opentripplanner.routing.vertextype.TransitStop

    @SuppressWarnings("unchecked")
    @Override
    public List<TransitStop> getTransitStopForEnvelope(Envelope envelope) {
        List<TransitStop> transitStops = transitStopTree.query(envelope);
        for (Iterator<TransitStop> its = transitStops.iterator(); its.hasNext();) {
            TransitStop ts = its.next();
            if (!envelope.intersects(new Coordinate(ts.getLon(), ts.getLat())))
                its.remove();
        }
        return transitStops;
    }
View Full Code Here

Examples of org.opentripplanner.routing.vertextype.TransitStop

        firstTripPattern.add(firstTripTimes);
        secondTripPattern.add(secondTripTimes);
        thirdTripPattern.add(thirdTripTimes);

        // Vertices for legs 1, 2 and 3
        TransitStop v6 = new TransitStop(graph, trainStopDepart);
        TransitStopDepart v8 = new TransitStopDepart(graph, trainStopDepart, v6);
        // To understand the stop indexes in the vertex constructors, look at firstStopTimes.add() etc. above
        PatternDepartVertex v10 = new PatternDepartVertex(graph, firstTripPattern, 0);
        PatternArriveVertex v12 = new PatternArriveVertex(graph, firstTripPattern, 1);
        PatternDepartVertex v14 = new PatternDepartVertex(graph, firstTripPattern, 1);
        PatternArriveVertex v16 = new PatternArriveVertex(graph, firstTripPattern, 2);
        PatternDepartVertex v18 = new PatternDepartVertex(graph, secondTripPattern, 0);
        PatternArriveVertex v20 = new PatternArriveVertex(graph, secondTripPattern, 1);
        TransitStop v24 = new TransitStop(graph, trainStopArrive);
        TransitStopArrive v22 = new TransitStopArrive(graph, trainStopArrive, v24);

        // Vertices for legs 3 and 4
        TransitStop v26 = new TransitStop(graph, ferryStopDepart);
        TransitStopDepart v28 = new TransitStopDepart(graph, ferryStopDepart, v26);
        PatternDepartVertex v30 = new PatternDepartVertex(graph, thirdTripPattern, 0);
        PatternArriveVertex v32 = new PatternArriveVertex(graph, thirdTripPattern, 1);
        TransitStop v36 = new TransitStop(graph, ferryStopArrive);
        TransitStopArrive v34 = new TransitStopArrive(graph, ferryStopArrive, v36);

        // Vertices for leg 5
        IntersectionVertex v38 = new IntersectionVertex(graph, "Vertex 38", 179, 89);
        IntersectionVertex v40 = new IntersectionVertex(graph, "Vertex 40", 180, 89);
View Full Code Here

Examples of org.opentripplanner.routing.vertextype.TransitStop

            // Return null here rather than in StreetTransitLink so that walk-only
            // options can be used to find transit stops without boarding vehicles.
            if (!options.modes.isTransit())
                return null;

            TransitStop toVertex = (TransitStop) getToVertex();

            // If we've hit our transfer limit, don't go any further
            if (s0.getNumBoardings() > options.maxTransfers)
                return null;

            /* apply transfer rules */
            /*
             * look in the global transfer table for the rules from the previous stop to this stop.
             */
            long t0 = s0.getTimeSeconds();
            long slack;
            if (s0.isEverBoarded()) {
                slack = options.transferSlack - options.boardSlack;
            } else {
                slack = options.alightSlack;
            }
            long alight_before = t0 - slack;
            int transfer_penalty = 0;

            // penalize transfers more heavily if requested by the user
            if (s0.isEverBoarded()) {
                // this is not the first boarding, therefore we must have "transferred" -- whether
                // via a formal transfer or by walking.
                transfer_penalty += options.transferPenalty;
            }

            StateEditor s1 = s0.edit(this);
            s1.setTimeSeconds(alight_before);
            long wait_cost = t0 - alight_before;
            s1.incrementWeight(wait_cost + transfer_penalty);
            s1.setBackMode(getMode());
            return s1.makeState();
        } else {
            /* Forward traversal: not so much to do */
            StateEditor s1 = s0.edit(this);
            TransitStop toVertex = (TransitStop) getToVertex();
            s1.alightTransit();
            s1.incrementTimeInSeconds(options.alightSlack);
            s1.setBackMode(getMode());
            return s1.makeState();
        }
View Full Code Here

Examples of org.opentripplanner.routing.vertextype.TransitStop

        Stop stop1 = new Stop();
        stop1.setId(new AgencyAndId("agency", "stop1"));
        Stop stop2 = new Stop();
        stop2.setId(new AgencyAndId("agency", "stop2"));
       
        Vertex from = new TransitStop(graph, stop1);
        Vertex to = new TransitStop(graph, stop2);
       
        // Create dummy TimetableResolver
        TimetableResolver resolver = new TimetableResolver();
       
        // Mock TimetableSnapshotSource to return dummy TimetableResolver
View Full Code Here

Examples of org.opentripplanner.routing.vertextype.TransitStop

     * @param from is label of from vertex
     * @param to is label of to vertex
     * @param distance is distance of transfer
     */
    private void createSimpleTransfer(String from, String to, int distance) {
        TransitStop fromv = ((TransitStop) graph.getVertex(from));
        TransitStop tov = ((TransitStop) graph.getVertex(to));
        new SimpleTransfer(fromv, tov, distance, null);
    }
View Full Code Here

Examples of org.opentripplanner.routing.vertextype.TransitStop

        stopD.setLat(0);
        stopE.setId(new AgencyAndId("Stop", "E"));
        stopE.setLon(2);
        stopE.setLat(2);

        TransitStop transitStopA = new TransitStop(graph, stopA);
        TransitStop transitStopB = new TransitStop(graph, stopB);
        TransitStop transitStopC = new TransitStop(graph, stopC);
        TransitStop transitStopD = new TransitStop(graph, stopD);
        TransitStop transitStopE = new TransitStop(graph, stopE);

        IntersectionVertex intersectionA = new IntersectionVertex(graph, "Intersection A", 1, 1);
        IntersectionVertex intersectionB = new IntersectionVertex(graph, "Intersection B", 1, 2);
        IntersectionVertex intersectionC = new IntersectionVertex(graph, "Intersection C", 2, 2);
        IntersectionVertex intersectionD = new IntersectionVertex(graph, "Intersection D", 2, 1);
View Full Code Here

Examples of org.opentripplanner.routing.vertextype.TransitStop

    public final void testOnBoardDepartureAtArrivalTime() {
        Coordinate[] coordinates = new Coordinate[2];
        coordinates[0] = new Coordinate(0.0, 0.0);
        coordinates[1] = new Coordinate(0.0, 1.0);

        TransitStop station0 = mock(TransitStop.class);
        TransitStop station1 = mock(TransitStop.class);
        PatternDepartVertex depart = mock(PatternDepartVertex.class);
        PatternArriveVertex arrive = mock(PatternArriveVertex.class);
        Graph graph = mock(Graph.class);
        RoutingRequest routingRequest = mock(RoutingRequest.class);
        ServiceDay serviceDay = mock(ServiceDay.class);

        when(graph.getTimeZone()).thenReturn(TimeZone.getTimeZone("GMT"));
        when(station0.getX()).thenReturn(coordinates[0].x);
        when(station0.getY()).thenReturn(coordinates[0].y);
        when(station1.getX()).thenReturn(coordinates[1].x);
        when(station1.getY()).thenReturn(coordinates[1].y);

        RoutingContext routingContext = new RoutingContext(routingRequest, graph, null, arrive);
        AgencyAndId agencyAndId = new AgencyAndId("Agency", "ID");
        Route route = new Route();
        ArrayList<StopTime> stopTimes = new ArrayList<StopTime>(2);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.