NASA World Wind

gov.nasa.worldwind.view.firstperson
Class FlyViewInputHandler

java.lang.Object
  extended by gov.nasa.worldwind.awt.AbstractViewInputHandler
      extended by gov.nasa.worldwind.awt.BasicViewInputHandler
          extended by gov.nasa.worldwind.view.firstperson.FlyViewInputHandler
All Implemented Interfaces:
ViewInputHandler, FocusListener, KeyListener, MouseListener, MouseMotionListener, MouseWheelListener, PropertyChangeListener, EventListener

public class FlyViewInputHandler
extends BasicViewInputHandler


Nested Class Summary
 class FlyViewInputHandler.ResetPitchActionListener
           
 class FlyViewInputHandler.RollActionListener
          Input handler to handle user input that changes Roll.
 
Nested classes/interfaces inherited from class gov.nasa.worldwind.awt.BasicViewInputHandler
BasicViewInputHandler.HorizontalTransActionListener, BasicViewInputHandler.HorizTransMouseActionListener, BasicViewInputHandler.MoveToMouseActionListener, BasicViewInputHandler.ResetHeadingActionListener, BasicViewInputHandler.ResetHeadingPitchActionListener, BasicViewInputHandler.RotateActionListener, BasicViewInputHandler.RotateMouseActionListener, BasicViewInputHandler.StopViewActionListener, BasicViewInputHandler.VerticalTransActionListener, BasicViewInputHandler.VertTransMouseActionListener, BasicViewInputHandler.VertTransMouseWheelActionListener
 
Field Summary
protected static String ACTION_RESET_PITCH
           
protected static double DEFAULT_KEY_HORIZONTAL_TRANSLATE_MAX_VALUE
           
protected static double DEFAULT_KEY_HORIZONTAL_TRANSLATE_MAX_VALUE_SLOW
           
protected static double DEFAULT_KEY_HORIZONTAL_TRANSLATE_MIN_VALUE
           
protected static double DEFAULT_KEY_HORIZONTAL_TRANSLATE_MIN_VALUE_SLOW
           
protected static double DEFAULT_KEY_TRANSLATE_SMOOTHING_VALUE
           
protected static double DEFAULT_KEY_VERTICAL_TRANSLATE_MAX_VALUE
           
protected static double DEFAULT_KEY_VERTICAL_TRANSLATE_MIN_VALUE
           
protected static double DEFAULT_MOUSE_HORIZONTAL_TRANSLATE_MAX_VALUE
           
protected static double DEFAULT_MOUSE_HORIZONTAL_TRANSLATE_MIN_VALUE
           
protected static double DEFAULT_MOUSE_ROTATE_MAX_VALUE
           
protected static double DEFAULT_MOUSE_ROTATE_MIN_VALUE
           
protected static double DEFAULT_MOUSE_VERTICAL_TRANSLATE_MAX_VALUE
           
protected static double DEFAULT_MOUSE_VERTICAL_TRANSLATE_MIN_VALUE
           
protected static double DEFAULT_MOUSE_WHEEL_VERTICAL_TRANSLATE_VALUE_MAX
           
protected static double DEFAULT_MOUSE_WHEEL_VERTICAL_TRANSLATE_VALUE_MAX_OSX
           
protected static double DEFAULT_MOUSE_WHEEL_VERTICAL_TRANSLATE_VALUE_MIN
           
protected static double DEFAULT_MOUSE_WHEEL_VERTICAL_TRANSLATE_VALUE_MIN_OSX
           
protected static ViewInputAttributes.ActionAttributes.KeyAction DEFAULT_RESET_PITCH_KEY_ACT
           
static ViewInputAttributes.ActionAttributes.KeyAction[] resetPitchEvents
           
protected static String VIEW_ANIM_APP
           
protected static String VIEW_ANIM_HEADING
           
protected static String VIEW_ANIM_PAN
           
protected static String VIEW_ANIM_PITCH
           
protected static String VIEW_ANIM_POSITION
           
