Class RoadMarkerAlong

java.lang.Object
All Implemented Interfaces:
java.io.Serializable, Locatable, EventProducerInterface, Identifiable, Drawable
Direct Known Subclasses:
Barrier, Stripe

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
  • Constructor Details

    • 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 fails
      NetworkException - 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 fails
      NetworkException - 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 fails
      NetworkException - when id equal to null or not unique
    • RoadMarkerAlong

      public RoadMarkerAlong​(CrossSectionLink parentLink, java.util.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 fails
      NetworkException - 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 belongs
      newSimulator - SimulatorInterface.TimeDoubleUnit; the new simulator for this network
      cse - 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 Details

    • getZ

      protected final double getZ()
      Retrieve the Z offset (used to determine what covers what when drawing).
      Specified by:
      getZ in class CrossSectionElement
      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 java.util.Map<GTUType,​java.util.Set<LateralDirectionality>> getPermeabilityMap()
      Returns:
      permeabilityMap for internal use in (sub)classes.