JavaView® v2.12

jv.anim
Class PsKeyframe

java.lang.Object
  |
  +--jv.object.PsObject
        |
        +--jv.project.PgGeometry
              |
              +--jv.anim.PsKeyframe
All Implemented Interfaces:
java.lang.Cloneable, PgGeometryIf, PsKeyframeIf, PsTimeListenerIf, PsUpdateIf, java.io.Serializable

public class PsKeyframe
extends PgGeometry
implements PsKeyframeIf, PsTimeListenerIf

Collection of keys which is a pair of an object and a unique time associated with each object. The objects must be of the same class, and must implement the interpolation method 'blend'.

Instance of this class can be used a the dynamic in an animation.

Version:
21.02.01, 3.00 revised (kp) Implement new methods of PsTimeListenerIf, remove method 'alloc', rename methods.
16.09.00, 2.50 revised (kp) This class no longer implements PsTimeListener, should be managed by parent class.
24.08.00, 2.00 revised (kp) Superclass changed to PgGeometry from PsObject.
04.10.99, 1.01 revised (ur) Four methods getTimeOfFirst/Previous/Next/LastKey added.
22.06.99, 1.00 created (kp)
Author:
Konrad Polthier
See Also:
PsAnimation, PsTimeListenerIf, PsKeyframeIf, Serialized Form

Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_SELECTED, IS_USED, NUM_TAGS
 
Fields inherited from interface jv.project.PgGeometryIf
AMBIENT_H2_HYPERBOLIC, AMBIENT_H3_HYPERBOLIC, AMBIENT_H4_HYPERBOLIC, AMBIENT_PROJECTIONS, AMBIENT_R1_EUCLIDEAN, AMBIENT_R2_EUCLIDEAN, AMBIENT_R3_EUCLIDEAN, AMBIENT_R4_EUCLIDEAN, AMBIENT_R5_EUCLIDEAN, AMBIENT_S1_SPHERE, AMBIENT_S2_SPHERE, AMBIENT_S3_SPHERE, AMBIENT_S4_SPHERE, AMBIENT_SPACES, INSPECTOR_CONTROL, INSPECTOR_CONTROL_EXT, INSPECTOR_MATERIAL, INSPECTOR_MATERIAL_EXT, INSPECTOR_TEXTURE, INSPECTOR_TEXTURE_EXT, LABEL_BASE, LABEL_CENTER, LABEL_HEAD, LABEL_MIDDLE, LABEL_TAIL, LABEL_TOP, METHOD_EXT, PROJ_KLEIN_BALL, PROJ_PARALLEL, PROJ_POINCARE_BALL, PROJ_STEREOGRAPHIC, PROJ_UPPER_HALFSPACE
 
Constructor Summary
PsKeyframe()
          Constructor with empty list of keyframes.
 
Method Summary
 int addKey(PgGeometry object, double time)
          Add key at specified time and return index of key.
 PsAnimation getAnimation()
          Get the animation object of the project which handles the projects animations.
 PgGeometry getDynamic()
          Get the geometry which is used for interpolation between keyframes.
 PgGeometry getNextObject(double time)
          Get geometry of keyframe return by getNextKey(double).
 int getNumOfKeys()
          Get number of keyframes of this instance.
 PgGeometry getObject(double time)
          Get geometry of keyframe return by getKey(double).
 PgGeometry getObject(int ind)
          Get geometry of keyframe return by getKey(int).
 double getTimeOfFirstKey()
          Minimal value of animation interval if instance has keyframes.
 double getTimeOfLastKey()
          Maximal value of animation interval if instance has keyframes.
 double getTimeOfNextKey()
          Current time plus time step increment if instance has keyframes.
 double getTimeOfPreviousKey()
          Current time minus time step increment if instance has keyframes.
 boolean hasAnimation()
          Check whether this project is registered as listener of an animation object.
 void init()
          Initialize instance variables.
 boolean isEnabledKeysOnly()
          Get flag which determines smooth interpolation or displaying of key objects only.
 void removeKey(double time)
          Remove key at specified time within EPS tolerance.
 void removeKey(int ind)
          Remove key at specified index.
 void setAnimation(PsAnimation anAnimation)
          Assign the animation object where this listener is registered.
 void setDynamic(PgGeometry geom)
          Set the geometry which is used for interpolation between keyframes.
 void setEnabledKeysOnly(boolean flag)
          Set flag to avoid smooth interpolation but displaying key objects only.
 void setName(java.lang.String name)
          Set name of instance, and set name of interpolation object.
 boolean setTime(double time)
          Refresh the interpolation geometry at the given time.
 boolean setTime(PsTimeEvent timeEvent)
          Refresh the interpolation geometry at the given time.
 boolean update(java.lang.Object event)
          Update method of geometry updates registered panels, update listeners, and invokes a repaint in the registered displays.
 
