OrbitBehaviorInterim 2.1

com.interactivemesh.j3d.community.utils.navigation.orbit
Class OrbitBehaviorInterim

java.lang.Object
  extended by javax.media.j3d.SceneGraphObject
      extended by javax.media.j3d.Node
          extended by javax.media.j3d.Leaf
              extended by javax.media.j3d.Behavior
                  extended by com.interactivemesh.j3d.community.utils.navigation.orbit.ViewPlatformBehaviorInterim
                      extended by com.interactivemesh.j3d.community.utils.navigation.orbit.ViewPlatformAWTBehaviorInterim
                          extended by com.interactivemesh.j3d.community.utils.navigation.orbit.OrbitBehaviorInterim
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener

public class OrbitBehaviorInterim
extends ViewPlatformAWTBehaviorInterim

Moves the View around a point of interest when the mouse is dragged with a mouse button pressed. Includes rotation, zoom, and translation actions. Zooming can also be obtained by using mouse wheel.

The rotate action rotates the ViewPlatform around the point of interest when the mouse is moved with the main mouse button pressed. The rotation is in the direction of the mouse movement, with a default rotation of 0.01 radians for each pixel of mouse movement.

The zoom action moves the ViewPlatform closer to or further from the point of interest when the mouse is moved with the middle mouse button pressed (or Alt-main mouse button on systems without a middle mouse button). The default zoom action is to translate the ViewPlatform 0.01 units for each pixel of mouse movement. Moving the mouse up moves the ViewPlatform closer, moving the mouse down moves the ViewPlatform further away.

By default, the zoom action allows the ViewPlatform to move through the center of rotation to orbit at a negative radius. The STOP_ZOOM constructor flag will stop the ViewPlatform at a minimum radius from the center. The default minimum radius is 0.0 and can be set using the setMinRadius method.

The PROPORTIONAL_ZOOM constructor flag changes the zoom action to move the ViewPlatform proportional to its distance from the center of rotation. For this mode, the default action is to move the ViewPlatform by 1% of its distance from the center of rotation for each pixel of mouse movement.

The translate action translates the ViewPlatform when the mouse is moved with the right mouse button pressed (Shift-main mouse button on systems without a right mouse button). The translation is in the direction of the mouse movement, with a default translation of 0.01 units for each pixel of mouse movement.

The sensitivity of the actions can be scaled using the setActionFactor() methods which scale the default movement by the factor. The rotate and translate actions have separate factors for x and y.

The actions can be reversed using the REVERSE_ACTION constructor flags. The default action moves the ViewPlatform around the objects in the scene. The REVERSE_ACTION flags can make the objects in the scene appear to be moving in the direction of the mouse movement.

The actions can be disabled by either using the DISABLE_ACTION constructor flags or the setActionEnable methods.

The default center of rotation is (0, 0, 0) and can be set using the setRotationCenter() method.

Since:
Java 3D 1.2.1

Field Summary
static int DISABLE_ROTATE
          Constructor flag to disable rotate
static int DISABLE_TRANSLATE
          Constructor flag to disable translate
static int DISABLE_ZOOM
          Constructor flag to disable zoom
protected  double maxClipRatio
          Maximum ratio of back and front clip distances.
protected  double minBackClipDistance
          Minimum back clip distance.
protected  int projection
          Projection mode: View.PARALLEL_PROJECTION or View.PERSPECTIVE_PROJECTION.
static int PROPORTIONAL_ZOOM
          Constructor flag to use proportional zoom, which determines how much you zoom based on view's distance from the center of rotation.
protected  double radiusFactor
          Factor to scale the scene radius.
static int REVERSE_ALL
          Constructor flag to reverse all the behaviors
static int REVERSE_ROTATE
          Constructor flag to reverse the rotate behavior
static int REVERSE_TRANSLATE
          Constructor flag to reverse the translate behavior
static int REVERSE_ZOOM
          Constructor flag to reverse the zoom behavior
protected  javax.vecmath.Point3d sceneCenter
          Center of the scene bounding sphere.
protected  double sceneRadius
          Radius of the scene bounding sphere.
protected  javax.media.j3d.BoundingSphere sceneSphere
          Bounding sphere of the scene as base for clipping distances calculation.
static int STOP_ZOOM
          Constructor flag that indicates zoom should stop when it reaches the minimum orbit radius set by setMinRadius().
protected  javax.media.j3d.View view
          The target View for this behavior.
 
