j3d.org Code

org.j3d.renderer.java3d.navigation
Class NavigationHandler

java.lang.Object
  extended byorg.j3d.renderer.java3d.navigation.NavigationProcessor
      extended byorg.j3d.renderer.java3d.navigation.NavigationHandler
All Implemented Interfaces:
NavigationMouseProcessor
Direct Known Subclasses:
MouseViewHandler

public class NavigationHandler
extends NavigationProcessor
implements NavigationMouseProcessor

A listener and handler responsible for executing all navigation commands from mice to move a viewpoint around a scene.

This class does not contain any direct event handling. Instead it assumes that another class with either derive from it or delegate to it to do the actual movement processing. This allows it to be used as a standard AWT event listener or a Java3D behaviour as required by the software.

Separate states are allowed to be set for each button. Once one button is pressed, all the other button presses are ignored. By default, all the buttons start with no state set. The user will have to explicitly set the state for each button to get them to work.

Depending on the requirements of the user, the speed scale factor can be computed

Version:
$Revision: 1.1 $

Field Summary
 
Fields inherited from class org.j3d.renderer.java3d.navigation.NavigationProcessor
AVATAR_CYLINDER, AVATAR_POINT, AVATAR_SHOULDERS
 
Constructor Summary
NavigationHandler()
          Create a new mouse handler with no view information set.
 
Method Summary
 void mouseDragged(java.awt.event.MouseEvent evt)
          Process a mouse drag event to change the current movement value from the previously set value to the new value
 void mousePressed(java.awt.event.MouseEvent evt)
          Process a mouse press and set the behavior running.
 void mouseReleased(java.awt.event.MouseEvent evt)
          Process a mouse release to return all the values back to normal.
 void setButtonNavigation(int button, int state)
          Set the ability to use a given state within the handler for a specific mouse button (up to 3).
 void setNavigationStateListener(NavigationStateListener l)
          Set the listener for navigation state change notifications.
 
Methods inherited from class org.j3d.renderer.java3d.navigation.NavigationProcessor
getNavigationState, getPosition, getTimerBehavior, move, orient, processNextFrame, setAvatarInfo, setCenterOfRotation, setCollisionListener, setFrameUpdateListener, setNavigationSpeed, setNavigationState, setOrbitTime, setViewInfo, setViewInfo, setViewPath, setWorldInfo, startMove, stopMove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NavigationHandler

public NavigationHandler()
Create a new mouse handler with no view information set. This handler will not do anything until the view transform references have been set and the navigation modes for at least one mouse button.

Method Detail

setButtonNavigation

public void setButtonNavigation(int button,
                                int state)
Set the ability to use a given state within the handler for a specific mouse button (up to 3). This allows the caller to control exactly what states are allowed to be used and with which buttons. Note that it is quite legal to set all three buttons to the same navigation state

Specified by:
setButtonNavigation in interface NavigationMouseProcessor
Parameters:
button - The mouse button value from MouseEvent
state - The navigation state to use for that button

setNavigationStateListener

public void setNavigationStateListener(NavigationStateListener l)
Set the listener for navigation state change notifications. By setting a value of null it will clear the currently set instance

Specified by:
setNavigationStateListener in interface NavigationMouseProcessor
Parameters:
l - The listener to use for change updates

mousePressed

public void mousePressed(java.awt.event.MouseEvent evt)
Process a mouse press and set the behavior running. This will cause the navigation state to be set depending on the mouse button pressed.

Specified by:
mousePressed in interface NavigationMouseProcessor
Parameters:
evt - The event that caused this method to be called

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent evt)
Process a mouse drag event to change the current movement value from the previously set value to the new value

Specified by:
mouseDragged in interface NavigationMouseProcessor
Parameters:
evt - The event that caused this method to be called

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent evt)
Process a mouse release to return all the values back to normal. This places all of the transforms back to identity and sets it as though the nothing had happened.

Specified by:
mouseReleased in interface NavigationMouseProcessor
Parameters:
evt - The event that caused this method to be called

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org