Package org.opentrafficsim.kpi.sampling
Class CrossSection
java.lang.Object
org.opentrafficsim.kpi.sampling.CrossSection
- All Implemented Interfaces:
Serializable
,Iterable<CrossSection.LanePosition>
public class CrossSection
extends Object
implements Serializable, Iterable<CrossSection.LanePosition>
A cross sections contains locations on lanes that together make up a cross section. It is not required that this is on a
single road, i.e. the cross section may be any section in space.
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, Wouter Schakel
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
Position on a lane. -
Constructor Summary
ConstructorsConstructorDescriptionCrossSection
(Set<CrossSection.LanePosition> lanePositions) Constructor with set of lane positions.CrossSection
(LinkData<?> link, double fraction) Constructor with link and fraction. -
Method Summary
Modifier and TypeMethodDescriptionfinal Set<CrossSection.LanePosition>
Returns a safe copy of the lane positions.iterator()
Returns an iterator over the lane positions.final int
size()
Returns the number of lane positions.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
CrossSection
Constructor with set of lane positions.- Parameters:
lanePositions
- set of lane locations
-
CrossSection
Constructor with link and fraction. Note that the fraction is used with the length of each lane. For curved links this fraction may not point to locations on the lane that are perfectly laterally adjacent. GTUs can thus possibly change lane at these gaps and be missed.- Parameters:
link
- linkfraction
- fraction on link
-
-
Method Details
-
size
public final int size()Returns the number of lane positions.- Returns:
- number of directed lane positions
-
getLanePositions
Returns a safe copy of the lane positions.- Returns:
- safe copy of lane positions
-
iterator
Returns an iterator over the lane positions.- Specified by:
iterator
in interfaceIterable<CrossSection.LanePosition>
- Returns:
- iterator over lane positions
-
toString
-