|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object aim4.map.lane.AbstractLane
public abstract class AbstractLane
This is a base class for all Lanes. Creates an ID system for lanes such that all lanes will have a different integer ID. Also handles traffic generation methods, and other things that are the same no matter the implementation of the Lane.
Constructor Summary | |
---|---|
AbstractLane(double speedLimit)
Create a new Lane. |
Method Summary | |
---|---|
abstract boolean |
contains(Point2D pos)
Whether or not the provided point can be considered "in" this Lane. |
abstract double |
distanceAlongLane(Point2D pos)
Get the distance along the Lane from the start of the Lane to the Point in the center of the Lane nearest the given Point. |
abstract Point2D |
getEndPoint()
Get the ending point of the Lane. |
abstract double |
getHeadingAtNormalizedDistance(double normalizedDistance)
Get the heading of the Lane at a particular normalized distance from the start of the Lane. |
int |
getId()
Get the unique ID number of this Lane. |
abstract double |
getInitialHeading()
Get the heading of this Lane at its starting point. |
LaneIM |
getLaneIM()
Get the LaneIM object that helps to locate the intersection managers on a lane. |
abstract Point2D |
getLeadPoint(Point2D pos,
double leadDist)
Get a point further down the Lane from the nearest point to the given position. |
Lane |
getLeftNeighbor()
Get the left neighbor of this Lane. |
abstract double |
getLength()
Get the length of this Lane. |
Lane |
getNextLane()
Get the Lane into which this Lane leads, or null if none. |
abstract Point2D |
getPointAtNormalizedDistance(double normalizedDistance)
Get a point in the center of the lane at a particular normalized distance from the start of the Lane. |
Lane |
getPrevLane()
Get the Lane which leads into this Lane, or null if none. |
Lane |
getRightNeighbor()
Get the right neighbor of this Lane. |
abstract Shape |
getShape()
Get a Shape describing this Lane, including its width. |
abstract Shape |
getShape(double startFraction,
double endFraction)
Get a Shape describing an interval of this lane, using normalized distances. |
double |
getSpeedLimit()
Get the speed limit of this Lane, in meters per second. |
abstract Point2D |
getStartPoint()
Get the starting point of the Lane. |
abstract double |
getTerminalHeading()
Get the heading of this Lane at its ending point. |
abstract double |
getWidth()
Get the width of this Lane, in meters. |
boolean |
hasLeftNeighbor()
Whether the Lane has another Lane immediately to its left travelling in the same direction. |
boolean |
hasNextLane()
Whether or not this Lane flows into another Lane. |
boolean |
hasPrevLane()
Whether or not another Lane flows into this Lane. |
boolean |
hasRightNeighbor()
Whether the Lane has another Lane immediately to its right travelling in the same direction. |
abstract Point2D |
intersectionPoint(Line2D l)
The point at which the the given Line intersects the center of this Lane. |
abstract Shape |
leftBorder()
Get a Shape representing the left border of this Lane. |
abstract Point2D |
leftIntersectionPoint(Line2D l)
The point at which the the given Line intersects the left border of this Lane. |
abstract double |
nearestDistance(Point2D pos)
Get the distance from a point to the center of the Lane. |
abstract Point2D |
nearestPoint(Point2D p)
Get the point in the center of the Lane nearest to the provided point. |
abstract double |
normalizedDistanceAlongLane(Point2D pos)
Get the normalized distance to the point in the center of the lane nearest the provided point. |
abstract double |
remainingDistanceAlongLane(Point2D pos)
Get the amount of distance left in this Lane from the point on the Lane nearest to the given point. |
abstract Shape |
rightBorder()
Get a Shape representing the right border of this Lane. |
abstract Point2D |
rightIntersectionPoint(Line2D l)
The point at which the the given Line intersects the right border of this Lane. |
void |
setId(int id)
Set the unique ID number of this Lane. |
void |
setLeftNeighbor(Lane ln)
Register another Lane as a left neighbor to this Lane. |
void |
setNextLane(Lane nextLane)
Set the Lane into which this Lane leads. |
void |
setPrevLane(Lane prevLane)
Set the Lane which leads into this Lane. |
void |
setRightNeighbor(Lane ln)
Register another Lane as a right neighbor to this Lane. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface aim4.map.lane.Lane |
---|
normalizedDistance |
Constructor Detail |
---|
public AbstractLane(double speedLimit)
Method Detail |
---|
public int getId()
getId
in interface Lane
public void setId(int id)
setId
in interface Lane
id
- the ID number of this lanepublic double getSpeedLimit()
getSpeedLimit
in interface Lane
public LaneIM getLaneIM()
getLaneIM
in interface Lane
public boolean hasNextLane()
hasNextLane
in interface Lane
public Lane getNextLane()
null
if none.
getNextLane
in interface Lane
null
if nonepublic void setNextLane(Lane nextLane)
setNextLane
in interface Lane
nextLane
- the Lane into which this Lane leadspublic boolean hasPrevLane()
hasPrevLane
in interface Lane
public Lane getPrevLane()
null
if none.
getPrevLane
in interface Lane
null
if nonepublic void setPrevLane(Lane prevLane)
setPrevLane
in interface Lane
prevLane
- the Lane which leads into this Lanepublic boolean hasLeftNeighbor()
hasLeftNeighbor
in interface Lane
public Lane getLeftNeighbor()
getLeftNeighbor
in interface Lane
null
if none
existspublic void setLeftNeighbor(Lane ln)
setLeftNeighbor
in interface Lane
ln
- the Lane to set as this Lane's left neighborpublic boolean hasRightNeighbor()
hasRightNeighbor
in interface Lane
public Lane getRightNeighbor()
getRightNeighbor
in interface Lane
null
if none
existspublic void setRightNeighbor(Lane ln)
setRightNeighbor
in interface Lane
ln
- the Lane to set as this Lane's right neighborpublic abstract double getLength()
getLength
in interface Lane
public abstract Point2D getStartPoint()
getStartPoint
in interface Lane
public abstract Point2D getEndPoint()
getEndPoint
in interface Lane
public abstract Point2D getPointAtNormalizedDistance(double normalizedDistance)
getPointAtNormalizedDistance
in interface Lane
normalizedDistance
- the normalized distance (between 0 and 1) from
the start of the Lane
public abstract Point2D nearestPoint(Point2D p)
nearestPoint
in interface Lane
p
- the point to which the nearest point in the center of the Lane
should be found
public abstract double nearestDistance(Point2D pos)
nearestDistance
in interface Lane
pos
- the point from which to find the distance to the Lane
public abstract Point2D getLeadPoint(Point2D pos, double leadDist)
getLeadPoint
in interface Lane
pos
- the position from which to calculate the nearest point in
the LaneleadDist
- the lead distance further down the Lane, in meters
leadDist
further down the Lane from
the closest point in the Lane to pos
public abstract double distanceAlongLane(Point2D pos)
distanceAlongLane
in interface Lane
pos
- the point to which to find the distance along the Lane
public abstract double remainingDistanceAlongLane(Point2D pos)
remainingDistanceAlongLane
in interface Lane
pos
- the point nearest which to find the distance to the end of the
Lane
public abstract double normalizedDistanceAlongLane(Point2D pos)
normalizedDistanceAlongLane
in interface Lane
pos
- the point near to which to find the normalized distance
public abstract double getInitialHeading()
getInitialHeading
in interface Lane
public abstract double getTerminalHeading()
getTerminalHeading
in interface Lane
public abstract double getHeadingAtNormalizedDistance(double normalizedDistance)
getHeadingAtNormalizedDistance
in interface Lane
normalizedDistance
- the normalized distance (between 0 and 1) from
the start of the Lane
public abstract Point2D intersectionPoint(Line2D l)
intersectionPoint
in interface Lane
l
- the Line with which to find the intersection
null
if it doesn't intersectpublic abstract double getWidth()
getWidth
in interface Lane
public abstract Shape getShape()
getShape
in interface Lane
public abstract Shape getShape(double startFraction, double endFraction)
getShape
in interface Lane
startFraction
- the normalized distance from the start of the lane
to the start of the segment which the Shape
representsendFraction
- the normalized distance from the start of the lane
to the end of the segment which the Shape represents
public abstract boolean contains(Point2D pos)
contains
in interface Lane
pos
- the point to check
public abstract Shape leftBorder()
leftBorder
in interface Lane
public abstract Shape rightBorder()
rightBorder
in interface Lane
public abstract Point2D leftIntersectionPoint(Line2D l)
leftIntersectionPoint
in interface Lane
l
- the Line with which to find the intersection
null
if it doesn't intersectpublic abstract Point2D rightIntersectionPoint(Line2D l)
rightIntersectionPoint
in interface Lane
l
- the Line with which to find the intersection
null
if it doesn't intersect
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |