public interface ViewInputHandler
extends java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.awt.event.FocusListener
Modifier and Type | Method and Description |
---|---|
void |
addAnimator(Animator animator)
Add an
Animator to this ViewInputHandler . |
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(java.awt.Point point1,
java.awt.Point point2,
Vec4 vec1,
Vec4 vec2)
Compute the drag slope the given screen and world coordinates.
|
ViewInputAttributes |
getAttributes()
Returns the values that are used to transform raw input events into view movments.
|
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. |
WorldWindow |
getWorldWindow()
Return the
WorldWindow this ViewInputHandler is listening to for input events, and will modify in
response to those events |
void |
goTo(Position lookAtPos,
double elevation)
Animate to the specified position.
|
boolean |
isAnimating()
Determine if there are any animations active in the
View . |
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.
|
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 |
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. |
void |
stopAnimators()
Stops any animations that are active in this
View |
void |
viewApplied()
Called just after the view applies its state and computes its internal transforms.
|
void addAnimator(Animator animator)
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.animator
- the Animator
to be addedvoid apply()
View
state prior to the View
setting the modelview matrix for rendering the current frame.double computeDragSlope(java.awt.Point point1, java.awt.Point point2, Vec4 vec1, Vec4 vec2)
point1
- The previous mouse coordinate.point2
- The current mouse coordinate.vec1
- The first cartesian world space coordinate.vec2
- The second cartesion world space coordinate.ViewInputAttributes getAttributes()
double getDragSlopeFactor()
factor
that dampens view movement when the user pans drags the cursor in a way that could
cause an abrupt transition.setDragSlopeFactor(double)
WorldWindow getWorldWindow()
WorldWindow
this ViewInputHandler is listening to for input events, and will modify in
response to those eventsWorldWindow
this ViewInputHandler is listening to, and will modify in response to
events.void goTo(Position lookAtPos, double elevation)
View
to look
at the given position from the given elevation.lookAtPos
- The position to animate the view to look at.elevation
- The elevation to look at the position
from.boolean isAnimating()
View
.boolean isEnableSmoothing()
boolean isLockHeading()
boolean isStopOnFocusLost()
void setAttributes(ViewInputAttributes attributes)
attributes
- values that will be used to transform raw input into view movement.java.lang.IllegalArgumentException
- if attributes
is null.ViewInputAttributes
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.factor
- dampening view movement when a mouse drag event would cause an abrupt transition. Must be greater
than or equal to zero.java.lang.IllegalArgumentException
- if factor
is less than zero.void setEnableSmoothing(boolean enable)
ViewInputAttributes
. A value of false will disable all smoothing.enable
- true to smooth view movements; false otherwise.void setLockHeading(boolean lock)
lock
- true if the view's heading should stay the same unless explicity changed; false otherwise.void setStopOnFocusLost(boolean stop)
stop
- true if the view should stop when the WorldWindow looses focus; false otherwise.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.newWorldWindow
- the WorldWindow
to listen on, and modify in response to events.void stopAnimators()
View
void viewApplied()