CrossSectionSlice.java

  1. package org.opentrafficsim.road.network.lane;

  2. import java.io.Serializable;

  3. import org.djunits.value.vdouble.scalar.Length;

  4. /**
  5.  * The CrossSectionSlice provides the width and offset at a relative length of a CrossSectionElement.
  6.  * <p>
  7.  * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  8.  * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
  9.  * </p>
  10.  * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
  11.  * initial version Nov 26, 2015 <br>
  12.  * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
  13.  * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
  14.  */
  15. public class CrossSectionSlice implements Serializable
  16. {
  17.     /** */
  18.     private static final long serialVersionUID = 20151126L;

  19.     /** The relative position from the start, measured along the design line of the parent link. */
  20.     private final Length relativeLength;

  21.     /** The lateral offset from the design line of the parentLink at the relative length. */
  22.     private final Length designLineOffset;

  23.     /** The width, positioned <i>symmetrically around</i> the position at the relative length. */
  24.     private final Length width;

  25.     /**
  26.      * Construct a new CrossSectionSlice.
  27.      * @param relativeLength Length; the relative position from the start, measured along the design line of the parent link
  28.      * @param designLineOffset Length; the lateral offset from the design line of the parentLink at the relative length
  29.      * @param width Length; the width, positioned <i>symmetrically around</i> the position at the relative length
  30.      */
  31.     public CrossSectionSlice(final Length relativeLength, final Length designLineOffset, final Length width)
  32.     {
  33.         super();
  34.         this.relativeLength = relativeLength;
  35.         this.designLineOffset = designLineOffset;
  36.         this.width = width;
  37.     }

  38.     /**
  39.      * Retrieve the relative length.
  40.      * @return Length; the relativeLength
  41.      */
  42.     public final Length getRelativeLength()
  43.     {
  44.         return this.relativeLength;
  45.     }

  46.     /**
  47.      * Retrieve the design line offset.
  48.      * @return Length; designLineOffset
  49.      */
  50.     public final Length getDesignLineOffset()
  51.     {
  52.         return this.designLineOffset;
  53.     }

  54.     /**
  55.      * Retrieve the width.
  56.      * @return Length; the width
  57.      */
  58.     public final Length getWidth()
  59.     {
  60.         return this.width;
  61.     }

  62.     /** {@inheritDoc} */
  63.     @Override
  64.     public final String toString()
  65.     {
  66.         return "CrossSectionSlice [relativeLength=" + this.relativeLength + ", designLineOffset=" + this.designLineOffset
  67.                 + ", width=" + this.width + "]";
  68.     }
  69. }