Package org.opentripplanner.routing.graph

Examples of org.opentripplanner.routing.graph.Vertex$ValidEdgeTypes


        when(graph.getVertex("Station_1")).thenReturn(station1);

        tripPattern.add(tripTimes);
        graph.index = new GraphIndex(graph);

        Vertex vertex = onBoardDepartServiceImpl.setupDepartOnBoard(routingContext);

        assertEquals(coordinates[1].x, vertex.getX(), 0.0);
        assertEquals(coordinates[1].y, vertex.getY(), 0.0);
    }
View Full Code Here


    }

    public void testMaxTime() {

        Graph graph = ConstantsForTests.getInstance().getPortlandGraph();
        Vertex start = graph.getVertex("TriMet:8371");
        Vertex end = graph.getVertex("TriMet:8374");

        RoutingRequest options = new RoutingRequest();
        long startTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 11, 1, 12, 34, 25);
        options.dateTime = startTime;
        // one hour is more than enough time
View Full Code Here

        assertEquals(1, step1.alerts.size());
        assertEquals("NE", step1.alerts.get(0).alertHeaderText.getSomeTranslation());
    }

    public void testIntermediate() throws Exception {
        Vertex v1 = getVertexByCrossStreets("NW 10TH AVE", "W BURNSIDE ST");
        Vertex v2 = getVertexByCrossStreets("SE 82ND AVE", "SE ASH ST").getOutgoing().iterator()
                .next().getToVertex();
        Vertex v3 = getVertexByCrossStreets("NE 21ST AVE", "NE MASON ST").getOutgoing().iterator()
                .next().getToVertex();
        Vertex v4 = getVertexByCrossStreets("SE 92ND AVE", "SE FLAVEL ST");
        Vertex[] vertices = { v1, v3, v2, v4 };
        assertNotNull(v1);
        assertNotNull(v2);
        assertNotNull(v3);
        assertNotNull(v4);

        TestPlanner planner = new TestPlanner("portland", v1.getLabel(), v4.getLabel(),
                Arrays.asList(v2.getLabel(), v3.getLabel()));
        List<GraphPath> paths = planner.getPaths();

        assertTrue(paths.size() > 0);
        GraphPath path = paths.get(0);
View Full Code Here

        // Now add a timed transfer between two other busses
        addTripToTripTransferTimeToTable(table, "7528", "9756", "75", "12", "750W1300", "120W1320"
                , StopTransfer.TIMED_TRANSFER);
        // Don't forget to also add a TimedTransferEdge
        Vertex fromVertex = graph.getVertex("TriMet:7528_arrive");
        Vertex toVertex = graph.getVertex("TriMet:9756_depart");
        TimedTransferEdge timedTransferEdge = new TimedTransferEdge(fromVertex, toVertex);

        // Do the planning again
        response = planner.getItineraries();
        itinerary = response.getPlan().itinerary.get(0);
View Full Code Here

        assertEquals("91W1350", itinerary.legs.get(3).tripId);

        // Now add a timed transfer between two other busses
        addStopToStopTransferTimeToTable(table, "7528", "9756", StopTransfer.TIMED_TRANSFER);
        // Don't forget to also add a TimedTransferEdge
        Vertex fromVertex = graph.getVertex("TriMet:7528_arrive");
        Vertex toVertex = graph.getVertex("TriMet:9756_depart");
        TimedTransferEdge timedTransferEdge = new TimedTransferEdge(fromVertex, toVertex);

        // Do the planning again
        response = planner.getItineraries();
        itinerary = response.getPlan().itinerary.get(0);
View Full Code Here

        return v;
    }

    private void edges(String... vLabels) {
        for (int i = 0; i < vLabels.length - 1; i++) {
            Vertex vA = _graph.getVertex(vLabels[i]);
            Vertex vB = _graph.getVertex(vLabels[i + 1]);

            new SimpleConcreteEdge(vA, vB);
            new SimpleConcreteEdge(vB, vA);
        }
    }
View Full Code Here

        assertEquals(4, numVerticesAfter - numVerticesBefore);
        Collection<Edge> outgoing = station1.getOutgoing();
        assertTrue(outgoing.size() == 2);
        Edge edge = outgoing.iterator().next();

        Vertex midpoint = edge.getToVertex();
        assertTrue(Math.abs(midpoint.getCoordinate().y - 40.01) < 0.00000001);

        outgoing = station2.getOutgoing();
        assertTrue(outgoing.size() == 2);
        edge = outgoing.iterator().next();

        Vertex station2point = edge.getToVertex();
        assertTrue(Math.abs(station2point.getCoordinate().x - -74.002) < 0.00000001);

    }
View Full Code Here

    public void testBannedRoutes() {

        Graph graph = ConstantsForTests.getInstance().getPortlandGraph();

        RoutingRequest options = new RoutingRequest();
        Vertex start = graph.getVertex("TriMet:8371");
        Vertex end = graph.getVertex("TriMet:8374");
        options.dateTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 11, 1, 12, 34, 25);
        // must set routing context _after_ options is fully configured (time)
        options.setRoutingContext(graph, start, end);
        ShortestPathTree spt = null;
View Full Code Here

        for (int i = 0; i < 20; i++) {
            RoutingRequest options = new RoutingRequest();
            options.dateTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 11, 1, 12, 34,
                    25);
            // Pick two random locations
            Vertex start = null;
            Vertex end = null;
            while (start == null)
                start = graph.getVertex("TriMet:" + rand.nextInt(10000));
            while (end == null)
                end = graph.getVertex("TriMet:" + rand.nextInt(10000));
            options.setRoutingContext(graph, start, end);
View Full Code Here

        /* Graph vertices */
        for (Vertex vertex : graph.index.vertexForId.values()) {
            if (vertex instanceof TransitStop) {
                Stop stop = ((TransitStop)vertex).getStop();
                Vertex index_vertex = graph.index.stopVertexForStop.get(stop);
                assertEquals(index_vertex, vertex);
            }
        }

        /* Agencies */
 
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.graph.Vertex$ValidEdgeTypes

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.