Class Stripe
java.lang.Object
org.djutils.event.LocalEventProducer
org.opentrafficsim.road.network.lane.CrossSectionElement
org.opentrafficsim.road.network.lane.Stripe
- All Implemented Interfaces:
Serializable
,Remote
,Locatable
,org.djutils.event.EventProducer
,org.opentrafficsim.base.Identifiable
,Drawable
Copyright (c) 2013-2023 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 enum
Defines the visible type of the stripe, and the standard permeability that pertains to it. -
Field Summary
Fields inherited from class org.opentrafficsim.road.network.lane.CrossSectionElement
crossSectionSlices, FIXUPPOINTPROPORTION, length, MAXIMUMDIRECTIONERROR, parentLink
Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITION
-
Constructor Summary
ConstructorsConstructorDescriptionStripe
(Stripe.Type type, CrossSectionLink parentLink, List<CrossSectionSlice> crossSectionSlices) Constructor for elaborate longitudinal property changes.Stripe
(Stripe.Type type, CrossSectionLink parentLink, Length lateralCenterPosition, Length width) Constructor for constant properties along the length.Stripe
(Stripe.Type type, CrossSectionLink parentLink, Length startCenterPosition, Length endCenterPosition, Length beginWidth, Length endWidth, boolean fixGradualLateralOffset) Constructor allowing difference at start at end. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPermeability
(GtuType gtuType, LateralDirectionality lateralDirection) Add lateral permeability for a GTU type in the direction of the design line of the overarching CrossSectionLink.void
Clears the overrule type, after which the normal type will hold.getType()
Returns the stripe type.final double
getZ()
Retrieve the Z offset (used to determine what covers what when drawing).final boolean
isPermeable
(GtuType gtuType, LateralDirectionality lateralDirection) Returns whether the given GTU type is allowed to cross the line in the given lateral direction.void
setOverruleType
(Stripe.Type overruleType) Sets an overruling stripe type.Methods inherited from class org.opentrafficsim.road.network.lane.CrossSectionElement
constructContour, equals, getBeginWidth, getBounds, getCenterLine, getContour, getDesignLineOffsetAtBegin, getDesignLineOffsetAtEnd, getEndWidth, getFullId, getId, getLateralBoundaryPosition, getLateralBoundaryPosition, getLateralCenterPosition, getLateralCenterPosition, getLength, getLocation, getNetwork, getParentLink, getWidth, getWidth, 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
-
Constructor Details
-
Stripe
public Stripe(Stripe.Type type, CrossSectionLink parentLink, Length startCenterPosition, Length endCenterPosition, Length beginWidth, Length endWidth, boolean fixGradualLateralOffset) throws OtsGeometryException, NetworkException Constructor allowing difference at start at end.- Parameters:
type
- Type; strip type defining appearance and default permeability.parentLink
- CrossSectionLink; Cross Section Link to which the element belongs.startCenterPosition
- Length; the lateral start position compared to the linear geometry of the Cross Section Link at the start of the road marker.endCenterPosition
- Length; the lateral end position compared to the linear geometry of the Cross Section Link at the end of the road marker.beginWidth
- Length; start width, positioned <i>symmetrically around</i> the lateral start position.endWidth
- Length; end width, positioned <i>symmetrically around</i> the lateral end position.fixGradualLateralOffset
- boolean; true if gradualLateralOffset needs to be fixed- Throws:
OtsGeometryException
- when creation of the center line or contour geometry failsNetworkException
- when id equal to null or not unique
-
Stripe
public Stripe(Stripe.Type type, CrossSectionLink parentLink, Length lateralCenterPosition, Length width) throws OtsGeometryException, NetworkException Constructor for constant properties along the length.- Parameters:
type
- Type; strip type defining appearance and default permeability.parentLink
- CrossSectionLink; Cross Section Link to which the element belongs.lateralCenterPosition
- Length; the lateral start position compared to the linear geometry of the Cross Section Link.width
- Length; start width, positioned <i>symmetrically around</i> the lateral start position.- Throws:
OtsGeometryException
- when creation of the center line or contour geometry failsNetworkException
- when id equal to null or not unique
-
Stripe
public Stripe(Stripe.Type type, CrossSectionLink parentLink, List<CrossSectionSlice> crossSectionSlices) throws OtsGeometryException, NetworkException Constructor for elaborate longitudinal property changes.- Parameters:
type
- Type; strip type defining appearance and default permeability.parentLink
- CrossSectionLink; Cross Section Link to which the element belongs.crossSectionSlices
- List<CrossSectionSlice>; The offsets and widths at positions along the line, relative to the design line of the parent link. If there is just one with and offset, there should just be one element in the list with Length = 0. If there are more slices, the last one should be at the length of the design line. If not, a NetworkException is thrown.- Throws:
OtsGeometryException
- when creation of the center line or contour geometry failsNetworkException
- when id equal to null or not unique
-
-
Method Details
-
getType
Returns the stripe type.- Returns:
- Type; stripe type.
-
setOverruleType
Sets an overruling stripe type. This can be used for e.g. rush-hour lanes, without changing the appearance of the stripe. Note that custom set permeabilities (addPermeability()) remain active.- Parameters:
overruleType
- Type; overruling stripe type.
-
clearOverruleType
public void clearOverruleType()Clears the overrule type, after which the normal type will hold. -
getZ
public final double getZ()Retrieve the Z offset (used to determine what covers what when drawing).- Specified by:
getZ
in interfaceLocatable
- Overrides:
getZ
in classCrossSectionElement
- Returns:
- double; the Z-offset for drawing (what's on top, what's underneath).
-
addPermeability
Add lateral permeability for a GTU type in the direction of the design line of the overarching CrossSectionLink. Add NONE to prevent lane changes relative to the stripe type. Add LEFT or RIGHT, or both in two calls, to enable lane changes relative to the stripe type.- Parameters:
gtuType
- GtuType; GTU type to add permeability for.lateralDirection
- LateralDirectionality; direction to add compared to the direction of the design line.
-
isPermeable
Returns whether the given GTU type is allowed to cross the line in the given lateral direction.- Parameters:
gtuType
- GtuType; GTU type to look for.lateralDirection
- LateralDirectionality; direction to look for (LEFT or RIGHT) compared to the direction of the design line.- Returns:
- whether the road marker is permeable for the GTU type.
-