Class GraphLaneUtil


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

    Copyright (c) 2013-2020 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<KpiLaneDirection> createPath​(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​(List<String> names,
                                                             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
      • createCrossSection

        public static GraphCrossSection<KpiLaneDirection> createCrossSection​(List<String> names,
                                                                             List<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