|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectshady.common.ui.HotSpot
shady.common.ui.multi.ChainIKHotSpot
public class ChainIKHotSpot
A HotSpot that controls a multishady chain by ChainIK.
Copyright (C) 2006 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.
| Field Summary | |
|---|---|
protected Block |
block
The chain-end to control. |
static java.lang.String |
CHAIN_PACKAGE
Package containing the chain classes. |
protected ChainIK |
chainIK
The ChainIK currently live. |
protected static java.util.List |
chainIKHotSpots
All currently active ChainIKHotSpots. |
static double |
CLEAR_ANNOTATIONS_TIME
Seconds before annotations are cleared. |
static boolean |
DEBUG
Whether to debug. |
static java.lang.String |
DEFAULT_IK_NAME
Default IK name. |
static int |
DEFAULT_ITERATIONS_PER_UPDATE
Default number of iterations per update. |
static double |
DEFAULT_UPDATE_TIME
Default update time in seconds. |
static double |
DRAG_ANNOTATION_MAG
Magnitude of drag annotation vector in pixels |
protected java.lang.String |
dragAnnotationName
Name of the drag annotation. |
protected boolean |
dragOngoing
Whether a drag is in progress. |
protected java.lang.Object |
graphicsLock
Synchronization object for graphics updates. |
static java.lang.String |
ikName
IK name, e.g. |
static int |
iterationsPerUpdate
Iterations per update. |
static double |
MAX_ANNOTATION_TIME
Max allowed time to display annotations in seconds. |
static double |
MAX_UPDATE_TIME
Max allowed time for an update in seconds. |
static double |
TARGET_SLOP_PIXELS
Max allowed target slop in pixels. |
protected java.lang.Object |
targetLock
Synchronization lock for the target variables. |
protected double |
targetRotation
Target rotation in radians. |
protected double |
targetSetTime
Time of most recent target change. |
protected double |
targetX
Target x coord. |
protected double |
targetY
Target y coord. |
static double |
TILT_PER_CLICK
Differential tilt per click in radians. |
protected java.lang.String |
tiltAnnotationName
Name of the tilt annotation. |
protected static vona.time.Clock |
updateClock
Timebase for doUpdate(double). |
protected static vona.time.PeriodicThread |
updateThread
The update thread. |
| Fields inherited from class shady.common.ui.HotSpot |
|---|
graphicsDisplay, point, uid, uidCounter |
| Constructor Summary | |
|---|---|
ChainIKHotSpot(Block block)
Create a new ChainIKHotSpot. |
|
| Method Summary | |
|---|---|
protected void |
addAnnotations(GraphicsDisplay graphicsDisplay)
Update the annotations. |
protected void |
doUpdate(double currentTime)
(Re) cons chainIK if necessary and do up to iterationsPerUpdate IK iterations. |
protected double |
getCurrentRotation()
Get the current EE rotation in radians. |
protected double |
getCurrentX()
Get the current EE x coordinate. |
protected double |
getCurrentY()
Get the current EE y coordinate. |
boolean |
handleDrag(double dx,
double dy,
java.awt.geom.Point2D startDragPoint,
java.awt.geom.Point2D point,
int modifiers,
boolean accel)
Subclasses wishing to respond to drags override this. |
void |
handleDragEnded(java.awt.geom.Point2D startDragPoint,
java.awt.geom.Point2D point,
int modifiers,
boolean accel)
Subclasses wishing to respond to drags may override this to be told when the drag ends. |
protected boolean |
isTilt(int modifiers)
Check whether this is a tilt. |
protected void |
removeAnnotations(GraphicsDisplay graphicsDisplay)
Clear the annotations. |
void |
setGraphicsDisplay(GraphicsDisplay graphicsDisplay)
Used by GraphicsDisplay to notify this HotSpot when it has been
added and removed. |
static void |
setUpdateTime(double updateTime)
Set the update time for all ChainIKHotSpots. |
| Methods inherited from class shady.common.ui.HotSpot |
|---|
distanceSq, distanceSq, distanceSq, handleWheel |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final boolean DEBUG
Whether to debug.
public static final double DEFAULT_UPDATE_TIME
Default update time in seconds.
public static final java.lang.String DEFAULT_IK_NAME
Default IK name.
public static final int DEFAULT_ITERATIONS_PER_UPDATE
Default number of iterations per update.
public static final java.lang.String CHAIN_PACKAGE
Package containing the chain classes.
public static final double TILT_PER_CLICK
Differential tilt per click in radians.
public static final double CLEAR_ANNOTATIONS_TIME
Seconds before annotations are cleared.
public static final double DRAG_ANNOTATION_MAG
Magnitude of drag annotation vector in pixels
public static final double TARGET_SLOP_PIXELS
Max allowed target slop in pixels.
public static final double MAX_UPDATE_TIME
Max allowed time for an update in seconds.
public static final double MAX_ANNOTATION_TIME
Max allowed time to display annotations in seconds.
protected Block block
The chain-end to control.
protected ChainIK chainIK
The ChainIK currently live.
public static java.lang.String ikName
IK name, e.g. "Transpose" for "shady.common.multi.chain.TransposeIK".
public static int iterationsPerUpdate
Iterations per update.
protected double targetX
Target x coord.
protected double targetY
Target y coord.
protected double targetRotation
Target rotation in radians.
protected double targetSetTime
Time of most recent target change.
protected java.lang.Object targetLock
Synchronization lock for the target variables.
protected boolean dragOngoing
Whether a drag is in progress.
protected java.lang.String tiltAnnotationName
Name of the tilt annotation.
protected java.lang.String dragAnnotationName
Name of the drag annotation.
protected static final java.util.List chainIKHotSpots
All currently active ChainIKHotSpots.
protected static final vona.time.Clock updateClock
Timebase for doUpdate(double).
protected static final vona.time.PeriodicThread updateThread
The update thread.
protected java.lang.Object graphicsLock
Synchronization object for graphics updates.
| Constructor Detail |
|---|
public ChainIKHotSpot(Block block)
Create a new ChainIKHotSpot.
block - the chain-end to control, not null| Method Detail |
|---|
protected double getCurrentX()
Get the current EE x coordinate.
protected double getCurrentY()
Get the current EE y coordinate.
protected double getCurrentRotation()
Get the current EE rotation in radians.
public static void setUpdateTime(double updateTime)
Set the update time for all ChainIKHotSpots.
updateTime - the update time for all ChainIKHotSpots, in seconds
public boolean handleDrag(double dx,
double dy,
java.awt.geom.Point2D startDragPoint,
java.awt.geom.Point2D point,
int modifiers,
boolean accel)
Subclasses wishing to respond to drags override this.
This method will be called at each mouse event during a drag which started over the hotspot.
Default impl just returns false.
This impl sets targetX and targetY from
point.
handleDrag in class HotSpotdx - horizontal pixels moved since last call, view framedy - vertical pixels moved since last call, view framestartDragPoint - the drag start point in world frame, not nullpoint - the current drag point in world frame, not nullmodifiers - modifiersEx of the mouse eventaccel - whether the user is indicating this is an accelerated gesture
protected boolean isTilt(int modifiers)
Check whether this is a tilt.
Current impl just looks for CTRL down.
protected void addAnnotations(GraphicsDisplay graphicsDisplay)
Update the annotations.
graphicsDisplay - the GraphicsDisplay in which to drawprotected void removeAnnotations(GraphicsDisplay graphicsDisplay)
Clear the annotations.
graphicsDisplay - the GraphicsDisplay in which to draw
public void handleDragEnded(java.awt.geom.Point2D startDragPoint,
java.awt.geom.Point2D point,
int modifiers,
boolean accel)
Subclasses wishing to respond to drags may override this to be told when the drag ends.
This method will be called when a drag which started over the hotspot ends.
Default impl just returns false.
This impl clears dragOngoing.
handleDragEnded in class HotSpotstartDragPoint - the drag start point in world frame, not nullpoint - the end drag point in world frame, not nullmodifiers - modifiersEx of the mouse eventaccel - whether the user is indicating this is an accelerated gestureprotected void doUpdate(double currentTime)
(Re) cons chainIK if necessary and do up to iterationsPerUpdate IK iterations.
Does nothing unless an update is needed.
currentTime - the current time according to updateClockpublic void setGraphicsDisplay(GraphicsDisplay graphicsDisplay)
Used by GraphicsDisplay to notify this HotSpot when it has been
added and removed.
This impl removes us from consideration for update.
setGraphicsDisplay in class HotSpotgraphicsDisplay - the GraphicsDisplay or null for none
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||