Class DirectedLanePosition
java.lang.Object
org.opentrafficsim.road.network.lane.DirectedLanePosition
- All Implemented Interfaces:
java.io.Serializable
public class DirectedLanePosition
extends java.lang.Object
implements java.io.Serializable
Store one position, direction and lane of a GTU.
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 DirectedLanePosition(Lane lane, Length position, GTUDirectionality gtuDirection)Construct a new DirectedLanePosition. -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object obj)GTUDirectionalitygetGtuDirection()Retrieve the gtuDirection.LanegetLane()Retrieve the lane.LaneDirectiongetLaneDirection()Returns the lane direction in the direction of this lane direction.LinkDirectiongetLinkDirection()Returns the link direction in the direction of this lane direction.DirectedPointgetLocation()Retrieve the location and direction of the GTU on the lane.LengthgetPosition()Retrieve the position on the lane.inthashCode()java.lang.StringtoString()
-
Constructor Details
-
DirectedLanePosition
public DirectedLanePosition(Lane lane, Length position, GTUDirectionality gtuDirection) throws GTUExceptionConstruct a new DirectedLanePosition.- Parameters:
lane- Lane; the lane for the positionposition- Length; the position on the lane, relative to the cross section link (design line)gtuDirection- GTUDirectionality; the direction the vehicle is driving to -- either in the direction of the design line, or against it- Throws:
GTUException- when preconditions fail
-
-
Method Details
-
getLane
Retrieve the lane.- Returns:
- Lane; the lane for the position
-
getPosition
Retrieve the position on the lane.- Returns:
- Length; the position on the lane, relative to the cross section link (design line)
-
getGtuDirection
Retrieve the gtuDirection.- Returns:
- GTUDirectionality; gtuDirection the direction the vehicle is driving to -- either in the direction of the design line, or against it
-
getLocation
Retrieve the location and direction of the GTU on the lane.- Returns:
- DirectedPoint; the location and direction of the GTU on the lane
-
getLaneDirection
Returns the lane direction in the direction of this lane direction.- Returns:
- lane direction in the direction of this lane direction
-
getLinkDirection
Returns the link direction in the direction of this lane direction.- Returns:
- link direction in the direction of this lane direction
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
toString
public final java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-