View Javadoc
1   package org.opentrafficsim.road.network.lane;
2   
3   import org.opentrafficsim.core.geometry.OTSGeometryException;
4   import org.opentrafficsim.core.network.NetworkException;
5   
6   /**
7    * <p>
8    * Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
9    * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
10   * <p>
11   * $LastChangedDate: 2015-09-03 13:38:01 +0200 (Thu, 03 Sep 2015) $, @version $Revision: 1378 $, by $Author: averbraeck $,
12   * initial version Aug 19, 2014 <br>
13   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
14   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
15   * @author <a href="http://www.citg.tudelft.nl">Guus Tamminga</a>
16   */
17  public class Shoulder extends CrossSectionElement
18  {
19      /** */
20      private static final long serialVersionUID = 20140819L;
21  
22      /**
23       * @param parentLink Cross Section Link to which the element belongs.
24       * @param id String; the id of the lane. Should be unique within the parentLink.
25       * @param lateralPosition the lateral start position compared to the linear geometry of the Cross Section Link.
26       * @param beginWidth start width, positioned <i>symmetrically around</i> the lateral start position.
27       * @param endWidth end width, positioned <i>symmetrically around</i> the lateral end position.
28       * @throws OTSGeometryException when creation of the center line or contour geometry fails
29       * @throws NetworkException when id equal to null or not unique
30       */
31      public Shoulder(final CrossSectionLink parentLink, final String id, final Length.Rel lateralPosition,
32          final Length.Rel beginWidth, final Length.Rel endWidth) throws OTSGeometryException, NetworkException
33      {
34          super(parentLink, id, lateralPosition, lateralPosition, beginWidth, endWidth);
35      }
36  
37      /** {@inheritDoc} */
38      @Override
39      protected final double getZ()
40      {
41          return -0.0002;
42      }
43  
44      /** {@inheritDoc} */
45      @Override
46      @SuppressWarnings("checkstyle:designforextension")
47      public String toString()
48      {
49          return String.format("Shoulder offset %.2fm..%.2fm, width %.2fm..%.2fm", getDesignLineOffsetAtBegin().getSI(),
50              getDesignLineOffsetAtEnd().getSI(), getBeginWidth().getSI(), getEndWidth().getSI());
51      }
52  
53  }