NASA World Wind

gov.nasa.worldwind.view.orbit
Class OrbitViewInputHandler

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

public class OrbitViewInputHandler
extends BasicViewInputHandler


Nested Class Summary
protected static class OrbitViewInputHandler.CollisionAwarePitchAccessor
          CollisionAwarePitchAccessor implements an PropertyAccessor.AngleAccessor interface onto the pitch property of an OrbitView.
 class OrbitViewInputHandler.ResetRollActionListener
          Action handler to reset 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  AnimationController gotoAnimControl
           
static String ORBITVIEW_RESET_ROLL
           
protected  AnimationController uiAnimControl
           
protected static String VIEW_ANIM_APP
           
protected static String VIEW_ANIM_CENTER
           
protected static String VIEW_ANIM_HEADING
           
protected static String VIEW_ANIM_HEADING_PITCH
           
protected static String VIEW_ANIM_PAN
           
protected static String VIEW_ANIM_PITCH
           
protected static String VIEW_ANIM_POSITION
           
protected static String VIEW_ANIM_ROLL
           
protected static String VIEW_ANIM_ZOOM
           
 
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
OrbitViewInputHandler()
          Create a new input handler.
 
Method Summary
 void addAnimator(Animator animator)
          Add an Animator to this ViewInputHandler.
 void addCenterAnimator(Position begin, Position end, boolean smoothed)
           
 void addCenterAnimator(Position begin, Position end, long lengthMillis, boolean smoothed)
           
 void addEyePositionAnimator(long timeToIterate, Position beginPosition, Position endPosition)
           
 void addFlyToZoomAnimator(Angle heading, Angle pitch, double zoom)
           
 void addHeadingAnimator(Angle begin, Angle end)
           
 void addHeadingPitchRollAnimator(Angle beginHeading, Angle endHeading, Angle beginPitch, Angle endPitch, Angle beginRoll, Angle endRoll)
          Add an animator to animate heading, pitch, and roll.
 void addPanToAnimator(Position centerPos, Angle heading, Angle pitch, double zoom)
           
 void addPanToAnimator(Position centerPos, Angle heading, Angle pitch, double zoom, boolean endCenterOnSurface)
           
 void addPanToAnimator(Position centerPos, Angle heading, Angle pitch, double zoom, long timeToMove, boolean endCenterOnSurface)
           
 void addPanToAnimator(Position beginCenterPos, Position endCenterPos, Angle beginHeading, Angle endHeading, Angle beginPitch, Angle endPitch, double beginZoom, double endZoom, boolean endCenterOnSurface)
           
 void addPanToAnimator(Position beginCenterPos, Position endCenterPos, Angle beginHeading, Angle endHeading, Angle beginPitch, Angle endPitch, double beginZoom, double endZoom, long timeToMove, boolean endCenterOnSurface)
           
 void addPitchAnimator(Angle begin, Angle end)
           
 void addRollAnimator(Angle begin, Angle end)
          Add an animator to animate roll.
 void addZoomAnimator(double zoomStart, double zoomEnd)
           
 void apply()
          Apply the changes prior to rendering a frame.
protected  void changeHeading(BasicOrbitView view, AnimationController animControl, Angle change, ViewInputAttributes.ActionAttributes attrib)
           
protected  void changePitch(BasicOrbitView view, AnimationController animControl, Angle change, ViewInputAttributes.ActionAttributes attrib)
           
protected  void changeZoom(BasicOrbitView view, AnimationController animControl, double change, ViewInputAttributes.ActionAttributes attrib)
           
protected static Angle computeNewHeading(Angle heading, OrbitViewLimits limits)
           
protected static Angle computeNewPitch(Angle pitch, OrbitViewLimits limits)
           
protected static Position computeNewPosition(Position position, OrbitViewLimits limits)
           
protected static double computeNewZoom(double curZoom, double change, OrbitViewLimits limits)
           
