Class Road

java.lang.Object
  |
  +--Road
All Implemented Interfaces:
uwcse.animation.Prop

public class Road
extends java.lang.Object
implements uwcse.animation.Prop

This class models a roadway in our scene.


Constructor Summary
Road(int x, int y, int width, int height, boolean east_west)
          Construct the surface and the centerline of the road given the parameters.
 
Method Summary
 void addTo(uwcse.graphics.GWindow g)
          Add the elements of this display object to the graphics window.
 int getHeight()
          Return the y-span of the Road.
 int getWidth()
          Return the x-span of the Road.
 int getX()
          Return the x-coordinate of the upper left corner of the Road.
 int getY()
          Return the y-coordinate of the upper left corner of the Road.
 void removeFromWindow()
          Remove the elements of this display object from the graphics window.
 boolean roadIsEastWest()
          Returns a boolean regarding orientation of the Road
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Road

public Road(int x,
            int y,
            int width,
            int height,
            boolean east_west)
Construct the surface and the centerline of the road given the parameters.

Parameters:
x - the x-coordinate of the upper left corner of the road
y - the y-coordinate of the upper left corner of the road
width - the x-axis span of the road
height - the y-axis span of the road
east_west - the direction of the road; true means East-West, false means North-South
Method Detail

addTo

public void addTo(uwcse.graphics.GWindow g)
Add the elements of this display object to the graphics window.

Specified by:
addTo in interface uwcse.animation.Prop
Parameters:
g - the graphics window to use

removeFromWindow

public void removeFromWindow()
Remove the elements of this display object from the graphics window.

Specified by:
removeFromWindow in interface uwcse.animation.Prop

getX

public int getX()
Return the x-coordinate of the upper left corner of the Road.

Returns:
the x-coordinate of the upper left corner of the Road

getY

public int getY()
Return the y-coordinate of the upper left corner of the Road.

Returns:
the y-coordinate of the upper left corner of the Road

getHeight

public int getHeight()
Return the y-span of the Road.

Returns:
the height of the Road

getWidth

public int getWidth()
Return the x-span of the Road.

Returns:
the width of the Road

roadIsEastWest

public boolean roadIsEastWest()
Returns a boolean regarding orientation of the Road

Returns:
true if the Road is oriented East-West, false if oriented North-South