jv.anim

## Class PsKeyframe

- java.lang.Object
- - jv.object.PsObject
  - - jv.project.PgGeometry
    - - jv.anim.PsKeyframe

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, PsKeyframeIf, PsTimeListenerIf, PsUpdateIf, PgGeometryIf

      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 as the dynamic in an animation.

  See Also:
    `PsAnimation`, `PsTimeListenerIf`, `PsKeyframeIf`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class jv.object.PsObject

      `HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, 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, BLEND_ALPHA, BLEND_MATERIAL, BLEND_REPLACE, FILTER_DIRECT, FILTER_LINEAR, FILTER_QUADRATIC, HAS_METHOD_MENU, 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, m_numLabelTypes, METHOD_EXT, PERIODIC_BOTH, PERIODIC_HEIGHT, PERIODIC_NONE, PERIODIC_WIDTH, PROJ_KLEIN_BALL, PROJ_PARALLEL, PROJ_POINCARE_BALL, PROJ_STEREOGRAPHIC, PROJ_UPPER_HALFSPACE, SIDE_BACK, SIDE_BOTH, SIDE_FRONT, SIDE_NONE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PsKeyframe()` Constructor with empty list of keyframes.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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 first keyframe with `currentTime>time`, or `null` if no more keyframes.
    `int` | `getNumOfKeys()` Get number of keyframes of this instance.
    `PgGeometry` | `getObject(double time)` Get geometry of keyframe with `currentTime<=time`.
    `PgGeometry` | `getObject(int ind)` Get geometry of keyframe with given index.
    `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, applyAmbientMatrix, applyModelingMatrix, blend, clearTagElement, clearTagPolygon, clearTagVertex, clone, convertWorldToModel, copy, fillMethodMenu, fillMethodMenu, getAmbientBounds, getAmbientInvMatrix, getAmbientMatrix, getAmbientProjection, getAmbientSpace, getAuthorInfo, getAuthors, getBounds, getCenter, getCenterOfElement, getControlPanel, getDiameter, getDimOfSimplex, getDimOfVertices, getDisplayList, getDisplays, getElement, getGeometryInfo, getJvx, getLabelAttribute, getLabelColor, getLabelFont, getLabelSize, getLabelStyle, getMaterialPanel, getModelMatrix, getPolygon, getState, getTextureImage, getTextureImageName, getTitle, getType, getVersion, getVersionType, getVertex, hasAmbientMatrix, hasDisplay, hasModelMatrix, hasTagElement, hasTagPolygon, hasTagVertex, intersectionWithLine, isConfigurable, isEnabledInstanceSharing, isShowingBndBox, isShowingCenter, isShowingName, isShowingTitle, isVisible, merge, paint, projectFromAmbientSpace, reflect, removeDisplay, removeElement, removeMethodMenus, removePolygon, removeVertex, setAmbientMatrix, setAmbientProjection, setAmbientSpace, setAuthorInfo, setAuthors, setCenter, setDimOfSimplex, setDimOfVertices, setElement, setEnabledInstanceSharing, setGeometryInfo, setJvx, setLabelAttribute, setLabelAttribute, setLabelColor, setLabelFont, setLabelSize, setLabelStyle, setModelMatrix, setPolygon, setState, setTagElement, setTagPolygon, setTagVertex, setTextureImage, setTextureImageName, setTitle, setType, setVersion, setVersionType, setVertex, setVisible, showBndBox, showCenter, showName, showTitle, toString`

    - ### Methods inherited from class jv.object.PsObject

      `addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setParent, setSymbol, 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, hasTag`

    - ### 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.
      Specified by:
        `setName` in interface `PgGeometryIf`
      Overrides:
        `setName` in class `PsObject`
      See Also:
        `PgGeometryIf.getName()`, `PgGeometryIf.setTitle(String)`

    - #### 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.
      Specified by:
        `update` in interface `PsUpdateIf`
      Overrides:
        `update` in class `PgGeometry`
      Parameters:
        `event` - carries a lot of information
      Returns:
        true if event has been handled, otherwise false
      See Also:
        `PsObject.setParent(PsUpdateIf)`, `PsObject.getFather()`, `PsObject.addUpdateListener(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:
        `geom` - 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 with given index.
      Parameters:
        `ind` - Index of a keyframe in [0, numKeys-1].
      Returns:
        Geometry of key, or null if failure.
      See Also:
        `getObject(double)`

    - #### getObject

          public PgGeometry getObject(double time)

      Get geometry of keyframe with `currentTime<=time`.
      Parameters:
        `time` - Time of the requested key.
      Returns:
        Geometry of key, or null if failure.
      See Also:
        `getNextObject(double)`

    - #### getNextObject

          public PgGeometry getNextObject(double time)

      Get geometry of first keyframe with `currentTime>time`, or `null` if no more keyframes.
      Parameters:
        `time` - Time of the requested key.
      Returns:
        Geometry of key, or null if failure.
      See Also:
        `getObject(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.

      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()`

"

The software JavaView? is copyright protected. All Rights Reserved.
"