Package org.opentripplanner.routing.graph

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


        StopTimeUpdate.Builder stopTimeUpdateBuilder;
        StopTimeEvent.Builder stopTimeEventBuilder;

        int trip_1_1_index = timetable.getTripIndex(new AgencyAndId("agency", "1.1"));

        Vertex stop_a = graph.getVertex("agency:A");
        Vertex stop_c = graph.getVertex("agency:C");
        RoutingRequest options = new RoutingRequest();

        ShortestPathTree spt;
        GraphPath path;
View Full Code Here


        addOutgoing(fromv, e);
        addIncoming(tov, e);
    }

    public void removeEdge(Edge e) {
        Vertex fromv = e.getFromVertex();
        Vertex tov = e.getToVertex();
        removeOutgoing(fromv, e);
        removeIncoming(tov, e);
    }
View Full Code Here

        }
    }

    private void labelState(State s, String str) {
        fill(240, 240, 240);
        Vertex v = s.getVertex();
        drawVertex(v, 8);
        str += " " + shortDateFormat.format(new Date(s.getTimeSeconds() * 1000));
        str += " [" + (int) s.getWeight() + "]";
        double x = toScreenX(v.getX()) + 10;
        double y = toScreenY(v.getY());
        double dy = y - lastLabelY;
        if (dy == 0) {
            y = lastLabelY + 20;
        } else if (Math.abs(dy) < 20) {
            y = lastLabelY + Math.signum(dy) * 20;
 
View Full Code Here

            env.expandToInclude(e.getFromVertex().getCoordinate());
            env.expandToInclude(e.getToVertex().getCoordinate());
        }

        ArrayList<Vertex> vertices = new ArrayList<Vertex>();
        Vertex v = anno.getReferencedVertex();
        if (v != null) {
            env.expandToInclude(v.getCoordinate());
            vertices.add(v);
        }

        if (e == null && v == null)
            return;
View Full Code Here

        long time = options.dateTime;
        options.setRoutingContext(graph);
        options.rctx.pathParsers = new PathParser[] { new BasicPathParser(),
                new NoThruTrafficPathParser() };

        Vertex fromVertex = options.rctx.fromVertex;
        Vertex toVertex = options.rctx.toVertex;
        if (options.intermediatesEffectivelyOrdered()) {
            LOG.debug("Intermediates are ordered.");

            List<Vertex> vertices = options.rctx.intermediateVertices;
            vertices.add(toVertex);
            options.clearIntermediatePlaces();
            // simple case: intermediate places are in order.
            List<GraphPath> paths = new ArrayList<GraphPath>();
            Vertex previousVertex = fromVertex;
            for (Vertex v : vertices) {
                options.dateTime = time;
                options.setRoutingContext(graph, previousVertex, v);
                List<GraphPath> partialPaths = chainedPathService.getPaths(options);
                if (partialPaths == null || partialPaths.size() == 0)
View Full Code Here

    }

    private GraphPath joinPaths(List<GraphPath> paths) {
        State lastState = paths.get(0).states.getLast();
        GraphPath newPath = new GraphPath(lastState, false);
        Vertex lastVertex = lastState.getVertex();
        for (GraphPath path : paths.subList(1, paths.size())) {
            lastState = newPath.states.getLast();
            // add a leg-switching state
            LegSwitchingEdge legSwitchingEdge = new LegSwitchingEdge(lastVertex, lastVertex);
            lastState = legSwitchingEdge.traverse(lastState);
View Full Code Here

        }
        assertTrue(found);
    }
   
    public void testBoardAlight() throws Exception {
        Vertex stop_a_depart = graph.getVertex("agency:A_depart");
        Vertex stop_b_depart = graph.getVertex("agency:B_depart");
       
        assertEquals(1, stop_a_depart.getDegreeOut());
        assertEquals(3, stop_b_depart.getDegreeOut());

        for (Edge e : stop_a_depart.getOutgoing()) {
            assertEquals(TransitBoardAlight.class, e.getClass());
            assertTrue(((TransitBoardAlight) e).boarding);
        }
       
        TransitBoardAlight pb = (TransitBoardAlight) stop_a_depart.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());
            } else {
                assertEquals(PatternHop.class, e.getClass());
            }
View Full Code Here

        }
       
    }
   
    public void testBoardAlightStopIndex() {
        Vertex stop_b_arrive = graph.getVertex("agency:C_arrive");
        Vertex stop_b_depart = graph.getVertex("agency:C_depart");
       
        Map<TripPattern, Integer> stopIndex = new HashMap<TripPattern, Integer>();
        for(Edge edge : stop_b_depart.getOutgoing()) {
            TransitBoardAlight tba = (TransitBoardAlight) edge;
            stopIndex.put(tba.getPattern(), tba.getStopIndex());
        }
       
        for(Edge edge : stop_b_arrive.getIncoming()) {
View Full Code Here

        return ret;
    }

    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();
        // test feed is designed for instantaneous transfers
        options.transferSlack = (0);
View Full Code Here

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

    public void testRoutingOverMidnight() throws Exception {
        // this route only runs on weekdays
        Vertex stop_g = graph.getVertex("agency:G_depart");
        Vertex stop_h = graph.getVertex("agency:H_arrive");

        ShortestPathTree spt;
        GraphPath path;
        RoutingRequest options = new RoutingRequest();

        // Friday evening
        options.dateTime = TestUtils.dateInSeconds("America/New_York", 2009, 8, 18, 23, 20, 0);
        options.setRoutingContext(graph, stop_g, stop_h);
        spt = aStar.getShortestPathTree(options);

        path = spt.getPath(stop_h, false);
        assertNotNull(path);
        assertEquals(4, path.states.size());

        // Saturday morning
        long startTime = TestUtils.dateInSeconds("America/New_York", 2009, 8, 19, 0, 5, 0);
        options.dateTime = startTime;
        options.setRoutingContext(graph, stop_g.getLabel(), stop_h.getLabel());
        spt = aStar.getShortestPathTree(options);

        path = spt.getPath(stop_h, false);
        assertNotNull(path);
        assertEquals(4, path.states.size());
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.