Class LaneDirection

java.lang.Object
org.opentrafficsim.road.network.lane.LaneDirection
All Implemented Interfaces:
java.io.Serializable

public class LaneDirection
extends java.lang.Object
implements java.io.Serializable
Combines a Lane with its GTUDirectionality.

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-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Mar 30, 2016
Author:
Alexander Verbraeck, Peter Knoppers
See Also:
Serialized Form
  • Constructor Details

    • LaneDirection

      public LaneDirection​(Lane lane, GTUDirectionality direction)
      Parameters:
      lane - Lane; the lane
      direction - GTUDirectionality; the direction to drive on this lane
  • Method Details

    • getLane

      public final Lane getLane()
      Returns:
      the lane
    • getDirection

      public final GTUDirectionality getDirection()
      Returns:
      the direction to drive on this lane
    • coveredDistance

      public final Length coveredDistance​(double fraction)
      Returns the covered distance driven to the given fractional position.
      Parameters:
      fraction - double; fractional position
      Returns:
      Length; covered distance driven to the given fractional position
    • remainingDistance

      public final Length remainingDistance​(double fraction)
      Returns the remaining distance to be driven from the given fractional position.
      Parameters:
      fraction - double; fractional position
      Returns:
      Length; remaining distance to be driven from the given fractional position
    • fractionAtCoveredDistance

      public final double fractionAtCoveredDistance​(Length distance)
      Returns the fraction along the design line for having covered the given distance.
      Parameters:
      distance - Length; covered distance
      Returns:
      double; fraction along the design line for having covered the given distance
    • getNextLaneDirection

      public final LaneDirection getNextLaneDirection​(LaneBasedGTU gtu)
      Returns the next lane and direction.
      Parameters:
      gtu - LaneBasedGTU; gtu
      Returns:
      LaneDirection; next lane and direction, null if none
    • getNextForRoute

      public java.util.Set<LaneDirection> getNextForRoute​(LaneBasedGTU gtu)
      Returns a set of LaneDirection's that can be followed considering the route.
      Parameters:
      gtu - LaneBasedGTU; GTU
      Returns:
      set of LaneDirection's that can be followed considering the route
    • getLength

      public Length getLength()
      Returns the length of the lane.
      Returns:
      Length; length of the lane
    • getLocationFraction

      public DirectedPoint getLocationFraction​(double fraction) throws OTSGeometryException
      Returns a directed point at the given fraction, in the direction of travel (not center line).
      Parameters:
      fraction - double; fractional position
      Returns:
      directed point at the given fraction, in the direction of travel
      Throws:
      OTSGeometryException - in case the fractional position is not correct
    • getAdjacentLaneDirection

      public final LaneDirection getAdjacentLaneDirection​(LateralDirectionality laneChangeDirection, LaneBasedGTU gtu)
      Returns the adjacent lane and direction.
      Parameters:
      gtu - LaneBasedGTU; gtu
      laneChangeDirection - LateralDirectionality; lane change direction
      Returns:
      LaneDirection; adjacent lane and direction, null if none
    • toString

      public final java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public final boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object