Record Class CrossSectionGeometry
java.lang.Object
java.lang.Record
org.opentrafficsim.road.network.lane.CrossSectionGeometry
- Record Components:
centerLine
- center linecontour
- contouroffset
- offsetwidth
- width
public record CrossSectionGeometry(org.opentrafficsim.base.geometry.OtsLine2d centerLine, org.djutils.draw.line.Polygon2d contour, ContinuousLine.ContinuousDoubleFunction offset, ContinuousLine.ContinuousDoubleFunction width)
extends Record
Cross-section element geometry. A static method
of(...)
is available to generate geometry based on a design line and
information on offset and width.
Copyright (c) 2024-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Wouter Schakel
-
Constructor Summary
ConstructorsConstructorDescriptionCrossSectionGeometry
(org.opentrafficsim.base.geometry.OtsLine2d centerLine, org.djutils.draw.line.Polygon2d contour, ContinuousLine.ContinuousDoubleFunction offset, ContinuousLine.ContinuousDoubleFunction width) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionorg.opentrafficsim.base.geometry.OtsLine2d
Returns the value of thecenterLine
record component.org.djutils.draw.line.Polygon2d
contour()
Returns the value of thecontour
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.static CrossSectionGeometry
of
(ContinuousLine designLine, Flattener flattener, ContinuousLine.ContinuousDoubleFunction offset, ContinuousLine.ContinuousDoubleFunction width) Create geometry based on design line, flattener, offset and width information.offset()
Returns the value of theoffset
record component.final String
toString()
Returns a string representation of this record class.width()
Returns the value of thewidth
record component.
-
Constructor Details
-
CrossSectionGeometry
public CrossSectionGeometry(org.opentrafficsim.base.geometry.OtsLine2d centerLine, org.djutils.draw.line.Polygon2d contour, ContinuousLine.ContinuousDoubleFunction offset, ContinuousLine.ContinuousDoubleFunction width) Constructor.- Throws:
NullPointerException
- when centerLine, contour or slices isnull
-
-
Method Details
-
of
public static CrossSectionGeometry of(ContinuousLine designLine, Flattener flattener, ContinuousLine.ContinuousDoubleFunction offset, ContinuousLine.ContinuousDoubleFunction width) Create geometry based on design line, flattener, offset and width information.- Parameters:
designLine
- design line relative to which offsets are definedflattener
- flattener to flatten center line and contouroffset
- offset informationwidth
- offset information- Returns:
- geometry for cross-section element
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
centerLine
public org.opentrafficsim.base.geometry.OtsLine2d centerLine()Returns the value of thecenterLine
record component.- Returns:
- the value of the
centerLine
record component
-
contour
public org.djutils.draw.line.Polygon2d contour()Returns the value of thecontour
record component.- Returns:
- the value of the
contour
record component
-
offset
Returns the value of theoffset
record component.- Returns:
- the value of the
offset
record component
-
width
Returns the value of thewidth
record component.- Returns:
- the value of the
width
record component
-