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.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
    Awt wake up condition .
    protected javax.media.j3d.WakeupOr
    wake up condition for awt, component and mouse.
    protected Rectangle
    Canvas boundary.
    protected Point2D.Float
    Canvas center.
    protected float
    Canvas rescale factor.
    protected float
    Canvas resacled X size.
    protected float
    Canvs rescaled Y size.
    protected boolean
    flag to invoke the mouse motion event or not.
    protected float
    Maxium rotation angle.
    protected float
    Maxium rotation velocity.
    protected boolean
    Motion, standard, fly thrugh, point.
    protected com.sun.j3d.utils.behaviors.mouse.MouseBehaviorCallback
    Mouse behavior callback.
    protected javax.media.j3d.Transform3D
    New target transform.
    protected JPanelView
    JPanel view reference.
    protected float
    Rotation pitch angle.
    protected javax.media.j3d.Transform3D
    Spin transform.
    protected float
    Rotation row angle.
    protected javax.media.j3d.Transform3D
    Row transform.
    protected javax.media.j3d.TransformGroup
    Target transform group.
    protected javax.media.j3d.Transform3D
    Target transform.
    protected javax.vecmath.Vector3f
    Velocity vector.
    protected javax.media.j3d.Transform3D
    Transfrom velocity.
    protected float
    Rotation yaw angle.
    protected javax.media.j3d.Transform3D
    Yaw transform.

    Fields inherited from class com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior

    homeTransform, vp

    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
    Creates new parent class with the dialog set for easy access between the user and the behaviors.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the canvas center.
    javax.media.j3d.TransformGroup
    Returns the TransformGroup this behavior acts on.
    private void
    Initializes wake up events.
    void
    Required to be a ViewPlatformBehavior.
    protected abstract void
    Creates a new transform and sets it in the canvas.
    boolean
    Indicates whether or not the canvas is ignoring mouse events.
    private void
    Processes an array of AWT events by calling processMouseEvent; or, if the user pressed ESC, disables certain behaviors.
    protected abstract void
    Process the mouse event.
    void
    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

    Methods inherited from class javax.media.j3d.SceneGraphObject

    clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • 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 Rectangle canvasBounds
      Canvas boundary.
    • canvasCenter

      protected 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 Details

    • 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 Details

    • getCanvasCenter

      public 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 class javax.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(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 class javax.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(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(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.