drawables
Class DrawableObject

java.lang.Object
  |
  +--drawables.DrawableObject

public class DrawableObject
extends java.lang.Object

Object class for objects with a drawable primitive.


Field Summary
protected static int NODEFSCALE
          Value for no default scale.
 
Constructor Summary
DrawableObject(long id, DrawableObjectType type, java.lang.String name, java.lang.String info, DrawableObjects container)
          Constructor of an object.
 
Method Summary
 void addDrawable(Drawable addPrim)
          Adds a primitive to the object.
 void draw(java.awt.Graphics g)
          Draws the primitives of the object.
 void draw(java.awt.Graphics g, int scale)
          Draws the primitives of the object.
 void draw(java.awt.Graphics g, java.awt.Rectangle r)
          Draws the primitives of the object.
 void draw(java.awt.Graphics g, java.awt.Rectangle r, int scale)
          Draws the primitives of the object.
 boolean equals(java.lang.Object obj)
          Compares to objects using their identifier.
 int getDataValue(int index)
          Returns a data value depending on the actual mode.
 int getDefaultScale()
          Returns the default scale of the object.
 Drawable getDrawable(int index)
          Returns the a corresponding primitive.
 long getId()
          Returns the identifier.
 java.lang.String getInfo()
          Returns the string with the attributes.
 java.awt.Rectangle getMBR()
          Computes the minimum bounding rectangle.
 java.lang.String getName()
          Returns the name of the object.
 int getNumberOfDrawables()
          Returns the number of drawable primitives.
 DrawableObjectType getObjectType()
          Returns the type of the object.
 int getPresValue()
          Returns the value which influeces the presentation depending on the actual mode.
 int hashCode()
          Returns the hashcode (=id).
 boolean isSelected()
          Returns whether the object is selected or not.
 boolean isVisible(int scale)
          Test whether one of the corresponding primitives is visible.
 void setDefaultScale(int scale)
          Sets the default scale.
 void setId(long id)
          Sets the id.
 void setName(java.lang.String name)
          Sets the name of the object.
 void setSelection(boolean on)
          Selects or deselect the object and its primitives.
 void write(java.io.DataOutputStream out)
          Writes the object without its primitives.
 void write(EntryWriter out)
          Writes the object without its primitives.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODEFSCALE

protected static final int NODEFSCALE
Value for no default scale.

See Also:
Constant Field Values
Constructor Detail

DrawableObject

public DrawableObject(long id,
                      DrawableObjectType type,
                      java.lang.String name,
                      java.lang.String info,
                      DrawableObjects container)
Constructor of an object.

Parameters:
id - the identifier
type - the type of the object
name - the name of the object
info - attributes of the object
container - container storing the object (the constructor does not put the object into the container)
Method Detail

addDrawable

public void addDrawable(Drawable addPrim)
Adds a primitive to the object.

Parameters:
addPrim - the primitive

draw

public void draw(java.awt.Graphics g)
Draws the primitives of the object.

Parameters:
g - graphic context

draw

public void draw(java.awt.Graphics g,
                 int scale)
Draws the primitives of the object.

Parameters:
g - graphic context
scale - actual scale

draw

public void draw(java.awt.Graphics g,
                 java.awt.Rectangle r)
Draws the primitives of the object.

Parameters:
g - graphic context
r - clipping rectangle

draw

public void draw(java.awt.Graphics g,
                 java.awt.Rectangle r,
                 int scale)
Draws the primitives of the object.

Parameters:
g - graphic context
r - clipping rectangle
scale - actual scale

equals

public boolean equals(java.lang.Object obj)
Compares to objects using their identifier.

Overrides:
equals in class java.lang.Object
Parameters:
obj - object to be compared
Returns:
equal?

getDataValue

public int getDataValue(int index)
                 throws java.lang.NumberFormatException
Returns a data value depending on the actual mode.

Parameters:
index - the index of the data value
Returns:
the value
Throws:
java.lang.NumberFormatException

getDefaultScale

public int getDefaultScale()
Returns the default scale of the object. If it is not set, the minimum scale of the first corresponding primitive is returned.

Returns:
the default scale

getDrawable

public Drawable getDrawable(int index)
Returns the a corresponding primitive.

Parameters:
index - of the primitive
Returns:
the primitive

getId

public long getId()
Returns the identifier.

Returns:
the ID

getInfo

public java.lang.String getInfo()
Returns the string with the attributes.

Returns:
the attributes

getMBR

public java.awt.Rectangle getMBR()
Computes the minimum bounding rectangle.

Returns:
the rectangle

getName

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

Returns:
the name (or an empty string)

getNumberOfDrawables

public int getNumberOfDrawables()
Returns the number of drawable primitives.

Returns:
number

getObjectType

public DrawableObjectType getObjectType()
Returns the type of the object.

Returns:
the type

getPresValue

public int getPresValue()
Returns the value which influeces the presentation depending on the actual mode.

Returns:
the value

hashCode

public int hashCode()
Returns the hashcode (=id).

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode

isSelected

public boolean isSelected()
Returns whether the object is selected or not.

Returns:
selected?

isVisible

public boolean isVisible(int scale)
Test whether one of the corresponding primitives is visible.

Parameters:
scale - scale (-1 => return true)
Returns:
visible?

setDefaultScale

public void setDefaultScale(int scale)
Sets the default scale.

Parameters:
scale - new default scale

setId

public void setId(long id)
Sets the id.

Parameters:
id - new id

setName

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

Parameters:
name - new name

setSelection

public void setSelection(boolean on)
Selects or deselect the object and its primitives.

Parameters:
on - selected?

write

public void write(java.io.DataOutputStream out)
Writes the object without its primitives.

Parameters:
out - the data output stream

write

public void write(EntryWriter out)
Writes the object without its primitives.

Parameters:
out - entry writer