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.
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description LaneDirection(Lane lane, GTUDirectionality direction)
-
Method Summary
Modifier and Type Method Description Length
coveredDistance(double fraction)
Returns the covered distance driven to the given fractional position.boolean
equals(java.lang.Object obj)
double
fractionAtCoveredDistance(Length distance)
Returns the fraction along the design line for having covered the given distance.LaneDirection
getAdjacentLaneDirection(LateralDirectionality laneChangeDirection, LaneBasedGTU gtu)
Returns the adjacent lane and direction.GTUDirectionality
getDirection()
Lane
getLane()
Length
getLength()
Returns the length of the lane.DirectedPoint
getLocationFraction(double fraction)
Returns a directed point at the given fraction, in the direction of travel (not center line).java.util.Set<LaneDirection>
getNextForRoute(LaneBasedGTU gtu)
Returns a set ofLaneDirection
's that can be followed considering the route.LaneDirection
getNextLaneDirection(LaneBasedGTU gtu)
Returns the next lane and direction.int
hashCode()
Length
remainingDistance(double fraction)
Returns the remaining distance to be driven from the given fractional position.java.lang.String
toString()
-
Constructor Details
-
LaneDirection
- Parameters:
lane
- Lane; the lanedirection
- GTUDirectionality; the direction to drive on this lane
-
-
Method Details
-
getLane
- Returns:
- the lane
-
getDirection
- Returns:
- the direction to drive on this lane
-
coveredDistance
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
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
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
Returns the next lane and direction.- Parameters:
gtu
- LaneBasedGTU; gtu- Returns:
- LaneDirection; next lane and direction,
null
if none
-
getNextForRoute
Returns a set ofLaneDirection
'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
Returns the length of the lane.- Returns:
- Length; length of the lane
-
getLocationFraction
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; gtulaneChangeDirection
- LateralDirectionality; lane change direction- Returns:
- LaneDirection; adjacent lane and direction,
null
if none
-
toString
public final java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
hashCode
public final int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object obj)- Overrides:
equals
in classjava.lang.Object
-