View Javadoc
1   package org.opentrafficsim.road.gtu.lane.tactical;
2   
3   import java.io.Serializable;
4   import java.util.List;
5   
6   import org.djunits.value.vdouble.scalar.Length;
7   import org.opentrafficsim.core.geometry.OtsLine2d;
8   import org.opentrafficsim.road.network.lane.Lane;
9   
10  /**
11   * This class provides the following information for an operational plan:
12   * <ul>
13   * <li>the lanes to follow, with the direction to drive on them</li>
14   * <li>the starting point on the first lane</li>
15   * <li>the path to follow when staying on the same lane</li>
16   * </ul>
17   * <p>
18   * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
19   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
20   * </p>
21   * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
22   * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
23   * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
24   * @param path OtsLine2d; the path it the GTU keeps driving in the same lane, and follows the route if possible in the same
25   *            lane. The path stops when the lane or a continuation lane does not lead in the direction of the route provided by
26   *            the strategical planner.
27   * @param laneList List&lt;Lane&gt;; the current lane on which the reference point of the GTU is registered (if the GTU is
28   *            registered on multiple lanes with the reference point, one lane is chosen where the reference point has a
29   *            fractional lane position between 0.0 and 1.0), and consecutive lanes that follow the route if possible in the same
30   *            lane. The list of lanes stops when a continuation lane does not lead in the direction of the route provided by the
31   *            strategical planner.
32   * @param referencePosition Length; the start point on the first lane in the laneList. When this is a point that represents a
33   *            GTU position, it should represent the reference point of the GTU.
34   */
35  public record LanePathInfo(OtsLine2d path, List<Lane> laneList, Length referencePosition) implements Serializable
36  {
37  
38      /** */
39      private static final long serialVersionUID = 20151231L;
40  
41      /**
42       * The reference lane is the widest lane on which the reference point of the GTU is fully registered.
43       * @return the reference lane on which the GTU is registered, or null if the GTU is not registered on any lane.
44       */
45      public final Lane getReferenceLane()
46      {
47          return this.laneList.isEmpty() ? null : this.laneList.get(0);
48      }
49  
50  }