Class CrossSectionElement
java.lang.Object
org.djutils.event.LocalEventProducer
org.opentrafficsim.road.network.lane.CrossSectionElement
- All Implemented Interfaces:
Serializable
,Remote
,nl.tudelft.simulation.dsol.animation.Locatable
,org.djutils.base.Identifiable
,org.djutils.event.EventProducer
,org.opentrafficsim.base.geometry.OtsLocatable
,Drawable
public abstract class CrossSectionElement
extends org.djutils.event.LocalEventProducer
implements org.opentrafficsim.base.geometry.OtsLocatable, Serializable, org.djutils.base.Identifiable, Drawable
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
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final CrossSectionLink
Cross Section Link to which the element belongs.Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITION
-
Constructor Summary
ConstructorDescriptionCrossSectionElement
(CrossSectionLink link, String id, OtsLine2d centerLine, org.djutils.draw.line.Polygon2d contour, List<CrossSectionSlice> crossSectionSlices) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
final org.djunits.value.vdouble.scalar.Length
Retrieve the width at the begin of the parent link.org.opentrafficsim.base.geometry.OtsBounds2d
final OtsLine2d
Retrieve the center line of this CrossSectionElement.final org.djutils.draw.line.Polygon2d
Retrieve the contour of this CrossSectionElement.org.djunits.value.vdouble.scalar.Length
getElevation
(double fractionalPosition) Returns the elevation at the given fractional position.org.djunits.value.vdouble.scalar.Length
getElevation
(org.djunits.value.vdouble.scalar.Length position) Returns the elevation at the given position.final org.djunits.value.vdouble.scalar.Length
Retrieve the width at the end of the parent link.final String
Retrieve the id of this CrossSectionElement.double
getGrade
(double fractionalPosition) Returns the grade at the given fractional position, given as delta_h / delta_f, where f is fractional position.double
getGrade
(org.djunits.value.vdouble.scalar.Length position) Returns the grade at the given position, given as delta_h / delta_f, where f is fractional position.final String
getId()
Retrieve the id of this CrossSectionElement.final org.djunits.value.vdouble.scalar.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.final org.djunits.value.vdouble.scalar.Length
getLateralBoundaryPosition
(LateralDirectionality lateralDirection, org.djunits.value.vdouble.scalar.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 org.djunits.value.vdouble.scalar.Length
getLateralCenterPosition
(double fractionalPosition) Retrieve the lateral offset from the Link design line at the specified longitudinal position.final org.djunits.value.vdouble.scalar.Length
getLateralCenterPosition
(org.djunits.value.vdouble.scalar.Length longitudinalPosition) Retrieve the lateral offset from the Link design line at the specified longitudinal position.final org.djunits.value.vdouble.scalar.Length
Return the length of this CrossSectionElement as measured along the design line (which equals the center line).final CrossSectionLink
getLink()
Returns the link of this cross-section element.org.djutils.draw.point.OrientedPoint2d
final RoadNetwork
final org.djunits.value.vdouble.scalar.Length
Retrieve the offset from the design line at the begin of the parent link.final org.djunits.value.vdouble.scalar.Length
Retrieve the offset from the design line at the end of the parent link.final org.djunits.value.vdouble.scalar.Length
getWidth
(double fractionalPosition) Return the width of this CrossSectionElement at a specified fractional longitudinal position.final org.djunits.value.vdouble.scalar.Length
getWidth
(org.djunits.value.vdouble.scalar.Length longitudinalPosition) Return the width of this CrossSectionElement at a specified longitudinal position.double
getZ()
Retrieve the Z offset (used to determine what covers what when drawing).int
hashCode()
toString()
Methods inherited from class org.djutils.event.LocalEventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventListenerMap, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface nl.tudelft.simulation.dsol.animation.Locatable
getDirZ
-
Field Details
-
link
Cross Section Link to which the element belongs.
-
-
Constructor Details
-
CrossSectionElement
public CrossSectionElement(CrossSectionLink link, String id, OtsLine2d centerLine, org.djutils.draw.line.Polygon2d contour, List<CrossSectionSlice> crossSectionSlices) throws NetworkException Constructor.- Parameters:
link
- CrossSectionLink; link.id
- String; id.centerLine
- PolyLine2d; center line.contour
- Polygon2d; contour shape.crossSectionSlices
- List<CrossSectionSlice>; cross-section slices.- Throws:
NetworkException
- when no cross-section slice is defined.
-
-
Method Details
-
getLink
Returns the link of this cross-section element.- Returns:
- CrossSectionLink; link of this cross-section element.
-
getNetwork
- Returns:
- the road network to which the lane belongs
-
getLateralCenterPosition
public final org.djunits.value.vdouble.scalar.Length getLateralCenterPosition(double fractionalPosition) Retrieve the lateral offset from the Link design line at the specified longitudinal position.- Parameters:
fractionalPosition
- double; fractional longitudinal position on this Lane- Returns:
- Length; the lateralCenterPosition at the specified longitudinal position
-
getLateralCenterPosition
public final org.djunits.value.vdouble.scalar.Length getLateralCenterPosition(org.djunits.value.vdouble.scalar.Length longitudinalPosition) Retrieve the lateral offset from the Link design line at the specified longitudinal position.- Parameters:
longitudinalPosition
- Length; the longitudinal position on this Lane- Returns:
- Length; the lateralCenterPosition at the specified longitudinal position
-
getWidth
public final org.djunits.value.vdouble.scalar.Length getWidth(org.djunits.value.vdouble.scalar.Length longitudinalPosition) Return the width of this CrossSectionElement at a specified longitudinal position.- Parameters:
longitudinalPosition
- Length; the longitudinal position- Returns:
- Length; the width of this CrossSectionElement at the specified longitudinal position.
-
getWidth
public final org.djunits.value.vdouble.scalar.Length getWidth(double fractionalPosition) Return the width of this CrossSectionElement at a specified fractional longitudinal position.- Parameters:
fractionalPosition
- double; the fractional longitudinal position- Returns:
- Length; the width of this CrossSectionElement at the specified fractional longitudinal position.
-
getLength
public final org.djunits.value.vdouble.scalar.Length getLength()Return the length of this CrossSectionElement as measured along the design line (which equals the center line).- Returns:
- Length; the length of this CrossSectionElement
-
getOffsetAtBegin
public final org.djunits.value.vdouble.scalar.Length getOffsetAtBegin()Retrieve the offset from the design line at the begin of the parent link.- Returns:
- Length; the offset of this CrossSectionElement at the begin of the parent link
-
getOffsetAtEnd
public final org.djunits.value.vdouble.scalar.Length getOffsetAtEnd()Retrieve the offset from the design line at the end of the parent link.- Returns:
- Length; the offset of this CrossSectionElement at the end of the parent link
-
getBeginWidth
public final org.djunits.value.vdouble.scalar.Length getBeginWidth()Retrieve the width at the begin of the parent link.- Returns:
- Length; the width of this CrossSectionElement at the begin of the parent link
-
getEndWidth
public final org.djunits.value.vdouble.scalar.Length getEndWidth()Retrieve the width at the end of the parent link.- Returns:
- Length; 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 interfacenl.tudelft.simulation.dsol.animation.Locatable
- Returns:
- double; the Z-offset for drawing (what's on top, what's underneath).
-
getCenterLine
Retrieve the center line of this CrossSectionElement.- Returns:
- OtsLine2d; the center line of this CrossSectionElement
-
getContour
public final org.djutils.draw.line.Polygon2d getContour()Retrieve the contour of this CrossSectionElement.- Returns:
- Polygon2d; the contour of this CrossSectionElement
-
getId
Retrieve the id of this CrossSectionElement.- Specified by:
getId
in interfaceorg.djutils.base.Identifiable
- Returns:
- String; the id of this CrossSectionElement
-
getFullId
Retrieve the id of this CrossSectionElement.- Returns:
- String; the id of this CrossSectionElement
-
getLateralBoundaryPosition
public final org.djunits.value.vdouble.scalar.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
- LateralDirectionality; LEFT, or RIGHTfractionalLongitudinalPosition
- double; ranges from 0.0 (begin of parentLink) to 1.0 (end of parentLink)- Returns:
- Length
-
getLateralBoundaryPosition
public final org.djunits.value.vdouble.scalar.Length getLateralBoundaryPosition(LateralDirectionality lateralDirection, org.djunits.value.vdouble.scalar.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
- LateralDirectionality; LEFT, or RIGHTlongitudinalPosition
- Length; the position along the length of this CrossSectionElement- Returns:
- Length
-
getLocation
public org.djutils.draw.point.OrientedPoint2d getLocation()- Specified by:
getLocation
in interfacenl.tudelft.simulation.dsol.animation.Locatable
- Specified by:
getLocation
in interfaceorg.opentrafficsim.base.geometry.OtsLocatable
-
getBounds
public org.opentrafficsim.base.geometry.OtsBounds2d getBounds()- Specified by:
getBounds
in interfacenl.tudelft.simulation.dsol.animation.Locatable
- Specified by:
getBounds
in interfaceorg.opentrafficsim.base.geometry.OtsLocatable
-
getElevation
public org.djunits.value.vdouble.scalar.Length getElevation(org.djunits.value.vdouble.scalar.Length position) Returns the elevation at the given position.- Parameters:
position
- Length; position.- Returns:
- Length; elevation at the given position.
-
getElevation
public org.djunits.value.vdouble.scalar.Length getElevation(double fractionalPosition) Returns the elevation at the given fractional position.- Parameters:
fractionalPosition
- double; fractional position.- Returns:
- Length; elevation at the given fractional position.
-
getGrade
public double getGrade(org.djunits.value.vdouble.scalar.Length position) Returns the grade at the given position, given as delta_h / delta_f, where f is fractional position.- Parameters:
position
- Length; position.- Returns:
- double; 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
- double; fractional position.- Returns:
- double; grade at the given fractional position.
-
toString
-
hashCode
public int hashCode() -
equals
-