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.base.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://github.com/peter-knoppers">Peter Knoppers</a>
23   * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
24   * @param path the path it the GTU keeps driving in the same lane, and follows the route if possible in the same lane. The path
25   *            stops when the lane or a continuation lane does not lead in the direction of the route provided by the strategical
26   *            planner.
27   * @param laneList the current lane on which the reference point of the GTU is registered (if the GTU is registered on multiple
28   *            lanes with the reference point, one lane is chosen where the reference point has a fractional lane position
29   *            between 0.0 and 1.0), and consecutive lanes that follow the route if possible in the same lane. The list of lanes
30   *            stops when a continuation lane does not lead in the direction of the route provided by the strategical planner.
31   * @param referencePosition the start point on the first lane in the laneList. When this is a point that represents a GTU
32   *            position, it should represent the reference point of the GTU.
33   */
34  public record LanePathInfo(OtsLine2d path, List<Lane> laneList, Length referencePosition) implements Serializable
35  {
36  
37      /** */
38      private static final long serialVersionUID = 20151231L;
39  
40      /**
41       * The reference lane is the widest lane on which the reference point of the GTU is fully registered.
42       * @return the reference lane on which the GTU is registered, or null if the GTU is not registered on any lane.
43       */
44      public final Lane getReferenceLane()
45      {
46          return this.laneList.isEmpty() ? null : this.laneList.get(0);
47      }
48  
49  }