Package org.opentripplanner.routing.graph

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


    }

    public void testPathways() throws Exception {

        Vertex entrance = graph.getVertex("agency:entrance_a");
        assertNotNull(entrance);
        Vertex stop = graph.getVertex("agency:A");
        assertNotNull(stop);

        RoutingRequest options = new RoutingRequest();
        options.dateTime = TestUtils.dateInSeconds("America/New_York", 2009, 8, 1, 16, 0, 0);
        options.setRoutingContext(graph, entrance, stop);
View Full Code Here


        graph.putService(CalendarServiceData.class, GtfsLibrary.createCalendarServiceData(context.getDao()));
    }

    public void testBoardAlight() throws Exception {

        Vertex stop_a = graph.getVertex("agency:A_depart");
        Vertex stop_b_depart = graph.getVertex("agency:B_depart");

        assertEquals(1, stop_a.getDegreeOut());
        assertEquals(3, stop_b_depart.getDegreeOut());

        for (Edge e : stop_a.getOutgoing()) {
            assertEquals(TransitBoardAlight.class, e.getClass());
            assertTrue(((TransitBoardAlight) e).boarding);
        }

        // TODO: could this ever be a PatternAlight? I think not.
        TransitBoardAlight pb = (TransitBoardAlight) stop_a.getOutgoing().iterator().next();
        Vertex journey_a_1 = pb.getToVertex();

        assertEquals(1, journey_a_1.getDegreeIn());

        for (Edge e : journey_a_1.getOutgoing()) {
            if (e.getToVertex() instanceof TransitStop) {
                assertEquals(TransitBoardAlight.class, e.getClass());
                assertTrue(((TransitBoardAlight) e).boarding);
            } else {
                assertEquals(PatternHop.class, e.getClass());
View Full Code Here

            }
        }
    }

    public void testDwell() throws Exception {
        Vertex stop_a = graph.getVertex("agency:A_depart");
        Vertex stop_c = graph.getVertex("agency:C_arrive");

        RoutingRequest options = new RoutingRequest();
        options.dateTime = TestUtils.dateInSeconds("America/New_York", 2009, 8, 7, 8, 0, 0);
        options.setRoutingContext(graph, stop_a, stop_c);
        ShortestPathTree spt = aStar.getShortestPathTree(options);
View Full Code Here

        assertEquals(endTime, path.getEndTime());
    }

    public void testRouting() throws Exception {

        Vertex stop_a = graph.getVertex("agency:A");
        Vertex stop_b = graph.getVertex("agency:B");
        Vertex stop_c = graph.getVertex("agency:C");
        Vertex stop_d = graph.getVertex("agency:D");
        Vertex stop_e = graph.getVertex("agency:E");

        RoutingRequest options = new RoutingRequest();
        options.dateTime = TestUtils.dateInSeconds("America/New_York", 2009, 8, 7, 0, 0, 0);

        ShortestPathTree spt;
View Full Code Here

        }
    }

    private void loadPathways(Graph graph) {
        for (Pathway pathway : _dao.getAllPathways()) {
            Vertex fromVertex = context.stationStopNodes.get(pathway.getFromStop());
            Vertex toVertex = context.stationStopNodes.get(pathway.getToStop());
            if (pathway.isWheelchairTraversalTimeSet()) {
                new PathwayEdge(fromVertex, toVertex, pathway.getTraversalTime(), pathway.getWheelchairTraversalTime());
            } else {
                new PathwayEdge(fromVertex, toVertex, pathway.getTraversalTime());
            }
View Full Code Here

            Stop toStop = t.getToStop();
            Route fromRoute = t.getFromRoute();
            Route toRoute = t.getToRoute();
            Trip fromTrip = t.getFromTrip();
            Trip toTrip = t.getToTrip();
            Vertex fromVertex = context.stopArriveNodes.get(fromStop);
            Vertex toVertex = context.stopDepartNodes.get(toStop);
            switch (t.getTransferType()) {
            case 1:
                // timed (synchronized) transfer
                // Handle with edges that bypass the street network.
                // from and to vertex here are stop_arrive and stop_depart vertices
View Full Code Here

     */
    public void createParentStationTransfers () {
        for (Stop stop : _dao.getAllStops()) {
            String parentStation = stop.getParentStation();
            if (parentStation != null) {
                Vertex stopVertex = context.stationStopNodes.get(stop);

                String agencyId = stop.getId().getAgencyId();
                AgencyAndId parentStationId = new AgencyAndId(agencyId, parentStation);

                Stop parentStop = _dao.getStopForId(parentStationId);
                Vertex parentStopVertex = context.stationStopNodes.get(parentStop);

                new FreeEdge(parentStopVertex, stopVertex);
                new FreeEdge(stopVertex, parentStopVertex);

                // Stops with location_type=2 (entrances as defined in the pathways.txt
                // proposal) have no arrive/depart vertices, hence the null checks.
                Vertex stopArriveVertex = context.stopArriveNodes.get(stop);
                Vertex parentStopArriveVertex = context.stopArriveNodes.get(parentStop);
                if (stopArriveVertex != null && parentStopArriveVertex != null) {
                    new FreeEdge(parentStopArriveVertex, stopArriveVertex);
                    new FreeEdge(stopArriveVertex, parentStopArriveVertex);
                }

                Vertex stopDepartVertex = context.stopDepartNodes.get(stop);
                Vertex parentStopDepartVertex = context.stopDepartNodes.get(parentStop);
                if (stopDepartVertex != null && parentStopDepartVertex != null) {
                    new FreeEdge(parentStopDepartVertex, stopDepartVertex);
                    new FreeEdge(stopDepartVertex, parentStopDepartVertex);
                }

View Full Code Here

        return DFA;
    }

    @Override
    public int terminalFor(State state) {
        Vertex v = state.getVertex();
        if (v instanceof StreetVertex || v instanceof StreetLocation) {
            TraverseModeSet modes = state.getOptions().modes;
            if (modes.contains(TraverseMode.BICYCLE)
                    && (!modes.contains(TraverseMode.WALK) || !state.isBikeRenting())) {
                Edge edge = state.getBackEdge();
View Full Code Here

        return DFA;
    }

    @Override
    public int terminalFor(State state) {
        Vertex v = state.getVertex();
        if (v instanceof StreetVertex || v instanceof StreetLocation) {
            TraverseModeSet modes = state.getOptions().modes;
            if (modes.contains(TraverseMode.BICYCLE)
                    && (!modes.contains(TraverseMode.WALK) || !state.isBikeRenting())) {
                Edge edge = state.getBackEdge();
View Full Code Here

        loader.setProvider(provider);

        loader.buildGraph(gg, extra);

        // Kamiennogorska at south end of segment
        Vertex v1 = gg.getVertex("osm:node:280592578");

        // Kamiennogorska at Mariana Smoluchowskiego
        Vertex v2 = gg.getVertex("osm:node:288969929");

        // Mariana Smoluchowskiego, north end
        Vertex v3 = gg.getVertex("osm:node:280107802");

        // Mariana Smoluchowskiego, south end (of segment connected to v2)
        Vertex v4 = gg.getVertex("osm:node:288970952");

        assertNotNull(v1);
        assertNotNull(v2);
        assertNotNull(v3);
        assertNotNull(v4);
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.