Package org.opentripplanner.routing.edgetype

Examples of org.opentripplanner.routing.edgetype.StreetEdge


    }

    @Override
    public boolean renderEdge(Edge e, EdgeVisualAttributes attrs) {
        if (e instanceof StreetEdge) {
            StreetEdge pse = (StreetEdge) e;
            if (pse.getPermission().allows(TraverseMode.BICYCLE)) {
                double bikeSafety = pse.getBicycleSafetyFactor();
                attrs.color = palette.getColor(bikeSafety);
                attrs.label = String.format("%.02f", bikeSafety);
            } else {
                attrs.color = Color.LIGHT_GRAY;
                attrs.label = "no bikes";
View Full Code Here


                });

        IntersectionVertex v1 = new IntersectionVertex(null, "v1", -0.10, 0);
        IntersectionVertex v2 = new IntersectionVertex(null, "v2", 0, 0);
       
        StreetEdge leftEdge = new StreetEdge(v1, v2, geometry, "morx", 10.0, StreetTraversalPermission.ALL, true);

        LineString geometry2 = gf.createLineString(new Coordinate[] {
                new Coordinate(0, 0),
                new Coordinate(-0.10, 0)
                });

        StreetEdge rightEdge = new StreetEdge(v1, v2, geometry2, "fleem", 10.0, StreetTraversalPermission.ALL, false);

        assertEquals(180, Math.abs(leftEdge.getOutAngle() - rightEdge.getOutAngle()));

    }
View Full Code Here

    public void testCalculateTurnAngle() {
        // Graph for a fictional grid city with turn restrictions
        IntersectionVertex v1 = vertex("maple_1st", new Coordinate(2.0, 2.0), false);
        IntersectionVertex v2 = vertex("maple_2nd", new Coordinate(2.0, 1.0), false);
       
        StreetEdge e1 = edge(v1, v2, 1.0, false);

        // Edge has same first and last angle.
        assertEquals(90, e1.getInAngle());
        assertEquals(90, e1.getOutAngle());
       
        // 2 new ones
        IntersectionVertex v3 = vertex("test2", new Coordinate(1.0, 1.0), false);
       
        // Second edge
        StreetEdge e2 = edge(v2, v3, 1.0, false);

        assertEquals(0, e2.getInAngle());
        assertEquals(0, e2.getOutAngle());
       
        // Difference should be about 90.
        int diff = (e1.getOutAngle() - e2.getInAngle());
        assertEquals(90, diff);
       
        int turnAngle = costModel.calculateTurnAngle(e1, e2, options);
        assertEquals(270, turnAngle);
    }
View Full Code Here

        IntersectionVertex u = vertex("from_v", a, false);
        IntersectionVertex v = vertex("intersection", b, false);
        IntersectionVertex w = vertex("to_v", c, false);
       
        // Two edges.
        StreetEdge fromEdge = edge(u, v, 1.0, false);
        StreetEdge toEdge = edge(v, w, 1.0, false);
       
        int turnAngle = costModel.calculateTurnAngle(fromEdge, toEdge, options);
        assertFalse(costModel.isRightTurn(turnAngle));
        assertFalse(costModel.isLeftTurn(turnAngle));
       
View Full Code Here

        IntersectionVertex v = vertex("intersection", b, false);
        IntersectionVertex w = vertex("to_v", c, false);
        v.freeFlowing = (true);
       
        // Two edges.
        StreetEdge fromEdge = edge(u, v, 1.0, false);
        StreetEdge toEdge = edge(v, w, 1.0, false);
       
        float fromSpeed = 1.0f;
        float toSpeed = 1.0f;
        TraverseMode mode = TraverseMode.CAR;
       
View Full Code Here

        IntersectionVertex u = vertex("from_v", a, false);
        IntersectionVertex v = vertex("intersection", b, false);
        IntersectionVertex w = vertex("to_v", c, false);
       
        // Two edges - will infer that the vertex is free-flowing since there is no light.
        StreetEdge fromEdge = edge(u, v, 1.0, false);
        StreetEdge toEdge = edge(v, w, 1.0, false);
       
        float fromSpeed = 1.0f;
        float toSpeed = 1.0f;
        TraverseMode mode = TraverseMode.CAR;
       
View Full Code Here

        IntersectionVertex u = vertex("from_v", a, false);
        IntersectionVertex v = vertex("intersection", b, false);
        IntersectionVertex w = vertex("to_v", c, false);
   
        // Two edges.
        StreetEdge fromEdge = edge(u, v, 1.0, false);
        StreetEdge toEdge = edge(v, w, 1.0, false);
       
        // 3rd edge prevents inferral of free-flowingness
        StreetEdge extraEdge = edge(v, u, 1.0, false);
               
        float fromSpeed = 1.0f;
        float toSpeed = 1.0f;
        TraverseMode mode = TraverseMode.CAR;
       
View Full Code Here

        IntersectionVertex u = vertex("from_v", a, false);
        IntersectionVertex v = vertex("intersection", b, false);
        IntersectionVertex w = vertex("to_v", c, false);
   
        // Two edges.
        StreetEdge fromEdge = edge(u, v, 1.0, false);
        StreetEdge toEdge = edge(v, w, 1.0, false);
       
        // 3rd edge prevents inferral of free-flowingness
        StreetEdge extraEdge = edge(v, u, 1.0, false);
               
        int turnAngle = costModel.calculateTurnAngle(fromEdge, toEdge, options);
        assertTrue(costModel.isRightTurn(turnAngle));
        assertFalse(costModel.isLeftTurn(turnAngle));
       
View Full Code Here

        IntersectionVertex u = vertex("from_v", a, false);
        IntersectionVertex v = vertex("intersection", b, false);
        IntersectionVertex w = vertex("to_v", c, false);
   
        // Two edges.
        StreetEdge fromEdge = edge(u, v, 1.0, false);
        StreetEdge toEdge = edge(v, w, 1.0, false);
       
        // 3rd edge prevents inferral of free-flowingness
        StreetEdge extraEdge = edge(v, u, 1.0, false);
               
        int turnAngle = costModel.calculateTurnAngle(fromEdge, toEdge, options);
        assertFalse(costModel.isRightTurn(turnAngle));
        assertTrue(costModel.isLeftTurn(turnAngle));
       
View Full Code Here

        coords[0] = vA.getCoordinate();
        coords[1] = vB.getCoordinate();
        LineString geom = GeometryUtils.getGeometryFactory().createLineString(coords);

        StreetTraversalPermission perm = StreetTraversalPermission.ALL;
        return new StreetEdge(vA, vB, geom, name, length, perm, back);
    }
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.edgetype.StreetEdge

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.