Methods inherited from class jv.project.PgGeometry
addDisplay, addElement, addPolygon, addVertex, blend, clearTagElement, clearTagPolygon, clearTagVertex, clone, copy, fillMethodMenu, getAmbientBounds, getAmbientInvMatrix, getAmbientMatrix, getAmbientProjection, getAmbientSpace, getAuthorInfo, getAuthors, getBounds, getCenter, getCenterOfElement, getControlPanel, getDiameter, getDimOfSimplex, getDimOfVertices, getDisplays, getElement, getGeometryInfo, getJvx, getLabelAttribute, getMaterialPanel, getModelMatrix, getPolygon, getTextureImage, getTextureImageName, getTitle, getVersion, getVersionType, getVertex, hasAmbientMatrix, hasDisplay, hasModelMatrix, hasTagElement, hasTagPolygon, hasTagVertex, intersectionWithLine, isConfigurable, isShowingBndBox, isShowingCenter, isShowingTitle, isVisible, merge, paint, reflect, removeDisplay, removeElement, removePolygon, removeVertex, setAmbientMatrix, setAmbientProjection, setAmbientSpace, setAuthorInfo, setAuthors, setCenter, setDimOfSimplex, setElement, setGeometryInfo, setJvx, setLabelAttribute, setLabelAttribute, setModelMatrix, setPolygon, setState, setTagElement, setTagPolygon, setTagVertex, setTextureImage, setTextureImageName, setTitle, setVersion, setVersionType, setVertex, setVisible, showBndBox, showCenter, showTitle, toString
 
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, removeInspector, removeUpdateListener, setParent, setTag, updatePanels
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.anim.PsTimeListenerIf
getName
 
Methods inherited from interface jv.project.PgGeometryIf
assureInspector, getInfoPanel, getName
 
Methods inherited from interface jv.object.PsUpdateIf
getFather, setParent
 

Constructor Detail

PsKeyframe

public PsKeyframe()
Constructor with empty list of keyframes.
Method Detail

init

public void init()
Initialize instance variables.
Overrides:
init in class PgGeometry

setName

public void setName(java.lang.String name)
Set name of instance, and set name of interpolation object. If called before allocation of geometries then key geometries inherit the name suffixed with their key index.
Overrides:
setName in class PsObject

update

public boolean update(java.lang.Object event)
Update method of geometry updates registered panels, update listeners, and invokes a repaint in the registered displays.
Overrides:
update in class PgGeometry
Following copied from interface: jv.object.PsUpdateIf
Parameters:
event - carries a lot of information
Returns:
true if event has been handled, otherwise false
See Also:
PsObject, PsUpdateIf.getFather(), PsUpdateIf.setParent(PsUpdateIf)

getDynamic

public PgGeometry getDynamic()
Get the geometry which is used for interpolation between keyframes. This dynamic geometry should be added to a display in order to visualize a time section of this keyframe sequence.
Returns:
dynamic section of the time dependent geometry

setDynamic

public void setDynamic(PgGeometry geom)
Set the geometry which is used for interpolation between keyframes. This dynamic geometry must be of the same class as all other key objects. Usually, it is assigned automatically by this keyframe class.

This keyframe class is set as the parent of the dynamic geometry.

Parameters:
geometry - used to store a dynamic section of the keyframe animation.

setEnabledKeysOnly

public void setEnabledKeysOnly(boolean flag)
Set flag to avoid smooth interpolation but displaying key objects only.
Parameters:
flag - Set true to avoid smooth interpolation

isEnabledKeysOnly

public boolean isEnabledKeysOnly()
Get flag which determines smooth interpolation or displaying of key objects only.
Returns:
Get true if no smooth interpolation

