Package org.opentripplanner.routing.vertextype

Examples of org.opentripplanner.routing.vertextype.TransitStop


        assertEquals(coordinates[1].y, vertex.getY(), 0.0);
    }

    @Test
    public final void testOnBoardAtStation() {
        TransitStop station0 = mock(TransitStop.class);
        TransitStop station1 = mock(TransitStop.class);
        TransitStop station2 = mock(TransitStop.class);
        PatternDepartVertex depart = mock(PatternDepartVertex.class);
        PatternArriveVertex dwell = mock(PatternArriveVertex.class);
        PatternArriveVertex arrive = mock(PatternArriveVertex.class);
        Graph graph = mock(Graph.class);
        RoutingRequest routingRequest = mock(RoutingRequest.class);
View Full Code Here


        s2.setName("transitVertex 2");
        s2.setLon(-74.002);
        s2.setLat(40.0099999);
        s2.setId(new AgencyAndId("A", "morx station"));

        station1 = new TransitStop(graph, s1);
        station2 = new TransitStop(graph, s2);
        station1.addMode(TraverseMode.RAIL);
        station2.addMode(TraverseMode.RAIL);
       
        graph.rebuildVertexAndEdgeIndices();
    }
View Full Code Here

    public void testSpatialIndex() {
        Stop stopJ = graph.index.stopForId.get(new AgencyAndId("agency", "J"));
        Stop stopL = graph.index.stopForId.get(new AgencyAndId("agency", "L"));
        Stop stopM = graph.index.stopForId.get(new AgencyAndId("agency", "M"));
        TransitStop stopvJ = graph.index.stopVertexForStop.get(stopJ);
        TransitStop stopvL = graph.index.stopVertexForStop.get(stopL);
        TransitStop stopvM = graph.index.stopVertexForStop.get(stopM);
        // There are a two other stops within 100 meters of stop J.
        Envelope env = new Envelope(new Coordinate(stopJ.getLon(), stopJ.getLat()));
        env.expandBy(SphericalDistanceLibrary.metersToLonDegrees(100, stopJ.getLat()),
                SphericalDistanceLibrary.metersToDegrees(100));
        List<TransitStop> stops = graph.index.stopSpatialIndex.query(env);
View Full Code Here

        }
       
        if (options.arriveBy) {
            /* Traverse backward: not much to do */
            StateEditor s1 = s0.edit(this);
            TransitStop fromVertex = (TransitStop) getFromVertex();

            //apply board slack
            s1.incrementTimeInSeconds(options.boardSlack);
            s1.alightTransit();
            s1.setBackMode(getMode());
View Full Code Here

        factory.run(graph);
        graph.putService(CalendarServiceData.class, GtfsLibrary.createCalendarServiceData(context.getDao()));
       
        String[] stops = {"agency:A", "agency:B", "agency:C", "agency:D", "agency:E"};
        for (int i = 0; i < stops.length; ++i) {
            TransitStop stop = (TransitStop) (graph.getVertex(stops[i]));
           
            IntersectionVertex front = new IntersectionVertex(graph, "near_1_" + stop.getStopId(), stop.getX() + 0.0001, stop.getY() + 0.0001);
            IntersectionVertex back =  new IntersectionVertex(graph, "near_2_" + stop.getStopId(), stop.getX() - 0.0001, stop.getY() - 0.0001);
           
            StreetEdge street1 = new StreetEdge(front, back, GeometryUtils.makeLineString(stop.getX() + 0.0001, stop.getY() + 0.0001, stop.getX() - 0.0001, stop.getY() - 0.0001), "street", 100, StreetTraversalPermission.ALL, false);
            StreetEdge street2 = new StreetEdge(back, front, GeometryUtils.makeLineString(stop.getX() - 0.0001, stop.getY() - 0.0001, stop.getX() + 0.0001, stop.getY() + 0.0001), "street", 100, StreetTraversalPermission.ALL, true);
        }

        NetworkLinker nl = new NetworkLinker(graph);
        nl.createLinkage();
    }