protected static String VIEW_ANIM_ROLL
           
 
Fields inherited from class gov.nasa.worldwind.awt.AbstractViewInputHandler
attributes, DEFAULT_DRAG_SLOPE_FACTOR, DEFAULT_PER_FRAME_INPUT_DELAY, dragSlopeFactor, enableSmoothing, GENERATE_EVENTS, keyActionMap, keyEventState, keyModsActionMap, lastMousePoint, lastPerFrameInputTime, lockHeading, modifierList, mouseActionMap, mouseDownPoint, mouseModsActionMap, mousePoint, mouseWheelModsActionMap, NUM_MODIFIERS, QUERY_EVENTS, SCALE_FUNC_EYE_ALTITUDE, SCALE_FUNC_EYE_ALTITUDE_EXP, SCALE_FUNC_ZOOM, SCALE_FUNC_ZOOM_EXP, selectedPosition, stopOnFocusLost, wwd, wwdFocusOwner
 
Constructor Summary
FlyViewInputHandler()
           
 
Method Summary
 void addAnimator(Animator animator)
          Add an Animator to this ViewInputHandler.
 void apply()
          Implementations are expected to apply any changes to the View state prior to the View setting the modelview matrix for rendering the current frame.
 void goTo(Position lookAtPos, double distance)
          Animate to the specified position.
protected  void handleViewStopped()
           
 boolean isAnimating()
          Determine if there are any animations active in the View.
 void lookAt(Position lookAtPos, long timeToMove)
           
protected  void onHorizontalTranslateAbs(Angle latitudeChange, Angle longitudeChange, ViewInputAttributes.ActionAttributes actionAttribs)
           
protected  void onHorizontalTranslateRel(Angle forwardChange, Angle sideChange, ViewInputAttributes.ActionAttributes actionAttribs)
           
protected  void onHorizontalTranslateRel(double forwardInput, double sideInput, double totalForwardInput, double totalSideInput, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)
           
protected  void onMoveTo(Position focalPosition, ViewInputAttributes.ActionAttributes actionAttribs)
           
protected  void onMoveTo(Position focalPosition, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttribs)
           
protected  void onResetHeading(ViewInputAttributes.ActionAttributes actionAttribs)
           
protected  void onResetHeadingPitchRoll(ViewInputAttributes.ActionAttributes actionAttribs)
           
protected  void onResetPitch(ViewInputAttributes.ActionAttributes actionAttribs)
           
protected  void onRoll(Angle rollChange, ViewInputAttributes.ActionAttributes actionAttribs)
          Called when the roll changes due to user input.
protected  void onRoll(double rollInput, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)
          Called when the roll changes due to user input.
protected  void onRotateView(Angle headingChange, Angle pitchChange, ViewInputAttributes.ActionAttributes actionAttribs)
           
protected  void onRotateView(double headingInput, double pitchInput, double totalHeadingInput, double totalPitchInput, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)
           
protected  void onVerticalTranslate(double translateChange, double totalTranslateChange, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttribs)
           
protected  void onVerticalTranslate(double translateChange, ViewInputAttributes.ActionAttributes actionAttribs)
           
protected  void setEyePosition(AnimationController animControl, View view, Position position, ViewInputAttributes.ActionAttributes attrib)
           
protected  void setHeading(View view, AnimationController animControl, Angle heading, ViewInputAttributes.ActionAttributes attrib)
           
protected  void setPitch(View view, AnimationController animControl, Angle pitch, ViewInputAttributes.ActionAttributes attrib)
           
protected  void setRoll(View view, AnimationController animControl, Angle roll, ViewInputAttributes.ActionAttributes attrib)
          Set the roll in a view.
 void stopAnimators()
          Stops any animations that are active in this View
protected  void stopGoToAnimators()
           
protected  void stopUserInputAnimators()
           
 
Methods inherited from class gov.nasa.worldwind.awt.BasicViewInputHandler
callActionListListeners, callActionListListeners, callMouseActionListListeners, callMouseWheelActionListListeners, handleKeyPressed, handleMouseClicked, handleMouseDragged, handleMouseWheelMoved, handlePerFrameKeyState, handlePerFrameMouseState, handlePropertyChange, onHorizontalTranslateRel, onRotateView, onRotateView, onVerticalTranslate
 