Fields inherited from class com.interactivemesh.j3d.community.utils.navigation.orbit.ViewPlatformAWTBehaviorInterim
component, frameWakeup, motion, MOUSE_LISTENER, MOUSE_MOTION_LISTENER, MOUSE_WHEEL_LISTENER, POST_ID, postWakeup, targetTransform
 
Fields inherited from class com.interactivemesh.j3d.community.utils.navigation.orbit.ViewPlatformBehaviorInterim
homeRotCenter, homeTransform, targetTG
 
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
OrbitBehaviorInterim()
          Constructs a OrbitBehaviorInterim with a null source of Component, a null targets of TransformGroup and View, and no constructor flags.
OrbitBehaviorInterim(java.awt.Component c, javax.media.j3d.TransformGroup tg)
          Constructs a OrbitBehaviorInterim with a specified source of Component, a specified target of TransformGroup, a null target of View, and no constructor flags.
OrbitBehaviorInterim(java.awt.Component c, javax.media.j3d.TransformGroup tg, int flags)
          Constructs a OrbitBehaviorInterim with a specified source of Component, a specified target of TransformGroup, a null target of View, and specified constructor flags.
OrbitBehaviorInterim(java.awt.Component c, javax.media.j3d.TransformGroup tg, javax.media.j3d.View view)
          Constructs a OrbitBehaviorInterim with a specified source of Component, specified targets of TransformGroup and View, and no constructor flags.
OrbitBehaviorInterim(java.awt.Component c, javax.media.j3d.TransformGroup tg, javax.media.j3d.View view, int flags)
          Constructs a OrbitBehaviorInterim with a specified source of Component, specified targets of TransformGroup and View, and specified constructor flags.
OrbitBehaviorInterim(int flags)
          Constructs a OrbitBehaviorInterim with a null source of Component, null targets of TransformGroup and View, and specified constructor flags.
 
Method Summary
 javax.media.j3d.Bounds getClippingBounds()
          Returns the bounding object for clipping distances calculation.
 double getFieldOfView()
          Returns the current field of view of the View object.
 double getMinRadius()
          Returns the minimum orbit radius.
 int getProjectionMode()
          Returns the current projection mode.
 boolean getRotateEnable()
          Retrieves the state of rotate enabled
 void getRotationCenter(javax.vecmath.Point3d center)
          Places the value of the center around which the View rotates into the Point3d.
 double getRotXFactor()
          Returns the x rotation movement multiplier
 double getRotYFactor()
          Returns the y rotation movement multiplier
 boolean getTranslateEnable()
          Retrieves the state of translate enabled
 double getTransXFactor()
          Returns the x translation movement multiplier
 double getTransYFactor()
          Returns the y translation movement multiplier
 void getViewingTransform(javax.media.j3d.Transform3D transform)
          Copies the viewing transform of this OrbitBehaviorInterim into the passed transform object.
 javax.media.j3d.View getVpView()
          Returns the ViewPlatform's View for this behavior.
 boolean getZoomEnable()
          Retrieves the state of zoom enabled
 double getZoomFactor()
          Returns the zoom movement multiplier
 void goHome()
          Positions and reorients the ViewingPlatform to its "home" transform.
 void goHome(boolean aroundHomeCenter)
          Positions and reorients the ViewingPlatform to its "home" transform and the current rotation center is set to the "home" rotation center if desired.
protected  void integrateTransforms()
          Compound transformations
 boolean isClippingEnabled()
          Retrieves a flag indicating whether clip distances will be updated.
 boolean isPureParallelEnabled()
          Retrieves a flag indicating whether pure parallel projection is enabled.
 void lookAtRotationCenter()
          Moves the View to the current center of rotation.
protected  void processAWTEvents(java.awt.AWTEvent[] events)
          Process AWTEvents
protected  void resetView()
          Reset the orientation and distance of this behavior to the current values in the ViewPlatform Transform Group
protected  void resetViewParallelLookAtRotCenter()
          Reset the orientation and distance/scaling of this OrbitBehaviorInterim if the center of rotation has changed in (pure) parallel projection mode.
protected  void resetViewPureParallelRotCenter()
          Reset the orientation and distance/scaling of this OrbitBehaviorInterim if the center of rotation has changed in pure parallel projection mode.
 void setAWTComponent(java.awt.Component c)
          Sets the Component used to listen for mouse, mouse motion, and mouse wheel events.
 void setClippingBounds(javax.media.j3d.Bounds sceneBounds)
          Sets the bounding object for clipping distances calculation.
