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

public class CrossSectionLink extends Link implements Serializable
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:
  • Field Details

    • LANE_ADD_EVENT

      public static final org.djutils.event.EventType 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

      public static final org.djutils.event.EventType 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, FractionalLengthData elevation, LaneKeepingPolicy laneKeepingPolicy) throws NetworkException
      Construction of a cross section link.
      Parameters:
      network - RoadNetwork; the network
      id - String; the link id.
      startNode - Node; the start node (directional).
      endNode - Node; the end node (directional).
      linkType - LinkType; the link type
      designLine - OtsLine2d; the design line of the Link
      elevation - FractionalLengthData; elevation given over fractional length, may be null.
      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

      public RoadNetwork getNetwork()
      Overrides:
      getNetwork in class Link
    • addCrossSectionElement

      protected final void addCrossSectionElement(CrossSectionElement cse)
      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

      public final List<CrossSectionElement> getCrossSectionElementList()
      Retrieve a safe copy of the cross section element list.
      Returns:
      List<CrossSectionElement>; the cross section element list.
    • getLaneKeepingPolicy

      public final LaneKeepingPolicy getLaneKeepingPolicy()
      Retrieve the lane keeping policy.
      Returns:
      LaneKeepingPolicy; the lane keeping policy on this CrossSectionLink
    • getCrossSectionElement

      public final CrossSectionElement getCrossSectionElement(String id)
      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

      public final List<Lane> getLanes()
      Return a safe copy of the list of lanes of this CrossSectionLink.
      Returns:
      List<Lane>; the list of lanes.
    • getShoulders

      public final List<Shoulder> getShoulders()
      Return a safe copy of the list of shoulders of this CrossSectionLink.
      Returns:
      List<Shoulder>; the list of lanes.
    • getLanesAndShoulders

      public final List<Lane> getLanesAndShoulders()
      Return a safe copy of the list of lanes and shoulders of this CrossSectionLink.
      Returns:
      List<Lane>; the list of lanes.
    • getPriority

      public final CrossSectionLink.Priority getPriority()
      Returns:
      priority.
    • setPriority

      public final void setPriority(CrossSectionLink.Priority priority)
      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

      public final String toString()
      Overrides:
      toString in class Link