public abstract class AbstractViewInputHandler extends Object implements ViewInputHandler, PropertyChangeListener
| Constructor and Description |
|---|
AbstractViewInputHandler() |
| Modifier and Type | Method and Description |
|---|---|
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. |
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 long |
getPerFrameInputInterval() |
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 |
handlePerFrameAnimation(String target) |
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 void |
onStopView() |
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 |
setMouseDownView(View mouseDownView) |
protected void |
setPerFrameInputInterval(long milliseconds) |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddAnimator, goTo, isAnimating, stopAnimatorsprotected ViewInputAttributes attributes
protected static final double DEFAULT_DRAG_SLOPE_FACTOR
protected static final long DEFAULT_PER_FRAME_INPUT_INTERVAL
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 Matrix mouseDownModelview
protected Point mouseDownPoint
protected Matrix mouseDownProjection
protected Rectangle mouseDownViewport
protected ViewInputAttributes.DeviceModifierMap mouseModsActionMap
protected Point mousePoint
protected ViewInputAttributes.DeviceModifierMap mouseWheelModsActionMap
protected final int NUM_MODIFIERS
protected long perFrameInputInterval
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
public void apply()
ViewInputHandlerView state prior to the View
setting the modelview matrix for rendering the current frame.apply in interface ViewInputHandlerpublic double computeDragSlope(Point point1, Point point2, Vec4 vec1, Vec4 vec2)
ViewInputHandlercomputeDragSlope 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 Position computeSelectedPosition()
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 ViewInputHandlerprotected 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 long getPerFrameInputInterval()
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 eventsgetWorldWindow 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 handlePerFrameAnimation(String target)
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 MouseWheelListenerprotected void onStopView()
public void propertyChange(PropertyChangeEvent e)
propertyChange in interface PropertyChangeListenerprotected 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 setMouseDownView(View mouseDownView)
protected void setPerFrameInputInterval(long milliseconds)
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()
ViewInputHandlerviewApplied in interface ViewInputHandler