Class Stripe

java.lang.Object
org.djutils.event.LocalEventProducer
org.opentrafficsim.road.network.lane.CrossSectionElement
org.opentrafficsim.road.network.lane.Stripe
All Implemented Interfaces:
Serializable, Remote, Locatable, org.djutils.event.EventProducer, org.opentrafficsim.base.Identifiable, Drawable

public class Stripe extends CrossSectionElement

Copyright (c) 2013-2023 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, Wouter Schakel
See Also:
  • Constructor Details

    • Stripe

      public Stripe(Stripe.Type type, CrossSectionLink parentLink, Length startCenterPosition, Length endCenterPosition, Length beginWidth, Length endWidth, boolean fixGradualLateralOffset) throws OtsGeometryException, NetworkException
      Constructor allowing difference at start at end.
      Parameters:
      type - Type; strip type defining appearance and default permeability.
      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
    • Stripe

      public Stripe(Stripe.Type type, CrossSectionLink parentLink, Length lateralCenterPosition, Length width) throws OtsGeometryException, NetworkException
      Constructor for constant properties along the length.
      Parameters:
      type - Type; strip type defining appearance and default permeability.
      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
    • Stripe

      public Stripe(Stripe.Type type, CrossSectionLink parentLink, List<CrossSectionSlice> crossSectionSlices) throws OtsGeometryException, NetworkException
      Constructor for elaborate longitudinal property changes.
      Parameters:
      type - Type; strip type defining appearance and default permeability.
      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
  • Method Details

    • getType

      public Stripe.Type getType()
      Returns the stripe type.
      Returns:
      Type; stripe type.
    • setOverruleType

      public void setOverruleType(Stripe.Type overruleType)
      Sets an overruling stripe type. This can be used for e.g. rush-hour lanes, without changing the appearance of the stripe. Note that custom set permeabilities (addPermeability()) remain active.
      Parameters:
      overruleType - Type; overruling stripe type.
    • clearOverruleType

      public void clearOverruleType()
      Clears the overrule type, after which the normal type will hold.
    • getZ

      public final double getZ()
      Retrieve the Z offset (used to determine what covers what when drawing).
      Specified by:
      getZ in interface Locatable
      Overrides:
      getZ in class CrossSectionElement
      Returns:
      double; the Z-offset for drawing (what's on top, what's underneath).
    • addPermeability

      public void addPermeability(GtuType gtuType, LateralDirectionality lateralDirection)
      Add lateral permeability for a GTU type in the direction of the design line of the overarching CrossSectionLink. Add NONE to prevent lane changes relative to the stripe type. Add LEFT or RIGHT, or both in two calls, to enable lane changes relative to the stripe type.
      Parameters:
      gtuType - GtuType; GTU type to add permeability for.
      lateralDirection - LateralDirectionality; direction to add compared to the direction of the design line.
    • isPermeable

      public final boolean isPermeable(GtuType gtuType, LateralDirectionality lateralDirection)
      Returns whether the given GTU type is allowed to cross the line in the given lateral direction.
      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.