View Javadoc
1   package org.opentrafficsim.road.network.lane;
2   
3   import org.djunits.value.vdouble.scalar.Length;
4   import org.opentrafficsim.core.geometry.OtsGeometryException;
5   import org.opentrafficsim.core.network.NetworkException;
6   
7   /**
8    * Represents a shoulder. The purpose opf this class is to be able to toggle animation of shoulders, without also toggling lanes
9    * and stripes.
10   * <p>
11   * Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
12   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
13   * </p>
14   * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
15   * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
16   * @author <a href="https://dittlab.tudelft.nl">Wouter Schakel</a>
17   */
18  public class Shoulder extends CrossSectionElement
19  {
20      /** */
21      private static final long serialVersionUID = 20140819L;
22  
23      /**
24       * Creates a shoulder element.
25       * @param parentLink CrossSectionLink; Cross Section Link to which the element belongs.
26       * @param id String; the id of the lane. Should be unique within the parentLink.
27       * @param lateralPositionStart Length; the lateral start position compared to the linear geometry of the Cross Section Link.
28       * @param lateralPositionEnd Length; the lateral end position compared to the linear geometry of the Cross Section Link
29       * @param beginWidth Length; start width, positioned &lt;i&gt;symmetrically around&lt;/i&gt; the lateral start position.
30       * @param endWidth Length; end width, positioned &lt;i&gt;symmetrically around&lt;/i&gt; the lateral end position.
31       * @param fixGradualLateralOffset boolean; true if gradualLateralOffset needs to be fixed
32       * @throws OtsGeometryException when creation of the center line or contour geometry fails
33       * @throws NetworkException when id equal to null or not unique
34       */
35      public Shoulder(final CrossSectionLink parentLink, final String id, final Length lateralPositionStart,
36              final Length lateralPositionEnd, final Length beginWidth, final Length endWidth,
37              final boolean fixGradualLateralOffset) throws OtsGeometryException, NetworkException
38      {
39          super(parentLink, id, lateralPositionStart, lateralPositionEnd, beginWidth, endWidth, false);
40      }
41  
42      /** {@inheritDoc} */
43      @Override
44      public final double getZ()
45      {
46          return -0.0004;
47      }
48  
49      /** {@inheritDoc} */
50      @Override
51      @SuppressWarnings("checkstyle:designforextension")
52      public String toString()
53      {
54          return String.format("Shoulder offset %.2fm..%.2fm, width %.2fm..%.2fm", getDesignLineOffsetAtBegin().getSI(),
55                  getDesignLineOffsetAtEnd().getSI(), getBeginWidth().getSI(), getEndWidth().getSI());
56      }
57  
58  }