com.sun.j3d.utils.behaviors.vp

## Class WandViewBehavior.ListenerBase

- java.lang.Object
- - com.sun.j3d.utils.behaviors.sensor.SensorInputAdaptor
  - - com.sun.j3d.utils.behaviors.vp.WandViewBehavior.ListenerBase

- All Implemented Interfaces:
    SensorButtonListener, SensorReadListener
  Direct Known Subclasses:
    WandViewBehavior.GrabViewListener6D, WandViewBehavior.RotationListener2D, WandViewBehavior.RotationListener6D, WandViewBehavior.ScaleListener2D, WandViewBehavior.ScaleListener6D, WandViewBehavior.TranslationListener2D, WandViewBehavior.TranslationListener6D
  Enclosing class:
    WandViewBehavior

      public class WandViewBehavior.ListenerBase
      extends SensorInputAdaptor

  A base class for implementing some of this behavior's listeners.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Transform3D` | `sensorToTracker` The initial transform from sensor coordinates to tracker base coordinates, set by `initAction`.
    `protected Transform3D` | `sensorToVworld` The initial transform from sensor coordinates to virtual world coordinates, set by `initAction`.
    `protected Transform3D` | `trackerToVworld` The initial transform from tracker base coordinates to virtual world coordinates, set by `initAction`.
    `protected Transform3D` | `viewPlatformToVworld` The initial transform from view platform coordinates to virtual world coordinates, set by `initAction`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WandViewBehavior.ListenerBase()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `conditionViewScale(Transform3D viewPlatformToVworld)` Equalizes the scale factors in the view tranform, which must be congruent.
    `protected void` | `endAction(Sensor s)` Ends the action.
    `protected double` | `getPhysicalToViewPlatformScale()` Gets the scale from physical units to view platform units.
    `protected double` | `getPhysicalToVirtualScale()` Gets the physical to virtual scale.
    `protected void` | `initAction(Sensor s)` Initializes the listener action.
    `protected boolean` | `isActive()` Returns true if the listener is currently active; that is, if `initAction` has been called but not yet `endAction`.
    `void` | `pressed(SensorEvent e)` This method is called when a sensor's button is pressed.
    `void` | `released(SensorEvent e)` This method is called when a sensor's button is released.
    `protected void` | `transformAboutCenter(Transform3D target, Point3d center, Transform3D transform)` Transforms the target coordinate system about a center point.
    `protected void` | `translateTransform(Transform3D transform, Vector3d translation)` Translates a coordinate system.

    - ### Methods inherited from class com.sun.j3d.utils.behaviors.sensor.SensorInputAdaptor

      `clicked, dragged, read`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### viewPlatformToVworld

          protected Transform3D viewPlatformToVworld

      The initial transform from view platform coordinates to virtual world coordinates, set by `initAction`.

    - #### trackerToVworld

          protected Transform3D trackerToVworld

      The initial transform from tracker base coordinates to virtual world coordinates, set by `initAction`.

    - #### sensorToVworld

          protected Transform3D sensorToVworld

      The initial transform from sensor coordinates to virtual world coordinates, set by `initAction`.

    - #### sensorToTracker

          protected Transform3D sensorToTracker

      The initial transform from sensor coordinates to tracker base coordinates, set by `initAction`.

  - ### Constructor Detail

    - #### WandViewBehavior.ListenerBase

          public WandViewBehavior.ListenerBase()

  - ### Method Detail

    - #### initAction

          protected void initAction(Sensor s)

      Initializes the listener action. Subclasses must call this before starting the action, either from `pressed` or when a 2D valuator exits the deadzone threshold.
      Parameters:
        `s` - reference to a 6DOF sensor if used by the listener; may be `null`

    - #### endAction

          protected void endAction(Sensor s)

      Ends the action. Subclasses must be call this from `released` or when a 2D valuator enters the deadzone threshold.
      Parameters:
        `s` - reference to a 6DOF sensor if used by the listener; may be `null`

    - #### isActive

          protected boolean isActive()

      Returns true if the listener is currently active; that is, if `initAction` has been called but not yet `endAction`.
      Returns:
        true if the listener is active, false otherwise

    - #### pressed

          public void pressed(SensorEvent e)

      Description copied from interface: `SensorButtonListener`
      This method is called when a sensor's button is pressed.
      Specified by:
        `pressed` in interface `SensorButtonListener`
      Overrides:
        `pressed` in class `SensorInputAdaptor`
      Parameters:
        `e` - the sensor event

    - #### released

          public void released(SensorEvent e)

      Description copied from interface: `SensorButtonListener`
      This method is called when a sensor's button is released.
      Specified by:
        `released` in interface `SensorButtonListener`
      Overrides:
        `released` in class `SensorInputAdaptor`
      Parameters:
        `e` - the sensor event

    - #### getPhysicalToVirtualScale

          protected double getPhysicalToVirtualScale()

      Gets the physical to virtual scale.

    - #### getPhysicalToViewPlatformScale

          protected double getPhysicalToViewPlatformScale()

      Gets the scale from physical units to view platform units.

    - #### translateTransform

          protected void translateTransform(Transform3D transform,
                                Vector3d translation)

      Translates a coordinate system.
      Parameters:
        `transform` - the coordinate system to be translated
        `translation` - the vector by which to translate

    - #### transformAboutCenter

          protected void transformAboutCenter(Transform3D target,
                                  Point3d center,
                                  Transform3D transform)

      Transforms the target coordinate system about a center point. This can be used for rotation and scaling.
      Parameters:
        `target` - the coordinate system to transform
        `center` - the center point about which to transform
        `transform` - the transform to apply

    - #### conditionViewScale

          protected void conditionViewScale(Transform3D viewPlatformToVworld)

      Equalizes the scale factors in the view tranform, which must be congruent. If successful, the `ViewingPlatform TransformGroup` is updated; otherwise, its transform is reset to the home transform. This should be called if multiple incremental scale factors are applied to the view transform.
      Parameters:
        `viewPlatformToVworld` - the view transform

Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.