ubc.cs.JLog.Animation
Class aAnimationShape_line

java.lang.Object
  extended by ubc.cs.JLog.Animation.aAttributeTranslation
      extended by ubc.cs.JLog.Animation.aAnimationShape
          extended by ubc.cs.JLog.Animation.aAnimationShape_line
All Implemented Interfaces:
iAttributes

public class aAnimationShape_line
extends aAnimationShape


Field Summary
protected  FloatRectangle cached_rotline
           
protected  java.awt.Rectangle cached_tranline
           
protected  java.awt.Color colour
           
static java.lang.String COLOUR_ATTR_KEY
           
static java.lang.String LINE_ATTR_KEY
           
protected  FloatRectangle original_line
           
 
Fields inherited from class ubc.cs.JLog.Animation.aAnimationShape
name, NAME_ATTR_KEY, object, OBJECT_ATTR_KEY, ROTATION_ATTR_KEY, rotation_offset, TYPE_ATTR_KEY, X_ATTR_KEY, x_offset, Y_ATTR_KEY, y_offset
 
Constructor Summary
aAnimationShape_line(aAnimationObject ao, java.lang.String n, FloatRectangle r, java.awt.Color c)
          The constructor.
 
Method Summary
 void draw(java.awt.Graphics g)
          Draw the shape in the Graphics environment provided.
protected  FloatRectangle generateRotatedLine(FloatRectangle fr)
           
protected  java.awt.Rectangle generateTranslatedLine(FloatRectangle fr)
           
 java.util.Hashtable getAttributes()
          Returns a hashtable of every attribute associated with this object.
 java.awt.Rectangle getBounds()
          Returns the bounding rectangle for this shape, given in global coordinates.
 jTermTranslation getTermTranslation()
          Get the current translation unit for this object.
 java.lang.String getType()
          Sub-classes should return their type value (i.e., the value used to specify the shape type to create in the animation<addshape> predicate command).
 void setAttributes(java.util.Hashtable attributes)
          Set the attributes of the object to those in the given Hashtable.
static void setDefaultsForTranslation(jTermTranslation t)
           
 void setLine(FloatRectangle r)
           
 void setLocalPosition(float x, float y)
          Set the new location of the shape to the given offset values.
 void setLocalRotation(float r)
          Set the object relative rotation of the shape to the given angle in radians.
 void updateMagnification()
          Update notification.
 void updatePosition()
          Update notification.
 void updateRotation()
          Update notification.
 
Methods inherited from class ubc.cs.JLog.Animation.aAnimationShape
getEnclosingObject, getName, setName
 
Methods inherited from class ubc.cs.JLog.Animation.aAttributeTranslation
convertFromColor, convertFromFont, convertFromPolygon, convertFromRectangle, convertToAnimationObject, convertToAnimationShape, convertToAttributesObject, convertToBoolean, convertToColor, convertToFloat, convertToFont, convertToInt, convertToList, convertToPolygon, convertToRectangle, convertToString, convertToTerms, convertToTerms, setObjectDefaults, setStringKeysForTranslation, setTermDefaults
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE_ATTR_KEY

public static final java.lang.String LINE_ATTR_KEY
See Also:
Constant Field Values

COLOUR_ATTR_KEY

public static final java.lang.String COLOUR_ATTR_KEY
See Also:
Constant Field Values

colour

protected java.awt.Color colour

original_line

protected FloatRectangle original_line

cached_rotline

protected FloatRectangle cached_rotline

cached_tranline

protected java.awt.Rectangle cached_tranline
Constructor Detail

aAnimationShape_line

public aAnimationShape_line(aAnimationObject ao,
                            java.lang.String n,
                            FloatRectangle r,
                            java.awt.Color c)
The constructor. Requires the owning aAnimationObject, and a name. The rectangle describes the two points that make up the line (the width, height are the x,y of the second point).

Parameters:
ao - The graphical object composed from this shape. Animation shapes can only belong to one object.
n - The name of the shape.
r - The rectangle representing the line.
c - The colour of the line.
Method Detail

draw

public void draw(java.awt.Graphics g)
Description copied from class: aAnimationShape
Draw the shape in the Graphics environment provided.

Specified by:
draw in class aAnimationShape
Parameters:
g - The Graphics environment to draw into.

getBounds

public java.awt.Rectangle getBounds()
Description copied from class: aAnimationShape
Returns the bounding rectangle for this shape, given in global coordinates.

Specified by:
getBounds in class aAnimationShape
Returns:
The Rectangle bounding this shape.

getType

public java.lang.String getType()
Description copied from class: aAnimationShape
Sub-classes should return their type value (i.e., the value used to specify the shape type to create in the animation<addshape> predicate command).

Specified by:
getType in class aAnimationShape
Returns:
The type string for the class.

setLine

public void setLine(FloatRectangle r)

setLocalPosition

public void setLocalPosition(float x,
                             float y)
Description copied from class: aAnimationShape
Set the new location of the shape to the given offset values.

Overrides:
setLocalPosition in class aAnimationShape
Parameters:
x - The new x position component, relative to enclosing object.
y - The new y position component, relative to enclosing object.

setLocalRotation

public void setLocalRotation(float r)
Description copied from class: aAnimationShape
Set the object relative rotation of the shape to the given angle in radians.

Overrides:
setLocalRotation in class aAnimationShape
Parameters:
r - The new angle of the shape in radians.

setDefaultsForTranslation

public static void setDefaultsForTranslation(jTermTranslation t)

getTermTranslation

public jTermTranslation getTermTranslation()
Description copied from class: aAttributeTranslation
Get the current translation unit for this object. Usually, it will get a translation unit for the class. The returned unit should not be modified (since it belongs to the class).

Overrides:
getTermTranslation in class aAnimationShape
Returns:
The jTermTranslation translation unit.

getAttributes

public java.util.Hashtable getAttributes()
Description copied from interface: iAttributes
Returns a hashtable of every attribute associated with this object. Each attribute must have a String name key, and its associated value (non-null).

Specified by:
getAttributes in interface iAttributes
Overrides:
getAttributes in class aAnimationShape
Returns:
The Hashtable of attribute name-value pairings.

setAttributes

public void setAttributes(java.util.Hashtable attributes)
Description copied from interface: iAttributes
Set the attributes of the object to those in the given Hashtable. Errors such as Non-applicable attributes, or invalid values can be handled as the receiving object prefers (e.g., silently ignore, or throw exception).

Specified by:
setAttributes in interface iAttributes
Overrides:
setAttributes in class aAnimationShape
Parameters:
attributes - The Hashtable of attribute name-value pairings.

updatePosition

public void updatePosition()
Description copied from class: aAnimationShape
Update notification. The enclosing object position has changed.

Overrides:
updatePosition in class aAnimationShape

updateRotation

public void updateRotation()
Description copied from class: aAnimationShape
Update notification. The enclosing object rotation has changed.

Overrides:
updateRotation in class aAnimationShape

updateMagnification

public void updateMagnification()
Description copied from class: aAnimationShape
Update notification. The environment magnification value changed.

Overrides:
updateMagnification in class aAnimationShape

generateRotatedLine

protected FloatRectangle generateRotatedLine(FloatRectangle fr)

generateTranslatedLine

protected java.awt.Rectangle generateTranslatedLine(FloatRectangle fr)