Class GraphLaneUtil

java.lang.Object
org.opentrafficsim.draw.graphs.road.GraphLaneUtil

public final class GraphLaneUtil
extends java.lang.Object
Utilities to create GraphPaths and GraphCrossSections for graphs, based on lanes.

Copyright (c) 2013-2019 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 Details

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