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 class
OrbitViewInputHandler.CollisionAwarePitchAccessor
CollisionAwarePitchAccessor implements anPropertyAccessor.AngleAccessor
interface onto the pitch property of anOrbitView
.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
Fields Modifier and Type Field Description protected AnimationController
gotoAnimControl
static java.lang.String
ORBITVIEW_RESET_ROLL
protected AnimationController
uiAnimControl
protected static java.lang.String
VIEW_ANIM_APP
protected static java.lang.String
VIEW_ANIM_CENTER
protected static java.lang.String
VIEW_ANIM_EYE
protected static java.lang.String
VIEW_ANIM_HEADING
protected static java.lang.String
VIEW_ANIM_HEADING_PITCH
protected static java.lang.String
VIEW_ANIM_PAN
protected static java.lang.String
VIEW_ANIM_PITCH
protected static java.lang.String
VIEW_ANIM_POSITION
protected static java.lang.String
VIEW_ANIM_ROLL
protected static java.lang.String
VIEW_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 void
addAnimator(Animator animator)
Add anAnimator
to thisViewInputHandler
.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(OrbitView view, Angle heading)
protected static Angle
computeNewPitch(OrbitView view, Angle pitch)
protected static Position
computeNewPosition(OrbitView view, Position position)
protected static double
computeNewZoom(OrbitView view, double curZoom, double change)
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(java.beans.PropertyChangeEvent e)
protected void
handleViewStopped()
protected void
initializeInputHandlers()
Initialize input handlers specific to ObitView.boolean
isAnimating()
Determine if there are any animations active in theView
.protected boolean
isNonContinous2DGlobe()
protected void
onHorizontalTranslate2D(double forwardInput, double sideInput, double totalForwardInput, double totalSideInput, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)
protected void
onHorizontalTranslateAbs(Angle latitudeChange, Angle longitudeChange, ViewInputAttributes.ActionAttributes actionAttribs)
protected void
onHorizontalTranslateRel(double forwardInput, double sideInput, double totalForwardInput, double totalSideInput, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)
protected void
onHorizontalTranslateRel(Angle forwardChange, Angle sideChange, ViewInputAttributes.ActionAttributes actionAttribs)
protected void
onMoveTo(Position focalPosition, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttribs)
protected void
onMoveTo2D(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(double headingInput, double pitchInput, double totalHeadingInput, double totalPitchInput, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)
protected void
onRotateView(Angle headingChange, Angle pitchChange, ViewInputAttributes.ActionAttributes actionAttribs)
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
setEyePoint(Vec4 eyePoint, ViewInputAttributes.ActionAttributes attrib)
protected void
stopAllAnimators()
void
stopAnimators()
Stops any animations that are active in thisView
protected void
stopGoToAnimators()
protected void
stopUserInputAnimators(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:
onMoveTo
in 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:
onHorizontalTranslateRel
in 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:
onResetHeading
in 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:
onResetHeadingPitchRoll
in classBasicViewInputHandler
-
onRotateView
protected void onRotateView(double headingInput, double pitchInput, double totalHeadingInput, double totalPitchInput, ViewInputAttributes.DeviceAttributes deviceAttributes, ViewInputAttributes.ActionAttributes actionAttributes)
- Specified by:
onRotateView
in 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:
onVerticalTranslate
in 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:
apply
in interfaceViewInputHandler
- Overrides:
apply
in classBasicViewInputHandler
-
handlePropertyChange
protected void handlePropertyChange(java.beans.PropertyChangeEvent e)
- Overrides:
handlePropertyChange
in classBasicViewInputHandler
-
stopAllAnimators
protected void stopAllAnimators()
-
stopGoToAnimators
protected void stopGoToAnimators()
-
stopUserInputAnimators
protected void stopUserInputAnimators(java.lang.Object... names)
-
handleViewStopped
protected void handleViewStopped()
- Overrides:
handleViewStopped
in 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:ViewInputHandler
Animate to the specified position. The implementation is expected to animate theView
to 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 theposition
from.
-
stopAnimators
public void stopAnimators()
Description copied from interface:ViewInputHandler
Stops any animations that are active in thisView
-
isAnimating
public boolean isAnimating()
Description copied from interface:ViewInputHandler
Determine 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:ViewInputHandler
Add anAnimator
to thisViewInputHandler
. This method does not start theAnimator
. Starting theAnimator
is 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
- theAnimator
to be added
-
-