Package org.opentripplanner.routing.graph

Examples of org.opentripplanner.routing.graph.Edge


        coordinateSequence = coordinateSequenceFactory.create(coordinates);
        geometry = new LineString(coordinateSequence, geometryFactory);

        Vertex vertex = onBoardDepartServiceImpl.setupDepartOnBoard(routingContext);
        Edge edge = vertex.getOutgoing().toArray(new Edge[1])[0];

        assertEquals(vertex, edge.getFromVertex());
        assertEquals(dwell, edge.getToVertex());
        assertEquals("The right", edge.getDirection());
        assertEquals(geometry, edge.getGeometry());

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


        State s0 = new State(options);
        State s1 = e1.traverse(s0);
        State s2 = e2.traverse(s1);
        State s3 = e3.traverse(s2);
       
        Edge partialE2First = intermediate.getIncoming().iterator().next();
        Edge partialE2Second = intermediate.getOutgoing().iterator().next();
        System.out.println(intermediate.getIncoming());
        System.out.println(intermediate.getOutgoing());
       
        State partialS0 = new State(options);
        State partialS1 = e1.traverse(partialS0);
        State partialS2A = partialE2First.traverse(partialS1);
        State partialS2B = partialE2Second.traverse(partialS2A);
        State partialS3 = e3.traverse(partialS2B);
       
        // Should start at the same time.
        assertEquals(s0.getTimeSeconds(), partialS0.getTimeSeconds());
       
        // Time and cost should be the same up to a rounding difference.
        assertTrue(Math.abs(s3.getTimeSeconds() - partialS3.getTimeSeconds()) <= 1);
        assertTrue(Math.abs(s3.getElapsedTimeSeconds() - partialS3.getElapsedTimeSeconds()) <= 1);
        assertTrue(Math.abs(s3.getWeight() - partialS3.getWeight()) <= 1);
       
        // All intersections take 0 seconds now.
        options.traversalCostModel = (new DummyCostModel(0.0));

        State s0NoCost = new State(options);
        State s1NoCost = e1.traverse(s0NoCost);
        State s2NoCost = e2.traverse(s1NoCost);
        State s3NoCost = e3.traverse(s2NoCost);
       
        State partialS0NoCost = new State(options);
        State partialS1NoCost = e1.traverse(partialS0NoCost);
        State partialS2ANoCost = partialE2First.traverse(partialS1NoCost);
        State partialS2BNoCost = partialE2Second.traverse(partialS2ANoCost);
        State partialS3NoCost = e3.traverse(partialS2BNoCost);
       
        // Time and cost should be the same up to a rounding difference.
        assertTrue(Math.abs(s3NoCost.getTimeSeconds() - partialS3NoCost.getTimeSeconds()) <= 1);
        assertTrue(Math.abs(s3NoCost.getElapsedTimeSeconds() - partialS3NoCost.getElapsedTimeSeconds()) <= 1);
View Full Code Here

        stroke(40, 40, 128, 30); // transparent blue
        strokeWeight(4);
        noFill();
        // for (Edge e : visibleTransitEdges) {
        while (drawOffset < visibleTransitEdges.size()) {
            Edge e = visibleTransitEdges.get(drawOffset);
            drawEdge(e);
            drawOffset += 1;
            if (drawOffset % BLOCK_SIZE == 0) {
                if (millis() - startMillis > FRAME_TIME)
                    return false;
View Full Code Here

        stroke(256, 165, 0, 30); // transparent blue
        strokeWeight(3);
        noFill();
        // for (Edge e : visibleTransitEdges) {
        while (drawOffset < visibleLinkEdges.size()) {
            Edge e = visibleLinkEdges.get(drawOffset);
            drawEdge(e);
            drawOffset += 1;
            if (drawOffset % BLOCK_SIZE == 0) {
                if (millis() - startMillis > FRAME_TIME)
                    return false;
View Full Code Here

        desaturate();
        noFill();
        stroke(256, 0, 0, 128); // , 8);
        strokeWeight(6);
        while (!newHighlightedEdges.isEmpty()) {
            Edge de = newHighlightedEdges.poll();
            if (de != null) {
                drawEdge(de);
                highlightedEdges.add(de);
            }
        }
View Full Code Here

    }

    public void drawAnotation(GraphBuilderAnnotation anno) {
        Envelope env = new Envelope();

        Edge e = anno.getReferencedEdge();
        if (e != null) {
            this.enqueueHighlightedEdge(e);
            env.expandToInclude(e.getFromVertex().getCoordinate());
            env.expandToInclude(e.getToVertex().getCoordinate());
        }

        ArrayList<Vertex> vertices = new ArrayList<Vertex>();
        Vertex v = anno.getReferencedVertex();
        if (v != null) {
View Full Code Here

        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();
View Full Code Here

            GraphPath startIntermediatePath = getPath(aStar, prototypeOptions, null, start, intermediate);
            if (startIntermediatePath == null) {
                continue;
            }
           
            Edge back = startIntermediatePath.states.getLast().getBackEdge();
            GraphPath intermediateEndPath = getPath(aStar, prototypeOptions, back, intermediate, end);
            if (intermediateEndPath == null) {
                continue;
            }
           
View Full Code Here

        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();
                if (edge instanceof StreetEdge) {
                    int cls = ((StreetEdge) edge).getStreetClass();
                    return cls & StreetEdge.CROSSING_CLASS_MASK;
                } else {
                    return StreetEdge.CLASS_OTHERPATH;
View Full Code Here

        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();
                if (edge instanceof StreetEdge) {
                    int cls = ((StreetEdge) edge).getStreetClass();
                    return cls & StreetEdge.CROSSING_CLASS_MASK;
                } else {
                    return StreetEdge.CLASS_OTHERPATH;
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.graph.Edge

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.