Class CrossSectionLink
java.lang.Object
org.djutils.event.LocalEventProducer
org.opentrafficsim.core.network.Link
org.opentrafficsim.road.network.lane.CrossSectionLink
- All Implemented Interfaces:
nl.tudelft.simulation.dsol.animation.Locatable,Identifiable,EventProducer,OtsShape,HierarchicallyTyped<LinkType,Link>
A CrossSectionLink is a link with lanes where GTUs can possibly switch between lanes.
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
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EventTypeThe (regular, not timed) event type for pub/sub indicating the addition of a Lane to a CrossSectionLink.static final EventTypeThe (regular, not timed) event type for pub/sub indicating the removal of a Lane from a CrossSectionLink.Fields inherited from class org.opentrafficsim.core.network.Link
GTU_ADD_EVENT, GTU_REMOVE_EVENTFields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITIONFields inherited from interface org.opentrafficsim.base.geometry.OtsShape
DEFAULT_POLYGON_SEGMENTS, WORLD_MARGIN_LINE -
Constructor Summary
ConstructorsConstructorDescriptionCrossSectionLink(RoadNetwork network, String id, Node startNode, Node endNode, LinkType linkType, OtsLine2d designLine, ContinuousPiecewiseLinearFunction elevation, LaneKeepingPolicy laneKeepingPolicy) Construction of a cross section link. -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidAdd a cross section element at the end of the list.final Optional<CrossSectionElement>Find a cross section element with a specified id.final List<CrossSectionElement>Retrieve a safe copy of the cross section element list.Returns the line over which GTUs enter and leave the link at the end node.final LaneKeepingPolicyRetrieve the lane keeping policy.getLanes()Return a safe copy of the list of lanes of this CrossSectionLink.Return a safe copy of the list of lanes and shoulders of this CrossSectionLink.Sets the priority.Return a safe copy of the list of shoulders of this CrossSectionLink.Returns the line over which GTUs enter and leave the link at the start node.final voidsetPriority(CrossSectionLink.Priority priority) Returns the priority.final StringtoString()Methods inherited from class org.opentrafficsim.core.network.Link
addGTU, equals, getAbsoluteContour, getDesignLine, getElevation, getElevation, getEndNode, getGrade, getGrade, getGTUCount, getGTUs, getId, getLength, getLocation, getRelativeBounds, getRelativeContour, getSimulator, getStartNode, getType, hashCode, isConnector, removeGTUMethods inherited from class org.djutils.event.LocalEventProducer
getEventListenerMapMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListenerMethods inherited from interface org.opentrafficsim.base.HierarchicallyTyped
isOfTypeMethods inherited from interface nl.tudelft.simulation.dsol.animation.Locatable
getZMethods inherited from interface org.opentrafficsim.base.geometry.OtsShape
contains, contains, getAbsoluteBounds, getAbsoluteContour, getDirZ, signedDistance, signedDistance
-
Field Details
-
LANE_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of a Lane to a CrossSectionLink.
Payload: Object[] { String networkId, String linkId, String LaneId, int laneNumber }
TODO work in a different way with lane numbers to align to standard lane numbering. -
LANE_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of a Lane from a CrossSectionLink.
Payload: Object[] { String networkId, String linkId, String LaneId }
TODO allow for the removal of a Lane; currently this is not possible.
-
-
Constructor Details
-
CrossSectionLink
public CrossSectionLink(RoadNetwork network, String id, Node startNode, Node endNode, LinkType linkType, OtsLine2d designLine, ContinuousPiecewiseLinearFunction elevation, LaneKeepingPolicy laneKeepingPolicy) throws NetworkException Construction of a cross section link.- Parameters:
network- the networkid- the link id.startNode- the start node (directional).endNode- the end node (directional).linkType- the link typedesignLine- the design line of the Linkelevation- elevation given over fractional length, may benull.laneKeepingPolicy- the policy to generally keep left, keep right, or keep lane- 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 Details
-
getNetwork
- Overrides:
getNetworkin classLink
-
addCrossSectionElement
Add a cross section element at the end of the list.
Note: LEFT is seen as a positive lateral direction, RIGHT as a negative lateral direction.- Parameters:
cse- the cross section element to add.
-
getCrossSectionElementList
Retrieve a safe copy of the cross section element list.- Returns:
- the cross section element list.
-
getLaneKeepingPolicy
Retrieve the lane keeping policy.- Returns:
- the lane keeping policy on this CrossSectionLink
-
getCrossSectionElement
Find a cross section element with a specified id.- Parameters:
id- the id to search for- Returns:
- the cross section element with the given id, empty if not found
-
getLanes
Return a safe copy of the list of lanes of this CrossSectionLink.- Returns:
- the list of lanes.
-
getShoulders
Return a safe copy of the list of shoulders of this CrossSectionLink.- Returns:
- the list of lanes.
-
getLanesAndShoulders
Return a safe copy of the list of lanes and shoulders of this CrossSectionLink.- Returns:
- the list of lanes.
-
getPriority
Sets the priority.- Returns:
- priority.
-
setPriority
Returns the priority.- Parameters:
priority- set priority.
-
getStartLine
Returns the line over which GTUs enter and leave the link at the start node.- Returns:
- line over which GTUs enter and leave the link at the start node
-
getEndLine
Returns the line over which GTUs enter and leave the link at the end node.- Returns:
- line over which GTUs enter and leave the link at the end node
-
toString
-