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 LengthcoveredDistance(double fraction)Returns the covered distance driven to the given fractional position.booleanequals(java.lang.Object obj)doublefractionAtCoveredDistance(Length distance)Returns the fraction along the design line for having covered the given distance.LaneDirectiongetAdjacentLaneDirection(LateralDirectionality laneChangeDirection, LaneBasedGTU gtu)Returns the adjacent lane and direction.GTUDirectionalitygetDirection()LanegetLane()LengthgetLength()Returns the length of the lane.DirectedPointgetLocationFraction(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.LaneDirectiongetNextLaneDirection(LaneBasedGTU gtu)Returns the next lane and direction.inthashCode()LengthremainingDistance(double fraction)Returns the remaining distance to be driven from the given fractional position.java.lang.StringtoString()
-
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,
nullif 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,
nullif none
-
toString
public final java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
hashCode
public final int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-