|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectubc.cs.JLog.Animation.aAttributeTranslation
ubc.cs.JLog.Animation.aAnimationObject
public class aAnimationObject
This represents a graphical object which is composed from possibly several
collection of aAnimationShape
s. Each collection is a particular
view of that object (multiple views permit animation). An object also has a
level attribute that determines its order when displayed in the environment
(to determine overlap of the object's image). Animation objects can also
keep track of the path they have traversed. Objects are not themselves visible
(the enclosed shapes give the visible manifestation), but they do have coordinates
and rotation attributes. Coordinates are given the canonical global coordinates (i.e.,
with magnification of 1.0) and rotation of an object is given in radians. Enclosed
shapes have local canonical coordinates and rotations which are offsets from the object
values. A display point (non-canonical) is the global point with magnifcation applied.
Field Summary | |
---|---|
protected aAnimationEnvironment |
environment
|
protected int |
level
|
static java.lang.String |
LEVEL_ATTR_KEY
|
protected java.lang.String |
name
|
static java.lang.String |
NAME_ATTR_KEY
|
protected java.util.Hashtable[] |
named_shapes
|
protected java.util.Vector |
path
|
protected java.awt.Color |
path_colour
|
protected int |
path_size
|
protected int |
path_skip
|
protected int |
path_skipcount
|
static java.lang.String |
PATHCOLOUR_ATTR_KEY
|
static java.lang.String |
PATHSIZE_ATTR_KEY
|
static java.lang.String |
PATHSKIP_ATTR_KEY
|
protected float |
rotation
|
static java.lang.String |
ROTATION_ATTR_KEY
|
protected java.util.Vector[] |
shapes
|
protected int |
view
|
static java.lang.String |
VIEW_ATTR_KEY
|
protected float |
x
|
static java.lang.String |
X_ATTR_KEY
|
protected float |
y
|
static java.lang.String |
Y_ATTR_KEY
|
Constructor Summary | |
---|---|
aAnimationObject(aAnimationEnvironment ae,
java.lang.String n,
int l,
int vs)
The constructor. |
Method Summary | |
---|---|
protected void |
addPath(float x,
float y)
Add a location to the path. |
void |
addShape(aAnimationShape as)
Add an aAnimationShape . |
void |
draw(java.awt.Graphics g)
Draw the current view of the object in the Graphics environment
provided. |
java.util.Enumeration |
enumShapes()
Get an Enumeration of the shapes in the current view. |
java.util.Hashtable |
getAttributes()
Returns a hashtable of every attribute associated with this object. |
java.awt.Rectangle |
getBounds()
Returns the bounding rectangle for this object in the current view, given in global coordinates. |
java.awt.Point |
getDisplayPointFromLocalPoint(float dx,
float dy)
Calculates the display coordinates for given local (i.e., shape relative) point. |
java.awt.Point |
getDisplayPointFromLocalPosition(float dx,
float dy,
float dr)
Calculates the display coordinates for given local (i.e., shape relative) point and rotation. |
aAnimationEnvironment |
getEnvironment()
|
float |
getGlobalRotationFromLocal(float dr)
|
float |
getGlobalXPositionFromLocal(float dx)
|
float |
getGlobalYPositionFromLocal(float dy)
|
int |
getLevel()
|
java.lang.String |
getName()
|
int |
getPathSize(boolean allowed)
Get the size of the path. |
aAnimationShape |
getShape(java.lang.String name)
Get a shape in the current view with the given name. |
int |
getShapeView(aAnimationShape s)
Get the view containing the given shape. |
jTermTranslation |
getTermTranslation()
Get the current translation unit for this object. |
int |
getView()
Get the current display view. |
void |
removeShape(aAnimationShape as)
Remove an aAnimationShape from the current view. |
void |
setAttributes(java.util.Hashtable attributes)
Set the attributes of the object to those in the given Hashtable. |
static void |
setDefaultsForTranslation(jTermTranslation t)
|
void |
setLevel(int l)
Set the object level in the display heirarchy. |
void |
setName(java.lang.String n)
|
void |
setPathSize(int sz,
int sk,
java.awt.Color c)
Set the path attributes. |
void |
setPosition(float x,
float y)
Adjust the global location of the object to the given position. |
void |
setRotation(float r)
Adjust the rotation of the object to the given angle in radians. |
void |
setView(int v)
Set the current view to display. |
void |
updateMagnification()
Update notification. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String X_ATTR_KEY
public static final java.lang.String Y_ATTR_KEY
public static final java.lang.String ROTATION_ATTR_KEY
public static final java.lang.String NAME_ATTR_KEY
public static final java.lang.String LEVEL_ATTR_KEY
public static final java.lang.String VIEW_ATTR_KEY
public static final java.lang.String PATHSIZE_ATTR_KEY
public static final java.lang.String PATHSKIP_ATTR_KEY
public static final java.lang.String PATHCOLOUR_ATTR_KEY
protected aAnimationEnvironment environment
protected int level
protected int view
protected java.lang.String name
protected java.util.Vector path
protected int path_size
protected int path_skip
protected int path_skipcount
protected java.awt.Color path_colour
protected java.util.Vector[] shapes
protected java.util.Hashtable[] named_shapes
protected float x
protected float y
protected float rotation
Constructor Detail |
---|
public aAnimationObject(aAnimationEnvironment ae, java.lang.String n, int l, int vs)
aAnimationEnvironment
,
name, level, and the maximum views.
ae
- The graphical environment that encloses this object.
Animation object can only belong to one environment.n
- The name of the object.l
- The level at which this object floats in the environment.
Lower numbers are deeper in environment (they are drawn
first), while larger numbers appear towards the top of the
environment (drawn last).vs
- The maximum number of views the object will have. Each view
must be populated with aAnimationShape
s.Method Detail |
---|
public aAnimationEnvironment getEnvironment()
public aAnimationShape getShape(java.lang.String name)
name
- The name of the shape.
aAnimationShape
from the current view,
with the given name.public java.util.Enumeration enumShapes()
aAnimationShape
shape
object from the current view.public void addShape(aAnimationShape as)
aAnimationShape
. The shape must already be created
with this object being its parent object. Shape is added to the current view.
as
- The aAnimationShape
to add.public void removeShape(aAnimationShape as)
aAnimationShape
from the current view.
as
- The aAnimationShape
to remove.public void draw(java.awt.Graphics g)
Graphics
environment
provided. Includes any path that the object has recorded.
g
- The Graphics
environment to draw into.public java.awt.Rectangle getBounds()
Rectangle
bounding this object.public java.lang.String getName()
public void setName(java.lang.String n)
public int getLevel()
public void setLevel(int l)
l
- The level at which this object floats in the environment.
Lower numbers are deeper in environment (they are drawn
first), while larger numbers appear towards the top of the
environment (drawn last).public int getView()
public int getShapeView(aAnimationShape s)
s
- The shape, which this object should contain.
public void setView(int v)
v
- The view number (zero based).public static void setDefaultsForTranslation(jTermTranslation t)
public jTermTranslation getTermTranslation()
aAttributeTranslation
getTermTranslation
in class aAttributeTranslation
jTermTranslation
translation unit.public java.util.Hashtable getAttributes()
iAttributes
public void setAttributes(java.util.Hashtable attributes)
iAttributes
attributes
- The Hashtable of attribute name-value pairings.public final java.awt.Point getDisplayPointFromLocalPosition(float dx, float dy, float dr)
dx
- Local (shape relative) x position offset from the objects position.dy
- Local (shape relative) y position offset from the objects position.dr
- Local (shape relative) rotation offset.public final java.awt.Point getDisplayPointFromLocalPoint(float dx, float dy)
dx
- Local (shape relative) x position offset from the objects position.dy
- Local (shape relative) y position offset from the objects position.public final float getGlobalRotationFromLocal(float dr)
public final float getGlobalXPositionFromLocal(float dx)
public final float getGlobalYPositionFromLocal(float dy)
public void setPathSize(int sz, int sk, java.awt.Color c)
sz
- The number of previous locations to keep track of.sk
- The number of previous locations skip over before recording
a location (used to prevent sampling every location).c
- The colour to draw the path in.public int getPathSize(boolean allowed)
allowed
- true if we want the maximum number of previous locations
allowed, false if we just want to know how many locations
are already recorded in the path.
allowed
is true, then returns the maximum
number of previous locations to record, otherwise returns
the number of previous locations currently recorded.protected void addPath(float x, float y)
x
- The x component of the location.y
- The y component of the location.public void setPosition(float x, float y)
x
- The x component of the location.y
- The y component of the location.public void setRotation(float r)
r
- The angle of the object in radians.public void updateMagnification()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |