com.alienfactory.javamappy
Class MapObject

java.lang.Object
  extended by com.alienfactory.javamappy.MapObject

public class MapObject
extends java.lang.Object

A simple bean class which represents a MapObject as used by Mappy.

The Object structure for the MapWin32 Pro editor version.

A MapObject may contain multiple images or a tile graphic, 7 fields of User data and 8 other flags.

Author:
Kris Arndt

Field Summary
static int BACKGROUND
          A MapObject image layer used to get / set its image index.
static int FLAG1
          A User defined flag.
static int FLAG2
          A User defined flag.
static int FLAG3
          A User defined flag.
static int FLAG4
          A User defined flag.
static int FLAG5
          A User defined flag.
static int FLAG6
          A User defined flag.
static int FLAG7
          A User defined flag.
static int FLAG8
          A User defined flag.
static int FOREGROUND1
          A MapObject image layer used to get / set its image index.
static int FOREGROUND2
          A MapObject image layer used to get / set its image index.
static int FOREGROUND3
          A MapObject image layer used to get / set its image index.
static int MAX_USER_DATA
          A minimum index for User Data.
static int MIN_USER_DATA
          A minimum index for User Data.
 
Constructor Summary
MapObject()
           
 
Method Summary
 boolean getFlag(int flag)
          Returns the specified flag.
 int getGfxId()
           
 int getGHandleXOff()
           
 int getGHandleYOff()
           
 int getGHeight()
           
 int getGWidth()
           
 int getGXOffset()
           
 int getGYOffset()
           
 int getImageIndex(int imageLayer)
          Returns the image index of the given MapObject layer.
 int getShow()
           
 java.lang.String getTextString()
          Returns the text string associated with this MapObject.
 int getTileId()
           
 int getUserData(int index)
          Returns the specified User Data.
 int getX()
           
 int getY()
           
 void setFlag(int flag, boolean newFlag)
          Sets the specified flag to the given boolean value.
 void setGfxId(int i)
           
 void setGHandleXOff(int i)
           
 void setGHandleYOff(int i)
           
 void setGHeight(int i)
           
 void setGWidth(int i)
           
 void setGXOffset(int i)
           
 void setGYOffset(int i)
           
 void setImageIndex(int imageLayer, int newImageIndex)
          Sets the image index of the given MapObject layer.
 void setShow(int i)
           
 void setTextString(java.lang.String textString)
          Sets the text string associated with this MapObject.
 void setTileId(int i)
           
 void setUserData(int index, int newUserData)
          Sets the specified User Data.
 void setX(int x)
           
 void setY(int y)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BACKGROUND

public static final int BACKGROUND
A MapObject image layer used to get / set its image index.

Has a constant value of 0.

See Also:
setImageIndex(int, int), getImageIndex(int), Constant Field Values

FOREGROUND1

public static final int FOREGROUND1
A MapObject image layer used to get / set its image index.

Has a constant value of 1.

See Also:
setImageIndex(int, int), getImageIndex(int), Constant Field Values

FOREGROUND2

public static final int FOREGROUND2
A MapObject image layer used to get / set its image index.

Has a constant value of 2.

See Also:
setImageIndex(int, int), getImageIndex(int), Constant Field Values

FOREGROUND3

public static final int FOREGROUND3
A MapObject image layer used to get / set its image index.

Has a constant value of 3.

See Also:
setImageIndex(int, int), getImageIndex(int), Constant Field Values

MIN_USER_DATA

public static final int MIN_USER_DATA
A minimum index for User Data.

Has a constant value of 1.

See Also:
setUserData(int, int), getUserData(int), Constant Field Values

MAX_USER_DATA

public static final int MAX_USER_DATA
A minimum index for User Data.

Has a constant value of 7.

See Also:
setUserData(int, int), getUserData(int), Constant Field Values

FLAG1

public static final int FLAG1
A User defined flag.

Has a constant value of 0.

See Also:
setFlag(int, boolean), getFlag(int), Constant Field Values

FLAG2

public static final int FLAG2
A User defined flag.

Has a constant value of 1.

See Also:
setFlag(int, boolean), getFlag(int), Constant Field Values

FLAG3

public static final int FLAG3
A User defined flag.

Has a constant value of 2.

See Also:
setFlag(int, boolean), getFlag(int), Constant Field Values

FLAG4

public static final int FLAG4
A User defined flag.

Has a constant value of 3.

