JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.chart3d.j2d.actions
Class RotateAction

java.lang.Object
  |
  +--com.klg.jclass.chart3d.j2d.actions.BaseAction
        |
        +--com.klg.jclass.chart3d.j2d.actions.RotateAction
All Implemented Interfaces:
JCAction, Serializable
Direct Known Subclasses:
RotateEyeAction, RotateXAction, RotateYAction, RotateZAction

public class RotateAction
extends BaseAction

Handler object for rotate actions within JClass Chart 3D Java2D. When a rotate action is started, JCChart3dArea will create an instance of RotateAction and call start(), animate() and end() at appropriate points. A mapping from event to action type is stored the chart's JCActionTable.

See Also:
JCAction, JCActionTable, BaseAction, Serialized Form

Field Summary
protected  int axisId
          The id of the axis on which to base the rotation
protected  Point first
          Point in chart area at which the rotate action was started.
protected  Point last
          Last point used for rotation.
protected  double origXRotation
          Original X rotation value in case this action is cancelled
protected  double origYRotation
          Original Y rotation value in case this action is cancelled
protected  double origZRotation
          Original Z rotation value in case this action is cancelled
protected  Matrix4d rotate
          The rotation matrix used to extract the new rotation angles
protected  double xRotation
          The current xRotation for this action
protected  double yRotation
          The current yRotation for this action
protected  double zRotation
          The current zRotation for this action
 
Fields inherited from class com.klg.jclass.chart3d.j2d.actions.BaseAction
ANIMATING, chart3dArea, enabled, NONE, START, status
 
Constructor Summary
RotateAction()
          Default constructor.
RotateAction(int axisId)
          Constructor which sets the axis on which to rotate.
 
Method Summary
 void animate(InputEvent event, int x, int y)
          Called by JCChart3dArea when the action is to be animated.
 void cancel()
          Called by JCChart3dArea when the action is cancelled
 void end(InputEvent event, int x, int y)
          Called by JCChart3dArea when the action is over.
 void extractAngles(Matrix4d m)
          Extracts the rotation angles from a rotation matrix.
 double getXRotation()
          Get the current x rotation angle
 double getYRotation()
          Get the current y rotation angle
 double getZRotation()
          Get the current z rotation angle
 void reanimate(int x, int y)
          Called by JCChartArea when the chart area has been refreshed and the animation must be redrawn.
 void start(InputEvent event, int x, int y)
          Called by JCChart3dArea when the action is started.
 
Methods inherited from class com.klg.jclass.chart3d.j2d.actions.BaseAction
drawPreview, getChart3d, getChart3dArea, initialize, isEnabled, setChart3dArea, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

first

protected Point first
Point in chart area at which the rotate action was started.


last

protected Point last
Last point used for rotation.


origXRotation

protected double origXRotation
Original X rotation value in case this action is cancelled


origYRotation

protected double origYRotation
Original Y rotation value in case this action is cancelled


origZRotation

protected double origZRotation
Original Z rotation value in case this action is cancelled


xRotation

protected double xRotation
The current xRotation for this action


yRotation

protected double yRotation
The current yRotation for this action


zRotation

protected double zRotation
The current zRotation for this action


axisId

protected int axisId
The id of the axis on which to base the rotation


rotate

protected Matrix4d rotate
The rotation matrix used to extract the new rotation angles

Constructor Detail

RotateAction

public RotateAction()
Default constructor.


RotateAction

public RotateAction(int axisId)
Constructor which sets the axis on which to rotate. JCAxis.AXIS_NONE means use the general rotation method.

Parameters:
axisId - The id of the axis on which to base the rotation
Method Detail

getXRotation

public double getXRotation()
Get the current x rotation angle

Returns:
The current x rotation angle

getYRotation

public double getYRotation()
Get the current y rotation angle

Returns:
The current y rotation angle

getZRotation

public double getZRotation()
Get the current z rotation angle

Returns:
The current z rotation angle

extractAngles

public void extractAngles(Matrix4d m)
Extracts the rotation angles from a rotation matrix. The matrix m is equated with the general rotation matrix and the resulting system is solved. This gives nine equations and three unknowns.

Parameters:
m - The matrix from which rotation angles are extracted

start

public void start(InputEvent event,
                  int x,
                  int y)
Called by JCChart3dArea when the action is started. For the rotate action, this method sets a series of initial values.

Specified by:
start in interface JCAction
Specified by:
start in class BaseAction
Parameters:
event - The event for the action
x - The x pixel position where rotation is starting
y - The y pixel position where rotation is starting

animate

public void animate(InputEvent event,
                    int x,
                    int y)
Called by JCChart3dArea when the action is to be animated. For the rotate action, this method calculates new rotation and elevation values for the chart area.

Specified by:
animate in interface JCAction
Specified by:
animate in class BaseAction
Parameters:
event - The event for the action
x - The x pixel position where the animation is happening
y - The y pixel position where the animation is happening

reanimate

public void reanimate(int x,
                      int y)
Called by JCChartArea when the chart area has been refreshed and the animation must be redrawn.

Specified by:
reanimate in interface JCAction
Specified by:
reanimate in class BaseAction
Parameters:
x - The x pixel position where reanimation is happening
y - The y pixel position where reanimation is happening

end

public void end(InputEvent event,
                int x,
                int y)
Called by JCChart3dArea when the action is over. Does nothing for the rotate action.

Specified by:
end in interface JCAction
Specified by:
end in class BaseAction
Parameters:
event - The event for the action
x - The x pixel position where the user finished rotating
y - The y pixel position where the user finished rotating

cancel

public void cancel()
Called by JCChart3dArea when the action is cancelled

Specified by:
cancel in interface JCAction
Specified by:
cancel in class BaseAction

Copyright © 2004 Quest Software Inc..
All rights reserved.