aim4.im

## Class RoadBasedIntersection

- java.lang.Object
- - aim4.im.RoadBasedIntersection

- All Implemented Interfaces:
    Intersection

      public class RoadBasedIntersection
      extends Object
      implements Intersection

  An intersection that is defined by the intersection of a set of roads.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static double` | `EXPANSION_DISTANCE` The distance outside of the strict intersection that the IntersectionManager will control, in meters.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RoadBasedIntersection(List<Road> roads)` Basic class constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Constants.TurnDirection` | `calcTurnDirection(Lane currentLane, Lane departureLane)` Get the turn direction of the vehicle at the next intersection.
    `Area` | `getArea()` Get the Area controlled by this intersection manager.
    `Area` | `getAreaPlus()` Get the area slightly larger than the area controlled by this intersection manager.
    `Rectangle2D` | `getBoundingBox()` Get the minimal rectangular region that encloses the intersection.
    `Point2D` | `getCentroid()` Get the centroid of the intersection manager.
    `List<Path2D>` | `getEdges()` Get the list of edges.
    `double` | `getEntryHeading(Lane l)` Get the heading at which the given lane enters the intersection.
    `List<Lane>` | `getEntryLanes()` Get the Lanes that enter the space governed by this intersection manager.
    `WayPoint` | `getEntryPoint(Lane l)` Get the Point at which the given Lane enters the intersection.
    `List<Road>` | `getEntryRoads()` Get the Roads that enter the space governed by this intersection manager.
    `double` | `getExitHeading(Lane l)` Get the heading at which the given Lane exits the intersection.
    `List<Lane>` | `getExitLanes()` Get the Lanes that exit the space governed by this intersection manager.
    `WayPoint` | `getExitPoint(Lane l)` Get the Point at which the given Lane exits the intersection.
    `List<Road>` | `getExitRoads()` Get the Roads that exit the space governed by this intersection manager.
    `List<Lane>` | `getLanes()` Get the Lanes incident to the space governed by this intersection.
    `List<Road>` | `getRoads()` Get the Roads incident to the space governed by this intersection.
    `boolean` | `isEnteredBy(Lane l)` Whether the given Lane enters this intersection.
    `boolean` | `isExitedBy(Lane l)` Whether the given Lane leaves this intersection.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EXPANSION_DISTANCE

          public static final double EXPANSION_DISTANCE

      The distance outside of the strict intersection that the IntersectionManager will control, in meters. 4.0 meters. This gives room for things like crosswalks.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### RoadBasedIntersection

          public RoadBasedIntersection(List<Road> roads)

      Basic class constructor. Takes the Roads for which an IntersectionManager is needed and extracts all the necessary information.
      Parameters:
        `roads` - a list of Roads whose intersection this IntersectionManager will manage

  - ### Method Detail

    - #### getRoads

          public List<Road> getRoads()

      Get the Roads incident to the space governed by this intersection.
      Specified by:
        `getRoads` in interface `Intersection`
      Returns:
        the roads managed by this intersection.

    - #### getLanes

          public List<Lane> getLanes()

      Get the Lanes incident to the space governed by this intersection.
      Specified by:
        `getLanes` in interface `Intersection`
      Returns:
        the lanes managed by this intersection.

    - #### getArea

          public Area getArea()

      Get the Area controlled by this intersection manager.
      Specified by:
        `getArea` in interface `Intersection`
      Returns:
        the Area controlled by this intersection manager

    - #### getAreaPlus

          public Area getAreaPlus()

      Get the area slightly larger than the area controlled by this intersection manager.
      Specified by:
        `getAreaPlus` in interface `Intersection`
      Returns:
        the Area controlled by this intersection manager

    - #### getCentroid

          public Point2D getCentroid()

      Get the centroid of the intersection manager.
      Specified by:
        `getCentroid` in interface `Intersection`
      Returns:
        the centroid of the intersection manager

    - #### getBoundingBox

          public Rectangle2D getBoundingBox()

      Get the minimal rectangular region that encloses the intersection.
      Specified by:
        `getBoundingBox` in interface `Intersection`
      Returns:
        the minimal rectangular region that encloses the intersection

    - #### getEdges

          public List<Path2D> getEdges()

      Get the list of edges.
      Returns:
        the list of edges

    - #### getEntryRoads

          public List<Road> getEntryRoads()

      Get the Roads that enter the space governed by this intersection manager.
      Specified by:
        `getEntryRoads` in interface `Intersection`
      Returns:
        the Roads that enter the space governed by this IntersectionManager

    - #### getEntryLanes

          public List<Lane> getEntryLanes()

      Get the Lanes that enter the space governed by this intersection manager.
      Specified by:
        `getEntryLanes` in interface `Intersection`
      Returns:
        the Lanes that enter the space governed by this IntersectionManager

    - #### isEnteredBy

          public boolean isEnteredBy(Lane l)

      Whether the given Lane enters this intersection.
      Specified by:
        `isEnteredBy` in interface `Intersection`
      Parameters:
        `l` - the Lane to consider
      Returns:
        whether the Lane enters this intersection

    - #### getEntryPoint

          public WayPoint getEntryPoint(Lane l)

      Get the Point at which the given Lane enters the intersection.
      Specified by:
        `getEntryPoint` in interface `Intersection`
      Parameters:
        `l` - the Lane
      Returns:
        the Point at which the given Lane enters the intersection, or `null` if it does not

    - #### getEntryHeading

          public double getEntryHeading(Lane l)

      Get the heading at which the given lane enters the intersection.
      Specified by:
        `getEntryHeading` in interface `Intersection`
      Parameters:
        `l` - the Lane
      Returns:
        the heading at which the Lane enters the intersection

    - #### getExitRoads

          public List<Road> getExitRoads()

      Get the Roads that exit the space governed by this intersection manager.
      Specified by:
        `getExitRoads` in interface `Intersection`
      Returns:
        the Roads that exit the space governed by this IntersectionManager

    - #### getExitLanes

          public List<Lane> getExitLanes()

      Get the Lanes that exit the space governed by this intersection manager.
      Specified by:
        `getExitLanes` in interface `Intersection`
      Returns:
        the Lanes that exit the space governed by this IntersectionManager

    - #### isExitedBy

          public boolean isExitedBy(Lane l)

      Whether the given Lane leaves this intersection.
      Specified by:
        `isExitedBy` in interface `Intersection`
      Parameters:
        `l` - the Lane to consider
      Returns:
        whether the Lane exits this intersection

    - #### getExitPoint

          public WayPoint getExitPoint(Lane l)

      Get the Point at which the given Lane exits the intersection.
      Specified by:
        `getExitPoint` in interface `Intersection`
      Parameters:
        `l` - the Lane
      Returns:
        the Point at which the given Lane exits the intersection, or `null` if it does not

    - #### getExitHeading

          public double getExitHeading(Lane l)

      Get the heading at which the given Lane exits the intersection.
      Specified by:
        `getExitHeading` in interface `Intersection`
      Parameters:
        `l` - the Lane
      Returns:
        the heading at which the Lane exits the intersection

    - #### calcTurnDirection

          public Constants.TurnDirection calcTurnDirection(Lane currentLane,
                                                  Lane departureLane)

      Get the turn direction of the vehicle at the next intersection.
      Specified by:
        `calcTurnDirection` in interface `Intersection`
      Parameters:
        `currentLane` - the current lane.
        `departureLane` - the departure lane.
      Returns:
        the turn direction of the vehicle at the next intersection

Copyright © 2013. All rights reserved.