Class MouseBehavior
- 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.MouseBehavior
-
- Direct Known Subclasses:
FlyBehavior
public abstract class MouseBehavior extends com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior
Abstract 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.WakeupOr
awtCondition
Awt wake up condition .protected javax.media.j3d.WakeupOr
bothCondition
wake up condition for awt, component and mouse.protected java.awt.Rectangle
canvasBounds
Canvas boundary.protected java.awt.geom.Point2D.Float
canvasCenter
Canvas center.protected float
deadFactor
Canvas rescale factor.protected float
deadXSize
Canvas resacled X size.protected float
deadYSize
Canvs rescaled Y size.protected boolean
ignoreMouseMotion
flag to invoke the mouse motion event or not.protected float
MAX_ANGLE
Maxium rotation angle.protected float
MAX_VELOCITY
Maxium rotation velocity.protected boolean
motion
Motion, standard, fly thrugh, point.protected com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback
mouseCallback
Mouse behavior callback.protected javax.media.j3d.Transform3D
newTargetTransform
New target transform.protected JPanelView
parent
JPanel view reference.protected float
pitchAngle
Rotation pitch angle.protected javax.media.j3d.Transform3D
pitchTransform
Spin transform.protected float
spinAngle
Rotation row angle.protected javax.media.j3d.Transform3D
spinTransform
Row transform.protected javax.media.j3d.TransformGroup
targetTG
Target transform group.protected javax.media.j3d.Transform3D
targetTransform
Target transform.protected javax.vecmath.Vector3f
velocity
Velocity vector.protected javax.media.j3d.Transform3D
velocityTransform
Transfrom velocity.protected float
yawAngle
Rotation yaw angle.protected javax.media.j3d.Transform3D
yawTransform
Yaw 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 MouseBehavior(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.Float
getCanvasCenter()
Gets the canvas center.javax.media.j3d.TransformGroup
getTarget()
Returns the TransformGroup this behavior acts on.private void
init()
Initializes wake up events.void
initialize()
Required to be a ViewPlatformBehavior.protected abstract void
integrateTransforms()
Creates a new transform and sets it in the canvas.boolean
isIgnoreMouseMotion()
Indicates whether or not the canvas is ignoring mouse events.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.protected abstract void
processMouseEvent(java.awt.event.MouseEvent evt)
Process the mouse event.void
processStimulus(java.util.Enumeration en)
Required to be a ViewPlatformBehavior.void
setMaximumAngle(float angle)
Sets the maximum angle of the mouse movement.void
setMaximumVelocity(float max)
Sets the maximum velocity of the mouse movement.void
setTarget(javax.media.j3d.TransformGroup targetTG)
Sets the TransformGroup on which this behavior acts.void
setupCallback(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
-
MouseBehavior
public MouseBehavior(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:
initialize
in classjavax.media.j3d.Behavior
-
isIgnoreMouseMotion
public boolean isIgnoreMouseMotion()
Indicates whether or not the canvas is ignoring mouse events.- Returns:
true
indicates the canvas is ignoring mouse events,false
that 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:
processStimulus
in 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.
-
-