getObject

public PgGeometry getObject(int ind)
Get geometry of keyframe return by getKey(int).
Parameters:
ind - Index of a keyframe in [0, numKeys-1].
Returns:
Geometry of key, or null if failure.
See Also:
#getKey(int)

getObject

public PgGeometry getObject(double time)
Get geometry of keyframe return by getKey(double).
Parameters:
time - Time of the requested key.
Returns:
Geometry of key, or null if failure.
See Also:
#getKey(double)

getNextObject

public PgGeometry getNextObject(double time)
Get geometry of keyframe return by getNextKey(double).
Parameters:
time - Time of the requested key.
Returns:
Geometry of key, or null if failure.
See Also:
#getNextKey(double)

setTime

public boolean setTime(PsTimeEvent timeEvent)
Refresh the interpolation geometry at the given time. Method invokes the update method of the interpolation geometry to initiate a redraw.

HACK: Method should be moved to applications.

Specified by:
setTime in interface PsTimeListenerIf

setTime

public boolean setTime(double time)
Refresh the interpolation geometry at the given time. Method does not invoke the update method of the interpolation geometry.

getNumOfKeys

public int getNumOfKeys()
Get number of keyframes of this instance.
Returns:
number of keys, or 0 if list is empty.

addKey

public int addKey(PgGeometry object,
                  double time)
Add key at specified time and return index of key. There are four cases: either the new time is left or right of the existing time interval, or it is within EPS tolerance of a key, or between two keys.

removeKey

public void removeKey(double time)
Remove key at specified time within EPS tolerance. If no key found, just return.

removeKey

public void removeKey(int ind)
Remove key at specified index.

getTimeOfFirstKey

public double getTimeOfFirstKey()
Minimal value of animation interval if instance has keyframes. Specific for keyframe animations, otherwise default implementations suffice. Method is invoked from animation panel to browse through set of keys.
Specified by:
getTimeOfFirstKey in interface PsKeyframeIf
See Also:
PsAnimation.enableKeys(boolean)

getTimeOfPreviousKey

public double getTimeOfPreviousKey()
Current time minus time step increment if instance has keyframes. Specific for keyframe animations, otherwise default implementations suffice. Method is invoked from animation panel to browse through set of keys.
Specified by:
getTimeOfPreviousKey in interface PsKeyframeIf

getTimeOfNextKey

public double getTimeOfNextKey()
Current time plus time step increment if instance has keyframes. Specific for keyframe animations, otherwise default implementations suffice.
Specified by:
getTimeOfNextKey in interface PsKeyframeIf
See Also:
PsAnimation.enableKeys(boolean)

getTimeOfLastKey

public double getTimeOfLastKey()
Maximal value of animation interval if instance has keyframes. Specific for keyframe animations, otherwise default implementations suffice.
Specified by:
getTimeOfLastKey in interface PsKeyframeIf
See Also:
PsAnimation.enableKeys(boolean)

getAnimation

public PsAnimation getAnimation()
Get the animation object of the project which handles the projects animations. This listener may only have a single animation object which is assigned by the animation object when this listener is registered using setAnimation(PsAnimation).
Specified by:
getAnimation in interface PsTimeListenerIf
See Also:
hasAnimation(), setAnimation(PsAnimation)

hasAnimation

public boolean hasAnimation()
Check whether this project is registered as listener of an animation object.
Specified by:
hasAnimation in interface PsTimeListenerIf
See Also:
getAnimation(), setAnimation(PsAnimation)

setAnimation

public void setAnimation(PsAnimation anAnimation)
Assign the animation object where this listener is registered. This method is invoked by the animation object during registration of this listener, and usually is not required to be called by a user. If this listener has an assigned animation object, then its animation panel may be shown to change the current time of this listener.

If this project has an animation object assigned in its constructor or init() method, then the animation panel is shown when the project's start() method is invoked during loading of the project.

Only one animation object may be assigned to this listener. Subsequent assignments will replace the previous assignment.

Specified by:
setAnimation in interface PsTimeListenerIf
See Also:
getAnimation(), hasAnimation()

JavaView® v2.12

The software JavaView® is copyright protected. All Rights Reserved.