Class FlyBehavior


  • public class FlyBehavior
    extends MouseBehavior
    This behavior is supposed to emulate a pilot directing an aircraft. The three mouse buttons act like a joystick. Rotation is controlled with the left mouse button and the middle mouse button. Zoom is controlled with the left mouse button; translation is controlled with the right mouse button.

    Here are the functions:
    Left mouse button:
    Up - zooms out
    Down - zooms in
    Right - spins to the left
    Left - spins to the right
    Right mouse button:
    Up - translates down
    Down - translates up
    Right - translates left
    Left - translates right
    Middle mouse button:
    Up - pitches up
    Down - pitches down
    Right - rolls right
    Left - rolls left

    A slider in the dialog controls the speed of these changes. Also, the further away from the center of the canvas the mouse event is, the faster it will occur. So if the user points the mouse with the left mouse button at the very top of the canvas, the image will zoom out quickly. If the user points the mouse with the left mouse button only slightly above the center of the canvas, the image will zoom out slowly.

    • Constructor Summary

      Constructors 
      Constructor Description
      FlyBehavior​(JPanelView parent)
      Constructs new behavior and initializes wake up events.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void integrateTransforms()
      Sets up the new transform by creating transforms from the determined pitch, yaw, and roll angles and multiplying these with the velocity.
      protected void processMouseEvent​(java.awt.event.MouseEvent event)
      Processes the mouse event, setting yaw, pitch, roll, and velocity depending on mouse button and position.
      • 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
    • Constructor Detail

      • FlyBehavior

        public FlyBehavior​(JPanelView parent)
        Constructs new behavior and initializes wake up events.
        Parameters:
        parent - The dialog that called this behavior.
    • Method Detail

      • integrateTransforms

        protected void integrateTransforms()
        Sets up the new transform by creating transforms from the determined pitch, yaw, and roll angles and multiplying these with the velocity.
        Specified by:
        integrateTransforms in class MouseBehavior
      • processMouseEvent

        protected void processMouseEvent​(java.awt.event.MouseEvent event)
        Processes the mouse event, setting yaw, pitch, roll, and velocity depending on mouse button and position.
        Specified by:
        processMouseEvent in class MouseBehavior
        Parameters:
        event - Mouse event to process.