Class RoadMarkerAlong
- java.lang.Object
-
- org.djutils.event.EventProducer
-
- org.opentrafficsim.road.network.lane.CrossSectionElement
-
- org.opentrafficsim.road.network.lane.RoadMarkerAlong
-
- All Implemented Interfaces:
Serializable
,Locatable
,EventProducerInterface
,Identifiable
,Drawable
public abstract class RoadMarkerAlong extends CrossSectionElement
Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.$LastChangedDate: 2015-09-03 13:38:01 +0200 (Thu, 03 Sep 2015) $, @version $Revision: 1378 $, by $Author: averbraeck $, initial version Oct 25, 2014
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.opentrafficsim.road.network.lane.CrossSectionElement
crossSectionSlices, FIXUPPOINTPROPORTION, length, MAXIMUMDIRECTIONERROR, parentLink
-
Fields inherited from class org.djutils.event.EventProducer
eventProducerImpl
-
Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
-
-
Constructor Summary
Constructors Modifier Constructor Description RoadMarkerAlong(CrossSectionLink parentLink, List<CrossSectionSlice> crossSectionSlices)
Note: LEFT is seen as a positive lateral direction, RIGHT as a negative lateral direction, with the direction from the StartNode towards the EndNode as the longitudinal direction.protected
RoadMarkerAlong(CrossSectionLink newCrossSectionLink, SimulatorInterface.TimeDoubleUnit newSimulator, RoadMarkerAlong cse)
Clone a RoadMarkerAlong for a new network.RoadMarkerAlong(CrossSectionLink parentLink, Length lateralCenterPosition, Length width)
Note: LEFT is seen as a positive lateral direction, RIGHT as a negative lateral direction, with the direction from the StartNode towards the EndNode as the longitudinal direction.RoadMarkerAlong(CrossSectionLink parentLink, Length startCenterPosition, Length endCenterPosition, Length beginWidth, Length endWidth)
Note: LEFT is seen as a positive lateral direction, RIGHT as a negative lateral direction, with the direction from the StartNode towards the EndNode as the longitudinal direction.RoadMarkerAlong(CrossSectionLink parentLink, Length startCenterPosition, Length endCenterPosition, Length beginWidth, Length endWidth, boolean fixGradualLateralOffset)
Note: LEFT is seen as a positive lateral direction, RIGHT as a negative lateral direction, with the direction from the StartNode towards the EndNode as the longitudinal direction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPermeability(GTUType gtuType, LateralDirectionality lateralDirection)
Add lateral permeability for a GTU type in the direction of the design line of the overarching CrossSectionLink.protected Map<GTUType,Set<LateralDirectionality>>
getPermeabilityMap()
protected double
getZ()
Retrieve the Z offset (used to determine what covers what when drawing).boolean
isPermeable(GTUType gtuType, LateralDirectionality lateralDirection)
-
Methods inherited from class org.opentrafficsim.road.network.lane.CrossSectionElement
clone, constructContour, equals, getBeginWidth, getBounds, getCenterLine, getContour, getDesignLineOffsetAtBegin, getDesignLineOffsetAtEnd, getEndWidth, getFullId, getId, getLateralBoundaryPosition, getLateralBoundaryPosition, getLateralCenterPosition, getLateralCenterPosition, getLength, getLocation, getNetwork, getParentLink, getSourceId, getWidth, getWidth, hashCode, toString
-
Methods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
-
-
-
Constructor Detail
-
RoadMarkerAlong
public RoadMarkerAlong(CrossSectionLink parentLink, Length startCenterPosition, Length endCenterPosition, Length beginWidth, Length endWidth, boolean fixGradualLateralOffset) throws OTSGeometryException, NetworkException
Note: LEFT is seen as a positive lateral direction, RIGHT as a negative lateral direction, with the direction from the StartNode towards the EndNode as the longitudinal direction.- Parameters:
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
-
RoadMarkerAlong
public RoadMarkerAlong(CrossSectionLink parentLink, Length startCenterPosition, Length endCenterPosition, Length beginWidth, Length endWidth) throws OTSGeometryException, NetworkException
Note: LEFT is seen as a positive lateral direction, RIGHT as a negative lateral direction, with the direction from the StartNode towards the EndNode as the longitudinal direction.- Parameters:
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.- Throws:
OTSGeometryException
- when creation of the center line or contour geometry failsNetworkException
- when id equal to null or not unique
-
RoadMarkerAlong
public RoadMarkerAlong(CrossSectionLink parentLink, Length lateralCenterPosition, Length width) throws OTSGeometryException, NetworkException
Note: LEFT is seen as a positive lateral direction, RIGHT as a negative lateral direction, with the direction from the StartNode towards the EndNode as the longitudinal direction.- Parameters:
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
-
RoadMarkerAlong
public RoadMarkerAlong(CrossSectionLink parentLink, List<CrossSectionSlice> crossSectionSlices) throws OTSGeometryException, NetworkException
Note: LEFT is seen as a positive lateral direction, RIGHT as a negative lateral direction, with the direction from the StartNode towards the EndNode as the longitudinal direction.- Parameters:
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
-
RoadMarkerAlong
protected RoadMarkerAlong(CrossSectionLink newCrossSectionLink, SimulatorInterface.TimeDoubleUnit newSimulator, RoadMarkerAlong cse) throws NetworkException
Clone a RoadMarkerAlong for a new network.- Parameters:
newCrossSectionLink
- CrossSectionLink; the new link to which the clone belongsnewSimulator
- SimulatorInterface.TimeDoubleUnit; the new simulator for this networkcse
- RoadMarkerAlong; the element to clone from- Throws:
NetworkException
- if link already exists in the network, if name of the link is not unique, or if the start node or the end node of the link are not registered in the network.
-
-
Method Detail
-
getZ
protected final double getZ()
Retrieve the Z offset (used to determine what covers what when drawing).- Specified by:
getZ
in classCrossSectionElement
- Returns:
- double; the Z-offset for drawing (what's on top, what's underneath).
-
addPermeability
public final void addPermeability(GTUType gtuType, LateralDirectionality lateralDirection)
Add lateral permeability for a GTU type in the direction of the design line of the overarching CrossSectionLink. Therefore, the lateral directionality of one-sided permeability has to be switched for left lanes. This is done because the CrossSectionLink has no idea in which direction vehicles will be moving. On a 1+1 lane road with overtaking possibilities, the longitudinal directionality of both lanes will be BOTH. Example:Suppose the design line runs from left to right. ========================= LANE 1L (BACKWARD) GTUs are allowed to move to lane 2L Permeability RIGHT is true, although vehicles will go to the LEFT... ------------------------- ========================= LANE 2L (BACKWARD) GTUs are NOT allowed to move to lane 1L nor to lane 2R No permeability defined (empty set) ========================= ========================= LANE 2R (FORWARD) GTUs are NOT allowed to move to lane 1R nor to lane 2L No permeability defined (empty set) ========================= ------------------------- LANE 1R (FORWARD) GTUs are allowed to move to lane 2R Permeability LEFT is true =========================
Note: GTUType.ALL can be used to set permeability for all types of GTU at once.- Parameters:
gtuType
- GTUType; GTU type to add permeability for.lateralDirection
- LateralDirectionality; direction to add (LEFT or RIGHT) compared to the direction of the design line.
-
isPermeable
public final boolean isPermeable(GTUType gtuType, LateralDirectionality lateralDirection)
- 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.
-
getPermeabilityMap
protected final Map<GTUType,Set<LateralDirectionality>> getPermeabilityMap()
- Returns:
- permeabilityMap for internal use in (sub)classes.
-
-