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-2020 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          this.relativeLength = relativeLength;
41          this.designLineOffset = designLineOffset;
42          this.width = width;
43      }
44  
45      /**
46       * Retrieve the relative length.
47       * @return Length; the relativeLength
48       */
49      public final Length getRelativeLength()
50      {
51          return this.relativeLength;
52      }
53  
54      /**
55       * Retrieve the design line offset.
56       * @return Length; designLineOffset
57       */
58      public final Length getDesignLineOffset()
59      {
60          return this.designLineOffset;
61      }
62  
63      /**
64       * Retrieve the width.
65       * @return Length; the width
66       */
67      public final Length getWidth()
68      {
69          return this.width;
70      }
71  
72      /** {@inheritDoc} */
73      @Override
74      public final String toString()
75      {
76          return "CrossSectionSlice [relativeLength=" + this.relativeLength + ", designLineOffset=" + this.designLineOffset
77                  + ", width=" + this.width + "]";
78      }
79  }