View Javadoc
1   package org.opentrafficsim.road.network.lane;
2   
3   import java.util.HashMap;
4   import java.util.Map;
5   
6   import org.djunits.unit.SpeedUnit;
7   import org.opentrafficsim.core.geometry.OTSGeometryException;
8   import org.opentrafficsim.core.gtu.GTUType;
9   import org.opentrafficsim.core.network.LongitudinalDirectionality;
10  import org.opentrafficsim.core.network.NetworkException;
11  import org.opentrafficsim.road.network.lane.changing.OvertakingConditions;
12  
13  /**
14   * Lane without traffic, e.g. emergency lane next to highway.
15   * <p>
16   * Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
17   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
18   * <p>
19   * $LastChangedDate: 2015-09-16 19:20:07 +0200 (Wed, 16 Sep 2015) $, @version $Revision: 1405 $, by $Author: averbraeck $,
20   * initial version Feb 28, 2015 <br>
21   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
22   */
23  public class NoTrafficLane extends Lane
24  {
25      /** */
26      private static final long serialVersionUID = 20150228L;
27  
28      /** Map that tells that directionality is NONE for all GTU types. */
29      private static final Map<GTUType, LongitudinalDirectionality> DIRECTIONALITY_NONE = new HashMap<>();
30  
31      /** Map that tells that speed is 0.0 for all GTU Types. */
32      private static final Map<GTUType, Speed.Abs> SPEED_NULL = new HashMap<>();
33      
34      /** the overtaking rules for a no-traffic lane. */
35      private static final OvertakingConditions NO_OVERTAKING = new OvertakingConditions.None();
36  
37      static
38      {
39          DIRECTIONALITY_NONE.put(GTUType.ALL, LongitudinalDirectionality.NONE);
40          SPEED_NULL.put(GTUType.ALL, new Speed.Abs(0.0, SpeedUnit.SI));
41      }
42  
43      /**
44       * @param parentLink Cross Section Link to which the element belongs.
45       * @param id String; the id of the lane. Should be unique within the parentLink.
46       * @param lateralOffsetAtStart DoubleScalar.Rel&lt;LengthUnit&gt;; the lateral offset of the design line of the new
47       *            CrossSectionLink with respect to the design line of the parent Link at the start of the parent Link
48       * @param lateralOffsetAtEnd DoubleScalar.Rel&lt;LengthUnit&gt;; the lateral offset of the design line of the new
49       *            CrossSectionLink with respect to the design line of the parent Link at the end of the parent Link
50       * @param beginWidth DoubleScalar.Rel&lt;LengthUnit&gt;; start width, positioned <i>symmetrically around</i> the design line
51       * @param endWidth DoubleScalar.Rel&lt;LengthUnit&gt;; end width, positioned <i>symmetrically around</i> the design line
52       * @throws OTSGeometryException when creation of the geometry fails
53       * @throws NetworkException when id equal to null or not unique
54       */
55      @SuppressWarnings("checkstyle:parameternumber")
56      public NoTrafficLane(final CrossSectionLink parentLink, final String id, final Length.Rel lateralOffsetAtStart,
57          final Length.Rel lateralOffsetAtEnd, final Length.Rel beginWidth, final Length.Rel endWidth)
58          throws OTSGeometryException, NetworkException
59      {
60          super(parentLink, id, lateralOffsetAtStart, lateralOffsetAtEnd, beginWidth, endWidth, LaneType.NONE,
61              DIRECTIONALITY_NONE, SPEED_NULL, NO_OVERTAKING);
62      }
63  
64      /** {@inheritDoc} */
65      @Override
66      protected final double getZ()
67      {
68          return -0.00005;
69      }
70  }