protected  double getScaleValueHorizTransRel(ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)
           
protected  double getScaleValueRotate(ViewInputAttributes.ActionAttributes actionAttributes)
           
protected  double getScaleValueZoom(ViewInputAttributes.ActionAttributes actionAttributes)
           
 void goTo(Position lookAtPos, double distance)
          Animate to the specified position.
protected  void handleOrbitViewCenterStopped()
           
protected  void handlePropertyChange(PropertyChangeEvent e)
           
protected  void handleViewStopped()
           
protected  void initializeInputHandlers()
          Initialize input handlers specific to ObitView.
 boolean isAnimating()
          Determine if there are any animations active in the View.
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 onResetRoll(ViewInputAttributes.ActionAttributes actionAttribs)
          Called when user input causes the roll to reset.
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 actionAttributes)
           
protected  void onVerticalTranslate(double translateChange, ViewInputAttributes.ActionAttributes actionAttribs)
           
protected  void setCenterPosition(BasicOrbitView view, AnimationController animControl, Position position, ViewInputAttributes.ActionAttributes attrib)
           
protected  void stopAllAnimators()
           
 void stopAnimators()
          Stops any animations that are active in this View
protected  void stopGoToAnimators()
           
protected  void stopUserInputAnimators(Object... names)
           
 
Methods inherited from class gov.nasa.worldwind.awt.BasicViewInputHandler
callActionListListeners, callActionListListeners, callMouseActionListListeners, callMouseWheelActionListListeners, handleKeyPressed, handleMouseClicked, handleMouseDragged, handleMouseWheelMoved, handlePerFrameKeyState, handlePerFrameMouseState, 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

gotoAnimControl

protected AnimationController gotoAnimControl

ORBITVIEW_RESET_ROLL

public static final String ORBITVIEW_RESET_ROLL
See Also:
Constant Field Values

uiAnimControl

protected AnimationController uiAnimControl

VIEW_ANIM_APP

protected static final String VIEW_ANIM_APP
See Also:
Constant Field Values

VIEW_ANIM_CENTER

protected static final String VIEW_ANIM_CENTER
See Also:
Constant Field Values

VIEW_ANIM_HEADING

protected static final String VIEW_ANIM_HEADING
See Also:
Constant Field Values

VIEW_ANIM_HEADING_PITCH

protected static final String VIEW_ANIM_HEADING_PITCH
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

VIEW_ANIM_ZOOM

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

OrbitViewInputHandler

public OrbitViewInputHandler()
Create a new input handler.

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

addCenterAnimator

public void addCenterAnimator(Position begin,
                              Position end,
                              boolean smoothed)

addCenterAnimator

public void addCenterAnimator(Position begin,
                              Position end,
                              long lengthMillis,
                              boolean smoothed)

addEyePositionAnimator

public void addEyePositionAnimator(long timeToIterate,
                                   Position beginPosition,
                                   Position endPosition)

addFlyToZoomAnimator

public void addFlyToZoomAnimator(Angle heading,
                                 Angle pitch,
                                 double zoom)

addHeadingAnimator

public void addHeadingAnimator(Angle begin,
                               Angle end)

addHeadingPitchRollAnimator

public void addHeadingPitchRollAnimator(Angle beginHeading,
                                        Angle endHeading,
                                        Angle beginPitch,
                                        Angle endPitch,
                                        Angle beginRoll,
                                        Angle endRoll)
Add an animator to animate heading, pitch, and roll.

Parameters:
beginHeading - starting heading
endHeading - final heading
beginPitch - starting pitch
endPitch - final pitch
beginRoll - starting roll
endRoll - final roll

addPanToAnimator

public void addPanToAnimator(Position centerPos,
                             Angle heading,
                             Angle pitch,
                             double zoom)

addPanToAnimator

public void addPanToAnimator(Position centerPos,
                             Angle heading,
                             Angle pitch,
                             double zoom,
                             boolean endCenterOnSurface)

