Class GraphLaneUtil

java.lang.Object
org.opentrafficsim.animation.GraphLaneUtil

public final class GraphLaneUtil extends Object
Utilities to create GraphPaths and GraphCrossSections 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 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 name
      first - 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 name
      first - first lane
      last - 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 names
      first - 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 names
      first - first lanes
      last - 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 - name
      lane - 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 - name
      lanePosition - 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 names
      linkPosition - 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 - names
      lanes - lanes
      positions - positions
      speed - speed
      Returns:
      cross section