protected  void setClippingDistances()
          Calculates and sets the back and front clip distances for the target View object if clipping bounds and View objects are set.
 void setClippingEnabled(boolean enable)
          This OrbitBehaviorInterim updates the front and back clip distances of the View object if this clipping flag is set.
 void setFieldOfView(double angle)
          Sets the field of view of the View object.
 void setMinRadius(double r)
          Sets the minimum radius for the OrbitBehavior.
 void setProjectionMode(int mode)
          Sets the projection mode for this OrbitBehaviorInterim to parallel or perspective projection.
 void setProportionalZoom(boolean state)
          Set proportional zoom behavior.
 void setPureParallelEnabled(boolean enable)
          The pure parallel flag has to be set if this OrbitBeahviorInterim is used only or mainly in parallel projection mode to ensure that all its features are adjusted to parallel projection.
 void setReverseRotate(boolean state)
          Set reverse rotate behavior.
 void setReverseTranslate(boolean state)
          Set reverse translate behavior.
 void setReverseZoom(boolean state)
          Set reverse zoom behavior.
 void setRotateEnable(boolean enabled)
          Enables or disables rotation.
 void setRotationCenter(javax.vecmath.Point3d center)
          Sets the center around which the View rotates.
 void setRotationCenter(javax.vecmath.Point3d center, boolean lookAtRotCenter)
          Sets the center around which the View rotates and moves the View to this center if desired.
 void setRotFactors(double xfactor, double yfactor)
          Sets the rotation x and y factors.
 void setRotXFactor(double xfactor)
          Sets the rotation x factor.
 void setRotYFactor(double yfactor)
          Sets the rotation y factor.
 void setTransFactors(double xfactor, double yfactor)
          Sets the translation x and y factors.
 void setTranslateEnable(boolean enabled)
          Enables or disables translate.
 void setTransXFactor(double xfactor)
          Sets the translation x factor.
 void setTransYFactor(double yfactor)
          Sets the translation y factor.
 void setViewingTransform(javax.vecmath.Point3d eye, javax.vecmath.Point3d viewCenter, javax.vecmath.Vector3d up, boolean rotateAtViewCenter)
          Sets the viewing transform of this OrbitBehaviorInterim and the transform component of the viewing TransformGroup object according to the values of the passed objects and sets the center of view to the center of rotation if desired.
 void setViewingTransform(javax.vecmath.Point3d eye, javax.vecmath.Point3d viewCenter, javax.vecmath.Vector3d up, javax.vecmath.Point3d rotationCenter)
          Sets the viewing transform of this OrbitBehaviorInterim and the transform component of the viewing TransformGroup object according to the values of the passed objects and sets the center of rotation.
 void setViewingTransform(javax.media.j3d.Transform3D transform)
          Sets the viewing transform of this OrbitBehaviorInterim and the transform component of the viewing TransformGroup object to the value of the passed transform.
 void setViewingTransform(javax.media.j3d.Transform3D transform, javax.vecmath.Point3d rotationCenter)
          Sets the viewing transform of this OrbitBehaviorInterim and the transform component of the viewing TransformGroup object to the value of the passed transform and sets the center of rotation.
 void setViewingTransformGroup(javax.media.j3d.TransformGroup tg)
          Sets the ViewPlatform's TransformGroup for this behavior.
 void setVpView(javax.media.j3d.View view)
          Sets the ViewPlatform's View for this behavior.
 void setZoomEnable(boolean enabled)
          Enables or disables zoom.
 void setZoomFactor(double zfactor)
          Sets the zoom factor.
 
Methods inherited from class com.interactivemesh.j3d.community.utils.navigation.orbit.ViewPlatformAWTBehaviorInterim
initialize, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, processStimulus, queueAWTEvent, setEnable, setListenerFlags
 
Methods inherited from class com.interactivemesh.j3d.community.utils.navigation.orbit.ViewPlatformBehaviorInterim
getHomeRotationCenter, getHomeTransform, getViewingTransformGroup, setHomeRotationCenter, setHomeTransform
 
Methods inherited from class javax.media.j3d.Behavior
getEnable, getNumSchedulingIntervals, getSchedulingBoundingLeaf, getSchedulingBounds, getSchedulingInterval, getView, getWakeupCondition, postId, 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 Detail

REVERSE_ROTATE

public static final int REVERSE_ROTATE
Constructor flag to reverse the rotate behavior

See Also:
Constant Field Values

REVERSE_TRANSLATE

public static final int REVERSE_TRANSLATE
Constructor flag to reverse the translate behavior

See Also:
Constant Field Values

REVERSE_ZOOM