addPanToAnimator

public void addPanToAnimator(Position centerPos,
                             Angle heading,
                             Angle pitch,
                             double zoom,
                             long timeToMove,
                             boolean endCenterOnSurface)

addPanToAnimator

public void addPanToAnimator(Position beginCenterPos,
                             Position endCenterPos,
                             Angle beginHeading,
                             Angle endHeading,
                             Angle beginPitch,
                             Angle endPitch,
                             double beginZoom,
                             double endZoom,
                             boolean endCenterOnSurface)

addPanToAnimator

public void addPanToAnimator(Position beginCenterPos,
                             Position endCenterPos,
                             Angle beginHeading,
                             Angle endHeading,
                             Angle beginPitch,
                             Angle endPitch,
                             double beginZoom,
                             double endZoom,
                             long timeToMove,
                             boolean endCenterOnSurface)

addPitchAnimator

public void addPitchAnimator(Angle begin,
                             Angle end)

addRollAnimator

public void addRollAnimator(Angle begin,
                            Angle end)
Add an animator to animate roll.

Parameters:
begin - starting roll
end - final roll

addZoomAnimator

public void addZoomAnimator(double zoomStart,
                            double zoomEnd)

apply

public void apply()
Apply the changes prior to rendering a frame. The method will step animators, applying the results of those steps to the View, then if a focus on terrain is required, it will do that as well.

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

changeHeading

protected void changeHeading(BasicOrbitView view,
                             AnimationController animControl,
                             Angle change,
                             ViewInputAttributes.ActionAttributes attrib)

changePitch

protected void changePitch(BasicOrbitView view,
                           AnimationController animControl,
                           Angle change,
                           ViewInputAttributes.ActionAttributes attrib)

changeZoom

protected void changeZoom(BasicOrbitView view,
                          AnimationController animControl,
                          double change,
                          ViewInputAttributes.ActionAttributes attrib)

computeNewHeading

protected static Angle computeNewHeading(Angle heading,
                                         OrbitViewLimits limits)

computeNewPitch

protected static Angle computeNewPitch(Angle pitch,
                                       OrbitViewLimits limits)

computeNewPosition

protected static Position computeNewPosition(Position position,
                                             OrbitViewLimits limits)

computeNewZoom

protected static double computeNewZoom(double curZoom,
                                       double change,
                                       OrbitViewLimits limits)

getScaleValueHorizTransRel

protected double getScaleValueHorizTransRel(ViewInputAttributes.DeviceAttributes deviceAttributes,
                                            ViewInputAttributes.ActionAttributes actionAttributes)

getScaleValueRotate

protected double getScaleValueRotate(ViewInputAttributes.ActionAttributes actionAttributes)

getScaleValueZoom

protected double getScaleValueZoom(ViewInputAttributes.ActionAttributes actionAttributes)

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.

handleOrbitViewCenterStopped

protected void handleOrbitViewCenterStopped()

handlePropertyChange

protected void handlePropertyChange(PropertyChangeEvent e)
Overrides:
handlePropertyChange in class BasicViewInputHandler

handleViewStopped

protected void handleViewStopped()
Overrides:
handleViewStopped in class BasicViewInputHandler

initializeInputHandlers

protected void initializeInputHandlers()
Initialize input handlers specific to ObitView.


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.

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

onResetRoll

protected void onResetRoll(ViewInputAttributes.ActionAttributes actionAttribs)
Called when user input causes the roll to reset.

Parameters:
actionAttribs - input 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 actionAttributes)
Specified by:
onVerticalTranslate in class AbstractViewInputHandler

onVerticalTranslate

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

setCenterPosition

protected void setCenterPosition(BasicOrbitView view,
                                 AnimationController animControl,
                                 Position position,
                                 ViewInputAttributes.ActionAttributes attrib)

stopAllAnimators

protected void stopAllAnimators()

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(Object... names)

NASA World Wind