Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Class Road

    java.lang.Object
      |
      +--Road

All Implemented Interfaces:
  XMLSerializable

public class Road
extends java.lang.Object
implements XMLSerializable

The Road class represents a Graphical Road Object. It is composed of Lanes.

Field Summary
`int` | `busyness`
`static java.awt.BasicStroke` | `centerLine`
`static double` | `halfPI`
`static java.awt.BasicStroke` | `laneBackGround`
`static java.awt.BasicStroke` | `laneSurface`
`static int` | `laneWidth`
`static int` | `maxLaneNum`
`static java.awt.BasicStroke` | `normal`

Constructor Summary
`Road(int iD)` Creates a new `Road` instance.

Method Summary
`void` | `appendToEndOfRoad(int x, int y)`
`void` | `appendToStartOfRoad(int x, int y)`
`java.awt.geom.GeneralPath` | `calculateBoundaryPath(boolean wantleft)`
`void` | `calculateLeftSide()`
`void` | `calculateRightSide()`
`void` | `calculateShape()`
`boolean` | `checkappendLimits(int x, int y)` Checks whether its valid to append to the start of this road given the angle that the road would be created at.
`void` | `checkBoundsWith(java.awt.geom.Line2D l1, java.awt.geom.Line2D l2, java.awt.geom.Line2D l3, java.awt.geom.Line2D l4, java.awt.geom.Rectangle2D boundingBox)`
`boolean` | `checkextendLimits(int x, int y)` Checks whether its valid to extend the end of this road given the angle that the road would be created at.
`void` | `cutOffAt(double x, double y)`
`void` | `cutOffAt(int index)`
`Road` | `deepClone()`
`Road` | `deepClone(int newID)`
`void` | `drawDirectedMidPoints(java.awt.Graphics2D g2d)`
`void` | `drawHandles(java.awt.Graphics2D g2d)`
`void` | `drawRoad(java.awt.Graphics2D g2d)` Draws all the paths in "pathArray" (a GeneralPath[])
`java.awt.geom.Point2D` | `getEndHandle()`
`double` | `getFirstLineAngle()`
`java.awt.geom.Point2D` | `getHandle(java.awt.geom.Point2D point)`
`int` | `getID()`
`java.awt.geom.GeneralPath` | `getLane(int index)`
`java.awt.geom.Point2D` | `getLaneEndPoint(int index)`
`java.awt.geom.GeneralPath[]` | `getLanes()`
`java.awt.geom.Point2D` | `getLaneStartPoint(int index)`
`double` | `getLastLineAngle()`
`java.awt.geom.Line2D` | `getLine(int index)`
`java.awt.geom.Point2D` | `getMidPoint(java.awt.geom.Point2D point)`
`java.awt.geom.Point2D` | `getMidPointInLane(java.awt.geom.GeneralPath lane, java.awt.geom.Point2D point)` returns the mid-point arrow on "lane" that matched "point".
`java.awt.geom.Line2D` | `getNearestLine(java.awt.geom.Point2D point)`
`int` | `getNumArrayElements()` returns the number of initilized elements of a GeneralPath[]
`int` | `getNumberOfSections()`
`int` | `getNumLanes()`
`int` | `getNumLeftLanes()`
`int` | `getNumRightLanes()`
`java.awt.Shape` | `getRoadLeftSide()`
`int` | `getRoadLeftWidth()`
`java.awt.Shape` | `getRoadRightSide()`
`int` | `getRoadRightWidth()`
`java.awt.Shape` | `getRoadSide(boolean wantLeft)`
`java.awt.Shape` | `getRoadSide(int X, int Y)`
`int` | `getRoadWidth()`
`Road` | `getSectionFrom(int newID, double x, double y)`
`Road` | `getSectionFrom(int newID, int index)`
`java.awt.Shape` | `getShape()`
`java.awt.geom.Point2D` | `getStartHandle()`
`java.lang.String` | `getXMLName()`
`boolean` | `isEmpty()`
`boolean` | `isEndHandle(java.awt.geom.Point2D point)`
`boolean` | `isInCenterLane(java.awt.geom.Point2D point)`
`boolean` | `isSameLaneArrangement(Road tempRoad)`
`boolean` | `isSingleLane()`
`boolean` | `isStartHandle(java.awt.geom.Point2D point)`
`boolean` | `isSymetrical()`
`void` | `loadChilds(XMLLoader loader)`
`void` | `loadSelf(XMLElement element)`
`void` | `mergeRoad(Road roadToMerge)`
`void` | `modifyRoadHandle(boolean isStartPoint, java.awt.geom.Point2D newP)`
`void` | `modifyRoadHandle(java.awt.geom.Point2D pToChange, java.awt.geom.Point2D newP)`
`void` | `removeRoadPoint(java.awt.geom.Point2D pointToKill)`
`void` | `reverseDirection()`
`void` | `saveChilds(XMLSaver saver)`
`XMLElement` | `saveSelf()`
`void` | `setCenterPath(java.awt.geom.GeneralPath l0)`
`void` | `setLanes(java.awt.geom.GeneralPath[] lanes)`
`void` | `setMultipleLanes(int numLanes)`
`void` | `setMultipleLeftLanes(int multipleNum)`
`void` | `setMultipleRightLanes(int multipleNum)`
`void` | `setRoadShapeVariables()`
`void` | `setSingleLane(boolean singleLane)`
`void` | `setStart(int x, int y)`
`void` | `snapEndToGrid()`
`void` | `snapStartToGrid()`
`Road` | `splitRoad(double x, double y, int newIndex)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### laneWidth

    public static final int laneWidth

### maxLaneNum

    public static final int maxLaneNum

### halfPI

    public static final double halfPI

### laneSurface

    public static final java.awt.BasicStroke laneSurface

### centerLine

    public static final java.awt.BasicStroke centerLine

### normal

    public static final java.awt.BasicStroke normal

### laneBackGround

    public static final java.awt.BasicStroke laneBackGround

### busyness

    public int busyness

Constructor Detail

### Road

    public Road(int iD)

  Creates a new `Road` instance. The Road has "maxLaneNum" lanes. Lanes are stored in an array. The direction of a lane can be determined from its center-path (index 0). left lanes are have odd number array indices.`-> 7 | | 8 -> -> 5 | | 6 -> -> 3 | | 4 -> -> 1 | | 2 -> -> 0 | | 0 <- <- 2 | | 1 <- <- 4 | | 3 <- <- 6 | | 5 <- <- 8 | | 7 <-`
  Parameters:
    `index` - The ID number of the Road

Method Detail

### drawRoad

    public void drawRoad(java.awt.Graphics2D g2d)

  Draws all the paths in "pathArray" (a GeneralPath[])

### drawHandles

    public void drawHandles(java.awt.Graphics2D g2d)

### drawDirectedMidPoints

    public void drawDirectedMidPoints(java.awt.Graphics2D g2d)

### getStartHandle

    public java.awt.geom.Point2D getStartHandle()

### getEndHandle

    public java.awt.geom.Point2D getEndHandle()

### getHandle

    public java.awt.geom.Point2D getHandle(java.awt.geom.Point2D point)

### getMidPoint

    public java.awt.geom.Point2D getMidPoint(java.awt.geom.Point2D point)

### getMidPointInLane

    public java.awt.geom.Point2D getMidPointInLane(java.awt.geom.GeneralPath lane,
                                                   java.awt.geom.Point2D point)

  returns the mid-point arrow on "lane" that matched "point".

### getNearestLine

    public java.awt.geom.Line2D getNearestLine(java.awt.geom.Point2D point)

### getLine

    public java.awt.geom.Line2D getLine(int index)

### getShape

    public java.awt.Shape getShape()

### getRoadSide

    public java.awt.Shape getRoadSide(int X,
                                      int Y)

### getRoadSide

    public java.awt.Shape getRoadSide(boolean wantLeft)

### getRoadLeftSide

    public java.awt.Shape getRoadLeftSide()

### getRoadRightSide

    public java.awt.Shape getRoadRightSide()

### getID

    public int getID()

### getLane

    public java.awt.geom.GeneralPath getLane(int index)

### getLaneStartPoint

    public java.awt.geom.Point2D getLaneStartPoint(int index)

### getLaneEndPoint

    public java.awt.geom.Point2D getLaneEndPoint(int index)

### getLanes

    public java.awt.geom.GeneralPath[] getLanes()

### getNumLanes

    public int getNumLanes()

### getLastLineAngle

    public double getLastLineAngle()

### getFirstLineAngle

    public double getFirstLineAngle()

### getNumberOfSections

    public int getNumberOfSections()

### getRoadWidth

    public int getRoadWidth()

### getNumLeftLanes

    public int getNumLeftLanes()

### getNumRightLanes

    public int getNumRightLanes()

### getRoadLeftWidth

    public int getRoadLeftWidth()

### getRoadRightWidth

    public int getRoadRightWidth()

### setStart

    public void setStart(int x,
                         int y)

### setSingleLane

    public void setSingleLane(boolean singleLane)

### setLanes

    public void setLanes(java.awt.geom.GeneralPath[] lanes)

### setCenterPath

    public void setCenterPath(java.awt.geom.GeneralPath l0)

### setRoadShapeVariables

    public void setRoadShapeVariables()

### calculateShape

    public void calculateShape()

### calculateLeftSide

    public void calculateLeftSide()

### calculateRightSide

    public void calculateRightSide()

### calculateBoundaryPath

    public java.awt.geom.GeneralPath calculateBoundaryPath(boolean wantleft)

### isEmpty

    public boolean isEmpty()

### isEndHandle

    public boolean isEndHandle(java.awt.geom.Point2D point)

### isSingleLane

    public boolean isSingleLane()

### isSymetrical

    public boolean isSymetrical()

### isStartHandle

    public boolean isStartHandle(java.awt.geom.Point2D point)

### isInCenterLane

    public boolean isInCenterLane(java.awt.geom.Point2D point)

### isSameLaneArrangement

    public boolean isSameLaneArrangement(Road tempRoad)

### checkBoundsWith

    public void checkBoundsWith(java.awt.geom.Line2D l1,
                                java.awt.geom.Line2D l2,
                                java.awt.geom.Line2D l3,
                                java.awt.geom.Line2D l4,
                                java.awt.geom.Rectangle2D boundingBox)

### appendToStartOfRoad

    public void appendToStartOfRoad(int x,
                                    int y)

### appendToEndOfRoad

    public void appendToEndOfRoad(int x,
                                  int y)

### checkappendLimits

    public boolean checkappendLimits(int x,
                                     int y)

  Checks whether its valid to append to the start of this road given the angle that the road would be created at.

### checkextendLimits

    public boolean checkextendLimits(int x,
                                     int y)

  Checks whether its valid to extend the end of this road given the angle that the road would be created at.

### reverseDirection

    public void reverseDirection()

### modifyRoadHandle

    public void modifyRoadHandle(java.awt.geom.Point2D pToChange,
                                 java.awt.geom.Point2D newP)

### modifyRoadHandle

    public void modifyRoadHandle(boolean isStartPoint,
                                 java.awt.geom.Point2D newP)

### removeRoadPoint

    public void removeRoadPoint(java.awt.geom.Point2D pointToKill)

### mergeRoad

    public void mergeRoad(Road roadToMerge)

### setMultipleLeftLanes

    public void setMultipleLeftLanes(int multipleNum)

### setMultipleRightLanes

    public void setMultipleRightLanes(int multipleNum)

### setMultipleLanes

    public void setMultipleLanes(int numLanes)

### getSectionFrom

    public Road getSectionFrom(int newID,
                               int index)

### getSectionFrom

    public Road getSectionFrom(int newID,
                               double x,
                               double y)

### cutOffAt

    public void cutOffAt(int index)

### cutOffAt

    public void cutOffAt(double x,
                         double y)

### splitRoad

    public Road splitRoad(double x,
                          double y,
                          int newIndex)

### snapStartToGrid

    public void snapStartToGrid()

### snapEndToGrid

    public void snapEndToGrid()

### deepClone

    public Road deepClone(int newID)

### deepClone

    public Road deepClone()

### getNumArrayElements

    public int getNumArrayElements()

  returns the number of initilized elements of a GeneralPath[]

### getXMLName

    public java.lang.String getXMLName()

  Specified by:
    `getXMLName` in interface `XMLSerializable`

### saveSelf

    public XMLElement saveSelf()

  Specified by:
    `saveSelf` in interface `XMLSerializable`

### saveChilds

    public void saveChilds(XMLSaver saver)

  Specified by:
    `saveChilds` in interface `XMLSerializable`

### loadSelf

    public void loadSelf(XMLElement element)

  Specified by:
    `loadSelf` in interface `XMLSerializable`

### loadChilds

    public void loadChilds(XMLLoader loader)

  Specified by:
    `loadChilds` in interface `XMLSerializable`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD