Class GraphLaneUtil
- java.lang.Object
-
- org.opentrafficsim.draw.graphs.road.GraphLaneUtil
-
public final class GraphLaneUtil extends java.lang.Object
Utilities to createGraphPath
s andGraphCrossSection
s for graphs, based on lanes.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 19 okt. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static GraphCrossSection<KpiLaneDirection>
createCrossSection(java.lang.String name, DirectedLanePosition lanePosition)
Creates a cross section at the provided lane and position.static GraphCrossSection<KpiLaneDirection>
createCrossSection(java.util.List<java.lang.String> names, java.util.List<KpiLaneDirection> lanes, java.util.List<Length> positions, Speed speed)
Creates a cross section.static GraphCrossSection<KpiLaneDirection>
createCrossSection(java.util.List<java.lang.String> names, DirectedLinkPosition linkPosition)
Creates a cross section at the provided link and position.static GraphPath<KpiLaneDirection>
createPath(java.lang.String name, LaneDirection first)
Creates a path starting at the provided lane and moving downstream until a dead-end, split, or loop.static GraphPath<KpiLaneDirection>
createPath(java.util.List<java.lang.String> names, java.util.List<LaneDirection> first)
Creates a path starting at the provided lanes and moving downstream for as long as no lane finds a loop (on to any of the lanes) and there's a unique link all lanes have downstream.static GraphPath<KpiLaneDirection>
createSingleLanePath(java.lang.String name, LaneDirection lane)
Creates a single-lane path.
-
-
-
Method Detail
-
createPath
public static GraphPath<KpiLaneDirection> createPath(java.lang.String name, LaneDirection first) throws NetworkException
Creates a path starting at the provided lane and moving downstream until a dead-end, split, or loop.- Parameters:
name
- String; path namefirst
- LaneDirection; first lane- Returns:
- GraphPath<KpiLaneDirection> path
- Throws:
NetworkException
- when the lane does not have any set speed limit
-
createPath
public static GraphPath<KpiLaneDirection> createPath(java.util.List<java.lang.String> names, java.util.List<LaneDirection> first) throws NetworkException
Creates a path starting at the provided lanes and moving downstream for as long as no lane finds a loop (on to any of the lanes) and there's a unique link all lanes have downstream. The length and speed limit are taken from the first lane.- Parameters:
names
- List<String>; lane namesfirst
- List<LaneDirection>; first lanes- Returns:
- GraphPath<KpiLaneDirection> path
- Throws:
NetworkException
- when a lane does not have any set speed limit
-
createSingleLanePath
public static GraphPath<KpiLaneDirection> createSingleLanePath(java.lang.String name, LaneDirection lane) throws NetworkException
Creates a single-lane path.- Parameters:
name
- String; namelane
- LaneDirection; lane- Returns:
- GraphPath<KpiLaneDirection> path
- Throws:
NetworkException
- when a lane does not have any set speed limit
-
createCrossSection
public static GraphCrossSection<KpiLaneDirection> createCrossSection(java.lang.String name, DirectedLanePosition lanePosition) throws NetworkException
Creates a cross section at the provided lane and position.- Parameters:
name
- String; namelanePosition
- DirectedLanePosition; lane position- Returns:
- GraphCrossSection<KpiLaneDirection> cross section
- Throws:
NetworkException
- when the lane does not have any set speed limit
-
createCrossSection
public static GraphCrossSection<KpiLaneDirection> createCrossSection(java.util.List<java.lang.String> names, DirectedLinkPosition linkPosition) throws NetworkException
Creates a cross section at the provided link and position.- Parameters:
names
- List<String>; lane nameslinkPosition
- DirectedLinkPosition; link position- Returns:
- GraphCrossSection<KpiLaneDirection> cross section
- Throws:
NetworkException
- when a lane does not have any set speed limit
-
createCrossSection
public static GraphCrossSection<KpiLaneDirection> createCrossSection(java.util.List<java.lang.String> names, java.util.List<KpiLaneDirection> lanes, java.util.List<Length> positions, Speed speed)
Creates a cross section.- Parameters:
names
- List<String>;; nameslanes
- List<KpiLaneDirection>;; lanespositions
- List<Length>; positionsspeed
- Speed; speed- Returns:
- GraphCrossSection<KpiLaneDirection>; cross section
-
-