|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.awt.AbstractViewInputHandler
public abstract class AbstractViewInputHandler
| Constructor Summary | |
|---|---|
AbstractViewInputHandler()
|
|
| Method Summary | |
|---|---|
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. |
boolean |
callActionListener(KeyEventState keys,
String target,
ViewInputAttributes.ActionAttributes action)
|
double |
computeDragSlope(Point point1,
Point point2,
Vec4 vec1,
Vec4 vec2)
Compute the drag slope the given screen and world coordinates. |
protected Vec4 |
computeSelectedPointAt(Point point)
|
protected Position |
computeSelectedPosition()
|
protected static Point |
constrainToSourceBounds(Point point,
Object source)
|
protected double |
evaluateScaleFuncEyeAltitude()
|
protected double |
evaluateScaleFuncZoom()
|
void |
focusGained(FocusEvent e)
|
void |
focusLost(FocusEvent e)
|
ViewInputAttributes |
getAttributes()
Returns the values that are used to transform raw input events into view movments. |
protected LatLon |
getChangeInLocation(Point point1,
Point point2,
Vec4 vec1,
Vec4 vec2)
|
double |
getDragSlopeFactor()
Returns the factor that dampens view movement when the user pans drags the cursor in a way that could
cause an abrupt transition. |
protected Point |
getLastMousePoint()
|
Point |
getMouseDownPoint()
|
protected Point |
getMousePoint()
|
protected double |
getScaledValue(double minValue,
double maxValue,
String scaleFunc)
|
protected double |
getScaleValue(double minValue,
double maxValue,
double value,
double range,
boolean isExp)
|
protected double |
getScaleValueElevation(ViewInputAttributes.DeviceAttributes deviceAttributes,
ViewInputAttributes.ActionAttributes actionAttributes)
|
protected Position |
getSelectedPosition()
|
protected View |
getView()
|
WorldWindow |
getWorldWindow()
Return the WorldWindow this ViewInputHandler is listening to for input events, and will modify in
response to those events |
protected void |
handleFocusGained(FocusEvent e)
|
protected void |
handleFocusLost(FocusEvent e)
|
protected void |
handleKeyPressed(KeyEvent e)
|
protected void |
handleKeyReleased(KeyEvent e)
|
protected void |
handleMouseClicked(MouseEvent e)
|
protected void |
handleMouseDragged(MouseEvent e)
|
protected void |
handleMouseMoved(MouseEvent e)
|
protected void |
handleMousePressed(MouseEvent e)
|
protected void |
handleMouseReleased(MouseEvent e)
|
protected void |
handleMouseWheelMoved(MouseWheelEvent e)
|
protected boolean |
handlePerFrameKeyState(KeyEventState keys,
String target)
|
protected boolean |
handlePerFrameMouseState(KeyEventState keys,
String target)
|
protected void |
handlePropertyChange(PropertyChangeEvent e)
|
boolean |
isEnableSmoothing()
Returns whether the ViewInputHandler will smooth view movements in response to input events. |
boolean |
isLockHeading()
Returns whether the view's heading should stay the same unless explicitly changed. |
boolean |
isStopOnFocusLost()
Returns whether the view will stop when the WorldWindow looses focus. |
protected boolean |
isWorldWindowFocusOwner()
|
void |
keyPressed(KeyEvent e)
|
void |
keyReleased(KeyEvent e)
|
void |
keyTyped(KeyEvent e)
|
void |
mouseClicked(MouseEvent e)
|
void |
mouseDragged(MouseEvent e)
|
void |
mouseEntered(MouseEvent e)
|
void |
mouseExited(MouseEvent e)
|
void |
mouseMoved(MouseEvent e)
|
void |
mousePressed(MouseEvent e)
|
void |
mouseReleased(MouseEvent e)
|
void |
mouseWheelMoved(MouseWheelEvent e)
|
protected abstract void |
onHorizontalTranslateAbs(Angle latitudeChange,
Angle longitudeChange,
ViewInputAttributes.ActionAttributes actionAttribs)
|
protected abstract void |
onHorizontalTranslateRel(Angle forwardChange,
Angle sideChange,
ViewInputAttributes.ActionAttributes actionAttribs)
|
protected abstract void |
onHorizontalTranslateRel(double sideInput,
double forwardInput,
double sideInputFromMouseDown,
double forwardInputFromMouseDown,
ViewInputAttributes.DeviceAttributes deviceAttributes,
ViewInputAttributes.ActionAttributes actionAttributes)
|
protected abstract void |
onMoveTo(Position focalPosition,
ViewInputAttributes.ActionAttributes actionAttribs)
|
protected abstract void |
onMoveTo(Position focalPosition,
ViewInputAttributes.DeviceAttributes deviceAttributes,
ViewInputAttributes.ActionAttributes actionAttribs)
|
protected abstract void |
onResetHeading(ViewInputAttributes.ActionAttributes actionAttribs)
|
protected abstract void |
onResetHeadingPitchRoll(ViewInputAttributes.ActionAttributes actionAttribs)
|
protected abstract void |
onRotateView(Angle headingChange,
Angle pitchChange,
ViewInputAttributes.ActionAttributes actionAttribs)
|
protected abstract void |
onRotateView(double headingInput,
double pitchInput,
double totalHeadingInput,
double totalPitchInput,
ViewInputAttributes.DeviceAttributes deviceAttributes,
ViewInputAttributes.ActionAttributes actionAttributes)
|
protected void |
onStopView()
|
protected abstract void |
onVerticalTranslate(double translateChange,
double totalTranslateChange,
ViewInputAttributes.DeviceAttributes deviceAttributes,
ViewInputAttributes.ActionAttributes actionAttributes)
|
protected abstract void |
onVerticalTranslate(double translateChange,
ViewInputAttributes.ActionAttributes actionAttribs)
|
void |
propertyChange(PropertyChangeEvent e)
|
protected double |
rawInputToChangeInValue(double rawInput,
ViewInputAttributes.DeviceAttributes deviceAttributes,
ViewInputAttributes.ActionAttributes actionAttributes,
String scaleFunc)
|
void |
setAttributes(ViewInputAttributes attributes)
Sets the values that will be used to transform raw input events into view movements. |
void |
setDragSlopeFactor(double factor)
Sets the factor that dampens view movement when a mouse drag event would cause an abrupt
transition. |
void |
setEnableSmoothing(boolean enable)
Sets whether the ViewInputHandler should smooth view movements in response to input events. |
void |
setLockHeading(boolean lock)
Sets whether the view's heading should stay the same unless explicitly changed. |
void |
setMouseDownPoint(Point mouseDownPoint)
|
protected void |
setSelectedPosition(Position position)
|
void |
setStopOnFocusLost(boolean stop)
Sets whether the view should stop when the WorldWindow looses focus. |
void |
setWorldWindow(WorldWindow newWorldWindow)
Sets the WorldWindow this ViewInputHandler should listen to for input events, and should modify in
response to those events. |
protected void |
setWorldWindowFocusOwner(boolean focusOwner)
|
protected void |
updateMousePoint(MouseEvent e)
|
void |
viewApplied()
Called just after the view applies its state and computes its internal transforms. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface gov.nasa.worldwind.awt.ViewInputHandler |
|---|
addAnimator, goTo, isAnimating, stopAnimators |
| Field Detail |
|---|
protected ViewInputAttributes attributes
protected static final double DEFAULT_DRAG_SLOPE_FACTOR
protected static final long DEFAULT_PER_FRAME_INPUT_DELAY
protected double dragSlopeFactor
protected boolean enableSmoothing
protected static final String GENERATE_EVENTS
protected ViewInputAttributes.ActionAttributesMap keyActionMap
protected KeyEventState keyEventState
protected ViewInputAttributes.DeviceModifierMap keyModsActionMap
protected Point lastMousePoint
protected long lastPerFrameInputTime
protected boolean lockHeading
protected int[] modifierList
protected ViewInputAttributes.ActionAttributesMap mouseActionMap
protected Point mouseDownPoint
protected ViewInputAttributes.DeviceModifierMap mouseModsActionMap
protected Point mousePoint
protected ViewInputAttributes.DeviceModifierMap mouseWheelModsActionMap
protected final int NUM_MODIFIERS
protected static final String QUERY_EVENTS
protected static final String SCALE_FUNC_EYE_ALTITUDE
protected static final String SCALE_FUNC_EYE_ALTITUDE_EXP
protected static final String SCALE_FUNC_ZOOM
protected static final String SCALE_FUNC_ZOOM_EXP
protected Position selectedPosition
protected boolean stopOnFocusLost
protected WorldWindow wwd
protected boolean wwdFocusOwner
| Constructor Detail |
|---|
public AbstractViewInputHandler()
| Method Detail |
|---|
public void apply()
ViewInputHandlerView state prior to the View
setting the modelview matrix for rendering the current frame.
apply in interface ViewInputHandler
public boolean callActionListener(KeyEventState keys,
String target,
ViewInputAttributes.ActionAttributes action)
public double computeDragSlope(Point point1,
Point point2,
Vec4 vec1,
Vec4 vec2)
ViewInputHandler
computeDragSlope in interface ViewInputHandlerpoint1 - The previous mouse coordinate.point2 - The current mouse coordinate.vec1 - The first cartesian world space coordinate.vec2 - The second cartesion world space coordinate.
protected Vec4 computeSelectedPointAt(Point point)
protected Position computeSelectedPosition()
protected static Point constrainToSourceBounds(Point point,
Object source)
protected double evaluateScaleFuncEyeAltitude()
protected double evaluateScaleFuncZoom()
public void focusGained(FocusEvent e)
focusGained in interface FocusListenerpublic void focusLost(FocusEvent e)
focusLost in interface FocusListenerpublic ViewInputAttributes getAttributes()
getAttributes in interface ViewInputHandler
protected LatLon getChangeInLocation(Point point1,
Point point2,
Vec4 vec1,
Vec4 vec2)
public double getDragSlopeFactor()
factor that dampens view movement when the user pans drags the cursor in a way that could
cause an abrupt transition.
getDragSlopeFactor in interface ViewInputHandlersetDragSlopeFactor(double)protected Point getLastMousePoint()
public Point getMouseDownPoint()
protected Point getMousePoint()
protected double getScaledValue(double minValue,
double maxValue,
String scaleFunc)
protected double getScaleValue(double minValue,
double maxValue,
double value,
double range,
boolean isExp)
protected double getScaleValueElevation(ViewInputAttributes.DeviceAttributes deviceAttributes,
ViewInputAttributes.ActionAttributes actionAttributes)
protected Position getSelectedPosition()
protected View getView()
public WorldWindow getWorldWindow()
WorldWindow this ViewInputHandler is listening to for input events, and will modify in
response to those events
getWorldWindow in interface ViewInputHandlerWorldWindow this ViewInputHandler is listening to, and will modify in response to
events.protected void handleFocusGained(FocusEvent e)
protected void handleFocusLost(FocusEvent e)
protected void handleKeyPressed(KeyEvent e)
protected void handleKeyReleased(KeyEvent e)
protected void handleMouseClicked(MouseEvent e)
protected void handleMouseDragged(MouseEvent e)
protected void handleMouseMoved(MouseEvent e)
protected void handleMousePressed(MouseEvent e)
protected void handleMouseReleased(MouseEvent e)
protected void handleMouseWheelMoved(MouseWheelEvent e)
protected boolean handlePerFrameKeyState(KeyEventState keys,
String target)
protected boolean handlePerFrameMouseState(KeyEventState keys,
String target)
protected void handlePropertyChange(PropertyChangeEvent e)
public boolean isEnableSmoothing()
isEnableSmoothing in interface ViewInputHandlerpublic boolean isLockHeading()
isLockHeading in interface ViewInputHandlerpublic boolean isStopOnFocusLost()
isStopOnFocusLost in interface ViewInputHandlerprotected boolean isWorldWindowFocusOwner()
public void keyPressed(KeyEvent e)
keyPressed in interface KeyListenerpublic void keyReleased(KeyEvent e)
keyReleased in interface KeyListenerpublic void keyTyped(KeyEvent e)
keyTyped in interface KeyListenerpublic void mouseClicked(MouseEvent e)
mouseClicked in interface MouseListenerpublic void mouseDragged(MouseEvent e)
mouseDragged in interface MouseMotionListenerpublic void mouseEntered(MouseEvent e)
mouseEntered in interface MouseListenerpublic void mouseExited(MouseEvent e)
mouseExited in interface MouseListenerpublic void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListenerpublic void mousePressed(MouseEvent e)
mousePressed in interface MouseListenerpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenerpublic void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved in interface MouseWheelListener
protected abstract void onHorizontalTranslateAbs(Angle latitudeChange,
Angle longitudeChange,
ViewInputAttributes.ActionAttributes actionAttribs)
protected abstract void onHorizontalTranslateRel(Angle forwardChange,
Angle sideChange,
ViewInputAttributes.ActionAttributes actionAttribs)
protected abstract void onHorizontalTranslateRel(double sideInput,
double forwardInput,
double sideInputFromMouseDown,
double forwardInputFromMouseDown,
ViewInputAttributes.DeviceAttributes deviceAttributes,
ViewInputAttributes.ActionAttributes actionAttributes)
protected abstract void onMoveTo(Position focalPosition,
ViewInputAttributes.ActionAttributes actionAttribs)
protected abstract void onMoveTo(Position focalPosition,
ViewInputAttributes.DeviceAttributes deviceAttributes,
ViewInputAttributes.ActionAttributes actionAttribs)
protected abstract void onResetHeading(ViewInputAttributes.ActionAttributes actionAttribs)
protected abstract void onResetHeadingPitchRoll(ViewInputAttributes.ActionAttributes actionAttribs)
protected abstract void onRotateView(Angle headingChange,
Angle pitchChange,
ViewInputAttributes.ActionAttributes actionAttribs)
protected abstract void onRotateView(double headingInput,
double pitchInput,
double totalHeadingInput,
double totalPitchInput,
ViewInputAttributes.DeviceAttributes deviceAttributes,
ViewInputAttributes.ActionAttributes actionAttributes)
protected void onStopView()
protected abstract void onVerticalTranslate(double translateChange,
double totalTranslateChange,
ViewInputAttributes.DeviceAttributes deviceAttributes,
ViewInputAttributes.ActionAttributes actionAttributes)
protected abstract void onVerticalTranslate(double translateChange,
ViewInputAttributes.ActionAttributes actionAttribs)
public void propertyChange(PropertyChangeEvent e)
propertyChange in interface PropertyChangeListener
protected double rawInputToChangeInValue(double rawInput,
ViewInputAttributes.DeviceAttributes deviceAttributes,
ViewInputAttributes.ActionAttributes actionAttributes,
String scaleFunc)
public void setAttributes(ViewInputAttributes attributes)
setAttributes in interface ViewInputHandlerattributes - values that will be used to transform raw input into view movement.
IllegalArgumentException - if attributes is null.ViewInputAttributespublic void setDragSlopeFactor(double factor)
factor that dampens view movement when a mouse drag event would cause an abrupt
transition. The drag slope is the ratio of screen pixels to Cartesian distance moved, measured by the previous
and current mouse points. As drag slope gets larger, it becomes more difficult to operate the view. This
typically happens while dragging over and around the horizon, where movement of a few pixels can cause the view
to move many kilometers. This factor is the amount of damping applied to the view movement in such
cases. Setting factor to zero will disable this behavior, while setting factor to a
positive value may dampen the effects of mouse dragging.
setDragSlopeFactor in interface ViewInputHandlerfactor - dampening view movement when a mouse drag event would cause an abrupt transition. Must be greater
than or equal to zero.
IllegalArgumentException - if factor is less than zero.public void setEnableSmoothing(boolean enable)
ViewInputAttributes. A value of false will disable all smoothing.
setEnableSmoothing in interface ViewInputHandlerenable - true to smooth view movements; false otherwise.public void setLockHeading(boolean lock)
setLockHeading in interface ViewInputHandlerlock - true if the view's heading should stay the same unless explicity changed; false otherwise.public void setMouseDownPoint(Point mouseDownPoint)
protected void setSelectedPosition(Position position)
public void setStopOnFocusLost(boolean stop)
setStopOnFocusLost in interface ViewInputHandlerstop - true if the view should stop when the WorldWindow looses focus; false otherwise.public void setWorldWindow(WorldWindow newWorldWindow)
WorldWindow this ViewInputHandler should listen to for input events, and should modify in
response to those events. If the parameter newWorldWindow is null, then this ViewInputHandler
will do nothing.
setWorldWindow in interface ViewInputHandlernewWorldWindow - the WorldWindow to listen on, and modify in response to events.protected void setWorldWindowFocusOwner(boolean focusOwner)
protected void updateMousePoint(MouseEvent e)
public void viewApplied()
ViewInputHandler
viewApplied in interface ViewInputHandler
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||