Class CrossSectionLink
java.lang.Object
org.djutils.event.LocalEventProducer
org.opentrafficsim.core.network.Link
org.opentrafficsim.road.network.lane.CrossSectionLink
- All Implemented Interfaces:
Serializable,Remote,nl.tudelft.simulation.dsol.animation.Locatable,org.djutils.base.Identifiable,org.djutils.event.EventProducer,org.opentrafficsim.base.geometry.OtsLocatable,org.opentrafficsim.base.HierarchicallyTyped<LinkType,,Link> Drawable,SpatialObject
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
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.djutils.event.EventTypeThe (regular, not timed) event type for pub/sub indicating the addition of a Lane to a CrossSectionLink.static final org.djutils.event.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_POSITION -
Constructor Summary
ConstructorsConstructorDescriptionCrossSectionLink(RoadNetwork network, String id, Node startNode, Node endNode, LinkType linkType, OtsLine2d designLine, FractionalLengthData 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 CrossSectionElementFind a cross section element with a specified id.final List<CrossSectionElement>Retrieve a safe copy of the cross section element list.org.djutils.draw.line.PolyLine2dReturns 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.Return a safe copy of the list of shoulders of this CrossSectionLink.org.djutils.draw.line.PolyLine2dReturns the line over which GTUs enter and leave the link at the start node.final voidsetPriority(CrossSectionLink.Priority priority) final StringtoString()Methods inherited from class org.opentrafficsim.core.network.Link
addGTU, equals, getBounds, getDesignLine, getElevation, getElevation, getEndNode, getGrade, getGrade, getGTUCount, getGTUs, getId, getLength, getLocation, getShape, getSimulator, getStartNode, getType, hashCode, isConnector, removeGTUMethods 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, removeListenerMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opentrafficsim.base.HierarchicallyTyped
isOfTypeMethods inherited from interface nl.tudelft.simulation.dsol.animation.Locatable
getDirZ, getZ
-
Field Details
-
LANE_ADD_EVENT
public static final org.djutils.event.EventType LANE_ADD_EVENTThe (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
public static final org.djutils.event.EventType LANE_REMOVE_EVENTThe (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, FractionalLengthData elevation, LaneKeepingPolicy laneKeepingPolicy) throws NetworkException Construction of a cross section link.- Parameters:
network- RoadNetwork; the networkid- String; the link id.startNode- Node; the start node (directional).endNode- Node; the end node (directional).linkType- LinkType; the link typedesignLine- OtsLine2d; the design line of the Linkelevation- FractionalLengthData; elevation given over fractional length, may benull.laneKeepingPolicy- 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- CrossSectionElement; the cross section element to add.
-
getCrossSectionElementList
Retrieve a safe copy of the cross section element list.- Returns:
- List<CrossSectionElement>; the cross section element list.
-
getLaneKeepingPolicy
Retrieve the lane keeping policy.- Returns:
- LaneKeepingPolicy; the lane keeping policy on this CrossSectionLink
-
getCrossSectionElement
Find a cross section element with a specified id.- Parameters:
id- String; the id to search for- Returns:
- CrossSectionElement; the cross section element with the given id, or null if not found
-
getLanes
Return a safe copy of the list of lanes of this CrossSectionLink.- Returns:
- List<Lane>; the list of lanes.
-
getShoulders
Return a safe copy of the list of shoulders of this CrossSectionLink.- Returns:
- List<Shoulder>; the list of lanes.
-
getLanesAndShoulders
Return a safe copy of the list of lanes and shoulders of this CrossSectionLink.- Returns:
- List<Lane>; the list of lanes.
-
getPriority
- Returns:
- priority.
-
setPriority
- Parameters:
priority- Priority; set priority.
-
getStartLine
public org.djutils.draw.line.PolyLine2d getStartLine()Returns the line over which GTUs enter and leave the link at the start node.- Returns:
- PolyLine2d; line over which GTUs enter and leave the link at the start node
-
getEndLine
public org.djutils.draw.line.PolyLine2d getEndLine()Returns the line over which GTUs enter and leave the link at the end node.- Returns:
- PolyLine2d; line over which GTUs enter and leave the link at the end node
-
toString
-