public static final int REVERSE_ZOOM
Constructor flag to reverse the zoom behavior

See Also:
Constant Field Values

REVERSE_ALL

public static final int REVERSE_ALL
Constructor flag to reverse all the behaviors

See Also:
Constant Field Values

STOP_ZOOM

public static final int STOP_ZOOM
Constructor flag that indicates zoom should stop when it reaches the minimum orbit radius set by setMinRadius(). The minimus radius default is 0.0.

See Also:
Constant Field Values

DISABLE_ROTATE

public static final int DISABLE_ROTATE
Constructor flag to disable rotate

See Also:
Constant Field Values

DISABLE_TRANSLATE

public static final int DISABLE_TRANSLATE
Constructor flag to disable translate

See Also:
Constant Field Values

DISABLE_ZOOM

public static final int DISABLE_ZOOM
Constructor flag to disable zoom

See Also:
Constant Field Values

PROPORTIONAL_ZOOM

public static final int PROPORTIONAL_ZOOM
Constructor flag to use proportional zoom, which determines how much you zoom based on view's distance from the center of rotation. The percentage of distance that the viewer zooms is determined by the zoom factor.

See Also:
Constant Field Values

view

protected javax.media.j3d.View view
The target View for this behavior.

Since:
Version 2.0

projection

protected int projection
Projection mode: View.PARALLEL_PROJECTION or View.PERSPECTIVE_PROJECTION. Default mode is View.PERSPECTIVE_PROJECTION;

Since:
Version 2.0

sceneSphere

protected javax.media.j3d.BoundingSphere sceneSphere
Bounding sphere of the scene as base for clipping distances calculation.

Since:
Version 2.0

sceneCenter

protected javax.vecmath.Point3d sceneCenter
Center of the scene bounding sphere.

Since:
Version 2.0

sceneRadius

protected double sceneRadius
Radius of the scene bounding sphere.

Since:
Version 2.0

radiusFactor

protected double radiusFactor
Factor to scale the scene radius.

Since:
Version 2.0

maxClipRatio

protected double maxClipRatio
Maximum ratio of back and front clip distances.

Since:
Version 2.0

minBackClipDistance

protected double minBackClipDistance
Minimum back clip distance.

Since:
Version 2.0
Constructor Detail

OrbitBehaviorInterim

public OrbitBehaviorInterim()
Constructs a OrbitBehaviorInterim with a null source of Component, a null targets of TransformGroup and View, and no constructor flags.


OrbitBehaviorInterim

public OrbitBehaviorInterim(int flags)
Constructs a OrbitBehaviorInterim with a null source of Component, null targets of TransformGroup and View, and specified constructor flags.

Parameters:
flags - The option flags

OrbitBehaviorInterim

public OrbitBehaviorInterim(java.awt.Component c,
                            javax.media.j3d.TransformGroup tg)
Constructs a OrbitBehaviorInterim with a specified source of Component, a specified target of TransformGroup, a null target of View, and no constructor flags.

Parameters:
c - The Component to add the behavior to
tg - The target TransformGroup for this behavior
Throws:
java.lang.NullPointerException - If the Component or TransformGroup are null.

OrbitBehaviorInterim

public OrbitBehaviorInterim(java.awt.Component c,
                            javax.media.j3d.TransformGroup tg,
                            javax.media.j3d.View view)
Constructs a OrbitBehaviorInterim with a specified source of Component, specified targets of TransformGroup and View, and no constructor flags. The projection policy for this View is set to View.PERSPECTIVE_PROJECTION.

Parameters:
c - The Component to add the behavior to
tg - The target TransformGroup for this behavior
view - The target View for this behavior
Since:
Version 2.0

OrbitBehaviorInterim

public OrbitBehaviorInterim(java.awt.Component c,
                            javax.media.j3d.TransformGroup tg,
                            int flags)
Constructs a OrbitBehaviorInterim with a specified source of Component, a specified target of TransformGroup, a null target of View, and specified constructor flags.

Parameters:
c - The Component to add the behavior to
tg - The target TransformGroup for this behavior
flags - The option flags
Throws:
java.lang.NullPointerException - If the Component or TransformGroup are null.

OrbitBehaviorInterim

public OrbitBehaviorInterim(java.awt.Component c,
                            javax.media.j3d.TransformGroup tg,
                            javax.media.j3d.View view,
                            int flags)
Constructs a OrbitBehaviorInterim with a specified source of Component, specified targets of TransformGroup and View, and specified constructor flags. The projection policy for this View is set to View.PERSPECTIVE_PROJECTION.

