|
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.ViewInputHandler
public class ViewInputHandler
Field Summary | |
---|---|
protected static String |
GENERATE_EVENTS
|
protected static String |
QUERY_EVENTS
|
protected static String |
SCALE_FUNC_EYE_ALTITUDE
|
protected static String |
SCALE_FUNC_EYE_ALTITUDE_EXP
|
protected static String |
SCALE_FUNC_ZOOM
|
protected static String |
SCALE_FUNC_ZOOM_EXP
|
Constructor Summary | |
---|---|
ViewInputHandler()
|
Method Summary | |
---|---|
protected void |
changeHeading(OrbitView view,
Angle change,
ViewInputAttributes.ActionAttributes attrib)
|
protected void |
changePitch(OrbitView view,
Angle change,
ViewInputAttributes.ActionAttributes attrib)
|
protected void |
changeZoom(OrbitView view,
double change,
ViewInputAttributes.ActionAttributes attrib)
|
protected double |
computeDragSlope(Point point1,
Point point2,
Vec4 vec1,
Vec4 vec2)
|
protected static double |
computeNewZoomTarget(double curZoom,
double change)
|
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()
|
protected Point |
getMousePoint()
|
protected double |
getScaledValue(double minValue,
double maxValue,
String scaleFunc)
|
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 |
handleBeforeRendering(RenderingEvent e)
|
protected boolean |
handleKeyPan(KeyEventState keys,
String target)
|
protected void |
handleKeyPressed(KeyEvent e)
|
protected boolean |
handleKeyRotate(KeyEventState keys,
String target)
|
protected boolean |
handleKeyZoom(KeyEventState keys,
String target)
|
protected void |
handleMouseClicked(MouseEvent e)
|
protected void |
handleMouseDragged(MouseEvent e)
|
protected void |
handleMouseFocus(MouseEvent e)
|
protected void |
handleMousePan(MouseEvent e)
|
protected void |
handleMouseRotate(MouseEvent e)
|
protected void |
handleMouseWheelMoved(MouseWheelEvent e)
|
protected void |
handleMouseWheelZoom(MouseWheelEvent e)
|
protected void |
handleMouseZoom(MouseEvent e)
|
protected void |
handleOrbitViewCenterStopped()
|
protected void |
handlePerFrameInput()
|
protected boolean |
handlePerFrameKeyState(KeyEventState keys,
String target)
|
protected void |
handleViewStopped()
|
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 |
isPointBehindLineOrigin(Line line,
Vec4 point)
|
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 Vec4 |
nearestIntersectionPoint(Line line,
Intersection[] intersections)
|
protected void |
onFocusView(Position focalPosition,
ViewInputAttributes.ActionAttributes actionAttribs)
|
protected void |
onPanViewAbsolute(Angle latitudeChange,
Angle longitudeChange,
ViewInputAttributes.ActionAttributes actionAttribs)
|
protected void |
onPanViewRelative(Angle forwardChange,
Angle sideChange,
ViewInputAttributes.ActionAttributes actionAttribs)
|
protected void |
onResetHeading()
|
protected void |
onResetHeadingAndPitch()
|
protected void |
onRotateView(Angle headingChange,
Angle pitchChange,
ViewInputAttributes.ActionAttributes actionAttribs)
|
protected void |
onStopView()
|
protected void |
onZoomView(double zoomChange,
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. |
protected void |
setCenterPosition(OrbitView view,
Position position,
ViewInputAttributes.ActionAttributes attrib)
|
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. |
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)
|
void |
stageChanged(RenderingEvent e)
|
protected static Point |
subtract(Point a,
Point b)
|
protected void |
updateMousePoint(MouseEvent e)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String GENERATE_EVENTS
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
Constructor Detail |
---|
public ViewInputHandler()
Method Detail |
---|
protected void changeHeading(OrbitView view, Angle change, ViewInputAttributes.ActionAttributes attrib)
protected void changePitch(OrbitView view, Angle change, ViewInputAttributes.ActionAttributes attrib)
protected void changeZoom(OrbitView view, double change, ViewInputAttributes.ActionAttributes attrib)
protected double computeDragSlope(Point point1, Point point2, Vec4 vec1, Vec4 vec2)
protected static double computeNewZoomTarget(double curZoom, double change)
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 FocusListener
public void focusLost(FocusEvent e)
focusLost
in interface FocusListener
public ViewInputAttributes getAttributes()
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.
setDragSlopeFactor(double)
protected Point getLastMousePoint()
protected Point getMousePoint()
protected double getScaledValue(double minValue, double maxValue, String scaleFunc)
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
WorldWindow
this ViewInputHandler is listening to, and will modify in response to
events.protected void handleBeforeRendering(RenderingEvent e)
protected boolean handleKeyPan(KeyEventState keys, String target)
protected void handleKeyPressed(KeyEvent e)
protected boolean handleKeyRotate(KeyEventState keys, String target)
protected boolean handleKeyZoom(KeyEventState keys, String target)
protected void handleMouseClicked(MouseEvent e)
protected void handleMouseDragged(MouseEvent e)
protected void handleMouseFocus(MouseEvent e)
protected void handleMousePan(MouseEvent e)
protected void handleMouseRotate(MouseEvent e)
protected void handleMouseWheelMoved(MouseWheelEvent e)
protected void handleMouseWheelZoom(MouseWheelEvent e)
protected void handleMouseZoom(MouseEvent e)
protected void handleOrbitViewCenterStopped()
protected void handlePerFrameInput()
protected boolean handlePerFrameKeyState(KeyEventState keys, String target)
protected void handleViewStopped()
public boolean isEnableSmoothing()
public boolean isLockHeading()
public boolean isPointBehindLineOrigin(Line line, Vec4 point)
public boolean isStopOnFocusLost()
protected boolean isWorldWindowFocusOwner()
public void keyPressed(KeyEvent e)
keyPressed
in interface KeyListener
public void keyReleased(KeyEvent e)
keyReleased
in interface KeyListener
public void keyTyped(KeyEvent e)
keyTyped
in interface KeyListener
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved
in interface MouseWheelListener
protected Vec4 nearestIntersectionPoint(Line line, Intersection[] intersections)
protected void onFocusView(Position focalPosition, ViewInputAttributes.ActionAttributes actionAttribs)
protected void onPanViewAbsolute(Angle latitudeChange, Angle longitudeChange, ViewInputAttributes.ActionAttributes actionAttribs)
protected void onPanViewRelative(Angle forwardChange, Angle sideChange, ViewInputAttributes.ActionAttributes actionAttribs)
protected void onResetHeading()
protected void onResetHeadingAndPitch()
protected void onRotateView(Angle headingChange, Angle pitchChange, ViewInputAttributes.ActionAttributes actionAttribs)
protected void onStopView()
protected void onZoomView(double zoomChange, 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)
attributes
- values that will be used to transform raw input into view movement.
IllegalArgumentException
- if attributes
is null.@ViewInputAttributes
protected void setCenterPosition(OrbitView view, Position position, ViewInputAttributes.ActionAttributes attrib)
public 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.
IllegalArgumentException
- if factor
is less than zero.public void setEnableSmoothing(boolean enable)
ViewInputAttributes
. A value of false will disable all smoothing.
enable
- true to smooth view movements; false otherwise.public void setLockHeading(boolean lock)
lock
- true if the view's heading should stay the same unless explicity changed; false otherwise.protected void setSelectedPosition(Position position)
public void setStopOnFocusLost(boolean stop)
stop
- 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.
newWorldWindow
- the WorldWindow
to listen on, and modify in response to events.protected void setWorldWindowFocusOwner(boolean focusOwner)
public void stageChanged(RenderingEvent e)
stageChanged
in interface RenderingListener
protected static Point subtract(Point a, Point b)
protected void updateMousePoint(MouseEvent e)
|
NASA World Wind | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |