Class LaneDirection
- java.lang.Object
-
- org.opentrafficsim.road.network.lane.LaneDirection
-
- All Implemented Interfaces:
Serializable
public class LaneDirection extends Object implements 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.
$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Mar 30, 2016
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Length
coveredDistance(double fraction)
Returns the covered distance driven to the given fractional position.boolean
equals(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).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.String
toString()
-
-
-
Constructor Detail
-
LaneDirection
public LaneDirection(Lane lane, GTUDirectionality direction)
- Parameters:
lane
- Lane; the lanedirection
- GTUDirectionality; the direction to drive on this lane
-
-
Method Detail
-
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 Set<LaneDirection> getNextForRoute(LaneBasedGTU gtu)
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
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; gtulaneChangeDirection
- LateralDirectionality; lane change direction- Returns:
- LaneDirection; adjacent lane and direction,
null
if none
-
-