Parameters:
c - The Component to add the behavior to
tg - The target TransformGroup for this behavior
view - The target View for this behavior
flags - The option flags
Throws:
java.lang.NullPointerException - If the Component, TransformGroup, or View are null.
Since:
Version 2.0
Method Detail

setAWTComponent

public void setAWTComponent(java.awt.Component c)
Sets the Component used to listen for mouse, mouse motion, and mouse wheel events. If a subclass overrides this method, it must call super.setViewingTransformGroup(tg).

Overrides:
setAWTComponent in class ViewPlatformAWTBehaviorInterim
Parameters:
c - the source Component for this behavior

setViewingTransformGroup

public void setViewingTransformGroup(javax.media.j3d.TransformGroup tg)
Sets the ViewPlatform's TransformGroup for this behavior. If a subclass overrides this method, it must call super.setViewingTransformGroup(tg).

Overrides:
setViewingTransformGroup in class ViewPlatformAWTBehaviorInterim
Parameters:
tg - the target TransformGroup for this behavior

getVpView

public javax.media.j3d.View getVpView()
Returns the ViewPlatform's View for this behavior.

Returns:
The target View
Since:
Version 2.0

setVpView

public void setVpView(javax.media.j3d.View view)
Sets the ViewPlatform's View for this behavior. If clipping is enabled the back and front clip policies are set to View.VIRTUAL_EYE. If projection mode is View.PARALLEL_PROJECTION the screen scale policy is set to View.SCALE_EXPLICIT.

Parameters:
view - the target View for this behavior
Since:
Version 2.0

getProjectionMode

public int getProjectionMode()
Returns the current projection mode.

Returns:
one of View.PARALLEL_PROJECTION or View.PERSPECTIVE_PROJECTION
Since:
Version 2.0

setProjectionMode

public void setProjectionMode(int mode)
Sets the projection mode for this OrbitBehaviorInterim to parallel or perspective projection. The projection mode can be changed at any time.

The target View's projection policy is set to this mode value, too. If mode is View.PARALLEL_PROJECTION the target View's screen scale policy is set to View.SCALE_EXPLICIT. If mode is View.PERSPECTIVE_PROJECTION the target View's screen scale policy is set to View.SCALE_SCREEN_SIZE.

The default projection mode is View.PERSPECTIVE_PROJECTION.

Parameters:
mode - projection mode, one of View.PARALLEL_PROJECTION or View.PERSPECTIVE_PROJECTION
Throws:
java.lang.IllegalArgumentException - if mode is a value other than View.PARALLEL_PROJECTION or View.PERSPECTIVE_PROJECTION
java.lang.IllegalStateException - if no View object is set for this behavior
java.lang.IllegalStateException - if mode is View.PARALLEL_PROJECTION and the View object holds no Canvas3D instance
Since:
Version 2.0
See Also:
setPureParallelEnabled(boolean)

isPureParallelEnabled

public boolean isPureParallelEnabled()
Retrieves a flag indicating whether pure parallel projection is enabled.

Returns:
true if parallel projection isn't synchronized with perspective projection, false otherwise
Since:
Version 2.0

setPureParallelEnabled

public void setPureParallelEnabled(boolean enable)
The pure parallel flag has to be set if this OrbitBeahviorInterim is used only or mainly in parallel projection mode to ensure that all its features are adjusted to parallel projection.

Parameters:
enable - true if only parallel projection mode is used
Since:
Version 2.0
See Also:
setProjectionMode(int)

getFieldOfView

public double getFieldOfView()
Returns the current field of view of the View object.

Returns:
the current field of view in radians
Throws:
java.lang.IllegalStateException - if no View object is set for this behavior
Since:
Version 2.0

setFieldOfView

public void setFieldOfView(double angle)
Sets the field of view of the View object.

In case of parallel projection the field of view value determines the parallel scaling rate.

Parameters:
angle - the new field of view in radians
Throws:
java.lang.IllegalStateException - if no View object is set for this behavior
java.lang.IllegalStateException - if mode is View.PARALLEL_PROJECTION and the View object holds no Canvas3D instance
java.lang.IllegalArgumentException - if angle <= 0
Since:
Version 2.0

isClippingEnabled

public boolean isClippingEnabled()
Retrieves a flag indicating whether clip distances will be updated.

Returns:
true if clip distances will be updated, false otherwise
Since:
Version 2.0

setClippingEnabled

