becker.robots.icons
Class IntersectionIcon

java.lang.Object
  extended by becker.robots.icons.Icon
      extended by becker.robots.icons.CompositeIcon
          extended by becker.robots.icons.IntersectionIcon

public class IntersectionIcon
extends CompositeIcon

An icon to display an intersection.

Author:
Byron Weber Becker

Nested Class Summary
static class IntersectionIcon.Area
          An enumeration to specify the different areas of an IntersectionIcon.
 
Field Summary
 
Fields inherited from class becker.robots.icons.Icon
transparent
 
Constructor Summary
IntersectionIcon(Color roadColor, Color backgroundColor)
          Construct a new icon.
 
Method Summary
 void colorArea(IntersectionIcon.Area area, Color color)
          Change the color of one area of the intersection.
 void colorNonRoads(Color c)
          Color the areas of this intersection that are not roads.
 void colorRoads(Color c)
          Color the roads on this intersection.
 Icon componentIcon(IntersectionIcon.Area area)
          Return a reference to an icon representing one component of the intersection: the center of the intersection, the street entering from the east, or the southwest corner, for instance.
 Color getColor()
          Returns the color of the central road area.
 void setColor(Color newColor)
          Same as colorRoads.
 void setSimCount(int numSims)
          Display the number of Sims on this intersection.
 
Methods inherited from class becker.robots.icons.CompositeIcon
applyTransforms, componentIcon, hasChanged, markChanged, numComponents, renderImage
 
Methods inherited from class becker.robots.icons.Icon
getImage, getLabel, getRotation, getSize, getTransparency, paintIcon, setLabel, setSize, setTransparency
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntersectionIcon

public IntersectionIcon(Color roadColor,
                        Color backgroundColor)
Construct a new icon.

Parameters:
roadColor - The color used for the avenues and streets.
backgroundColor - The color used for the areas between avenues and streets.
Method Detail

setSimCount

public void setSimCount(int numSims)
Display the number of Sims on this intersection.

Parameters:
numSims - The number of sims on this icon's intersection.

componentIcon

public Icon componentIcon(IntersectionIcon.Area area)
Return a reference to an icon representing one component of the intersection: the center of the intersection, the street entering from the east, or the southwest corner, for instance.

Parameters:
area - One of {IntersectionIcon.Area.NORTH, SOUTH, EAST, WEST} for an avenue or street, one of {IntersectionIcon.Area.NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST} for an area between the avenues and streets, or IntersectionIcon.Area.CENTER for the actual intersection of the avenue and street.
Returns:
The icon used to display the specified portion of the intersection.

setColor

public void setColor(Color newColor)
Same as colorRoads.

Overrides:
setColor in class CompositeIcon
Parameters:
newColor - The new color.

getColor

public Color getColor()
Returns the color of the central road area.

Overrides:
getColor in class CompositeIcon
Returns:
this icon's current color.

colorArea

public void colorArea(IntersectionIcon.Area area,
                      Color color)
Change the color of one area of the intersection.

Parameters:
area - One of {IntersectionIcon.Area.NORTH, SOUTH, EAST, WEST} for an avenue or street, one of {IntersectionIcon.Area.NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST} for an area between the avenues and streets, or IntersectionIcon.Area.CENTER for the actual intersection of the avenue and street.
color - The new color for the specified area.

colorRoads

public void colorRoads(Color c)
Color the roads on this intersection.

Parameters:
c - the new color

colorNonRoads

public void colorNonRoads(Color c)
Color the areas of this intersection that are not roads.

Parameters:
c - the new color