Class CrossSectionElement

java.lang.Object
org.djutils.event.LocalEventProducer
org.opentrafficsim.road.network.lane.CrossSectionElement
All Implemented Interfaces:
nl.tudelft.simulation.dsol.animation.Locatable, Identifiable, EventProducer, OtsShape
Direct Known Subclasses:
Lane, Stripe

public abstract class CrossSectionElement extends LocalEventProducer implements OtsShape, Identifiable
Cross section elements are used to compose a CrossSectionLink.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Peter Knoppers, Guus Tamminga
  • Field Details

  • Constructor Details

  • Method Details

    • getLink

      public final CrossSectionLink getLink()
      Returns the link of this cross-section element.
      Returns:
      link of this cross-section element.
    • getNetwork

      public final RoadNetwork getNetwork()
      Returns network.
      Returns:
      the road network to which the lane belongs
    • getLateralCenterPosition

      public final Length getLateralCenterPosition(double fractionalPosition)
      Retrieve the lateral offset from the Link design line at the specified longitudinal position.
      Parameters:
      fractionalPosition - fractional longitudinal position on this Lane
      Returns:
      the lateralCenterPosition at the specified longitudinal position
    • getLateralCenterPosition

      public final Length getLateralCenterPosition(Length longitudinalPosition)
      Retrieve the lateral offset from the Link design line at the specified longitudinal position.
      Parameters:
      longitudinalPosition - the longitudinal position on this Lane
      Returns:
      the lateralCenterPosition at the specified longitudinal position
    • getWidth

      public final Length getWidth(Length longitudinalPosition)
      Return the width of this CrossSectionElement at a specified longitudinal position.
      Parameters:
      longitudinalPosition - the longitudinal position
      Returns:
      the width of this CrossSectionElement at the specified longitudinal position.
    • getWidth

      public final Length getWidth(double fractionalPosition)
      Return the width of this CrossSectionElement at a specified fractional longitudinal position.
      Parameters:
      fractionalPosition - the fractional longitudinal position
      Returns:
      the width of this CrossSectionElement at the specified fractional longitudinal position.
    • getLength

      public final Length getLength()
      Return the length of this CrossSectionElement as measured along the design line (which equals the center line).
      Returns:
      the length of this CrossSectionElement
    • getOffsetAtBegin

      public final Length getOffsetAtBegin()
      Retrieve the offset from the design line at the begin of the parent link.
      Returns:
      the offset of this CrossSectionElement at the begin of the parent link
    • getOffsetAtEnd

      public final Length getOffsetAtEnd()
      Retrieve the offset from the design line at the end of the parent link.
      Returns:
      the offset of this CrossSectionElement at the end of the parent link
    • getBeginWidth

      public final Length getBeginWidth()
      Retrieve the width at the begin of the parent link.
      Returns:
      the width of this CrossSectionElement at the begin of the parent link
    • getEndWidth

      public final Length getEndWidth()
      Retrieve the width at the end of the parent link.
      Returns:
      the width of this CrossSectionElement at the end of the parent link
    • getZ

      public double getZ()
      Retrieve the Z offset (used to determine what covers what when drawing).
      Specified by:
      getZ in interface nl.tudelft.simulation.dsol.animation.Locatable
      Returns:
      the Z-offset for drawing (what's on top, what's underneath).
    • getCenterLine

      public final OtsLine2d getCenterLine()
      Retrieve the center line of this CrossSectionElement.
      Returns:
      the center line of this CrossSectionElement
    • getAbsoluteContour

      public final Polygon2d getAbsoluteContour()
      Specified by:
      getAbsoluteContour in interface OtsShape
    • getRelativeContour

      public final Polygon2d getRelativeContour()
      Specified by:
      getRelativeContour in interface OtsShape
    • getId

      public final String getId()
      Specified by:
      getId in interface Identifiable
    • getFullId

      public final String getFullId()
      Retrieve the id of this CrossSectionElement.
      Returns:
      the id of this CrossSectionElement
    • getLateralBoundaryPosition

      public final Length getLateralBoundaryPosition(LateralDirectionality lateralDirection, double fractionalLongitudinalPosition)
      Return the lateral offset from the design line of the parent Link of the Left or Right boundary of this CrossSectionElement at the specified fractional longitudinal position.
      Parameters:
      lateralDirection - LEFT, or RIGHT
      fractionalLongitudinalPosition - ranges from 0.0 (begin of parentLink) to 1.0 (end of parentLink)
      Returns:
      Length
      Throws:
      IllegalArgumentException - when lateral direction is null or NONE.
    • getLateralBoundaryPosition

      public final Length getLateralBoundaryPosition(LateralDirectionality lateralDirection, Length longitudinalPosition)
      Return the lateral offset from the design line of the parent Link of the Left or Right boundary of this CrossSectionElement at the specified longitudinal position.
      Parameters:
      lateralDirection - LEFT, or RIGHT
      longitudinalPosition - the position along the length of this CrossSectionElement
      Returns:
      Length
    • getLocation

      public DirectedPoint2d getLocation()
      Specified by:
      getLocation in interface nl.tudelft.simulation.dsol.animation.Locatable
      Specified by:
      getLocation in interface OtsShape
    • getRelativeBounds

      public Bounds2d getRelativeBounds()
      Specified by:
      getRelativeBounds in interface nl.tudelft.simulation.dsol.animation.Locatable
      Specified by:
      getRelativeBounds in interface OtsShape
    • getElevation

      public Length getElevation(Length position)
      Returns the elevation at the given position.
      Parameters:
      position - position.
      Returns:
      elevation at the given position.
    • getElevation

      public Length getElevation(double fractionalPosition)
      Returns the elevation at the given fractional position.
      Parameters:
      fractionalPosition - fractional position.
      Returns:
      elevation at the given fractional position.
    • getGrade

      public double getGrade(Length position)
      Returns the grade at the given position, given as delta_h / delta_f, where f is fractional position.
      Parameters:
      position - position.
      Returns:
      grade at the given position.
    • getGrade

      public double getGrade(double fractionalPosition)
      Returns the grade at the given fractional position, given as delta_h / delta_f, where f is fractional position.
      Parameters:
      fractionalPosition - fractional position.
      Returns:
      grade at the given fractional position.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object