Methods inherited from class gov.nasa.worldwind.awt.AbstractViewInputHandler
callActionListener, computeDragSlope, computeSelectedPointAt, computeSelectedPosition, constrainToSourceBounds, evaluateScaleFuncEyeAltitude, evaluateScaleFuncZoom, focusGained, focusLost, getAttributes, getChangeInLocation, getDragSlopeFactor, getLastMousePoint, getMouseDownPoint, getMousePoint, getScaledValue, getScaleValue, getScaleValueElevation, getSelectedPosition, getView, getWorldWindow, handleFocusGained, handleFocusLost, handleKeyReleased, handleMouseMoved, handleMousePressed, handleMouseReleased, isEnableSmoothing, isLockHeading, isStopOnFocusLost, isWorldWindowFocusOwner, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, onStopView, propertyChange, rawInputToChangeInValue, setAttributes, setDragSlopeFactor, setEnableSmoothing, setLockHeading, setMouseDownPoint, setSelectedPosition, setStopOnFocusLost, setWorldWindow, setWorldWindowFocusOwner, updateMousePoint, viewApplied
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_RESET_PITCH

protected static final String ACTION_RESET_PITCH
See Also:
Constant Field Values

DEFAULT_KEY_HORIZONTAL_TRANSLATE_MAX_VALUE

protected static final double DEFAULT_KEY_HORIZONTAL_TRANSLATE_MAX_VALUE
See Also:
Constant Field Values

DEFAULT_KEY_HORIZONTAL_TRANSLATE_MAX_VALUE_SLOW

protected static final double DEFAULT_KEY_HORIZONTAL_TRANSLATE_MAX_VALUE_SLOW
See Also:
Constant Field Values

DEFAULT_KEY_HORIZONTAL_TRANSLATE_MIN_VALUE

protected static final double DEFAULT_KEY_HORIZONTAL_TRANSLATE_MIN_VALUE
See Also:
Constant Field Values

DEFAULT_KEY_HORIZONTAL_TRANSLATE_MIN_VALUE_SLOW

protected static final double DEFAULT_KEY_HORIZONTAL_TRANSLATE_MIN_VALUE_SLOW
See Also:
Constant Field Values

DEFAULT_KEY_TRANSLATE_SMOOTHING_VALUE

protected static final double DEFAULT_KEY_TRANSLATE_SMOOTHING_VALUE
See Also:
Constant Field Values

DEFAULT_KEY_VERTICAL_TRANSLATE_MAX_VALUE

protected static final double DEFAULT_KEY_VERTICAL_TRANSLATE_MAX_VALUE
See Also:
Constant Field Values

DEFAULT_KEY_VERTICAL_TRANSLATE_MIN_VALUE

protected static final double DEFAULT_KEY_VERTICAL_TRANSLATE_MIN_VALUE
See Also:
Constant Field Values

DEFAULT_MOUSE_HORIZONTAL_TRANSLATE_MAX_VALUE

protected static double DEFAULT_MOUSE_HORIZONTAL_TRANSLATE_MAX_VALUE

DEFAULT_MOUSE_HORIZONTAL_TRANSLATE_MIN_VALUE

protected static double DEFAULT_MOUSE_HORIZONTAL_TRANSLATE_MIN_VALUE

DEFAULT_MOUSE_ROTATE_MAX_VALUE

protected static final double DEFAULT_MOUSE_ROTATE_MAX_VALUE
See Also:
Constant Field Values

DEFAULT_MOUSE_ROTATE_MIN_VALUE

protected static final double DEFAULT_MOUSE_ROTATE_MIN_VALUE
See Also:
Constant Field Values

DEFAULT_MOUSE_VERTICAL_TRANSLATE_MAX_VALUE

protected static final double DEFAULT_MOUSE_VERTICAL_TRANSLATE_MAX_VALUE
See Also:
Constant Field Values

DEFAULT_MOUSE_VERTICAL_TRANSLATE_MIN_VALUE

protected static final double DEFAULT_MOUSE_VERTICAL_TRANSLATE_MIN_VALUE
See Also:
Constant Field Values

DEFAULT_MOUSE_WHEEL_VERTICAL_TRANSLATE_VALUE_MAX

