View Javadoc
1   package org.opentrafficsim.road.network.lane;
2   
3   import java.io.Serializable;
4   
5   import org.djunits.value.vdouble.scalar.Length;
6   
7   /**
8    * The CrossSectionSlice provides the width and offset at a relative length of a CrossSectionElement.
9    * <p>
10   * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
11   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
12   * </p>
13   * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
14   * initial version Nov 26, 2015 <br>
15   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
16   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
17   */
18  public class CrossSectionSlice implements Serializable
19  {
20      /** */
21      private static final long serialVersionUID = 20151126L;
22  
23      /** The relative position from the start, measured along the design line of the parent link. */
24      private final Length relativeLength;
25  
26      /** The lateral offset from the design line of the parentLink at the relative length. */
27      private final Length designLineOffset;
28  
29      /** The width, positioned <i>symmetrically around</i> the position at the relative length. */
30      private final Length width;
31  
32      /**
33       * @param relativeLength the relative position from the start, measured along the design line of the parent link
34       * @param designLineOffset the lateral offset from the design line of the parentLink at the relative length
35       * @param width the width, positioned <i>symmetrically around</i> the position at the relative length
36       */
37      public CrossSectionSlice(final Length relativeLength, final Length designLineOffset, final Length width)
38      {
39          super();
40          this.relativeLength = relativeLength;
41          this.designLineOffset = designLineOffset;
42          this.width = width;
43      }
44  
45      /**
46       * @return relativeLength
47       */
48      public final Length getRelativeLength()
49      {
50          return this.relativeLength;
51      }
52  
53      /**
54       * @return designLineOffset
55       */
56      public final Length getDesignLineOffset()
57      {
58          return this.designLineOffset;
59      }
60  
61      /**
62       * @return width
63       */
64      public final Length getWidth()
65      {
66          return this.width;
67      }
68  
69      /** {@inheritDoc} */
70      @Override
71      public final String toString()
72      {
73          return "CrossSectionSlice [relativeLength=" + this.relativeLength + ", designLineOffset=" + this.designLineOffset
74                  + ", width=" + this.width + "]";
75      }
76  }