|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.media.j3d.SceneGraphObject
javax.media.j3d.Node
javax.media.j3d.Leaf
javax.media.j3d.Behavior
com.interactivemesh.j3d.community.utils.navigation.orbit.ViewPlatformBehaviorInterim
com.interactivemesh.j3d.community.utils.navigation.orbit.ViewPlatformAWTBehaviorInterim
com.interactivemesh.j3d.community.utils.navigation.orbit.OrbitBehaviorPoPInterim
public class OrbitBehaviorPoPInterim
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
set
ActionFactor()
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
set
ActionEnable
methods.
The default center of rotation is (0, 0, 0) and can be set using the
setRotationCenter()
method.
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
|
protected double |
minBackDistance
|
protected int |
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
|
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
|
protected double |
sceneRadius
|
protected javax.media.j3d.BoundingSphere |
sceneSphere
|
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
|
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 | |
---|---|
OrbitBehaviorPoPInterim()
Constructs a OrbitBehaviorPoPInterim with a null source of Component, a null target of TransformGroup, and no constructor flags. |
|
OrbitBehaviorPoPInterim(java.awt.Component c,
javax.media.j3d.TransformGroup tg)
Constructs a OrbitBehaviorPoPInterim with a specified source of Component, a specified target of TransformGroup, and no constructor flags. |
|
OrbitBehaviorPoPInterim(java.awt.Component c,
javax.media.j3d.TransformGroup tg,
int flags)
Constructs a OrbitBehaviorPoPInterim with a specified source of Component, a specified target of TransformGroup, and specified constructor flags. |
|
OrbitBehaviorPoPInterim(java.awt.Component c,
javax.media.j3d.TransformGroup tg,
javax.media.j3d.View view)
|
|
OrbitBehaviorPoPInterim(java.awt.Component c,
javax.media.j3d.TransformGroup tg,
javax.media.j3d.View view,
int flags)
|
|
OrbitBehaviorPoPInterim(int flags)
Constructs a OrbitBehaviorPoPInterim with a null source of Component, null target of TransformGroup, and specified constructor flags. |
Method Summary | |
---|---|
javax.media.j3d.Bounds |
getClippingBounds()
|
double |
getMinRadius()
Returns the minimum orbit radius. |
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 |
javax.media.j3d.View |
getView()
|
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" one if desired. |
protected void |
integrateTransforms()
Called once per frame (if the view is moving) to calculate the new view platform transform |
boolean |
isClippingEnabled()
|
void |
lookAtRotationCenter()
Moves the View to the current rotation center. |
protected void |
processAWTEvents(java.awt.AWTEvent[] events)
This is called once per frame if there are any AWT events to process. |
protected void |
resetView()
Reset the orientation and distance of this behavior to the current values in the ViewPlatform Transform Group |
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)
|
protected void |
setClippingDistances()
|
void |
setClippingEnabled(boolean enable)
|
void |
setMinRadius(double r)
Sets the minimum radius for the OrbitBehavior. |
void |
setProjectionMode(int mode)
|
void |
setProjectionMode(int mode,
double parScaleFac)
|
void |
setProportionalZoom(boolean state)
Set proportional zoom behavior. |
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 |
setView(javax.media.j3d.View view)
|
void |
setViewingTransformGroup(javax.media.j3d.TransformGroup tg)
Sets the ViewPlatform's TransformGroup 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, 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 |
---|
public static final int REVERSE_ROTATE
public static final int REVERSE_TRANSLATE
public static final int REVERSE_ZOOM
public static final int REVERSE_ALL
public static final int STOP_ZOOM
public static final int DISABLE_ROTATE
public static final int DISABLE_TRANSLATE
public static final int DISABLE_ZOOM
public static final int PROPORTIONAL_ZOOM
protected javax.media.j3d.View view
protected int projection
protected javax.media.j3d.BoundingSphere sceneSphere
protected javax.vecmath.Point3d sceneCenter
protected double sceneRadius
protected double radiusFactor
protected double maxClipRatio
protected double minBackDistance
Constructor Detail |
---|
public OrbitBehaviorPoPInterim()
public OrbitBehaviorPoPInterim(int flags)
flags
- The option flagspublic OrbitBehaviorPoPInterim(java.awt.Component c, javax.media.j3d.TransformGroup tg)
c
- The Component to add the behavior totg
- The target TransformGroup for this behavior
java.lang.NullPointerException
- If the Component or TransformGroup are null.public OrbitBehaviorPoPInterim(java.awt.Component c, javax.media.j3d.TransformGroup tg, javax.media.j3d.View view)
public OrbitBehaviorPoPInterim(java.awt.Component c, javax.media.j3d.TransformGroup tg, int flags)
c
- The Component to add the behavior totg
- The target TransformGroup for this behaviorflags
- The option flags
java.lang.NullPointerException
- If the Component or TransformGroup are null.public OrbitBehaviorPoPInterim(java.awt.Component c, javax.media.j3d.TransformGroup tg, javax.media.j3d.View view, int flags)
Method Detail |
---|
public void setProjectionMode(int mode)
mode
- projection mode, one of View.PARALLEL_PROJECTION or View.PERSPECTIVE_PROJECTION
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 hold no Canvas3D instancepublic void setProjectionMode(int mode, double parScaleFac)
public boolean isClippingEnabled()
public void setClippingEnabled(boolean enable)
public javax.media.j3d.Bounds getClippingBounds()
public void setClippingBounds(javax.media.j3d.Bounds sceneBounds)
public void setAWTComponent(java.awt.Component c)
setAWTComponent
in class ViewPlatformAWTBehaviorInterim
c
- the source Component for this behaviorpublic void setViewingTransformGroup(javax.media.j3d.TransformGroup tg)
setViewingTransformGroup
in class ViewPlatformAWTBehaviorInterim
tg
- the target TransformGroup for this behaviorpublic javax.media.j3d.View getView()
getView
in class javax.media.j3d.Behavior
public void setView(javax.media.j3d.View view)
protected void processAWTEvents(java.awt.AWTEvent[] events)
ViewPlatformAWTBehaviorInterim
motion
variable will be true when the method
is called. If it is true when the method returns integrateTransforms
will be called immediately.
The AWTEvents are presented in the array in the order in which they
arrived from AWT.
processAWTEvents
in class ViewPlatformAWTBehaviorInterim
protected void resetView()
protected void setClippingDistances()
protected void integrateTransforms()
ViewPlatformAWTBehaviorInterim
integrateTransforms
in class ViewPlatformAWTBehaviorInterim
public void goHome()
ViewPlatformBehaviorInterim
goHome
in class ViewPlatformBehaviorInterim
public void goHome(boolean aroundHomeCenter)
ViewPlatformBehaviorInterim
goHome
in class ViewPlatformBehaviorInterim
aroundHomeCenter
- if true the current roation center is set
to the 'home' rotation center, otherwise the center remains unchangedpublic void setRotationCenter(javax.vecmath.Point3d center)
center
- The Point3d to set the center of rotation topublic void setRotationCenter(javax.vecmath.Point3d center, boolean lookAtRotCenter)
center
- The Point3d to set the center of rotation tolookAtRotCenter
- if true the View is moved to the rotation center, otherwise the View is unchangedpublic void lookAtRotationCenter()
public void getRotationCenter(javax.vecmath.Point3d center)
center
- The Point3dpublic void setRotFactors(double xfactor, double yfactor)
xfactor
- The x movement multiplieryfactor
- The y movement multiplierpublic void setRotXFactor(double xfactor)
xfactor
- The x movement multiplierpublic void setRotYFactor(double yfactor)
yfactor
- The y movement multiplierpublic void setTransFactors(double xfactor, double yfactor)
xfactor
- The x movement multiplieryfactor
- The y movement multiplierpublic void setTransXFactor(double xfactor)
xfactor
- The x movement multiplierpublic void setTransYFactor(double yfactor)
yfactor
- The y movement multiplierpublic void setZoomFactor(double zfactor)
zfactor
- The movement multiplierpublic double getRotXFactor()
public double getRotYFactor()
public double getTransXFactor()
public double getTransYFactor()
public double getZoomFactor()
public void setRotateEnable(boolean enabled)
enabled
- true or false to enable or disable rotatepublic void setZoomEnable(boolean enabled)
enabled
- true or false to enable or disable zoompublic void setTranslateEnable(boolean enabled)
enabled
- true or false to enable or disable translatepublic boolean getRotateEnable()
public boolean getZoomEnable()
public boolean getTranslateEnable()
public void setMinRadius(double r)
r
- the minimum radius
java.lang.IllegalArgumentException
- if the radius is less than 0.0public double getMinRadius()
public void setReverseTranslate(boolean state)
state
- if true, reverse translate behaviorpublic void setReverseRotate(boolean state)
state
- if true, reverse rotate behaviorpublic void setReverseZoom(boolean state)
state
- if true, reverse zoom behaviorpublic void setProportionalZoom(boolean state)
state
- if true, use proportional zoom behavior
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |