DE.purple_sunshine.bigbro
Class House
java.lang.Object
|
+--DE.purple_sunshine.bigbro.House
- public class House
- extends java.lang.Object
Knows the image of the blueprint of the house (which is usually used as
background image) and manages the areas (including the calculation of Paths).
- Since:
- JDK1.1
- Version:
- 1.0
- Author:
- Holger Wagner
|
Constructor Summary |
House(java.awt.Dimension size,
java.net.URL imageURL,
java.net.URL areaDescription,
java.net.URL pathAreaDescription)
Constructs a new House with the given parameters. |
|
Method Summary |
java.util.Vector |
computePath(PathElement from,
PathElement to)
Calculates a path from the current PathArea of the updated Area (real world
coordinates). |
Area |
getArea(java.lang.String id)
Returns the Area with id. |
java.net.URL |
getImageURL()
Returns the URL of the background image of this house. |
PathArea |
getPathArea(java.lang.String id)
Returns the PathArea with id. |
PathArea |
getRandomPathArea()
Returns a random path area. |
java.awt.Dimension |
getSize()
Returns the size of this house. |
void |
paintInto(java.awt.Graphics g)
Paints the Areas into g depending on settings made in the
SpyApplet. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NORTH
public static final int NORTH
SOUTH
public static final int SOUTH
EAST
public static final int EAST
WEST
public static final int WEST
House
public House(java.awt.Dimension size,
java.net.URL imageURL,
java.net.URL areaDescription,
java.net.URL pathAreaDescription)
- Constructs a new House with the given parameters.
- Parameters:
size - the actual size of the house in pixelsimageURL - the URL of the background imageareaDescription - the URL of the file in which the real world areas
are specifiedpathAreaDescription - the URL of the file in which the path
areas are specified (these are used to calculate paths from one
"real world area" to another one)
getArea
public Area getArea(java.lang.String id)
- Returns the Area with
id.
- Parameters:
id - the ID of the Area to be returned- Returns:
- the Area with
id
getPathArea
public PathArea getPathArea(java.lang.String id)
- Returns the PathArea with
id.
- Parameters:
id - the ID of the PathArea to be returned- Returns:
- the PathArea with
id
getRandomPathArea
public PathArea getRandomPathArea()
- Returns a random path area. This is used for generating random movement
if no real world updates are available.
- Returns:
- a random path area
getImageURL
public java.net.URL getImageURL()
- Returns the URL of the background image of this house.
- Returns:
- the URL of the background image of this house
getSize
public java.awt.Dimension getSize()
- Returns the size of this house.
- Returns:
- the size of this house
computePath
public java.util.Vector computePath(PathElement from,
PathElement to)
- Calculates a path from the current PathArea of the updated Area (real world
coordinates). When a point is reached, the person that has reached the
point should update its current PathArea.
- Parameters:
from - the current PathElement the Person for which the path shall
be computed is into - the destination PathElement- Returns:
- a Vector with the computed PathElements
paintInto
public void paintInto(java.awt.Graphics g)
- Paints the Areas into
g depending on settings made in the
SpyApplet.
- Parameters:
g - the Graphics instance to paint into- See Also:
SpyApplet.PAINT_PATHAREAS,
SpyApplet.PAINT_AREAS
© 2000, Holger Wagner, Purple Sunshine Productions.