public void setClippingEnabled(boolean enable)
This OrbitBehaviorInterim updates the front and back clip distances of the View object if this clipping flag is set. Depending on the scene bounds and the current center of rotation these distances are calculated to achieve a minimal clipping extent and an optimized back/front ratio.

By default clipping update is not enabled.

Parameters:
enable - true if clip distances should be updated
Since:
Version 2.0

getClippingBounds

public javax.media.j3d.Bounds getClippingBounds()
Returns the bounding object for clipping distances calculation.

Returns:
a copy of the bounding object
Since:
Version 2.0

setClippingBounds

public void setClippingBounds(javax.media.j3d.Bounds sceneBounds)
Sets the bounding object for clipping distances calculation. The passed Bounds instance is converted into a BoundingSphere object.

Parameters:
sceneBounds - typically the sphere bounds of the scene or an arbitrary bounding object
Since:
Version 2.0

setClippingDistances

protected void setClippingDistances()
Calculates and sets the back and front clip distances for the target View object if clipping bounds and View objects are set. This method is repeatedly called during the navigation if clipping is enabled.

Override this method for individual calculation of the clipping distances.

Since:
Version 2.0

processAWTEvents

protected void processAWTEvents(java.awt.AWTEvent[] events)
Process AWTEvents

Specified by:
processAWTEvents in class ViewPlatformAWTBehaviorInterim

resetView

protected void resetView()
Reset the orientation and distance of this behavior to the current values in the ViewPlatform Transform Group


resetViewParallelLookAtRotCenter

protected void resetViewParallelLookAtRotCenter()
Reset the orientation and distance/scaling of this OrbitBehaviorInterim if the center of rotation has changed in (pure) parallel projection mode.

Since:
Version 2.0

resetViewPureParallelRotCenter

protected void resetViewPureParallelRotCenter()
Reset the orientation and distance/scaling of this OrbitBehaviorInterim if the center of rotation has changed in pure parallel projection mode.

Since:
Version 2.0

integrateTransforms

protected void integrateTransforms()
Compound transformations

Specified by:
integrateTransforms in class ViewPlatformAWTBehaviorInterim

goHome

public void goHome()
Description copied from class: ViewPlatformBehaviorInterim
Positions and reorients the ViewingPlatform to its "home" transform.

Specified by:
goHome in class ViewPlatformBehaviorInterim

goHome

public void goHome(boolean aroundHomeCenter)
Description copied from class: ViewPlatformBehaviorInterim
Positions and reorients the ViewingPlatform to its "home" transform and the current rotation center is set to the "home" rotation center if desired.

Specified by:
goHome in class ViewPlatformBehaviorInterim
Parameters:
aroundHomeCenter - if true the current roation center is set to the 'home' rotation center, otherwise the center remains unchanged

getViewingTransform

public void getViewingTransform(javax.media.j3d.Transform3D transform)
Copies the viewing transform of this OrbitBehaviorInterim into the passed transform object.

Parameters:
transform - the transform object to be copied into
Throws:
java.lang.NullPointerException - if the passed transform object is null
Since:
Version 2.1

setViewingTransform

public void setViewingTransform(javax.media.j3d.Transform3D transform)
Sets the viewing transform of this OrbitBehaviorInterim and the transform component of the viewing TransformGroup object to the value of the passed transform.

Parameters:
transform - the transform to be copied
Throws:
java.lang.NullPointerException - if the passed transform object is null
java.lang.IllegalStateException - if no viewing TransformGroup object is set for this behavior
javax.media.j3d.CapabilityNotSetException - if appropriate capability is not set to the viewing TransformGroup object and this is part of live or compiled scene graph
javax.media.j3d.BadTransformException - if the transform is not congruent or non-uniform scaling
Since:
Version 2.1

setViewingTransform

public void setViewingTransform(javax.media.j3d.Transform3D transform,
                                javax.vecmath.Point3d rotationCenter)
Sets the viewing transform of this OrbitBehaviorInterim and the transform component of the viewing TransformGroup object to the value of the passed transform and sets the center of rotation.

Parameters:
transform - the transform to be copied
rotationCenter - the center of rotation
Throws:
java.lang.NullPointerException - if the passed transform object is null
java.lang.NullPointerException - if the passed center of rotation object is null
java.lang.IllegalStateException - if no viewing TransformGroup object is set for this behavior
javax.media.j3d.CapabilityNotSetException - if appropriate capability is not set to the viewing TransformGroup object and this is part of live or compiled scene graph
javax.media.j3d.BadTransformException - if the transform is not congruent or non-uniform scaling
Since:
Version 2.1

setViewingTransform

