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-2018 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       * Construct a new CrossSectionSlice.
34       * @param relativeLength Length; the relative position from the start, measured along the design line of the parent link
35       * @param designLineOffset Length; the lateral offset from the design line of the parentLink at the relative length
36       * @param width Length; the width, positioned <i>symmetrically around</i> the position at the relative length
37       */
38      public CrossSectionSlice(final Length relativeLength, final Length designLineOffset, final Length width)
39      {
40          super();
41          this.relativeLength = relativeLength;
42          this.designLineOffset = designLineOffset;
43          this.width = width;
44      }
45  
46      /**
47       * Retrieve the relative length.
48       * @return Length; the relativeLength
49       */
50      public final Length getRelativeLength()
51      {
52          return this.relativeLength;
53      }
54  
55      /**
56       * Retrieve the design line offset.
57       * @return Length; designLineOffset
58       */
59      public final Length getDesignLineOffset()
60      {
61          return this.designLineOffset;
62      }
63  
64      /**
65       * Retrieve the width.
66       * @return Length; the width
67       */
68      public final Length getWidth()
69      {
70          return this.width;
71      }
72  
73      /** {@inheritDoc} */
74      @Override
75      public final String toString()
76      {
77          return "CrossSectionSlice [relativeLength=" + this.relativeLength + ", designLineOffset=" + this.designLineOffset
78                  + ", width=" + this.width + "]";
79      }
80  }