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
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final CrossSectionLinkCross Section Link to which the element belongs.Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITIONFields inherited from interface org.opentrafficsim.base.geometry.OtsShape
DEFAULT_POLYGON_SEGMENTS, WORLD_MARGIN_LINE -
Constructor Summary
ConstructorsConstructorDescriptionCrossSectionElement(CrossSectionLink link, String id, CrossSectionGeometry geometry) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanfinal Polygon2dfinal LengthRetrieve the width at the begin of the parent link.final OtsLine2dRetrieve the center line of this CrossSectionElement.getElevation(double fractionalPosition) Returns the elevation at the given fractional position.getElevation(Length position) Returns the elevation at the given position.final LengthRetrieve the width at the end of the parent link.final StringRetrieve the id of this CrossSectionElement.doublegetGrade(double fractionalPosition) Returns the grade at the given fractional position, given as delta_h / delta_f, where f is fractional position.doubleReturns the grade at the given position, given as delta_h / delta_f, where f is fractional position.final StringgetId()final LengthgetLateralBoundaryPosition(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.final LengthgetLateralBoundaryPosition(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.final LengthgetLateralCenterPosition(double fractionalPosition) Retrieve the lateral offset from the Link design line at the specified longitudinal position.final LengthgetLateralCenterPosition(Length longitudinalPosition) Retrieve the lateral offset from the Link design line at the specified longitudinal position.final LengthReturn the length of this CrossSectionElement as measured along the design line (which equals the center line).final CrossSectionLinkgetLink()Returns the link of this cross-section element.final RoadNetworkReturns network.final LengthRetrieve the offset from the design line at the begin of the parent link.final LengthRetrieve the offset from the design line at the end of the parent link.final Polygon2dfinal LengthgetWidth(double fractionalPosition) Return the width of this CrossSectionElement at a specified fractional longitudinal position.final LengthReturn the width of this CrossSectionElement at a specified longitudinal position.doublegetZ()Retrieve the Z offset (used to determine what covers what when drawing).inthashCode()toString()Methods inherited from class org.djutils.event.LocalEventProducer
getEventListenerMapMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListenerMethods inherited from interface org.opentrafficsim.base.geometry.OtsShape
contains, contains, getAbsoluteBounds, getAbsoluteContour, getDirZ, signedDistance, signedDistance
-
Field Details
-
link
Cross Section Link to which the element belongs.
-
-
Constructor Details
-
CrossSectionElement
Constructor.- Parameters:
link- linkid- idgeometry- geometry
-
-
Method Details
-
getLink
Returns the link of this cross-section element.- Returns:
- link of this cross-section element.
-
getNetwork
Returns network.- Returns:
- the road network to which the lane belongs
-
getLateralCenterPosition
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
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
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
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
Return the length of this CrossSectionElement as measured along the design line (which equals the center line).- Returns:
- the length of this CrossSectionElement
-
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
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
Retrieve the width at the begin of the parent link.- Returns:
- the width of this CrossSectionElement at the begin of the parent link
-
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:
getZin interfacenl.tudelft.simulation.dsol.animation.Locatable- Returns:
- the Z-offset for drawing (what's on top, what's underneath).
-
getCenterLine
Retrieve the center line of this CrossSectionElement.- Returns:
- the center line of this CrossSectionElement
-
getAbsoluteContour
- Specified by:
getAbsoluteContourin interfaceOtsShape
-
getRelativeContour
- Specified by:
getRelativeContourin interfaceOtsShape
-
getId
- Specified by:
getIdin interfaceIdentifiable
-
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 RIGHTfractionalLongitudinalPosition- ranges from 0.0 (begin of parentLink) to 1.0 (end of parentLink)- Returns:
- Length
- Throws:
IllegalArgumentException- when lateral direction isnullor 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 RIGHTlongitudinalPosition- the position along the length of this CrossSectionElement- Returns:
- Length
-
getLocation
- Specified by:
getLocationin interfacenl.tudelft.simulation.dsol.animation.Locatable- Specified by:
getLocationin interfaceOtsShape
-
getRelativeBounds
- Specified by:
getRelativeBoundsin interfacenl.tudelft.simulation.dsol.animation.Locatable- Specified by:
getRelativeBoundsin interfaceOtsShape
-
getElevation
Returns the elevation at the given position.- Parameters:
position- position.- Returns:
- elevation at the given position.
-
getElevation
Returns the elevation at the given fractional position.- Parameters:
fractionalPosition- fractional position.- Returns:
- elevation at the given fractional position.
-
getGrade
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
-
hashCode
public int hashCode() -
equals
-