Class MouseBehaviorRenderer
- java.lang.Object
-
- javax.media.j3d.SceneGraphObject
-
- javax.media.j3d.Node
-
- javax.media.j3d.Leaf
-
- javax.media.j3d.Behavior
-
- com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior
-
- gov.nih.mipav.view.renderer.J3D.surfaceview.MouseBehaviorRenderer
-
- Direct Known Subclasses:
FlyBehaviorRenderer,PointerBehaviorRenderer
public abstract class MouseBehaviorRenderer extends com.sun.j3d.utils.behaviors.vp.ViewPlatformBehaviorAbstract class which implements much of the event tracking and state updating shared between Fly and Pointer behavior.Canvas3D size changes are tracked
- Author:
- Paul Byrne
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.media.j3d.WakeupOrawtConditionAwt wake up condition .protected javax.media.j3d.WakeupOrbothConditionwake up condition for awt, component and mouse.protected java.awt.RectanglecanvasBoundsCanvas boundary.protected java.awt.geom.Point2D.FloatcanvasCenterCanvas center.protected floatdeadFactorCanvas rescale factor.protected floatdeadXSizeCanvas resacled X size.protected floatdeadYSizeCanvs rescaled Y size.protected booleanignoreMouseMotionflag to invoke the mouse motion event or not.protected floatMAX_ANGLEMaxium rotation angle.protected floatMAX_VELOCITYMaxium rotation velocity.protected booleanmotionMotion, standard, fly thrugh, point.protected com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallbackmouseCallbackMouse behavior callback.protected javax.media.j3d.Transform3DnewTargetTransformNew target transform.protected JPanelViewparentJPanel view reference.protected floatpitchAngleRotation pitch angle.protected javax.media.j3d.Transform3DpitchTransformSpin transform.protected floatspinAngleRotation row angle.protected javax.media.j3d.Transform3DspinTransformRow transform.protected javax.media.j3d.TransformGrouptargetTGTarget transform group.protected javax.media.j3d.Transform3DtargetTransformTarget transform.protected javax.vecmath.Vector3fvelocityVelocity vector.protected javax.media.j3d.Transform3DvelocityTransformTransfrom velocity.protected floatyawAngleRotation yaw angle.protected javax.media.j3d.Transform3DyawTransformYaw transform.-
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
-
-
Constructor Summary
Constructors Constructor Description MouseBehaviorRenderer(JPanelView parent)Creates new parent class with the dialog set for easy access between the user and the behaviors.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.awt.geom.Point2D.FloatgetCanvasCenter()Gets the canvas center.javax.media.j3d.TransformGroupgetTarget()Returns the TransformGroup this behavior acts on.private voidinit()Initializes wake up events.voidinitialize()Required to be a ViewPlatformBehavior.protected abstract voidintegrateTransforms()Creates a new transform and sets it in the canvas.booleanisIgnoreMouseMotion()Indicates whether or not the canvas is ignoring mouse events.private voidprocessAWTEvents(java.awt.AWTEvent[] events)Processes an array of AWT events by calling processMouseEvent; or, if the user pressed ESC, disables certain behaviors.protected abstract voidprocessMouseEvent(java.awt.event.MouseEvent evt)Process the mouse event.voidprocessStimulus(java.util.Enumeration en)Required to be a ViewPlatformBehavior.voidsetMaximumAngle(float angle)Sets the maximum angle of the mouse movement.voidsetMaximumVelocity(float max)Sets the maximum velocity of the mouse movement.voidsetTarget(javax.media.j3d.TransformGroup targetTG)Sets the TransformGroup on which this behavior acts.voidsetupCallback(com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback callback)Sets who the behavior calls back to.-
Methods inherited from class com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior
getHomeTransform, getViewingPlatform, goHome, setHomeTransform, setViewingPlatform
-
Methods inherited from class javax.media.j3d.Behavior
getEnable, getNumSchedulingIntervals, getSchedulingBoundingLeaf, getSchedulingBounds, getSchedulingInterval, getView, getWakeupCondition, postId, setEnable, setSchedulingBoundingLeaf, setSchedulingBounds, setSchedulingInterval, updateNodeReferences, wakeupOn
-
Methods inherited from class javax.media.j3d.Node
cloneNode, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
-
-
-
-
Field Detail
-
awtCondition
protected javax.media.j3d.WakeupOr awtCondition
Awt wake up condition .
-
bothCondition
protected javax.media.j3d.WakeupOr bothCondition
wake up condition for awt, component and mouse.
-
canvasBounds
protected java.awt.Rectangle canvasBounds
Canvas boundary.
-
canvasCenter
protected java.awt.geom.Point2D.Float canvasCenter
Canvas center.
-
deadFactor
protected float deadFactor
Canvas rescale factor.
-
deadXSize
protected float deadXSize
Canvas resacled X size.
-
deadYSize
protected float deadYSize
Canvs rescaled Y size.
-
ignoreMouseMotion
protected boolean ignoreMouseMotion
flag to invoke the mouse motion event or not.
-
MAX_ANGLE
protected float MAX_ANGLE
Maxium rotation angle.
-
MAX_VELOCITY
protected float MAX_VELOCITY
Maxium rotation velocity.
-
motion
protected boolean motion
Motion, standard, fly thrugh, point.
-
mouseCallback
protected com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback mouseCallback
Mouse behavior callback.
-
newTargetTransform
protected javax.media.j3d.Transform3D newTargetTransform
New target transform.
-
parent
protected JPanelView parent
JPanel view reference.
-
pitchAngle
protected float pitchAngle
Rotation pitch angle.
-
pitchTransform
protected javax.media.j3d.Transform3D pitchTransform
Spin transform.
-
spinAngle
protected float spinAngle
Rotation row angle.
-
spinTransform
protected javax.media.j3d.Transform3D spinTransform
Row transform.
-
targetTG
protected javax.media.j3d.TransformGroup targetTG
Target transform group.
-
targetTransform
protected javax.media.j3d.Transform3D targetTransform
Target transform.
-
velocity
protected javax.vecmath.Vector3f velocity
Velocity vector.
-
velocityTransform
protected javax.media.j3d.Transform3D velocityTransform
Transfrom velocity.
-
yawAngle
protected float yawAngle
Rotation yaw angle.
-
yawTransform
protected javax.media.j3d.Transform3D yawTransform
Yaw transform.
-
-
Constructor Detail
-
MouseBehaviorRenderer
public MouseBehaviorRenderer(JPanelView parent)
Creates new parent class with the dialog set for easy access between the user and the behaviors.- Parameters:
parent- Parent dialog.
-
-
Method Detail
-
getCanvasCenter
public java.awt.geom.Point2D.Float getCanvasCenter()
Gets the canvas center. Needed for the mouse control buttons to properly set up the mouse event.- Returns:
- The canvas center.
-
getTarget
public javax.media.j3d.TransformGroup getTarget()
Returns the TransformGroup this behavior acts on.- Returns:
- The transform group this behavior acts on.
-
initialize
public void initialize()
Required to be a ViewPlatformBehavior. Creates new transforms and calls wakeupOn.- Specified by:
initializein classjavax.media.j3d.Behavior
-
isIgnoreMouseMotion
public boolean isIgnoreMouseMotion()
Indicates whether or not the canvas is ignoring mouse events.- Returns:
trueindicates the canvas is ignoring mouse events,falsethat they should be processed as usual.
-
processStimulus
public void processStimulus(java.util.Enumeration en)
Required to be a ViewPlatformBehavior. Processes a list of events, passing them down to the processMouseEvent and integrateTransforms methods.- Specified by:
processStimulusin classjavax.media.j3d.Behavior- Parameters:
en- List of events to process.
-
setMaximumAngle
public void setMaximumAngle(float angle)
Sets the maximum angle of the mouse movement.- Parameters:
angle- Angle to set maximum to.
-
setMaximumVelocity
public void setMaximumVelocity(float max)
Sets the maximum velocity of the mouse movement.- Parameters:
max- Value to set maximum to.
-
setTarget
public void setTarget(javax.media.j3d.TransformGroup targetTG)
Sets the TransformGroup on which this behavior acts.- Parameters:
targetTG- Target transform group to set to.
-
setupCallback
public void setupCallback(com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback callback)
Sets who the behavior calls back to.- Parameters:
callback- Place to call back to.
-
integrateTransforms
protected abstract void integrateTransforms()
Creates a new transform and sets it in the canvas.
-
processMouseEvent
protected abstract void processMouseEvent(java.awt.event.MouseEvent evt)
Process the mouse event. This is called every time an event arrives.- Parameters:
evt- Event to process.
-
init
private void init()
Initializes wake up events.
-
processAWTEvents
private void processAWTEvents(java.awt.AWTEvent[] events)
Processes an array of AWT events by calling processMouseEvent; or, if the user pressed ESC, disables certain behaviors.- Parameters:
events- List of AWT events to process.
-
-