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
(String name, Lane first, Lane last) 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>
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
- path namefirst
- first lane- Returns:
- path
- Throws:
org.opentrafficsim.core.network.NetworkException
- when the lane does not have any set speed limit
-
createPath
public static GraphPath<LaneDataRoad> createPath(String name, Lane first, Lane last) 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
- path namefirst
- first lanelast
- last lane- Returns:
- 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
- lane namesfirst
- first lanes- Returns:
- path
- Throws:
org.opentrafficsim.core.network.NetworkException
- when a lane does not have any set speed limit
-
createPath
public static GraphPath<LaneDataRoad> createPath(List<String> names, List<Lane> first, List<Lane> last) 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 is taken from the first lane. The speed is the minimum of all lanes in each section.- Parameters:
names
- lane namesfirst
- first laneslast
- last lanes- Returns:
- 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
- namelane
- lane- Returns:
- 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
- namelanePosition
- lane position- Returns:
- 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
- lane nameslinkPosition
- link position- Returns:
- 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
- nameslanes
- lanespositions
- positionsspeed
- speed- Returns:
- cross section
-