See Also:
setFlag(int, boolean), getFlag(int), Constant Field Values

FLAG5

public static final int FLAG5
A User defined flag.

Has a constant value of 4.

See Also:
setFlag(int, boolean), getFlag(int), Constant Field Values

FLAG6

public static final int FLAG6
A User defined flag.

Has a constant value of 5.

See Also:
setFlag(int, boolean), getFlag(int), Constant Field Values

FLAG7

public static final int FLAG7
A User defined flag.

Has a constant value of 6.

See Also:
setFlag(int, boolean), getFlag(int), Constant Field Values

FLAG8

public static final int FLAG8
A User defined flag.

Has a constant value of 7.

See Also:
setFlag(int, boolean), getFlag(int), Constant Field Values
Constructor Detail

MapObject

public MapObject()
Method Detail

setX

public void setX(int x)

getX

public int getX()

setY

public void setY(int y)

getY

public int getY()

setGfxId

public void setGfxId(int i)

getGfxId

public int getGfxId()

setTileId

public void setTileId(int i)

getTileId

public int getTileId()

setGXOffset

public void setGXOffset(int i)

getGXOffset

public int getGXOffset()

setGYOffset

public void setGYOffset(int i)

getGYOffset

public int getGYOffset()

setGWidth

public void setGWidth(int i)

getGWidth

public int getGWidth()

setGHeight

public void setGHeight(int i)

getGHeight

public int getGHeight()

setGHandleXOff

public void setGHandleXOff(int i)

getGHandleXOff

public int getGHandleXOff()

setGHandleYOff

public void setGHandleYOff(int i)

getGHandleYOff

public int getGHandleYOff()

setShow

public void setShow(int i)

getShow

public int getShow()

setImageIndex

public void setImageIndex(int imageLayer,
                          int newImageIndex)
                   throws java.lang.IllegalArgumentException
Sets the image index of the given MapObject layer.

Parameters:
imageLayer - should be one of BACKGROUND, FOREGROUND1, FOREGROUND2 or FOREGROUND3
newImageIndex - the image index to be set
Throws:
java.lang.IllegalArgumentException - if imageLayer is out of bounds - it is assumed that newImageIndex is valid
See Also:
getImageIndex(int)

getImageIndex

public int getImageIndex(int imageLayer)
                  throws java.lang.IllegalArgumentException
Returns the image index of the given MapObject layer.

Parameters:
imageLayer - should be one of BACKGROUND, FOREGROUND1, FOREGROUND2 or FOREGROUND3
Returns:
the image index of the given MapObject layer.
Throws:
java.lang.IllegalArgumentException - if imageLayer is out of bounds
See Also:
setImageIndex(int, int)

setUserData

public void setUserData(int index,
                        int newUserData)
                 throws java.lang.IllegalArgumentException
Sets the specified User Data.

Parameters:
index - the User Data to be updated.
newUserData - the new User Data.
Throws:
java.lang.IllegalArgumentException - if (index < MIN_USER_DATA) or (index > MAX_USER_DATA) or
See Also:
getUserData(int)

getUserData

public int getUserData(int index)
                throws java.lang.IllegalArgumentException
Returns the specified User Data.

Parameters:
index - the User Data to be returned.
Returns:
the specified User Data.
Throws:
java.lang.IllegalArgumentException - if (index < MIN_USER_DATA) or (index > MAX_USER_DATA) or
See Also:
setUserData(int, int)

setFlag

public void setFlag(int flag,
                    boolean newFlag)
             throws java.lang.IllegalArgumentException
Sets the specified flag to the given boolean value.

Parameters:
flag - should be between FLAG1 and FLAG2
newFlag - the new flag to set
Throws:
java.lang.IllegalArgumentException - if flag is out of bounds
See Also:
getFlag(int)

getFlag

public boolean getFlag(int flag)
                throws java.lang.IllegalArgumentException
Returns the specified flag.

Parameters:
flag - should be between FLAG1 and FLAG2
Returns:
the specified flag value
Throws:
java.lang.IllegalArgumentException - if flag is out of bounds
See Also:
setFlag(int, boolean)

getTextString

public java.lang.String getTextString()
Returns the text string associated with this MapObject. The string is set when the map is loaded and is defined within Mappy.


setTextString

public void setTextString(java.lang.String textString)
Sets the text string associated with this MapObject.



Copyright © 2001-2009 Alien-Factory Ltd. All Rights Reserved.