com.huguesjohnson.tiamat.graphics
Class Map

java.lang.Object
  extended by com.huguesjohnson.tiamat.graphics.Map
All Implemented Interfaces:
Storable, Drawable
Direct Known Subclasses:
TileMap

public abstract class Map
extends java.lang.Object
implements Drawable, Storable

class Map - abstract map

Author:
Hugues Johnson

Field Summary
protected  java.lang.String absoluteDir
           
protected  int height
           
protected  java.lang.String name
           
protected  int width
           
 
Constructor Summary
Map()
          Default constructor, creates an empty Map.
 
Method Summary
abstract  void draw()
          Draws the entire map.
abstract  void draw(int x, int y)
          Draws the entire map at location specified by (x,y).
abstract  void draw(int x1, int y1, int x2, int y2)
          Draws the map within the boundaries specified by (x1,y1) and (x2,y2).
 java.awt.Component getCanvas()
          Returns the canvas for this Map.
 int getHeight()
          Returns the height of the Map.
 java.lang.String getName()
          Returns the name of the Map.
 int getWidth()
          Returns the width of the Map.
abstract  void onDeserialize(Formatter formatter, java.lang.String absoluteDir)
          The onDeserialize event should be fired after an object is de-serialized.
 void setAbsoluteDir(java.lang.String absoluteDir)
           
 void setCanvas(java.awt.Component canvas)
          Sets the canvas for this Map.
 void setHeight(int height)
          Sets the height of the Map.
 void setName(java.lang.String name)
          Sets the name of the Map.
 void setWidth(int width)
          Sets the width of the Map.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

height

protected int height

width

protected int width

name

protected java.lang.String name

absoluteDir

protected transient java.lang.String absoluteDir
Constructor Detail

Map

public Map()
Default constructor, creates an empty Map.

Method Detail

getHeight

public int getHeight()
Returns the height of the Map.

Returns:
The height of the Map.

setHeight

public void setHeight(int height)
Sets the height of the Map.

Parameters:
height - The new height of the Map.

getWidth

public int getWidth()
Returns the width of the Map.

Returns:
The width of the Map.

setWidth

public void setWidth(int width)
Sets the width of the Map.

Parameters:
width - The new width of the Map.

getName

public java.lang.String getName()
Returns the name of the Map.

Returns:
The name of the Map.

setName

public void setName(java.lang.String name)
Sets the name of the Map.

Parameters:
name - The new name of the Map.

getCanvas

public java.awt.Component getCanvas()
Returns the canvas for this Map.

Returns:
The canvas for this Map.

setCanvas

public void setCanvas(java.awt.Component canvas)
Sets the canvas for this Map.

Parameters:
canvas - The new canvas for this Map.

setAbsoluteDir

public void setAbsoluteDir(java.lang.String absoluteDir)

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of the object.

draw

public abstract void draw()
Draws the entire map.

Specified by:
draw in interface Drawable

draw

public abstract void draw(int x,
                          int y)
Draws the entire map at location specified by (x,y).

Specified by:
draw in interface Drawable
Parameters:
x - The x co-ordinate.
y - The y co-ordinate.

draw

public abstract void draw(int x1,
                          int y1,
                          int x2,
                          int y2)
Draws the map within the boundaries specified by (x1,y1) and (x2,y2).

Specified by:
draw in interface Drawable
Parameters:
x1 - The x co-ordinate to start at.
y1 - The y co-ordinate to start at.
x2 - The x co-ordinate to end at.
y2 - The y co-ordinate to end at.

onDeserialize

public abstract void onDeserialize(Formatter formatter,
                                   java.lang.String absoluteDir)
The onDeserialize event should be fired after an object is de-serialized.

Specified by:
onDeserialize in interface Storable
Parameters:
formatter - The formatter to use to load any storable members.
absoluteDir - The working directory to use since all paths stored in the object should be relative.


Copyright © 2004-2006 Hugues Johnson