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 - String; path name
      first - 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 names
      first - 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; name
      lane - 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; name
      lanePosition - 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 names
      linkPosition - 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>;; names
      lanes - List<LaneDataRoad>;; lanes
      positions - List<Length>; positions
      speed - Speed; speed
      Returns:
      GraphCrossSection<LaneDataRoad>; cross section