Package org.opentrafficsim.animation
Class GraphLaneUtil
java.lang.Object
org.opentrafficsim.animation.GraphLaneUtil
Utilities to create
GraphPath
s and GraphCrossSection
s for graphs, based on lanes.
Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Method Summary
Modifier and TypeMethodDescriptionstatic GraphCrossSection<LaneDataRoad>
createCrossSection
(String name, LanePosition lanePosition) Creates a cross section at the provided lane and position.static GraphCrossSection<LaneDataRoad>
createCrossSection
(List<String> names, List<LaneDataRoad> lanes, List<org.djunits.value.vdouble.scalar.Length> positions, org.djunits.value.vdouble.scalar.Speed speed) Creates a cross section.static GraphCrossSection<LaneDataRoad>
createCrossSection
(List<String> names, org.opentrafficsim.core.network.LinkPosition linkPosition) Creates a cross section at the provided link and position.static GraphPath<LaneDataRoad>
createPath
(String name, Lane first) Creates a path starting at the provided lane and moving downstream until a dead-end, split, or loop.static GraphPath<LaneDataRoad>
createPath
(List<String> names, List<Lane> 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<LaneDataRoad>
createSingleLanePath
(String name, Lane lane) Creates a single-lane path.
-
Method Details
-
createPath
public static GraphPath<LaneDataRoad> createPath(String name, Lane first) throws org.opentrafficsim.core.network.NetworkException Creates a path starting at the provided lane and moving downstream until a dead-end, split, or loop.- Parameters:
name
- String; path namefirst
- Lane; first lane- Returns:
- GraphPath<LaneDataRoad> path
- Throws:
org.opentrafficsim.core.network.NetworkException
- when the lane does not have any set speed limit
-
createPath
public static GraphPath<LaneDataRoad> createPath(List<String> names, List<Lane> first) throws org.opentrafficsim.core.network.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<Lane>; first lanes- Returns:
- GraphPath<LaneDataRoad> path
- Throws:
org.opentrafficsim.core.network.NetworkException
- when a lane does not have any set speed limit
-
createSingleLanePath
public static GraphPath<LaneDataRoad> createSingleLanePath(String name, Lane lane) throws org.opentrafficsim.core.network.NetworkException Creates a single-lane path.- Parameters:
name
- String; namelane
- Lane; lane- Returns:
- GraphPath<LaneDataRoad> path
- Throws:
org.opentrafficsim.core.network.NetworkException
- when a lane does not have any set speed limit
-
createCrossSection
public static GraphCrossSection<LaneDataRoad> createCrossSection(String name, LanePosition lanePosition) throws org.opentrafficsim.core.network.NetworkException Creates a cross section at the provided lane and position.- Parameters:
name
- String; namelanePosition
- LanePosition; lane position- Returns:
- GraphCrossSection<LaneDataRoad> cross section
- Throws:
org.opentrafficsim.core.network.NetworkException
- when the lane does not have any set speed limit
-
createCrossSection
public static GraphCrossSection<LaneDataRoad> createCrossSection(List<String> names, org.opentrafficsim.core.network.LinkPosition linkPosition) throws org.opentrafficsim.core.network.NetworkException Creates a cross section at the provided link and position.- Parameters:
names
- List<String>; lane nameslinkPosition
- LinkPosition; link position- Returns:
- GraphCrossSection<LaneDataRoad> cross section
- Throws:
org.opentrafficsim.core.network.NetworkException
- when a lane does not have any set speed limit
-
createCrossSection
public static GraphCrossSection<LaneDataRoad> createCrossSection(List<String> names, List<LaneDataRoad> lanes, List<org.djunits.value.vdouble.scalar.Length> positions, org.djunits.value.vdouble.scalar.Speed speed) Creates a cross section.- Parameters:
names
- List<String>;; nameslanes
- List<LaneDataRoad>;; lanespositions
- List<Length>; positionsspeed
- Speed; speed- Returns:
- GraphCrossSection<LaneDataRoad>; cross section
-