public void setViewingTransform(javax.vecmath.Point3d eye,
                                javax.vecmath.Point3d viewCenter,
                                javax.vecmath.Vector3d up,
                                boolean rotateAtViewCenter)
Sets the viewing transform of this OrbitBehaviorInterim and the transform component of the viewing TransformGroup object according to the values of the passed objects and sets the center of view to the center of rotation if desired.

From the passed values a viewing transform is derived based on transform.lookAt(eye, viewCenter, up).

Parameters:
eye - the location of the ViewPlatform
viewCenter - a point in the virtual world where the View is looking
up - an up vector specifying the frustum's up direction
rotateAtViewCenter - if true the center of rotation is set to viewCenter, if false the current center of rotation is used
Throws:
java.lang.NullPointerException - if the passed eye object is null
java.lang.NullPointerException - if the passed center of view object is null
java.lang.NullPointerException - if the passed up vector object is null
java.lang.IllegalStateException - if no viewing TransformGroup object is set for this behavior
javax.media.j3d.CapabilityNotSetException - if appropriate capability is not set to the viewing TransformGroup object and this is part of live or compiled scene graph
javax.vecmath.SingularMatrixException - if this transform is not invertible
javax.media.j3d.BadTransformException - if the transform is not congruent or non-uniform scaling
Since:
Version 2.1

setViewingTransform

public void setViewingTransform(javax.vecmath.Point3d eye,
                                javax.vecmath.Point3d viewCenter,
                                javax.vecmath.Vector3d up,
                                javax.vecmath.Point3d rotationCenter)
Sets the viewing transform of this OrbitBehaviorInterim and the transform component of the viewing TransformGroup object according to the values of the passed objects and sets the center of rotation.

From the passed values a viewing transform is derived based on transform.lookAt(eye, viewCenter, up).

Parameters:
eye - the location of the ViewPlatform
viewCenter - a point in the virtual world where the View is looking
up - an up vector specifying the frustum's up direction
rotationCenter - the center of rotation
Throws:
java.lang.NullPointerException - if the passed eye object is null
java.lang.NullPointerException - if the passed center of view object is null
java.lang.NullPointerException - if the passed up vector object is null
java.lang.NullPointerException - if the passed center of rotation object is null
java.lang.IllegalStateException - if no viewing TransformGroup object is set for this behavior
javax.media.j3d.CapabilityNotSetException - if appropriate capability is not set to the viewing TransformGroup object and this is part of live or compiled scene graph
javax.vecmath.SingularMatrixException - if this transform is not invertible
javax.media.j3d.BadTransformException - if the transform is not congruent or non-uniform scaling
Since:
Version 2.1

setRotationCenter

public void setRotationCenter(javax.vecmath.Point3d center)
Sets the center around which the View rotates. If the viewing TransformGroup isn't set the center is updated, but rotation may not behave as expected. The default center is (0,0,0).

Parameters:
center - the Point3d to set the center of rotation to

setRotationCenter

public void setRotationCenter(javax.vecmath.Point3d center,
                              boolean lookAtRotCenter)
Sets the center around which the View rotates and moves the View to this center if desired. If the viewing TransformGroup isn't set only the center is updated, but rotation may not behave as expected. The default center is (0,0,0).

Parameters:
center - The Point3d to set the center of rotation to
lookAtRotCenter - if true the View is moved to the center of rotation, otherwise the View is unchanged
Since:
Version 1.1

lookAtRotationCenter

public void lookAtRotationCenter()
Moves the View to the current center of rotation. This method has no effect if the viewing TransformGroup isn't set.

Since:
Version 1.1

getRotationCenter

public void getRotationCenter(javax.vecmath.Point3d center)
Places the value of the center around which the View rotates into the Point3d.

Parameters:
center - The Point3d

setRotFactors

public void setRotFactors(double xfactor,
                          double yfactor)
Sets the rotation x and y factors. The factors are used to determine how many radians to rotate the view for each pixel of mouse movement. The view is rotated factor * 0.01 radians for each pixel of mouse movement. The default factor is 1.0.

Parameters:
xfactor - The x movement multiplier
yfactor - The y movement multiplier

setRotXFactor

public void setRotXFactor(double xfactor)
Sets the rotation x factor. The factors are used to determine how many radians to rotate the view for each pixel of mouse movement. The view is rotated factor * 0.01 radians for each pixel of mouse movement. The default factor is 1.0.

Parameters:
xfactor - The x movement multiplier

setRotYFactor