protected static final double DEFAULT_MOUSE_WHEEL_VERTICAL_TRANSLATE_VALUE_MAX
See Also:
Constant Field Values

DEFAULT_MOUSE_WHEEL_VERTICAL_TRANSLATE_VALUE_MAX_OSX

protected static final double DEFAULT_MOUSE_WHEEL_VERTICAL_TRANSLATE_VALUE_MAX_OSX
See Also:
Constant Field Values

DEFAULT_MOUSE_WHEEL_VERTICAL_TRANSLATE_VALUE_MIN

protected static final double DEFAULT_MOUSE_WHEEL_VERTICAL_TRANSLATE_VALUE_MIN
See Also:
Constant Field Values

DEFAULT_MOUSE_WHEEL_VERTICAL_TRANSLATE_VALUE_MIN_OSX

protected static final double DEFAULT_MOUSE_WHEEL_VERTICAL_TRANSLATE_VALUE_MIN_OSX
See Also:
Constant Field Values

DEFAULT_RESET_PITCH_KEY_ACT

protected static final ViewInputAttributes.ActionAttributes.KeyAction DEFAULT_RESET_PITCH_KEY_ACT

resetPitchEvents

public static final ViewInputAttributes.ActionAttributes.KeyAction[] resetPitchEvents

VIEW_ANIM_APP

protected static final String VIEW_ANIM_APP
See Also:
Constant Field Values

VIEW_ANIM_HEADING

protected static final String VIEW_ANIM_HEADING
See Also:
Constant Field Values

VIEW_ANIM_PAN

protected static final String VIEW_ANIM_PAN
See Also:
Constant Field Values

VIEW_ANIM_PITCH

protected static final String VIEW_ANIM_PITCH
See Also:
Constant Field Values

VIEW_ANIM_POSITION

protected static final String VIEW_ANIM_POSITION
See Also:
Constant Field Values

VIEW_ANIM_ROLL

protected static final String VIEW_ANIM_ROLL
See Also:
Constant Field Values
Constructor Detail

FlyViewInputHandler

public FlyViewInputHandler()
Method Detail

addAnimator

public void addAnimator(Animator animator)
Description copied from interface: ViewInputHandler
Add an Animator to this ViewInputHandler. This method does not start the Animator. Starting the Animator is the responsibility of the application. This method is here primarily for use by the View. Applications should call View.addAnimator(gov.nasa.worldwind.animation.Animator) to add an animtion to the view.

Parameters:
animator - the Animator to be added

apply

public void apply()
Description copied from interface: ViewInputHandler
Implementations are expected to apply any changes to the View state prior to the View setting the modelview matrix for rendering the current frame.

Specified by:
apply in interface ViewInputHandler
Overrides:
apply in class BasicViewInputHandler

goTo

public void goTo(Position lookAtPos,
                 double distance)
Description copied from interface: ViewInputHandler
Animate to the specified position. The implementation is expected to animate the View to look at the given position from the given elevation.

Specified by:
goTo in interface ViewInputHandler
Overrides:
goTo in class BasicViewInputHandler
Parameters:
lookAtPos - The position to animate the view to look at.
distance - The elevation to look at the position from.

handleViewStopped

protected void handleViewStopped()
Overrides:
handleViewStopped in class BasicViewInputHandler

isAnimating

public boolean isAnimating()
Description copied from interface: ViewInputHandler
Determine if there are any animations active in the View.

Returns:
true if there are active animations, false otherwise.

lookAt

public void lookAt(Position lookAtPos,
                   long timeToMove)

onHorizontalTranslateAbs

protected void onHorizontalTranslateAbs(Angle latitudeChange,
                                        Angle longitudeChange,
                                        ViewInputAttributes.ActionAttributes actionAttribs)
Overrides:
onHorizontalTranslateAbs in class BasicViewInputHandler

onHorizontalTranslateRel

protected void onHorizontalTranslateRel(Angle forwardChange,
                                        Angle sideChange,
                                        ViewInputAttributes.ActionAttributes actionAttribs)
Specified by:
onHorizontalTranslateRel in class AbstractViewInputHandler

