Package gov.nasa.worldwind.view.orbit
Class OrbitViewInputHandler
- java.lang.Object
-
- gov.nasa.worldwind.awt.AbstractViewInputHandler
-
- gov.nasa.worldwind.awt.BasicViewInputHandler
-
- gov.nasa.worldwind.view.orbit.OrbitViewInputHandler
-
- All Implemented Interfaces:
ViewInputHandler,java.awt.event.FocusListener,java.awt.event.KeyListener,java.awt.event.MouseListener,java.awt.event.MouseMotionListener,java.awt.event.MouseWheelListener,java.beans.PropertyChangeListener,java.util.EventListener
public class OrbitViewInputHandler extends BasicViewInputHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classOrbitViewInputHandler.CollisionAwarePitchAccessorCollisionAwarePitchAccessor implements anPropertyAccessor.AngleAccessorinterface onto the pitch property of anOrbitView.classOrbitViewInputHandler.ResetRollActionListenerAction 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
Fields Modifier and Type Field Description protected AnimationControllergotoAnimControlstatic java.lang.StringORBITVIEW_RESET_ROLLprotected AnimationControlleruiAnimControlprotected static java.lang.StringVIEW_ANIM_APPprotected static java.lang.StringVIEW_ANIM_CENTERprotected static java.lang.StringVIEW_ANIM_EYEprotected static java.lang.StringVIEW_ANIM_HEADINGprotected static java.lang.StringVIEW_ANIM_HEADING_PITCHprotected static java.lang.StringVIEW_ANIM_PANprotected static java.lang.StringVIEW_ANIM_PITCHprotected static java.lang.StringVIEW_ANIM_POSITIONprotected static java.lang.StringVIEW_ANIM_ROLLprotected static java.lang.StringVIEW_ANIM_ZOOM-
Fields inherited from class gov.nasa.worldwind.awt.AbstractViewInputHandler
attributes, DEFAULT_DRAG_SLOPE_FACTOR, DEFAULT_PER_FRAME_INPUT_INTERVAL, dragSlopeFactor, enableSmoothing, GENERATE_EVENTS, keyActionMap, keyEventState, keyModsActionMap, lastMousePoint, lastPerFrameInputTime, lockHeading, modifierList, mouseActionMap, mouseDownModelview, mouseDownPoint, mouseDownProjection, mouseDownViewport, mouseModsActionMap, mousePoint, mouseWheelModsActionMap, NUM_MODIFIERS, perFrameInputInterval, QUERY_EVENTS, SCALE_FUNC_EYE_ALTITUDE, SCALE_FUNC_EYE_ALTITUDE_EXP, SCALE_FUNC_ZOOM, SCALE_FUNC_ZOOM_EXP, selectedPosition, stopOnFocusLost, wwd, wwdFocusOwner
-
-
Constructor Summary
Constructors Constructor Description OrbitViewInputHandler()Create a new input handler.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAnimator(Animator animator)Add anAnimatorto thisViewInputHandler.voidaddCenterAnimator(Position begin, Position end, boolean smoothed)voidaddCenterAnimator(Position begin, Position end, long lengthMillis, boolean smoothed)voidaddEyePositionAnimator(long timeToIterate, Position beginPosition, Position endPosition)voidaddFlyToZoomAnimator(Angle heading, Angle pitch, double zoom)voidaddHeadingAnimator(Angle begin, Angle end)voidaddHeadingPitchRollAnimator(Angle beginHeading, Angle endHeading, Angle beginPitch, Angle endPitch, Angle beginRoll, Angle endRoll)Add an animator to animate heading, pitch, and roll.voidaddPanToAnimator(Position centerPos, Angle heading, Angle pitch, double zoom)voidaddPanToAnimator(Position centerPos, Angle heading, Angle pitch, double zoom, boolean endCenterOnSurface)voidaddPanToAnimator(Position centerPos, Angle heading, Angle pitch, double zoom, long timeToMove, boolean endCenterOnSurface)voidaddPanToAnimator(Position beginCenterPos, Position endCenterPos, Angle beginHeading, Angle endHeading, Angle beginPitch, Angle endPitch, double beginZoom, double endZoom, boolean endCenterOnSurface)voidaddPanToAnimator(Position beginCenterPos, Position endCenterPos, Angle beginHeading, Angle endHeading, Angle beginPitch, Angle endPitch, double beginZoom, double endZoom, long timeToMove, boolean endCenterOnSurface)voidaddPitchAnimator(Angle begin, Angle end)voidaddRollAnimator(Angle begin, Angle end)Add an animator to animate roll.voidaddZoomAnimator(double zoomStart, double zoomEnd)voidapply()Apply the changes prior to rendering a frame.protected voidchangeHeading(BasicOrbitView view, AnimationController animControl, Angle change, ViewInputAttributes.ActionAttributes attrib)protected voidchangePitch(BasicOrbitView view, AnimationController animControl, Angle change, ViewInputAttributes.ActionAttributes attrib)protected voidchangeZoom(BasicOrbitView view, AnimationController animControl, double change, ViewInputAttributes.ActionAttributes attrib)protected static AnglecomputeNewHeading(OrbitView view, Angle heading)protected static AnglecomputeNewPitch(OrbitView view, Angle pitch)protected static PositioncomputeNewPosition(OrbitView view, Position position)protected static doublecomputeNewZoom(OrbitView view, double curZoom, double change)protected doublegetScaleValueHorizTransRel(ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)protected doublegetScaleValueRotate(ViewInputAttributes.ActionAttributes actionAttributes)protected doublegetScaleValueZoom(ViewInputAttributes.ActionAttributes actionAttributes)voidgoTo(Position lookAtPos, double distance)Animate to the specified position.protected voidhandleOrbitViewCenterStopped()protected voidhandlePropertyChange(java.beans.PropertyChangeEvent e)protected voidhandleViewStopped()protected voidinitializeInputHandlers()Initialize input handlers specific to ObitView.booleanisAnimating()Determine if there are any animations active in theView.protected booleanisNonContinous2DGlobe()protected voidonHorizontalTranslate2D(double forwardInput, double sideInput, double totalForwardInput, double totalSideInput, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)protected voidonHorizontalTranslateAbs(Angle latitudeChange, Angle longitudeChange, ViewInputAttributes.ActionAttributes actionAttribs)protected voidonHorizontalTranslateRel(double forwardInput, double sideInput, double totalForwardInput, double totalSideInput, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)protected voidonHorizontalTranslateRel(Angle forwardChange, Angle sideChange, ViewInputAttributes.ActionAttributes actionAttribs)protected voidonMoveTo(Position focalPosition, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttribs)protected voidonMoveTo2D(Position focalPosition, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttribs)protected voidonResetHeading(ViewInputAttributes.ActionAttributes actionAttribs)protected voidonResetHeadingPitchRoll(ViewInputAttributes.ActionAttributes actionAttribs)protected voidonResetRoll(ViewInputAttributes.ActionAttributes actionAttribs)Called when user input causes the roll to reset.protected voidonRotateView(double headingInput, double pitchInput, double totalHeadingInput, double totalPitchInput, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)protected voidonRotateView(Angle headingChange, Angle pitchChange, ViewInputAttributes.ActionAttributes actionAttribs)protected voidonVerticalTranslate(double translateChange, double totalTranslateChange, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)protected voidonVerticalTranslate(double translateChange, ViewInputAttributes.ActionAttributes actionAttribs)protected voidsetCenterPosition(BasicOrbitView view, AnimationController animControl, Position position, ViewInputAttributes.ActionAttributes attrib)protected voidsetEyePoint(Vec4 eyePoint, ViewInputAttributes.ActionAttributes attrib)protected voidstopAllAnimators()voidstopAnimators()Stops any animations that are active in thisViewprotected voidstopGoToAnimators()protected voidstopUserInputAnimators(java.lang.Object... names)-
Methods inherited from class gov.nasa.worldwind.awt.BasicViewInputHandler
callActionListener, callActionListListeners, callActionListListeners, callMouseActionListListeners, callMouseWheelActionListListeners, handleKeyPressed, handleMouseClicked, handleMouseDragged, handleMouseWheelMoved, handlePerFrameKeyState, handlePerFrameMouseState
-
Methods inherited from class gov.nasa.worldwind.awt.AbstractViewInputHandler
computeDragSlope, computeSelectedPointAt, computeSelectedPosition, constrainToSourceBounds, evaluateScaleFuncEyeAltitude, evaluateScaleFuncZoom, focusGained, focusLost, getAttributes, getChangeInLocation, getDragSlopeFactor, getLastMousePoint, getMouseDownPoint, getMousePoint, getPerFrameInputInterval, getScaledValue, getScaleValue, getScaleValueElevation, getSelectedPosition, getView, getWorldWindow, handleFocusGained, handleFocusLost, handleKeyReleased, handleMouseMoved, handleMousePressed, handleMouseReleased, handlePerFrameAnimation, isEnableSmoothing, isLockHeading, isStopOnFocusLost, isWorldWindowFocusOwner, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, onStopView, propertyChange, rawInputToChangeInValue, setAttributes, setDragSlopeFactor, setEnableSmoothing, setLockHeading, setMouseDownPoint, setMouseDownView, setPerFrameInputInterval, setSelectedPosition, setStopOnFocusLost, setWorldWindow, setWorldWindowFocusOwner, updateMousePoint, viewApplied
-
-
-
-
Field Detail
-
gotoAnimControl
protected AnimationController gotoAnimControl
-
uiAnimControl
protected AnimationController uiAnimControl
-
VIEW_ANIM_HEADING
protected static final java.lang.String VIEW_ANIM_HEADING
- See Also:
- Constant Field Values
-
VIEW_ANIM_PITCH
protected static final java.lang.String VIEW_ANIM_PITCH
- See Also:
- Constant Field Values
-
VIEW_ANIM_ROLL
protected static final java.lang.String VIEW_ANIM_ROLL
- See Also:
- Constant Field Values
-
VIEW_ANIM_HEADING_PITCH
protected static final java.lang.String VIEW_ANIM_HEADING_PITCH
- See Also:
- Constant Field Values
-
VIEW_ANIM_POSITION
protected static final java.lang.String VIEW_ANIM_POSITION
- See Also:
- Constant Field Values
-
VIEW_ANIM_CENTER
protected static final java.lang.String VIEW_ANIM_CENTER
- See Also:
- Constant Field Values
-
VIEW_ANIM_ZOOM
protected static final java.lang.String VIEW_ANIM_ZOOM
- See Also:
- Constant Field Values
-
VIEW_ANIM_PAN
protected static final java.lang.String VIEW_ANIM_PAN
- See Also:
- Constant Field Values
-
VIEW_ANIM_APP
protected static final java.lang.String VIEW_ANIM_APP
- See Also:
- Constant Field Values
-
VIEW_ANIM_EYE
protected static final java.lang.String VIEW_ANIM_EYE
- See Also:
- Constant Field Values
-
ORBITVIEW_RESET_ROLL
public static final java.lang.String ORBITVIEW_RESET_ROLL
- See Also:
- Constant Field Values
-
-
Method Detail
-
initializeInputHandlers
protected void initializeInputHandlers()
Initialize input handlers specific to ObitView.
-
isNonContinous2DGlobe
protected boolean isNonContinous2DGlobe()
-
onMoveTo
protected void onMoveTo(Position focalPosition, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttribs)
- Specified by:
onMoveToin classBasicViewInputHandler
-
onMoveTo2D
protected void onMoveTo2D(Position focalPosition, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttribs)
-
onHorizontalTranslateAbs
protected void onHorizontalTranslateAbs(Angle latitudeChange, Angle longitudeChange, ViewInputAttributes.ActionAttributes actionAttribs)
-
onHorizontalTranslateRel
protected void onHorizontalTranslateRel(double forwardInput, double sideInput, double totalForwardInput, double totalSideInput, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)- Specified by:
onHorizontalTranslateRelin classBasicViewInputHandler
-
onHorizontalTranslateRel
protected void onHorizontalTranslateRel(Angle forwardChange, Angle sideChange, ViewInputAttributes.ActionAttributes actionAttribs)
-
onHorizontalTranslate2D
protected void onHorizontalTranslate2D(double forwardInput, double sideInput, double totalForwardInput, double totalSideInput, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)
-
onResetHeading
protected void onResetHeading(ViewInputAttributes.ActionAttributes actionAttribs)
- Specified by:
onResetHeadingin classBasicViewInputHandler
-
onResetRoll
protected void onResetRoll(ViewInputAttributes.ActionAttributes actionAttribs)
Called when user input causes the roll to reset.- Parameters:
actionAttribs- input that caused the change.
-
onResetHeadingPitchRoll
protected void onResetHeadingPitchRoll(ViewInputAttributes.ActionAttributes actionAttribs)
- Specified by:
onResetHeadingPitchRollin classBasicViewInputHandler
-
onRotateView
protected void onRotateView(double headingInput, double pitchInput, double totalHeadingInput, double totalPitchInput, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)- Specified by:
onRotateViewin classBasicViewInputHandler
-
onRotateView
protected void onRotateView(Angle headingChange, Angle pitchChange, ViewInputAttributes.ActionAttributes actionAttribs)
-
onVerticalTranslate
protected void onVerticalTranslate(double translateChange, double totalTranslateChange, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)- Specified by:
onVerticalTranslatein classBasicViewInputHandler
-
onVerticalTranslate
protected void onVerticalTranslate(double translateChange, ViewInputAttributes.ActionAttributes actionAttribs)
-
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:
applyin interfaceViewInputHandler- Overrides:
applyin classBasicViewInputHandler
-
handlePropertyChange
protected void handlePropertyChange(java.beans.PropertyChangeEvent e)
- Overrides:
handlePropertyChangein classBasicViewInputHandler
-
stopAllAnimators
protected void stopAllAnimators()
-
stopGoToAnimators
protected void stopGoToAnimators()
-
stopUserInputAnimators
protected void stopUserInputAnimators(java.lang.Object... names)
-
handleViewStopped
protected void handleViewStopped()
- Overrides:
handleViewStoppedin classBasicViewInputHandler
-
handleOrbitViewCenterStopped
protected void handleOrbitViewCenterStopped()
-
setEyePoint
protected void setEyePoint(Vec4 eyePoint, ViewInputAttributes.ActionAttributes attrib)
-
setCenterPosition
protected void setCenterPosition(BasicOrbitView view, AnimationController animControl, Position position, ViewInputAttributes.ActionAttributes attrib)
-
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)
-
computeNewZoom
protected static double computeNewZoom(OrbitView view, double curZoom, double change)
-
getScaleValueHorizTransRel
protected double getScaleValueHorizTransRel(ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)
-
getScaleValueRotate
protected double getScaleValueRotate(ViewInputAttributes.ActionAttributes actionAttributes)
-
getScaleValueZoom
protected double getScaleValueZoom(ViewInputAttributes.ActionAttributes actionAttributes)
-
addPanToAnimator
public void addPanToAnimator(Position beginCenterPos, Position endCenterPos, Angle beginHeading, Angle endHeading, Angle beginPitch, Angle endPitch, double beginZoom, double endZoom, 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 centerPos, Angle heading, Angle pitch, double zoom, long timeToMove, boolean endCenterOnSurface)
-
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)
-
addEyePositionAnimator
public void addEyePositionAnimator(long timeToIterate, Position beginPosition, Position endPosition)
-
addRollAnimator
public void addRollAnimator(Angle begin, Angle end)
Add an animator to animate roll.- Parameters:
begin- starting rollend- final roll
-
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 headingendHeading- final headingbeginPitch- starting pitchendPitch- final pitchbeginRoll- starting rollendRoll- final roll
-
addZoomAnimator
public void addZoomAnimator(double zoomStart, double zoomEnd)
-
addCenterAnimator
public void addCenterAnimator(Position begin, Position end, long lengthMillis, boolean smoothed)
-
goTo
public void goTo(Position lookAtPos, double distance)
Description copied from interface:ViewInputHandlerAnimate to the specified position. The implementation is expected to animate theViewto look at the given position from the given elevation.- Parameters:
lookAtPos- The position to animate the view to look at.distance- The elevation to look at thepositionfrom.
-
stopAnimators
public void stopAnimators()
Description copied from interface:ViewInputHandlerStops any animations that are active in thisView
-
isAnimating
public boolean isAnimating()
Description copied from interface:ViewInputHandlerDetermine if there are any animations active in theView.- Returns:
- true if there are active animations, false otherwise.
-
addAnimator
public void addAnimator(Animator animator)
Description copied from interface:ViewInputHandlerAdd anAnimatorto thisViewInputHandler. This method does not start theAnimator. Starting theAnimatoris the responsibility of the application. This method is here primarily for use by theView. Applications should callView.addAnimator(gov.nasa.worldwind.animation.Animator)to add an animtion to the view.- Parameters:
animator- theAnimatorto be added
-
-