Search in sources :

Example 16 with StreetTraversalPermission

use of org.opentripplanner.routing.edgetype.StreetTraversalPermission in project OpenTripPlanner by opentripplanner.

the class IntersectionVertexTest method edge.

/**
 * Create an edge. If twoWay, create two edges (back and forth).
 *
 * @param vA
 * @param vB
 * @param length
 * @param back true if this is a reverse edge
 */
private StreetEdge edge(StreetVertex vA, StreetVertex vB, double length, boolean back) {
    String labelA = vA.getLabel();
    String labelB = vB.getLabel();
    String name = String.format("%s_%s", labelA, labelB);
    Coordinate[] coords = new Coordinate[2];
    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);
}
Also used : Coordinate(com.vividsolutions.jts.geom.Coordinate) LineString(com.vividsolutions.jts.geom.LineString) StreetTraversalPermission(org.opentripplanner.routing.edgetype.StreetTraversalPermission) StreetEdge(org.opentripplanner.routing.edgetype.StreetEdge) LineString(com.vividsolutions.jts.geom.LineString)

Aggregations

StreetTraversalPermission (org.opentripplanner.routing.edgetype.StreetTraversalPermission)16 LineString (com.vividsolutions.jts.geom.LineString)10 Coordinate (com.vividsolutions.jts.geom.Coordinate)9 StreetEdge (org.opentripplanner.routing.edgetype.StreetEdge)8 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)3 P2 (org.opentripplanner.common.model.P2)3 I18NString (org.opentripplanner.util.I18NString)3 Geometry (com.vividsolutions.jts.geom.Geometry)2 GeometryFactory (com.vividsolutions.jts.geom.GeometryFactory)2 MultiPolygon (com.vividsolutions.jts.geom.MultiPolygon)2 Point (com.vividsolutions.jts.geom.Point)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 OSMWithTags (org.opentripplanner.openstreetmap.model.OSMWithTags)2 NamedArea (org.opentripplanner.routing.edgetype.NamedArea)2 IntersectionVertex (org.opentripplanner.routing.vertextype.IntersectionVertex)2 NonLocalizedString (org.opentripplanner.util.NonLocalizedString)2 VLPoint (org.opentripplanner.visibility.VLPoint)2 Polygon (com.vividsolutions.jts.geom.Polygon)1 Point (java.awt.Point)1