Class GraphLaneUtil


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

    Copyright (c) 2013-2022 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 Detail

      • createPath

        public static GraphPath<org.opentrafficsim.kpi.sampling.KpiLaneDirection> createPath​(String name,
                                                                                             LaneDirection 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 - LaneDirection; first lane
        Returns:
        GraphPath<KpiLaneDirection> path
        Throws:
        org.opentrafficsim.core.network.NetworkException - when the lane does not have any set speed limit
      • createPath

        public static GraphPath<org.opentrafficsim.kpi.sampling.KpiLaneDirection> createPath​(List<String> names,
                                                                                             List<LaneDirection> 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<LaneDirection>; first lanes
        Returns:
        GraphPath<KpiLaneDirection> path
        Throws:
        org.opentrafficsim.core.network.NetworkException - when a lane does not have any set speed limit
      • createSingleLanePath

        public static GraphPath<org.opentrafficsim.kpi.sampling.KpiLaneDirection> createSingleLanePath​(String name,
                                                                                                       LaneDirection lane)
                                                                                                throws org.opentrafficsim.core.network.NetworkException
        Creates a single-lane path.
        Parameters:
        name - String; name
        lane - LaneDirection; lane
        Returns:
        GraphPath<KpiLaneDirection> path
        Throws:
        org.opentrafficsim.core.network.NetworkException - when a lane does not have any set speed limit
      • createCrossSection

        public static GraphCrossSection<org.opentrafficsim.kpi.sampling.KpiLaneDirection> createCrossSection​(String name,
                                                                                                             DirectedLanePosition lanePosition)
                                                                                                      throws org.opentrafficsim.core.network.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:
        org.opentrafficsim.core.network.NetworkException - when the lane does not have any set speed limit
      • createCrossSection

        public static GraphCrossSection<org.opentrafficsim.kpi.sampling.KpiLaneDirection> createCrossSection​(List<String> names,
                                                                                                             org.opentrafficsim.core.network.DirectedLinkPosition linkPosition)
                                                                                                      throws org.opentrafficsim.core.network.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:
        org.opentrafficsim.core.network.NetworkException - when a lane does not have any set speed limit
      • createCrossSection

        public static GraphCrossSection<org.opentrafficsim.kpi.sampling.KpiLaneDirection> createCrossSection​(List<String> names,
                                                                                                             List<org.opentrafficsim.kpi.sampling.KpiLaneDirection> lanes,
                                                                                                             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