@ThreadSafe
public class RXSInteractor
extends java.lang.Object
Manages user interaction with a local-to-world transform consisting of an
RX
and possibly also a scale factor.
The actual transform state is maintained by rxsInterpolator
.
The transform is considered to map a local coordinate frame to a world
coordinate frame. It may be manipulated incrementally either by API calls
or by UI events to the handleEvent()
methods. The core
manipulation APIs are
scale(*)
rotate*In*(*)
translate*In*(*)
The motions are considered to move the local frame with respect to the
world frame unless controlInLocalFrame
is set, in which case they
move the local frame with respect to its current pose, or controlInManipulationFrame
is set, in which case they move the local frame
with respect to an arbitrary manipulation frame defined by the manipulationToWorld
transform.
Display3D
uses an RSXInteractor to implement viewpoint navigation
by manipulating the display's world-to-view transform: the interactor
"local" frame corresponds to the display "world" frame, and the interactor
"world" frame corresponds to the display "view" frame.
For arrow key events the last two types are combined into one thus reducing the total number of different motion types to four. If both Z motions are enabled, the left/right keys effect rotateZ and the up/down keys effect translateZ, otherwise all four arrow keys effect whichever Z motion is enabled. For arrow key events
KEY_REPEAT_THRESHOLD_MS
it is considered a block event and the motion is effected as an
interpolated block move, e.g. rotateXYBlocks(double, double)
. Longer hold times
are converted internally into a series of one-pixel motions at the rate
KEY_TIMER_PERIOD_MS
and effected as pixel events,
e.g. rotateXYPixels(double, double)
. The typematic events of the underlying
platform, if any, are detected by timing and ignored, see Sun bug ID 4153069
(open) "keyReleased behavior incorrect".
For mouse drag events
Mouse wheel events can effect scale, rotateZ, and translateZ motions only, in that order, thus reducing the total number of motion types to three.
Block motions are always internally converted to multi-pixel motions
before they are effected, and the number of pixels in any motion, whether
originally a block or pixel motion, is always then multiplied by the current
accelFactor
. Fractional pixel motions are handled. When a block
motion converts to more than interpolationThresholdPixels
it is
executed as an interpolation over interpolationTime
, otherwise it
is executed immediately as a jump.
Setting accelFactor
<= 0.0 has special meaning: block motions
are converted to one pixel per block, and pixel motions are not accelerated
(as if accelFactor
were 1.0). This enables pixel-at-a-time fine
manipulation.
If accelSliderEnabled
, then presses of the numeral keys change
accelFactor
with the 1 key giving 0 accel (the above special case),
the 2 key giving 1/8 accel, the 5 key giving 1.0 accel, the 0 key giving 4.0
accel, and the other numeral keys (in keyboard order 1234567890)
interpolating those values.
Rotate, Translate, and Scale block motions are converted to multi-pixel
motions according to currently set factors and the currently set canvas
dimensions. See setBlockRotateFactor(double)
, setBlockTranslateFactor(double)
, and setBlockScaleFactor(double)
for details.
Translations are converted from pixels to world frame units (even when
controlInLocalFrame
or controlInManipulationFrame
is set)
according to the current world-to-canvas transform, which is defined
by canvasSize
and worldToCanvasScale
. For example, these
may be set according to the current world-to-canvas projection transform of
a display component. The translation is then applied relative to the
orientation of the world frame unless controlInLocalFrame
is set,
in which case the translation is relative to the current orientation of the
local frame, or controlInManipulationFrame
is set, in which case
the translation is relative to the current orientation of the manipulation
frame.
Rotations are converted from pixels to radians by taking the quotient
with the corresponding dimension of the canvas: a rotation of p
horizontal pixels effects a rotation of 2*PI*p/w radians in the Y
axis where w is the component width; similarly for vertical pixels
and rotations about the X and Z axes. Rotate motions are always through the
local frame point set by setRotationCenter(double, double, double)
(defaults to
local frame origin) and are about world frame axes unless controlInLocalFrame
is set, in which case they are about the local frame
axes, or controlInManipulationFrame
is set, in which case they are
about the manipulation frame axes.
Scale motions are converted from pixels according to the current canvas
height h: a scale motion of p (signed) pixels effects a
multiplicative change of scaleBase
^(p/h) in local-to-world
scale. Thus when p=h, i.e. a downwards drag across the full canvas
height, the local-to-world scale is multiplied by scaleBase
, and
when p=-h, i.e. an upwards drag across the full canvas height, the
local-to-world scale is divided by scaleBase
. Scale motions
triggered by mouse drag or wheel events are are centered at the projection
of the mouse location on the world z-plane through the current rotation
center in world frame at the beginning of the motion. Scale motions
triggered by key events are centered on the current rotation center in world
frame.
This class is designed to be thread-safe with internal synchronization.
The lock acquisition order for deadlock avoidance is
rxsInterpolator
Copyright (C) 2007 Marsette A. Vona, III
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Modifier and Type | Field and Description |
---|---|
protected static double[] |
ACCEL_SLIDER
number key accel modification factors
|
java.lang.String |
accelChangeActionLabel
If non-null then this replaces "interaction" in messages printed to
System.out when
accelFactor is changed due to a keypress. |
protected double |
accelFactor
current acceleration factor
|
protected boolean |
accelSliderEnabled
whether the number key accel modification slider is enabled
|
protected boolean |
altDown
Whether the indicated key is currenly down.
|
protected double |
blockRotateFactor
Conversion factor taking block events to pixels relative to canvas
dimensions.
|
protected double |
blockScaleFactor
Conversion factor taking block events to pixels relative to canvas
dimensions.
|
protected double |
blockTranslateFactor
Conversion factor taking block events to pixels relative to canvas
dimensions.
|
protected double[] |
canvasSize
current canvas size in pixels or 0 to set from next input event
|
Clock |
clock
the time base
|
protected boolean |
controlInLocalFrame
If true then interactive motion increments are relative to local
frame.
|
protected boolean |
controlInManipulationFrame
If true then interactive motion increments are relative to manipulation
frame, which is defined by
manipulationToWorld . |
protected boolean |
ctrlDown
Whether the indicated key is currenly down.
|
private static java.lang.String |
cvsid |
static double |
DEF_BLOCK_ROTATE_FACTOR
default
blockRotateFactor |
static double |
DEF_BLOCK_SCALE_FACTOR
default
blockScaleFactor |
static double |
DEF_BLOCK_TRANSLATE_FACTOR
default
blockTranslateFactor |
static double |
DEF_INTERPOLATION_THRESHOLD_PIXELS
default
interpolationThresholdPixels |
static double |
DEF_INTERPOLATION_TIME
default
interpolationTime [s] |
static double |
DEF_SCALE_BASE
default
scaleBase |
protected long |
downPressed
Timestamp [ms] when the indicated key went down.
|
protected long |
downReleased
Timestamp [ms] when the indicated key went up.
|
protected boolean |
eventsDuringInterpolationEnabled
whether to allow input events while interpolations are ongoing
|
protected boolean |
eventsEnabled
top-level enable for any input events
|
protected double |
firstMouseX
pixel coord of mouse when first button went down
|
protected double |
firstMouseY
pixel coord of mouse when first button went down
|
protected double[] |
fitTXEMS
Temp workspace used in
fit(double, double, double, double,
double) . |
protected java.awt.event.FocusListener |
focusListener
listener for
addListeners(java.awt.Component) |
protected double |
interpolationDeadline
current interpolation end time [s]
|
protected double |
interpolationStartTime
current interpolation start time [s]
|
protected double |
interpolationThresholdPixels
threshold for block moves above which the motion is interpolated
|
protected double |
interpolationTime
current interpolation time [s]
|
static int |
KEY_REPEAT_SCALE_PIXELS_PER_MS
scale pixels per ms for key repeat in
keyTimer |
static long |
KEY_REPEAT_THRESHOLD_MS
threshold in [ms] beyond which key presses repeat
|
static int |
KEY_TIMER_PERIOD_MS
period in [ms] for
keyTimer |
protected java.awt.event.KeyListener |
keyListener
listener for
addListeners(java.awt.Component) |
protected javax.swing.Timer |
keyTimer
Keypress timer.
|
protected double |
lastMouseX
pixel coord of mouse at last event during drag
|
protected double |
lastMouseY
pixel coord of mouse at last event during drag
|
protected long |
leftPressed
Timestamp [ms] when the indicated key went down.
|
protected long |
leftReleased
Timestamp [ms] when the indicated key went up.
|
protected RX |
manipulationToWorld
Transform that takes manipulation frame coordinates to world frame,
thus defining manipulation frame.
|
protected java.awt.event.MouseListener |
mouseListener
listener for
addListeners(java.awt.Component) |
protected java.awt.event.MouseMotionListener |
mouseMotionListener
listener for
addListeners(java.awt.Component) |
protected java.awt.event.MouseWheelListener |
mouseWheelListener
listener for
addListeners(java.awt.Component) |
protected long |
rightPressed
Timestamp [ms] when the indicated key went down.
|
protected long |
rightReleased
Timestamp [ms] when the indicated key went up.
|
protected boolean |
rotateXYEnabled
whether events of the indicated type are enabled
|
protected boolean |
rotateZEnabled
whether events of the indicated type are enabled
|
protected double[] |
rotationCenter
rotation center in local frame, defaults to obj frame origin
|
RXSInterpolator |
rxsInterpolator
the interpolator
|
protected double |
scaleBase
exponential scale base, see class header doc for details
|
protected boolean |
scaleEnabled
whether events of the indicated type are enabled
|
protected boolean |
shiftDown
Whether the indicated key is currenly down.
|
protected double[] |
t0
temp V3, synchronized by
rxsInterpolator |
protected double[] |
t1
temp V3, synchronized by
rxsInterpolator |
protected boolean |
translateXYEnabled
whether events of the indicated type are enabled
|
protected boolean |
translateZEnabled
whether events of the indicated type are enabled
|
static int |
TYPEMATIC_SLOP_MS
ms below which key press succeding release is considered typematic
|
protected long |
upPressed
Timestamp [ms] when the indicated key went down.
|
protected long |
upReleased
Timestamp [ms] when the indicated key went up.
|
protected double |
worldToCanvasScale
scale factor taking world frame units to canvas pixels
|
Constructor and Description |
---|
RXSInteractor()
Makes a new interactor with a default
Clock (wall-clock time)
and interpolator. |
RXSInteractor(Clock clock)
Makes a new interactor with a default interpolator.
|
RXSInteractor(Clock clock,
RXSInterpolator rxsInterpolator)
Make an interactor based on the given clock and
rxsInterpolator.
|
RXSInteractor(RXSInterpolator interpolator)
Makes a new interactor with a default
Clock (wall-clock
time). |
Modifier and Type | Method and Description |
---|---|
void |
addListeners(java.awt.Component component)
Add event listeners to component which call the
handleEvent(...) APIs. |
void |
appendManipulationToWorld(RX rx)
appendManipulationToWorld(RX, boolean) without inverting |
void |
appendManipulationToWorld(RX rx,
boolean invert)
Append to the
manipulationToWorld transform. |
boolean |
areEventsDuringInterpolationEnabled()
check if input events are enabled while interpolations are ongoing
|
boolean |
areEventsEnabled()
check if input events are enabled at all
|
protected double |
canvasToWorldX(double x,
boolean doTranslate)
map x from a horizontal pixel location on cavas to world frame
|
protected double |
canvasToWorldY(double y,
boolean doTranslate)
map y from a vertical pixel location on cavas to world frame
|
java.lang.String |
cycleControlFrame()
cycleControlFrame(String, String, String) using default names |
java.lang.String |
cycleControlFrame(java.lang.String local,
java.lang.String world,
java.lang.String manipulation)
Cycle control to the next frame.
|
void |
dump()
dump(PrintStream) to System.out |
void |
dump(java.io.PrintStream s)
dump state
|
void |
dumpHelp()
dumpHelp(PrintStream, String, String, String, String, String,
String) to System.out with default strings. |
void |
dumpHelp(java.io.PrintStream s,
java.lang.String interacting,
java.lang.String interaction,
java.lang.String local,
java.lang.String world,
java.lang.String manipulation,
java.lang.String units)
Dump a help text.
|
void |
dumpHelp(java.lang.String interacting,
java.lang.String interaction,
java.lang.String local,
java.lang.String world,
java.lang.String manipulation,
java.lang.String units)
|
void |
enableAccelSlider(boolean enable)
whether to enable number key accel modification slider
|
void |
enableAllSubEvents()
enableAllSubEvents(boolean, boolean, boolean) with all
enabled. |
void |
enableAllSubEvents(boolean enableScale)
enableAllSubEvents(boolean, boolean, boolean) with all
translate and rotate enabled. |
void |
enableAllSubEvents(boolean enableScale,
boolean enableRotate,
boolean enableTranslate)
Enable or disable categories of types.
|
void |
enableEvents(boolean enable)
whether to enable input events at all
|
void |
enableEventsDuringInterpolation(boolean enable)
whether to enable input events while interpolations are ongoing
|
void |
enableRotateXY(boolean enable)
whether to enable rotateXY input events
|
void |
enableRotateZ(boolean enable)
whether to enable rotateZ input events
|
void |
enableScale(boolean enable)
whether to enable scale input events
|
void |
enableTranslateXY(boolean enable)
whether to enable translateXY input events
|
void |
enableTranslateZ(boolean enable)
whether to enable translateZ input events
|
void |
fit(double minX,
double minY,
double maxX,
double maxY)
Covers
fit(double, double, double, double) , uses currently set
interpolationTime . |
void |
fit(double minX,
double minY,
double maxX,
double maxY,
double interpolationTime)
Interpolate immediately to a transform that just-fits the world-frame
XY rect (minX, minY, maxX, maxY) within the world-frame XY rect
canvasSize /worldToCanvasScale centered at the
origin. |
java.lang.String |
getControlFrame()
getControlFrame(String, String, String) using default names |
java.lang.String |
getControlFrame(java.lang.String local,
java.lang.String world,
java.lang.String manipulation)
Get the name of the current control frame.
|
double |
getCurrentInterpolationCoordinate()
Get the current normalized linear interpolation coordinate in [0.0,
1.0].
|
RX |
getCurrentRX()
getCurrentRX(RX) , conses |
RX |
getCurrentRX(RX x)
Get the current interpolated value of the rigid transform.
|
double |
getCurrentScale()
Get the current interpolated value of the transform scale.
|
double |
getCurrentTime()
get the current
clock time in [s] |
double |
getCurrentTransform(RX x)
Get the current interpolated value of the transform and scale.
|
double[] |
getCurrentTXEM()
getCurrentTXEM(double[]) , conses |
double[] |
getCurrentTXEM(double[] txem)
Like
getCurrentTransform(RX) but returns transform as a
packed TXEM vector (tx, ty, tz, ex, ey, ez). |
double[] |
getCurrentTXEMS()
getCurrentTXEMS(double[]) , conses |
double[] |
getCurrentTXEMS(double[] txems)
Like
getCurrentTransform(RX) but returns transform as a
packed TXEM+scale vector (tx, ty, tz, ex, ey, ez, s). |
double[] |
getRotationCenter()
covers
getRotationCenter(double[]) , always conses |
double[] |
getRotationCenter(double[] c)
get value of current rotation center in local frame, cons if null
|
double[] |
getRotationCenterInWorld()
covers
getRotationCenterInWorld(double[]) , always conses |
double[] |
getRotationCenterInWorld(double[] c)
get value of current rotation center in world frame, cons if null
|
double |
getRotationCenterZInWorld()
get just the Z coordinate of the rotation center in world frame
|
boolean |
handleEvent(java.awt.event.FocusEvent e)
Handles focus events, in particular to stop
keyTimer . |
boolean |
handleEvent(java.awt.event.KeyEvent e)
Handles key events.
|
boolean |
handleEvent(java.awt.event.MouseEvent e)
Handles mouse events.
|
boolean |
handleEvent(java.awt.event.MouseWheelEvent e)
Handles mouse wheel events.
|
protected boolean |
handleKeyPressed(java.awt.event.KeyEvent e)
Handles key presses.
|
protected boolean |
handleKeyReleased(java.awt.event.KeyEvent e)
Handles key releases.
|
protected boolean |
handleKeyTyped(java.awt.event.KeyEvent e)
Handles key types.
|
boolean |
hasNext()
Check if an
interpolateToNext(double) or jumpToNext() will
change the current waypoint local-to-world transform. |
void |
interpolateTo(double interpolationTime,
RX x,
double s)
Interpolate immediately from the current transform to (x,
s).
|
void |
interpolateTo(RX x)
Covers
interpolateTo(double, RX, double) uses current interpolationTime and scale. |
void |
interpolateTo(RX x,
double s)
Covers
interpolateTo(double, RX, double) uses current interpolationTime . |
void |
interpolateToAim(double... args)
Rotate the local frame about the current rotation center c in
world frame to a pose that aims the local frame positive z axis towards
c and parallel to a given vector d, maintaining the current
distance from the local frame origin to c.
|
void |
interpolateToNext()
interpolateToNext(double) with current interpolationTime |
void |
interpolateToNext(double interpolationTime)
Like
interpolateTo(double, RX, double) but uses currently
accumulated next waypoint transform. |
void |
interpolateToTXEM(double... txem)
interpolateToTXEM(double, double...) with current interpolationTime . |
void |
interpolateToTXEM(double interpolationTime,
double... txem)
Like
interpolateTo(double, RX, double) but takes transform as
a packed TXEM vector (tx, ty, tz, ex, ey, ez) and uses current scale. |
void |
interpolateToTXEMS(double... txems)
interpolateToTXEMS(double, double...) with current interpolationTime . |
void |
interpolateToTXEMS(double interpolationTime,
double... txems)
Like
interpolateTo(double, RX, double) but takes transform
as a packed TXEM+scale vector (tx, ty, tz, ex, ey, ez, s). |
boolean |
isAccelSliderEnabled()
check if number key accel modification slider is enabled
|
boolean |
isControlInLocalFrame()
Check whether rotation and translation actions are relative to local
frame.
|
boolean |
isControlInManipulationFrame()
Check whether rotation and translation actions are relative to
manipulation frame.
|
boolean |
isControlInWorldFrame()
Check whether rotation and translation actions are relative to
world frame.
|
boolean |
isInterpolating()
check if an interpolation is currently ongoing
|
boolean |
isRotateXYEnabled()
check if rotateXY input events are enabled
|
boolean |
isRotateZEnabled()
check if rotateZ input events are enabled
|
boolean |
isScaleEnabled()
check if scale input events are enabled
|
boolean |
isTranslateXYEnabled()
check if translateXY input events are enabled
|
boolean |
isTranslateZEnabled()
check if translateZ input events are enabled
|
void |
jumpTo(RX x)
jumpTo(RX, double) with current scale. |
void |
jumpTo(RX x,
double s)
Covers
interpolateTo(double, RX, double) with zero
interpolation time. |
void |
jumpToAim(double... d) |
void |
jumpToNext()
Covers
interpolateToNext(double) with zero interpolation
time. |
void |
jumpToTXEM(double... txem)
Like
jumpTo(RX) but takes transform as a packed TXEM vector
(tx, ty, tz, ex, ey, ez). |
void |
jumpToTXEMS(double... txems)
Like
jumpTo(RX, double) but takes transform as a
packed TXEM+scale vector (tx, ty, tz, ex, ey, ez, s). |
protected int |
nextSubAction(int sa,
boolean e0,
boolean e1,
boolean e2,
boolean e3,
boolean e4)
selects the next enabled sub action after sa
|
void |
prependManipulationToWorld(RX rx)
prependManipulationToWorld(RX, boolean) without inverting |
void |
prependManipulationToWorld(RX rx,
boolean invert)
Prepend to the
manipulationToWorld transform. |
void |
removeListeners(java.awt.Component component)
Remove event listeners from component that were previously added
by
addListeners(java.awt.Component) . |
protected void |
resetEventState()
Stop
keyTimer and reset related state. |
void |
rotateEulerInLocal(double dx,
double dy,
double dz)
Append a rotation by Euler angles (dx, dy, dz) [radians] about
axes parallel to local frame and through the local frame
rotationCenter to the next waypoint. |
void |
rotateEulerInManipulationFrame(double dx,
double dy,
double dz)
Append a rotation by Euler angles (dx, dy, dz) [radians] about
axes parallel to manipulation frame and through the local
frame
rotationCenter to the next waypoint. |
void |
rotateEulerInWorld(double dx,
double dy,
double dz)
Append a rotation by Euler angles (dx, dy, dz) [radians] about
axes parallel to world frame and through the local frame
rotationCenter to the next waypoint. |
protected void |
rotateImpl(double dx,
double dy,
double dz)
|
void |
rotateXYBlocks(double dx,
double dy)
Execute a rotateXY input event of (dx, dy) blocks.
|
void |
rotateXYPixels(double dx,
double dy)
Execute a rotateXY input event of (dx, dy) pixels.
|
protected void |
rotateXYPixelsImpl(double dx,
double dy)
impl of
rotateXYPixels(double, double) w/o accel or jumpToNext() |
void |
rotateZBlocks(double dy)
Execute a rotateZ input event of dy vertical blocks.
|
protected void |
rotateZPixels(double dy)
Execute a rotateZ input event of dy vertical pixels.
|
void |
rotateZPixelsImpl(double dy)
impl of
rotateZPixels(double) w/o accel or jumpToNext() |
void |
scale(double factor)
Covers
scale(double, double, double, double) with current
rotation center, transformed to world frame, as scale center. |
void |
scale(double factor,
double cx,
double cy,
double cz)
Append a scaling by factor about world frame point (cx, cy,
cz) to the next waypoint.
|
void |
scaleBlocks(double dy)
Covers
scaleBlocks(double, double, double) , scales about
rotation center in world frame. |
void |
scaleBlocks(double dy,
double cx,
double cy)
Execute a scale input event of dy vertical blocks with scale
center the projection of the canvas pixel (cx, cy) on the world
z-plane through the local frame origin.
|
void |
scalePixels(double dy)
Covers
scalePixels(double, double, double) , scales about
rotation center in world frame. |
void |
scalePixels(double dy,
double cx,
double cy)
Execute a scale input event of dy vertical pixels with scale
center the projection of the canvas pixel (cx, cy) on the world
z-plane through the current rotation center in world frame.
|
protected void |
scalePixelsImpl(double dy,
double cx,
double cy)
impl of
scalePixels(double, double, double) without accel or jumpToNext() |
protected int |
selectSubAction(boolean e0,
boolean e1,
boolean e2,
boolean e3,
boolean e4,
boolean s1st,
boolean s2nd,
boolean s3rd,
boolean s4th,
boolean s5th)
Select one of up to five enabled sub-actions, helper for event
handlers.
|
void |
setAccelFactor(double factor)
Set the acceleration factor.
|
void |
setBlockRotateDegrees(double degrees)
covers
setBlockRotateFactor(double) , see which |
void |
setBlockRotateFactor(double factor)
Set the multiplicative factor which converts keypress and mousewheel
click events to pixel blocks for rotation.
|
void |
setBlockRotateRadians(double radians)
covers
setBlockRotateFactor(double) , see which |
void |
setBlockScaleFactor(double factor)
Set the multiplicative factor which converts keypress and mousewheel
click events to pixel blocks for scaling.
|
void |
setBlockTranslateFactor(double factor)
Set the multiplicative factor which converts keypress and mousewheel
click events to pixel blocks for translation.
|
void |
setCanvasSize(double width,
double height)
set canvas size in pixels or 0 to infer it from the next input event
|
void |
setControlInLocalFrame()
Make rotation and translation actions are relative to local frame.
|
void |
setControlInManipulationFrame()
Make rotation and translation actions are relative to manipulation
frame.
|
void |
setControlInWorldFrame()
Make rotation and translation actions are relative to world frame.
|
void |
setInterpolationThresholdPixels(double threshold)
set the interpolation threshold in pixels
|
void |
setInterpolationTime(double time)
set the time [s] for interpolations
|
void |
setManipulationToWorld(RX rx)
setManipulationToWorld(RX, boolean) without inverting |
void |
setManipulationToWorld(RX rx,
boolean invert)
Set the
manipulationToWorld transform by copy. |
void |
setRotationCenter(double[] c)
|
void |
setRotationCenter(double x,
double y,
double z)
set a new 3D rotation center in local frame
|
void |
setScaleBase(double scaleBase)
Set the scale base.
|
void |
setWorldToCanvasScale(double scale)
|
boolean |
transformDirty()
Check if the local-to-world transform
isInterpolating() or
hasNext() . |
protected void |
translateImpl(double dx,
double dy,
double dz)
|
void |
translateInLocal(double dx,
double dy,
double dz)
Append a translation by (dx, dy, dz) in local frame
orientation but world frame scale to the next waypoint.
|
void |
translateInManipulationFrame(double dx,
double dy,
double dz)
Append a translation by (dx, dy, dz) in manipulation
frame to the next waypoint.
|
void |
translateInWorld(double dx,
double dy,
double dz)
Append a translation by (dx, dy, dz) in world
frame to the next waypoint.
|
void |
translateXYBlocks(double dx,
double dy)
Execute a translateXY input event of (dx, dy) blocks.
|
void |
translateXYPixels(double dx,
double dy)
Execute a translateXY input event of (dx, dy) pixels.
|
protected void |
translateXYPixelsImpl(double dx,
double dy)
impl of
translateXYPixels(double, double) w/o accel or jumpToNext() |
void |
translateZBlocks(double dy)
Execute a translateZ input event of dy vertical blocks.
|
void |
translateZPixels(double dy)
Execute a translateZ input event of dy vertical pixels.
|
protected void |
translateZPixelsImpl(double dy)
impl of
translateZPixels(double) w/o accel or jumpToNext() |
private static final java.lang.String cvsid
public static final double DEF_INTERPOLATION_TIME
interpolationTime
[s]public static final double DEF_BLOCK_ROTATE_FACTOR
blockRotateFactor
public static final double DEF_BLOCK_TRANSLATE_FACTOR
blockTranslateFactor
public static final double DEF_BLOCK_SCALE_FACTOR
blockScaleFactor
public static final double DEF_SCALE_BASE
scaleBase
public static final double DEF_INTERPOLATION_THRESHOLD_PIXELS
interpolationThresholdPixels
public static final long KEY_REPEAT_THRESHOLD_MS
public static final int KEY_TIMER_PERIOD_MS
keyTimer
public static final int KEY_REPEAT_SCALE_PIXELS_PER_MS
keyTimer
public static final int TYPEMATIC_SLOP_MS
public final RXSInterpolator rxsInterpolator
protected static final double[] ACCEL_SLIDER
protected double interpolationTime
protected double interpolationStartTime
protected double interpolationDeadline
protected double interpolationThresholdPixels
protected double[] rotationCenter
protected volatile boolean scaleEnabled
protected volatile boolean translateXYEnabled
protected volatile boolean translateZEnabled
protected volatile boolean rotateXYEnabled
protected volatile boolean rotateZEnabled
protected volatile boolean accelSliderEnabled
protected volatile boolean eventsEnabled
protected volatile boolean eventsDuringInterpolationEnabled
protected boolean controlInLocalFrame
If true then interactive motion increments are relative to local frame.
protected boolean controlInManipulationFrame
If true then interactive motion increments are relative to manipulation
frame, which is defined by manipulationToWorld
.
protected RX manipulationToWorld
Transform that takes manipulation frame coordinates to world frame, thus defining manipulation frame.
Initially identity.
protected double blockRotateFactor
Conversion factor taking block events to pixels relative to canvas dimensions.
protected double blockTranslateFactor
Conversion factor taking block events to pixels relative to canvas dimensions.
protected double blockScaleFactor
Conversion factor taking block events to pixels relative to canvas dimensions.
protected double scaleBase
protected double accelFactor
public volatile java.lang.String accelChangeActionLabel
If non-null then this replaces "interaction" in messages printed to
System.out when accelFactor
is changed due to a keypress.
If null then such messages are not printed.
protected final double[] fitTXEMS
Temp workspace used in fit(double, double, double, double,
double)
.
protected final double[] t0
rxsInterpolator
protected final double[] t1
rxsInterpolator
protected double lastMouseX
protected double lastMouseY
protected double firstMouseX
protected double firstMouseY
protected double worldToCanvasScale
protected final double[] canvasSize
protected long upPressed
Timestamp [ms] when the indicated key went down.
Confined to the AWT event thread.
protected long downPressed
Timestamp [ms] when the indicated key went down.
Confined to the AWT event thread.
protected long leftPressed
Timestamp [ms] when the indicated key went down.
Confined to the AWT event thread.
protected long rightPressed
Timestamp [ms] when the indicated key went down.
Confined to the AWT event thread.
protected long upReleased
Timestamp [ms] when the indicated key went up.
Confined to the AWT event thread.
protected long downReleased
Timestamp [ms] when the indicated key went up.
Confined to the AWT event thread.
protected long leftReleased
Timestamp [ms] when the indicated key went up.
Confined to the AWT event thread.
protected long rightReleased
Timestamp [ms] when the indicated key went up.
Confined to the AWT event thread.
protected boolean ctrlDown
Whether the indicated key is currenly down.
Confined to the AWT event thread.
protected boolean shiftDown
Whether the indicated key is currenly down.
Confined to the AWT event thread.
protected boolean altDown
Whether the indicated key is currenly down.
Confined to the AWT event thread.
public final Clock clock
protected final java.awt.event.FocusListener focusListener
addListeners(java.awt.Component)
protected final java.awt.event.KeyListener keyListener
addListeners(java.awt.Component)
protected final java.awt.event.MouseListener mouseListener
addListeners(java.awt.Component)
protected final java.awt.event.MouseMotionListener mouseMotionListener
addListeners(java.awt.Component)
protected final java.awt.event.MouseWheelListener mouseWheelListener
addListeners(java.awt.Component)
protected final javax.swing.Timer keyTimer
Keypress timer.
This replaces platform typematic systems, and is implemented to work around bug ID 4153069 (open) "keyReleased behaviour incorrect".
Confined to the AWT event thread.
public RXSInteractor(Clock clock, RXSInterpolator rxsInterpolator)
Make an interactor based on the given clock and rxsInterpolator.
public RXSInteractor(Clock clock)
Makes a new interactor with a default interpolator.
public RXSInteractor(RXSInterpolator interpolator)
Makes a new interactor with a default Clock
(wall-clock
time).
public RXSInteractor()
Makes a new interactor with a default Clock
(wall-clock time)
and interpolator.
public double getCurrentTime()
clock
time in [s]public double getCurrentInterpolationCoordinate()
Get the current normalized linear interpolation coordinate in [0.0, 1.0].
public double getCurrentTransform(RX x)
Get the current interpolated value of the transform and scale.
x
- if non-null then the current interpolated local-to-world rigid
transform is copied here on returnpublic RX getCurrentRX(RX x)
Get the current interpolated value of the rigid transform.
x
- the current interpolated local-to-world rigid transform is copied
here on return, consing if nullpublic RX getCurrentRX()
getCurrentRX(RX)
, consespublic double getCurrentScale()
Get the current interpolated value of the transform scale.
public double[] getCurrentTXEMS(double[] txems)
Like getCurrentTransform(RX)
but returns transform as a
packed TXEM+scale vector (tx, ty, tz, ex, ey, ez, s).
public double[] getCurrentTXEMS()
getCurrentTXEMS(double[])
, consespublic double[] getCurrentTXEM(double[] txem)
Like getCurrentTransform(RX)
but returns transform as a
packed TXEM vector (tx, ty, tz, ex, ey, ez).
public double[] getCurrentTXEM()
getCurrentTXEM(double[])
, consespublic boolean isInterpolating()
public boolean hasNext()
Check if an interpolateToNext(double)
or jumpToNext()
will
change the current waypoint local-to-world transform.
public boolean transformDirty()
Check if the local-to-world transform isInterpolating()
or
hasNext()
.
public void interpolateTo(double interpolationTime, RX x, double s)
Interpolate immediately from the current transform to (x, s).
interpolationTime
- the time in seconds over which to perform the
interpolation (starting at time of call), or NaN to use the currently set
interpolationTime
x
- the target local-to-world RX
, or null to use the
currently accumulated next waypoint transform. Note that if
non-null then any currently accumulated next waypoint transform is
trashed.s
- the target local-to-world scale, or NaN to use the currently
accumulated next waypoint scale. Note that if non-NaN then any
currently accumulated next waypoint scale is trashed.public void interpolateTo(RX x, double s)
Covers interpolateTo(double, RX, double)
uses current interpolationTime
.
public void interpolateTo(RX x)
Covers interpolateTo(double, RX, double)
uses current interpolationTime
and scale.
public void interpolateToTXEMS(double interpolationTime, double... txems)
Like interpolateTo(double, RX, double)
but takes transform
as a packed TXEM+scale vector (tx, ty, tz, ex, ey, ez, s).
public void interpolateToTXEMS(double... txems)
interpolateToTXEMS(double, double...)
with current interpolationTime
.
public void interpolateToTXEM(double interpolationTime, double... txem)
Like interpolateTo(double, RX, double)
but takes transform as
a packed TXEM vector (tx, ty, tz, ex, ey, ez) and uses current scale.
public void interpolateToTXEM(double... txem)
interpolateToTXEM(double, double...)
with current interpolationTime
.
public void interpolateToNext(double interpolationTime)
Like interpolateTo(double, RX, double)
but uses currently
accumulated next waypoint transform.
interpolationTime
- the time in seconds over which to perform the
interpolation (starting at time of call), or NaN to use the currently set
interpolationTime
public void interpolateToNext()
interpolateToNext(double)
with current interpolationTime
public void jumpToNext()
Covers interpolateToNext(double)
with zero interpolation
time.
public void jumpTo(RX x, double s)
Covers interpolateTo(double, RX, double)
with zero
interpolation time.
public void jumpTo(RX x)
jumpTo(RX, double)
with current scale.
public void jumpToTXEMS(double... txems)
Like jumpTo(RX, double)
but takes transform as a
packed TXEM+scale vector (tx, ty, tz, ex, ey, ez, s).
public void jumpToTXEM(double... txem)
Like jumpTo(RX)
but takes transform as a packed TXEM vector
(tx, ty, tz, ex, ey, ez).
public void fit(double minX, double minY, double maxX, double maxY, double interpolationTime)
Interpolate immediately to a transform that just-fits the world-frame
XY rect (minX, minY, maxX, maxY) within the world-frame XY rect
canvasSize
/worldToCanvasScale
centered at the
origin.
Note that when an RXSInteractor
is used for viewpoint
navigation in a Display3D
, the world frame of the
interactor is the view frame of the display, and the local
frame of the interactor is the world frame of the display.
Any currently accumulated next waypoint transform is trashed.
interpolationTime
- the time in seconds over which to perform the
interpolation (starting at time of call), or NaN to use the currently set
interpolationTime
public void fit(double minX, double minY, double maxX, double maxY)
Covers fit(double, double, double, double)
, uses currently set
interpolationTime
.
public void interpolateToAim(double... args)
Rotate the local frame about the current rotation center c in world frame to a pose that aims the local frame positive z axis towards c and parallel to a given vector d, maintaining the current distance from the local frame origin to c.
This can be used to implement canonical orientation poses.
See also RX.aim(double...)
.
args
- either three or four doubles; the last three give d, if
length 4 then the first gives interpolation time, else the currently set
interpolationTime
is usedpublic void jumpToAim(double... d)
public void setInterpolationTime(double time)
public void setWorldToCanvasScale(double scale)
public void setCanvasSize(double width, double height)
public void addListeners(java.awt.Component component)
Add event listeners to component which call the handleEvent(...)
APIs.
public void removeListeners(java.awt.Component component)
Remove event listeners from component that were previously added
by addListeners(java.awt.Component)
.
It is safe to call this even if the listeners have not been added.
public void setRotationCenter(double x, double y, double z)
public void setRotationCenter(double[] c)
public double[] getRotationCenter(double[] c)
public double[] getRotationCenter()
getRotationCenter(double[])
, always consespublic double[] getRotationCenterInWorld(double[] c)
public double[] getRotationCenterInWorld()
getRotationCenterInWorld(double[])
, always consespublic double getRotationCenterZInWorld()
public void enableAccelSlider(boolean enable)
public boolean isAccelSliderEnabled()
public void enableScale(boolean enable)
public boolean isScaleEnabled()
public void enableTranslateXY(boolean enable)
public boolean isTranslateXYEnabled()
public void enableTranslateZ(boolean enable)
public boolean isTranslateZEnabled()
public void enableRotateXY(boolean enable)
public boolean isRotateXYEnabled()
public void enableRotateZ(boolean enable)
public boolean isRotateZEnabled()
public void enableAllSubEvents(boolean enableScale, boolean enableRotate, boolean enableTranslate)
Enable or disable categories of types.
public void enableAllSubEvents(boolean enableScale)
enableAllSubEvents(boolean, boolean, boolean)
with all
translate and rotate enabled.
public void enableAllSubEvents()
enableAllSubEvents(boolean, boolean, boolean)
with all
enabled.
public void enableEvents(boolean enable)
public boolean areEventsEnabled()
public void enableEventsDuringInterpolation(boolean enable)
public boolean areEventsDuringInterpolationEnabled()
public void setControlInWorldFrame()
Make rotation and translation actions are relative to world frame.
public void setControlInLocalFrame()
Make rotation and translation actions are relative to local frame.
public void setControlInManipulationFrame()
Make rotation and translation actions are relative to manipulation frame.
public void setManipulationToWorld(RX rx, boolean invert)
Set the manipulationToWorld
transform by copy.
invert
- whether to invert manipulationToWorld
after setting
itpublic void setManipulationToWorld(RX rx)
setManipulationToWorld(RX, boolean)
without invertingpublic void appendManipulationToWorld(RX rx, boolean invert)
Append to the manipulationToWorld
transform.
invert
- whether to append the inverse of rxpublic void appendManipulationToWorld(RX rx)
appendManipulationToWorld(RX, boolean)
without invertingpublic void prependManipulationToWorld(RX rx, boolean invert)
Prepend to the manipulationToWorld
transform.
invert
- whether to prepend the inverse of rxpublic void prependManipulationToWorld(RX rx)
prependManipulationToWorld(RX, boolean)
without invertingpublic java.lang.String cycleControlFrame(java.lang.String local, java.lang.String world, java.lang.String manipulation)
Cycle control to the next frame.
If control is currently in world frame (the default) it's changed to local frame. If it's in local frame it's changed to manipulation frame. And if It's in manipulation frame it's changed to world frame.
local
- the string to use in place of "local", or null to use defaultworld
- the string to use in place of "world", or null to use
defaultmanipulation
- the string to use in place of "manipulation", or null
to use defaultpublic java.lang.String cycleControlFrame()
cycleControlFrame(String, String, String)
using default namespublic java.lang.String getControlFrame(java.lang.String local, java.lang.String world, java.lang.String manipulation)
Get the name of the current control frame.
local
- the string to use in place of "local", or null to use defaultworld
- the string to use in place of "world", or null to use
defaultmanipulation
- the string to use in place of "manipulation", or null
to use defaultpublic java.lang.String getControlFrame()
getControlFrame(String, String, String)
using default namespublic boolean isControlInLocalFrame()
Check whether rotation and translation actions are relative to local frame.
public boolean isControlInManipulationFrame()
Check whether rotation and translation actions are relative to manipulation frame.
public boolean isControlInWorldFrame()
Check whether rotation and translation actions are relative to world frame.
public void setBlockRotateFactor(double factor)
Set the multiplicative factor which converts keypress and mousewheel click events to pixel blocks for rotation.
Each such event is converted to a block of pixels according to the axis of rotation implied by the event and the current canvas dimensions (w,h). For rotations about the Y axis the conversion is factor*w horizontal pixels per block, and for rotations about the X or Z axes the conversion is factor*h vertical pixels per block.
Note that the pixel representation is ultimately converted to an angle
in radians, again relative to the current canvas dimensions, with a full
2*PI rotation corresponding to the full dimension of the canvas. Thus the
factor set by this API actually sets an absolute rotation increment of
factor/(2*PI) radians for keypress and mousewheel rotation events.
The setBlockRotateDegrees(double)
and setBlockRotateRadians(double)
APIs
are convenient covers.
public void setBlockRotateDegrees(double degrees)
setBlockRotateFactor(double)
, see whichpublic void setBlockRotateRadians(double radians)
setBlockRotateFactor(double)
, see whichpublic void setBlockTranslateFactor(double factor)
Set the multiplicative factor which converts keypress and mousewheel click events to pixel blocks for translation.
Each such event is converted to a block of pixels according to the axis of translation implied by the event and the current canvas dimensions (w,h). For translations along the Y axis the conversion is factor*h vertical pixels per block, and for translations along the X or Z axes the conversion is factor*w horizontal pixels per block.
Note that the pixel representation is then converted to world frame
units at the time of the event by dividing by the current worldToCanvasScale
.
public void setBlockScaleFactor(double factor)
Set the multiplicative factor which converts keypress and mousewheel click events to pixel blocks for scaling.
Each such event is converted to a block of pixels according to the current canvas height h at factor*h vertical pixels per block.
Note that the pixel representation is then converted to a
multiplicative change to the current local-to-world scale of scaleBase
^(p/h), where h is the current canvas height, and
p is positive downwards. Thus each scale event of b
(signed) blocks effects a b*scaleBase
^factor
multiplicative change in local-to-world scale.
public void setScaleBase(double scaleBase)
Set the scale base.
See class header doc for details.
public void setAccelFactor(double factor)
Set the acceleration factor.
See class header doc for details.
public void setInterpolationThresholdPixels(double threshold)
public void scale(double factor, double cx, double cy, double cz)
Append a scaling by factor about world frame point (cx, cy, cz) to the next waypoint.
If any of the three scale center coordinates is NaN then the current rotation center, transformed to world frame, is used as the scale center.
Note that the next waypoint will not be engaged till interpolateToNext(double)
, jumpToNext()
, or an equivalent call is
made.
public void scale(double factor)
Covers scale(double, double, double, double)
with current
rotation center, transformed to world frame, as scale center.
public void scalePixels(double dy, double cx, double cy)
Execute a scale input event of dy vertical pixels with scale center the projection of the canvas pixel (cx, cy) on the world z-plane through the current rotation center in world frame.
See class header doc for how this is converted to a call to scale(double, double, double, double)
.
The move is executed immediately via a call to jumpToNext()
.
public void scalePixels(double dy)
Covers scalePixels(double, double, double)
, scales about
rotation center in world frame.
protected void scalePixelsImpl(double dy, double cx, double cy)
scalePixels(double, double, double)
without accel or jumpToNext()
public void scaleBlocks(double dy, double cx, double cy)
Execute a scale input event of dy vertical blocks with scale center the projection of the canvas pixel (cx, cy) on the world z-plane through the local frame origin.
See class header doc for how this is converted to a call to scalePixelsImpl(double, double, double)
.
If the conversion to pixels is greater than interpolationThresholdPixels
then the move is is executed immediately
via a call to interpolateToNext(double)
, otherwise it is executed via
jumpToNext()
.
public void scaleBlocks(double dy)
Covers scaleBlocks(double, double, double)
, scales about
rotation center in world frame.
public void translateInManipulationFrame(double dx, double dy, double dz)
Append a translation by (dx, dy, dz) in manipulation frame to the next waypoint.
If an interpolation is currently ongoing then the motion will be with respect to its final value.
Note that the next waypoint will not be engaged till interpolateToNext(double)
, jumpToNext()
, or an equivalent call is
made.
public void translateInLocal(double dx, double dy, double dz)
Append a translation by (dx, dy, dz) in local frame orientation but world frame scale to the next waypoint.
If an interpolation is currently ongoing then the motion will be with respect to its final value.
Note that the next waypoint will not be engaged till interpolateToNext(double)
, jumpToNext()
, or an equivalent call is
made.
public void translateInWorld(double dx, double dy, double dz)
Append a translation by (dx, dy, dz) in world frame to the next waypoint.
Note that the next waypoint will not be engaged till interpolateToNext(double)
, jumpToNext()
, or an equivalent call is
made.
protected void translateImpl(double dx, double dy, double dz)
public void translateXYPixels(double dx, double dy)
Execute a translateXY input event of (dx, dy) pixels.
See class header doc for how this is converted to a call to translateImpl(double, double, double)
.
The move is executed immediately via a call to jumpToNext()
.
protected void translateXYPixelsImpl(double dx, double dy)
translateXYPixels(double, double)
w/o accel or jumpToNext()
public void translateXYBlocks(double dx, double dy)
Execute a translateXY input event of (dx, dy) blocks.
See class header doc for how this is converted to a call to translateXYPixelsImpl(double, double)
.
If the (summed) conversion to pixels is greater than interpolationThresholdPixels
then the move is is executed immediately
via a call to interpolateToNext(double)
, otherwise it is executed via
jumpToNext()
.
public void translateZPixels(double dy)
Execute a translateZ input event of dy vertical pixels.
See class header doc for how this is converted to a call to translateImpl(double, double, double)
.
The move is executed immediately via a call to jumpToNext()
.
protected void translateZPixelsImpl(double dy)
translateZPixels(double)
w/o accel or jumpToNext()
public void translateZBlocks(double dy)
Execute a translateZ input event of dy vertical blocks.
See class header doc for how this is converted to a call to translateZPixelsImpl(double)
.
If the conversion to pixels is greater than interpolationThresholdPixels
then the move is is executed immediately
via a call to interpolateToNext(double)
, otherwise it is executed via
jumpToNext()
.
public void rotateEulerInManipulationFrame(double dx, double dy, double dz)
Append a rotation by Euler angles (dx, dy, dz) [radians] about
axes parallel to manipulation frame and through the local
frame rotationCenter
to the next waypoint.
If an interpolation is currently ongoing then the motion will be with respect to its final value.
The Euler angle rotation order is x, y, z.
Note that the next waypoint will not be engaged till interpolateToNext(double)
, jumpToNext()
, or an equivalent call is
made.
public void rotateEulerInLocal(double dx, double dy, double dz)
Append a rotation by Euler angles (dx, dy, dz) [radians] about
axes parallel to local frame and through the local frame
rotationCenter
to the next waypoint.
If an interpolation is currently ongoing then the rotation axes orientations and the rotation center will be with respect to its final value.
The Euler angle rotation order is x, y, z.
Note that the next waypoint will not be engaged till interpolateToNext(double)
, jumpToNext()
, or an equivalent call is
made.
public void rotateEulerInWorld(double dx, double dy, double dz)
Append a rotation by Euler angles (dx, dy, dz) [radians] about
axes parallel to world frame and through the local frame
rotationCenter
to the next waypoint.
If an interpolation is currently ongoing then the motion will be with respect to its final value.
The Euler angle rotation order is x, y, z.
Note that the next waypoint will not be engaged till interpolateToNext(double)
, jumpToNext()
, or an equivalent call is
made.
protected void rotateImpl(double dx, double dy, double dz)
public void rotateXYPixels(double dx, double dy)
Execute a rotateXY input event of (dx, dy) pixels.
See class header doc for how this is converted to a call to rotateImpl(double, double, double)
.
The move is executed immediately via a call to jumpToNext()
.
protected void rotateXYPixelsImpl(double dx, double dy)
rotateXYPixels(double, double)
w/o accel or jumpToNext()
public void rotateXYBlocks(double dx, double dy)
Execute a rotateXY input event of (dx, dy) blocks.
See class header doc for how this is converted to a call to rotateXYPixelsImpl(double, double)
.
If the (summed) conversion to pixels is greater than interpolationThresholdPixels
then the move is is executed immediately
via a call to interpolateToNext(double)
, otherwise it is executed via
jumpToNext()
.
protected void rotateZPixels(double dy)
Execute a rotateZ input event of dy vertical pixels.
See class header doc for how this is converted to a call to rotateImpl(double, double, double)
.
The move is executed immediately via a call to jumpToNext()
.
public void rotateZPixelsImpl(double dy)
rotateZPixels(double)
w/o accel or jumpToNext()
public void rotateZBlocks(double dy)
Execute a rotateZ input event of dy vertical blocks.
See class header doc for how this is converted to a call to rotateZPixelsImpl(double)
.
If the conversion to pixels is greater than interpolationThresholdPixels
then the move is is executed immediately
via a call to interpolateToNext(double)
, otherwise it is executed via
jumpToNext()
.
public void dump(java.io.PrintStream s)
public void dump()
dump(PrintStream)
to System.outpublic void dumpHelp(java.io.PrintStream s, java.lang.String interacting, java.lang.String interaction, java.lang.String local, java.lang.String world, java.lang.String manipulation, java.lang.String units)
Dump a help text.
interacting
- the string to use in place of "interacting", or null to
use defaultinteraction
- the string to use in place of "interaction", or null to
use defaultlocal
- the string to use in place of "local", or null to use defaultworld
- the string to use in place of "world", or null to use
defaultmanipulation
- the string to use in place of "manipulation", or null
to use defaultunits
- the string to use in place of "units", or null to use
defaultpublic void dumpHelp(java.lang.String interacting, java.lang.String interaction, java.lang.String local, java.lang.String world, java.lang.String manipulation, java.lang.String units)
public void dumpHelp()
dumpHelp(PrintStream, String, String, String, String, String,
String)
to System.out with default strings.
public boolean handleEvent(java.awt.event.KeyEvent e)
Handles key events.
This is thread-confined to the AWT event thread.
protected boolean handleKeyPressed(java.awt.event.KeyEvent e)
Handles key presses.
This is thread-confined to the AWT event thread.
protected boolean handleKeyReleased(java.awt.event.KeyEvent e)
Handles key releases.
This is thread-confined to the AWT event thread.
protected boolean handleKeyTyped(java.awt.event.KeyEvent e)
Handles key types.
This is thread-confined to the AWT event thread.
public boolean handleEvent(java.awt.event.MouseEvent e)
Handles mouse events.
This is thread-confined to the AWT event thread.
public boolean handleEvent(java.awt.event.MouseWheelEvent e)
Handles mouse wheel events.
This is thread-confined to the AWT event thread.
public boolean handleEvent(java.awt.event.FocusEvent e)
Handles focus events, in particular to stop keyTimer
.
This is thread-confined to the AWT event thread.
protected void resetEventState()
Stop keyTimer
and reset related state.
This is thread-confined to the AWT event thread.
protected int selectSubAction(boolean e0, boolean e1, boolean e2, boolean e3, boolean e4, boolean s1st, boolean s2nd, boolean s3rd, boolean s4th, boolean s5th)
Select one of up to five enabled sub-actions, helper for event handlers.
protected int nextSubAction(int sa, boolean e0, boolean e1, boolean e2, boolean e3, boolean e4)
protected double canvasToWorldX(double x, boolean doTranslate)
protected double canvasToWorldY(double y, boolean doTranslate)