1 package org.opentrafficsim.road.network.lane; 2 3 import java.util.List; 4 5 import org.djunits.value.vdouble.scalar.Length; 6 import org.opentrafficsim.core.geometry.OTSGeometryException; 7 import org.opentrafficsim.core.network.NetworkException; 8 9 /** 10 * <p> 11 * Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 12 * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>. 13 * <p> 14 * $LastChangedDate: 2015-09-03 13:38:01 +0200 (Thu, 03 Sep 2015) $, @version $Revision: 1378 $, by $Author: averbraeck $, 15 * initial version Aug 19, 2014 <br> 16 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a> 17 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a> 18 * @author <a href="http://www.citg.tudelft.nl">Guus Tamminga</a> 19 */ 20 public class Shoulder extends CrossSectionElement 21 { 22 /** */ 23 private static final long serialVersionUID = 20140819L; 24 25 /** 26 * @param parentLink Cross Section Link to which the element belongs. 27 * @param id String; the id of the lane. Should be unique within the parentLink. 28 * @param lateralPositionStart the lateral start position compared to the linear geometry of the Cross Section Link. 29 * @param lateralPositionEnd the lateral end position compared to the linear geometry of the Cross Section Link 30 * @param beginWidth start width, positioned <i>symmetrically around</i> the lateral start position. 31 * @param endWidth end width, positioned <i>symmetrically around</i> the lateral end position. 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.Rel lateralPositionStart, 36 final Length.Rel lateralPositionEnd, final Length.Rel beginWidth, final Length.Rel endWidth) 37 throws OTSGeometryException, NetworkException 38 { 39 super(parentLink, id, lateralPositionStart, lateralPositionEnd, beginWidth, endWidth); 40 } 41 42 /** 43 * @param parentLink Cross Section Link to which the element belongs. 44 * @param id String; the id of the lane. Should be unique within the parentLink. 45 * @param lateralPosition the lateral start position compared to the linear geometry of the Cross Section Link. 46 * @param width the shoulder width, positioned <i>symmetrically around</i> the lateral start position. 47 * @throws OTSGeometryException when creation of the center line or contour geometry fails 48 * @throws NetworkException when id equal to null or not unique 49 */ 50 public Shoulder(final CrossSectionLink parentLink, final String id, final Length.Rel lateralPosition, 51 final Length.Rel width) throws OTSGeometryException, NetworkException 52 { 53 super(parentLink, id, lateralPosition, width); 54 } 55 56 /** 57 * @param parentLink Cross Section Link to which the element belongs. 58 * @param id String; the id of the lane. Should be unique within the parentLink. 59 * @param crossSectionSlices The offsets and widths at positions along the line, relative to the design line of the parent 60 * link. If there is just one with and offset, there should just be one element in the list with Length.Rel = 0. 61 * If there are more slices, the last one should be at the length of the design line. If not, a NetworkException 62 * is thrown. 63 * @throws OTSGeometryException when creation of the center line or contour geometry fails 64 * @throws NetworkException when id equal to null or not unique 65 */ 66 public Shoulder(final CrossSectionLink parentLink, final String id, final List<CrossSectionSlice> crossSectionSlices) 67 throws OTSGeometryException, NetworkException 68 { 69 super(parentLink, id, crossSectionSlices); 70 } 71 72 /** {@inheritDoc} */ 73 @Override 74 protected final double getZ() 75 { 76 return -0.0002; 77 } 78 79 /** {@inheritDoc} */ 80 @Override 81 @SuppressWarnings("checkstyle:designforextension") 82 public String toString() 83 { 84 return String.format("Shoulder offset %.2fm..%.2fm, width %.2fm..%.2fm", getDesignLineOffsetAtBegin().getSI(), 85 getDesignLineOffsetAtEnd().getSI(), getBeginWidth().getSI(), getEndWidth().getSI()); 86 } 87 88 }