public void setRotYFactor(double yfactor)
Sets the rotation y factor. The factors are used to determine how many radians to rotate the view for each pixel of mouse movement. The view is rotated factor * 0.01 radians for each pixel of mouse movement. The default factor is 1.0.

Parameters:
yfactor - The y movement multiplier

setTransFactors

public void setTransFactors(double xfactor,
                            double yfactor)
Sets the translation x and y factors. The factors are used to determine how many units to translate the view for each pixel of mouse movement. The view is translated factor * 0.01 units for each pixel of mouse movement. The default factor is 1.0.

Parameters:
xfactor - The x movement multiplier
yfactor - The y movement multiplier

setTransXFactor

public void setTransXFactor(double xfactor)
Sets the translation x factor. The factors are used to determine how many units to translate the view for each pixel of mouse movement. The view is translated factor * 0.01 units for each pixel of mouse movement. The default factor is 1.0.

Parameters:
xfactor - The x movement multiplier

setTransYFactor

public void setTransYFactor(double yfactor)
Sets the translation y factor. The factors are used to determine how many units to translate the view for each pixel of mouse movement. The view is translated factor * 0.01 units for each pixel of mouse movement. The default factor is 1.0.

Parameters:
yfactor - The y movement multiplier

setZoomFactor

public void setZoomFactor(double zfactor)
Sets the zoom factor. The factor is used to determine how many units to zoom the view for each pixel of mouse movement. The view is zoomed factor * 0.01 units for each pixel of mouse movement. For proportional zoom, the view is zoomed factor * 1% of the distance from the center of rotation for each pixel of mouse movement. The default factor is 1.0.

Parameters:
zfactor - The movement multiplier

getRotXFactor

public double getRotXFactor()
Returns the x rotation movement multiplier

Returns:
The movement multiplier for x rotation

getRotYFactor

public double getRotYFactor()
Returns the y rotation movement multiplier

Returns:
The movement multiplier for y rotation

getTransXFactor

public double getTransXFactor()
Returns the x translation movement multiplier

Returns:
The movement multiplier for x translation

getTransYFactor

public double getTransYFactor()
Returns the y translation movement multiplier

Returns:
The movement multiplier for y translation

getZoomFactor

public double getZoomFactor()
Returns the zoom movement multiplier

Returns:
The movement multiplier for zoom

setRotateEnable

public void setRotateEnable(boolean enabled)
Enables or disables rotation. The default is true.

Parameters:
enabled - true or false to enable or disable rotate

setZoomEnable

public void setZoomEnable(boolean enabled)
Enables or disables zoom. The default is true.

Parameters:
enabled - true or false to enable or disable zoom

setTranslateEnable

public void setTranslateEnable(boolean enabled)
Enables or disables translate. The default is true.

Parameters:
enabled - true or false to enable or disable translate

getRotateEnable

public boolean getRotateEnable()
Retrieves the state of rotate enabled

Returns:
the rotate enable state

getZoomEnable

public boolean getZoomEnable()
Retrieves the state of zoom enabled

Returns:
the zoom enable state

getTranslateEnable

public boolean getTranslateEnable()
Retrieves the state of translate enabled

Returns:
the translate enable state

setMinRadius

public void setMinRadius(double r)
Sets the minimum radius for the OrbitBehavior. The zoom will stop at this distance from the center of rotation. The default is 0.0. The minimum will have no affect if the STOP_ZOOM constructor flag is not set.

Parameters:
r - the minimum radius
Throws:
java.lang.IllegalArgumentException - if the radius is less than 0.0

getMinRadius

public double getMinRadius()
Returns the minimum orbit radius. The zoom will stop at this distance from the center of rotation if the STOP_ZOOM constructor flag is set.

Returns:
the minimum radius

setReverseTranslate

public void setReverseTranslate(boolean state)
Set reverse translate behavior. The default is false.

Parameters:
state - if true, reverse translate behavior
Since:
Java 3D 1.3

setReverseRotate

public void setReverseRotate(boolean state)
Set reverse rotate behavior. The default is false.

Parameters:
state - if true, reverse rotate behavior
Since:
Java 3D 1.3

setReverseZoom

public void setReverseZoom(boolean state)
Set reverse zoom behavior. The default is false.

Parameters:
state - if true, reverse zoom behavior
Since:
Java 3D 1.3

setProportionalZoom

public void setProportionalZoom(boolean state)
Set proportional zoom behavior. The default is false.

Parameters:
state - if true, use proportional zoom behavior
Since:
Java 3D 1.3

OrbitBehaviorInterim 2.1