View Full Code Here

        assertEquals(StopTransfer.FORBIDDEN_TRANSFER, transferTable.getTransferTime(stopK, stopM, fromTrip, toTrip, true));
        assertEquals(StopTransfer.PREFERRED_TRANSFER, transferTable.getTransferTime(stopN, stopK, toTrip, toTrip2, true));
        assertEquals(StopTransfer.TIMED_TRANSFER, transferTable.getTransferTime(stopN, stopK, fromTrip, toTrip, true));
        assertEquals(15, transferTable.getTransferTime(stopN, stopK, fromTrip, toTrip2, true));
       
        TransitStop e_arrive = (TransitStop) graph.getVertex("agency:E");
        TransitStop f_depart = (TransitStop) graph.getVertex("agency:F");
        Edge edge = new TransferEdge(e_arrive, f_depart, 10000, 10000);
       
        long startTime = TestUtils.dateInSeconds("America/New_York", 2009, 8, 18, 0, 50, 0);
        Vertex stop_b = graph.getVertex("agency:B_depart");
        Vertex stop_g = graph.getVertex("agency:G_arrive");
        RoutingRequest options = new RoutingRequest();
        options.dateTime = startTime;
        options.setRoutingContext(graph, stop_b, stop_g);
        ShortestPathTree spt = aStar.getShortestPathTree(options);
       
        GraphPath path = spt.getPath(stop_g, false);
        assertNotNull(path);
       
        assertTrue("expected to use much later trip due to min transfer time", path.getEndTime() - startTime > 4.5 * 60 * 60);
       
        /* cleanup */
        e_arrive.removeOutgoing(edge);
        f_depart.removeIncoming(edge);
    }
View Full Code Here

            //add a vertex representing the stop
            if (locationType == 1) {
                context.stationStopNodes.put(stop, new TransitStation(graph, stop));
            } else {
                TransitStop stopVertex = new TransitStop(graph, stop);
                stopVertex.setStreetToStopTime(defaultStreetToStopTime);
                context.stationStopNodes.put(stop, stopVertex);

                if (locationType != 2) {
                    // Add a vertex representing arriving at the stop
                    TransitStopArrive arrive = new TransitStopArrive(graph, stop, stopVertex);
View Full Code Here

     */
    public void linkStopsToParentStations(Graph graph) {
        for (Stop stop : _dao.getAllStops()) {
            String parentStation = stop.getParentStation();
            if (parentStation != null) {
                TransitStop stopVertex = (TransitStop) context.stationStopNodes.get(stop);
                String agencyId = stop.getId().getAgencyId();
                AgencyAndId parentStationId = new AgencyAndId(agencyId, parentStation);
                Stop parentStop = _dao.getStopForId(parentStationId);
                if(context.stationStopNodes.get(parentStop) instanceof TransitStation) {
                    TransitStation parentStopVertex = (TransitStation)
View Full Code Here

                        graph.addAlertPatch(tripPattern.alightEdges[i], this);
                    }
                }
            }
        } else if (stop != null) {
            TransitStop transitStop = graph.index.stopVertexForStop.get(stop);

            for (Edge edge : transitStop.getOutgoing()) {
                if (edge instanceof PreBoardEdge) {
                    graph.addAlertPatch(edge, this);
                    break;
                }
            }

            for (Edge edge : transitStop.getIncoming()) {
                if (edge instanceof PreAlightEdge) {
                    graph.addAlertPatch(edge, this);
                    break;
                }
            }
View Full Code Here

                        graph.removeAlertPatch(tripPattern.alightEdges[i], this);
                    }
                }
            }
        } else if (stop != null) {
            TransitStop transitStop = graph.index.stopVertexForStop.get(stop);

            for (Edge edge : transitStop.getOutgoing()) {
                if (edge instanceof PreBoardEdge) {
                    graph.removeAlertPatch(edge, this);
                    break;
                }
            }

            for (Edge edge : transitStop.getIncoming()) {
                if (edge instanceof PreAlightEdge) {
                    graph.removeAlertPatch(edge, this);
                    break;
                }
            }
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.