onHorizontalTranslateRel

protected void onHorizontalTranslateRel(double forwardInput,
                                        double sideInput,
                                        double totalForwardInput,
                                        double totalSideInput,
                                        ViewInputAttributes.DeviceAttributes deviceAttributes,
                                        ViewInputAttributes.ActionAttributes actionAttributes)
Overrides:
onHorizontalTranslateRel in class BasicViewInputHandler

onMoveTo

protected void onMoveTo(Position focalPosition,
                        ViewInputAttributes.ActionAttributes actionAttribs)
Overrides:
onMoveTo in class BasicViewInputHandler

onMoveTo

protected void onMoveTo(Position focalPosition,
                        ViewInputAttributes.DeviceAttributes deviceAttributes,
                        ViewInputAttributes.ActionAttributes actionAttribs)
Overrides:
onMoveTo in class BasicViewInputHandler

onResetHeading

protected void onResetHeading(ViewInputAttributes.ActionAttributes actionAttribs)
Overrides:
onResetHeading in class BasicViewInputHandler

onResetHeadingPitchRoll

protected void onResetHeadingPitchRoll(ViewInputAttributes.ActionAttributes actionAttribs)
Overrides:
onResetHeadingPitchRoll in class BasicViewInputHandler

onResetPitch

protected void onResetPitch(ViewInputAttributes.ActionAttributes actionAttribs)

onRoll

protected void onRoll(Angle rollChange,
                      ViewInputAttributes.ActionAttributes actionAttribs)
Called when the roll changes due to user input.

Parameters:
rollChange - Change in roll.
actionAttribs - Action that caused the change.

onRoll

protected void onRoll(double rollInput,
                      ViewInputAttributes.DeviceAttributes deviceAttributes,
                      ViewInputAttributes.ActionAttributes actionAttributes)
Called when the roll changes due to user input.

Parameters:
rollInput - Change in roll.
deviceAttributes - Attributes of the input device.
actionAttributes - Action that caused the change.

onRotateView

protected void onRotateView(Angle headingChange,
                            Angle pitchChange,
                            ViewInputAttributes.ActionAttributes actionAttribs)
Specified by:
onRotateView in class AbstractViewInputHandler

onRotateView

protected void onRotateView(double headingInput,
                            double pitchInput,
                            double totalHeadingInput,
                            double totalPitchInput,
                            ViewInputAttributes.DeviceAttributes deviceAttributes,
                            ViewInputAttributes.ActionAttributes actionAttributes)
Specified by:
onRotateView in class AbstractViewInputHandler

onVerticalTranslate

protected void onVerticalTranslate(double translateChange,
                                   double totalTranslateChange,
                                   ViewInputAttributes.DeviceAttributes deviceAttributes,
                                   ViewInputAttributes.ActionAttributes actionAttribs)
Specified by:
onVerticalTranslate in class AbstractViewInputHandler

onVerticalTranslate

protected void onVerticalTranslate(double translateChange,
                                   ViewInputAttributes.ActionAttributes actionAttribs)
Overrides:
onVerticalTranslate in class BasicViewInputHandler

setEyePosition

protected void setEyePosition(AnimationController animControl,
                              View view,
                              Position position,
                              ViewInputAttributes.ActionAttributes attrib)

setHeading

protected void setHeading(View view,
                          AnimationController animControl,
                          Angle heading,
                          ViewInputAttributes.ActionAttributes attrib)

setPitch

protected void setPitch(View view,
                        AnimationController animControl,
                        Angle pitch,
                        ViewInputAttributes.ActionAttributes attrib)

setRoll

protected void setRoll(View view,
                       AnimationController animControl,
                       Angle roll,
                       ViewInputAttributes.ActionAttributes attrib)
Set the roll in a view.

Parameters:
view - View to modify.
animControl - Animator controller for the view.
roll - new roll value.
attrib - action that caused the roll to change.

stopAnimators

public void stopAnimators()
Description copied from interface: ViewInputHandler
Stops any animations that are active in this View


stopGoToAnimators

protected void stopGoToAnimators()

stopUserInputAnimators

protected void stopUserInputAnimators()

NASA World Wind