@ThreadSafe
public class UI
extends java.lang.Object
MSim user interface.
This class includes most of the UI elements other than rendering, which
is in Display
, and manipulation interaction which is in InteractorDriver
(manipulating Joint
configuration) and WidgetInteractor
(manipulating Widget
pose).
The primary textual UI is a JScheme REPL that is run in replThread
. setJSGlobals()
and loadJSchemeFiles()
initialize the Scheme environment with the user-level MSim API.
Though rendering is performed in Display
and manipulation is handled in InteractorDriver
and WidgetInteractor
, this class includes most of the other aspects
of graphical interaction, including keybindings and
picking/selecting entities.
An ActionMapper
handles mouse and keyboard input (other than picking, manipulation, and
navigation)
over the grapics display with several action maps, in decreasing priority
order:
userActionMap
: user-added actionsconsWidgetActionMap
: actions enabled during cons-Widget
modeconsJointActionMap
: actions enabled during cons-Joint
modemanipulationActionMap
: actions enabled during manipulationbaseActionMap
: general actionssliderActionMap
: handles input from the 1234567890 keyboard
top-row "slider", which can be directed to adjust navigation or manipulation
acceleration, the visual highlight factor, or the alpha mask factorClicking the primary mouse button initiates picking, through the Display3D.setPickPointOnCanvas(float, float)
API. The Display
elaborates the click
point to a pick segment through the view volume which pierces the canvas at
the clicked pixel, and on the next render cycle all intersecting model
entities which are both EntityClass.pickable
and EntityClass.individuallyPickable
are added to the pickCycle
, in
order of increasing distance from the viewer. The actual current pick is
the entry at pickIndex
in the pick cycle, initially the nearest.
The user may move forward or back in the cycle with page-up/page-down or
right/middle mouse button. The pick cycle and the current pick can be
cleared by clicking in empty space or by hiting escape.
The selection
is an arbitrary ordered set of model entities
currently identified by the user. It is distinct from the pick, but several
conveniences are included to add/remove the current pick to/from the
selection (hit s or C-click to toggle selection of current pick). The
selection
is cleared by hitting C-escape.
The pick and selection mechanisms include several further features, enabled or disabled by flags
Display.clearPickCycleOnNav
, Display.clearPickOnNav
-
whether to clear the current pick cycle when the viewpoint changes, and if
so, whether to also clear the current pick itself, or just the remainder of
the cycleDisplay.maskPickCycleCompliment
, Display.maskPickCompliment
- whether to mask entities that are not in (or
part of an entity in) the pick cycle (and/or just not the current pick)Display.maskPickOccluding
- whether to mask entities in the pick
cycle that are nearer than the current pick to the viewer's location at the
time the pick cycle was generated (which will be the same as the viewer's
current location as long as the viewpoint hasn't changed)Display.highlightSelection
, Display.maskSelectionCompliment
- whether to highlight entities that are in
(or part of an entity in) the current selection, and similarly whether to
mask entities that are not in (and not part of an entity in) the current
selectionmaskLinkagesBeyondThreshold
, maskLinkageThreshold
-
whether to mask all nodes in linkages beyond the given threshold distant
from the current picked linkage if anydumpPickAndSelectionOnChange
- whether to dump brief info
identifying changes to the pick and selection as they happen
Display.setRotationCenterToPickedNodeOrigin
- whether to set the
navigation rotation center to the origin of the canonical coordinate frame
of the current picked LinkageNode
, or that of the node that contains
the current pick entity, if it is not a LinkageNode
.autoManipulateJoints
- whether to automatically begin
manipulating Joint
s when they are picked.autoManipulateLinks
- whether to automatically begin
manipulating Link
pose when a Link
is picked.autoManipulateWidgets
- whether to automatically begin
manipulating user Widget
pose when a Widget
is picked.By default, keyboard arrow key and mouse actions in the Display
navigate the viewpoint. Hitting "m" with a current pick, picking a Joint
with autoManipulateJoints
, or calling manipulateJoint(Joint, int)
or one of the related APIs disables navigation
and enters manipulation mode (hit spacebar to temporarily toggle back and
forth from manipulation to navigation). In manipulation the same keyboard
and mouse actions that were used for navigation instead control the mobility
transform of the indicated Joint
, or the parent Joint
if the
currently picked node is a Link
. The actual set of possible motions
will be constrained according to the degrees of freedom of the selected
Joint
; the on-line help, displayed by hitting "h", will enumerate
the exact mapping from keyboard and mouse actions to motion of the selected
joint.
The Joint.RX_MOBILITY
transform is manipulated by default for
open-chain tree joints; Joint.RX_TARGET
is the default for unlocked
chain closures and unlocked tree joints supporting constrained chain
closures, and Joint.RX_LOCK
is the default for locked connected
chain closures. You can override the default and explicitly request to
manipulate Joint.RX_TARGET
or Joint.RX_POSTURE
by hitting
"A-m" or "S-m" respectively.
Hit "C-m" to manipulate the local pose of the picked node with respect to
its parent node. See manipulatePickedNodeLocalPose()
for
details.
Manipulation can also be initiated by hitting "p" with a current pick or
by calling manipulateLink(Link)
or one of the related APIs.
This manipulates Link
pose via the RootJoint
of the picked
Link
, or that of the parent Link
if the currently picked
node is a Joint
.
Clear the pick, hit escape, or call stopManipulating(boolean)
to
end manipulation and return to navigation.
Copyright (C) 2008 Marsette A. Vona, III
Modifier and Type | Class and Description |
---|---|
protected class |
UI.MSimActionMap
adds some specializations for MSim
|
class |
UI.Pick<T>
Represents a picked entity and the nearest pick intersection.
|
protected static class |
UI.QueuedAction
queued action for
actionMapper |
protected static class |
UI.SliderTarget
possible targets for 1234567890 slider actions
|
Modifier and Type | Field and Description |
---|---|
vona.ui.ActionMapper |
actionMapper
Manages
vona.ui.ActionMapper.Action s that handle user
input. |
protected java.util.List<UI.QueuedAction> |
actionQueue
queued actions for
actionMapper |
protected boolean |
altDownAtLastPick
state of indicated modifier at time of last pick
|
static boolean |
alwaysDumpNodePath
enable for indicated option
|
boolean |
alwaysManipulateLinkGlobalPose
enable for indicated option
|
boolean |
autoManipulateJoints
enable for indicated option
|
boolean |
autoManipulateLinks
enable for indicated option
|
boolean |
autoManipulateLockedNodes
enable for indicated option
|
boolean |
autoManipulateWidgets
enable for indicated option
|
UI.MSimActionMap |
baseActionMap
actions to handle base-case user input
|
boolean |
clickAndDragLinks
enable for indicated option
|
UI.MSimActionMap |
consJointActionMap
actions for cons joint mode
|
UI.MSimActionMap |
consWidgetActionMap
actions for cons widget mode
|
private static java.lang.String |
cvsid |
static int |
DEF_DISPLAY_HEIGHT
default graphics display height
|
static int |
DEF_DISPLAY_WIDTH
default graphics display width
|
static java.io.InputStream |
defaultJSchemeInput
default JScheme input stream
|
static java.io.OutputStream |
defaultJSchemeOutput
default JScheme output stream
|
Display |
display
the display, or null if none
|
boolean |
dumpPickAndSelectionOnChange
enable for indicated option
|
protected java.awt.Frame |
frame
our frame, iff run as an application
|
static java.lang.String |
HELP_MESSAGE
help message
|
static java.lang.String |
HOME_URL
application home URL
|
static java.lang.String |
INITIAL_FORMS_MESSAGE
inform user we're running initial forms
|
protected interact.Interactor |
interactor
JScheme interactor, if any
|
protected javax.swing.JFrame |
interactorFrame
JScheme interactor frame, if any
|
static java.lang.String |
JP_MSIM_LINK_MANIPULATOR
marks a joint as created by
getLinkManipulationJoint(msim.model.Link) |
jscheme.JScheme |
js
the JScheme interpreter, or null if none
|
static java.lang.String |
JS_API
scheme bindings for the api
|
static java.lang.String |
JS_EXTRA
scheme bindings for the extra stuff
|
static java.lang.String |
JS_INIT
initialization script loaded before all other scripts on cmd line
|
static java.lang.String |
JS_PROMPT
JScheme REPL prompt
|
java.io.InputStream |
jsInput
the JScheme interpreter input stream, or null if none
|
java.io.OutputStream |
jsOutput
the JScheme interpreter output stream, or null if none
|
int |
linkManipulationJointPriority |
float |
linkManipulationJointWeight |
UI.MSimActionMap |
manipulationActionMap
actions to handle manipulation user input
|
InteractorDriver |
manipulationDriver
the driver for
Joint manipulation |
vona.ui.RXSInteractor |
manipulationInteractor
the interactor for
Joint manipulation |
boolean |
maskLinkagesBeyondThreshold
enable for indicated option
|
protected int |
maskLinkageThreshold
Linkage.distanceToPickedLinkage threshold beyond which linkages
are masked. |
vona.ui.RXSInteractor |
navigationInteractor
the navigation interactor, or null if none
|
protected boolean |
persistManipulatedGoal
Whether to persist the manip goal when stopping manip that started by a
pick.
|
protected vona.ui.ActionMapper.Action |
pickAction
the pick action
|
protected java.util.List<UI.Pick<?>> |
pickCycle
Current set of picked
LinkageNode , Widget , Geometry , and LinkageNode.SubFrame , sorted in order of
increasing intersection distance. |
protected int |
pickIndex
Index of the currently picked entity in
pickCycle , or negative
if none. |
protected java.util.Map<java.lang.Object,UI.Pick<?>> |
pickMap
Mapping from
LinkageNode , Widget , Geometry , or
LinkageNode.SubFrame to its corresponding UI.Pick , if any. |
protected boolean |
pickPending
Indicates that the pick segment has been set but the render-based pick
computations are still not complete.
|
protected java.lang.Thread |
replThread
the thread running the REPL for
js , if any |
protected java.util.Set<java.lang.Object> |
selection
The current set of selected
LinkageNode s, Widget s,
Geometry s, and LinkageNode.SubFrame s, in
insertion order. |
protected boolean |
shiftDownAtLastPick
state of indicated modifier at time of last pick
|
static float |
SLIDER_HIGHLIGHT_FACTOR_SCALE
scale for
UI.SliderTarget.ST_HIGHLIGHT |
protected UI.MSimActionMap |
sliderActionMap
Implements
UI.SliderTarget.ST_HIGHLIGHT and UI.SliderTarget.ST_MASK . |
protected UI.SliderTarget |
sliderTarget
current target for 1234567890 slider actions
|
static java.lang.String |
STARTUP_MESSAGE
startup message
|
protected boolean |
togglePickInSelectionPending
Whether to add or remove the new pick from the selection at the end of
the next frame with picking.
|
UI.MSimActionMap |
userActionMap
actions to handle user-specified user input
|
WidgetInteractor |
widgetInteractor
the interactor for
Widget manipulation |
Constructor and Description |
---|
UI()
|
UI(boolean withDisplay,
boolean withJScheme)
|
UI(boolean withDisplay,
boolean withJScheme,
java.io.InputStream jschemeInput,
java.io.OutputStream jschemeOutput)
Create a new UI.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
addJointInteractive(Joint joint)
addJointInteractive(Link, Link, Joint, boolean) , get parent
and child from pick and/or selection, no rotX. |
java.lang.String |
addJointInteractive(Joint joint,
boolean rotX)
addJointInteractive(Link, Link, Joint, boolean) , get parent
and child from pick and/or selection. |
java.lang.String |
addJointInteractive(Link parent,
Joint joint)
addJointInteractive(Link, Link, Joint, boolean) , get child
from pick or selection, no rotX. |
java.lang.String |
addJointInteractive(Link parent,
Joint joint,
boolean rotX)
addJointInteractive(Link, Link, Joint, boolean) , get child
from pick or selection. |
java.lang.String |
addJointInteractive(Link parent,
Link child,
Joint joint)
|
java.lang.String |
addJointInteractive(Link parent,
Link child,
Joint joint,
boolean rotX)
Attach joint to the indicated nodes.
|
java.lang.String |
addWidgetInteractive(LinkageNode parent,
java.lang.String name,
java.lang.String frame,
vona.j3d.Widget widget)
|
java.lang.String |
addWidgetInteractive(LinkageNode parent,
java.lang.String name,
java.lang.String frame,
vona.j3d.Widget widget,
boolean rotX)
Add widget to the indicated parent node.
|
java.lang.String |
addWidgetInteractive(LinkageNode parent,
vona.j3d.Widget widget)
addWidgetInteractive(LinkageNode, String, String, Widget,
boolean) , default name and frame, no rotX. |
java.lang.String |
addWidgetInteractive(LinkageNode parent,
vona.j3d.Widget widget,
boolean rotX)
addWidgetInteractive(LinkageNode, String, String, Widget,
boolean) , default name and frame. |
java.lang.String |
addWidgetInteractive(java.lang.String type)
addWidgetInteractive(LinkageNode, String, String, Widget,
boolean) , to currently picked node or ground link, default name and
frame, no rotX. |
java.lang.String |
addWidgetInteractive(vona.j3d.Widget widget)
addWidgetInteractive(LinkageNode, String, String, Widget,
boolean) , to currently picked node or ground link, default name and
frame, no rotX. |
java.lang.String |
addWidgetInteractive(vona.j3d.Widget widget,
boolean rotX)
addWidgetInteractive(LinkageNode, String, String, Widget,
boolean) , to currently picked node or ground link, default name and
frame. |
void |
appletDestroy(java.applet.Applet applet)
Aplet destroy method.
|
void |
appletMain()
applet main method, see also
applicationMain() |
void |
applicationMain()
application main method, see also
appletMain() |
void |
clearPick()
clearPick(boolean, boolean) , including current, and fire
pickChanged(boolean, boolean, boolean) . |
protected void |
clearPick(boolean exceptCurrent,
boolean firePickChanged)
Clear the current pick.
|
int |
clearSelection()
clear
selection |
protected void |
configureFrame(java.awt.Frame frame)
configure a GUI toplevel
|
void |
consJointInteractive()
Conses a new joint and
addJointInteractive(Link, Link, Joint,
boolean) in the current pick context via consJointActionMap . |
Linkage |
consLinkageInteractive(Linkage.Disposition disposition)
|
Linkage |
consLinkageInteractive(Linkage.Disposition disposition,
java.lang.String name)
Cons and add a new
Linkage l in-context depending on the
current pick. |
Link |
consLinkInteractive()
Cons and add a new
Link l in-context depending on the
current pick. |
protected void |
consoleREPL(java.lang.String initialForms)
Run the
js REPL on the console. |
void |
consWidgetInteractive()
Conses a new widget and
addWidgetInteractive(LinkageNode,
String, String, Widget, boolean) in the current pick context via consWidgetActionMap . |
void |
cullPickAndSelection()
Go through the pick and selection data structures and cull out any
entities which are no longer in the model or which are no longer
visible.
|
void |
cycleAxesVisibility()
cycle axes widget visibility
|
void |
cycleClassVisiblity(EntityClass c)
cycle visibility of all entities of
EntityClass c |
void |
cycleIndividuallyPickOnly()
Cycle among various combinations of individually picking
EntityClass.NODES , EntityClass.SUBFRAMES , EntityClass.WIDGETS , and EntityClass.GEOMETRIES . |
void |
cycleManipulationFrame()
cycle the manipulation frame
|
void |
cycleMobilityWidgetVisibility()
cycle joint mobility widget visibility
|
void |
cycleRouteWidgetVisibility()
cycle route widget visibility
|
void |
cycleUserLinkWidgetVisibility()
cycle user link widget visibility
|
void |
decrementMaskLinkageThreshold()
decrement
maskLinkageThreshold |
int |
deselect(java.lang.Object... entities)
Remove entities from the selection, iff present.
|
boolean |
deselectPick()
Covers
deselectPick(boolean, boolean) , only deselects current
pick entity. |
int |
deselectPick(boolean andDescendantNodes,
boolean andAncestorNodes)
Remove the current pick entity, if any, from
selection . |
void |
disconnectPickedJointFromChild()
Null the child link of the current picked node iff it's a
Joint . |
void |
disconnectPickedJointFromParent()
Null the parent link of the current picked node iff it's a
Joint . |
static void |
dumpDetails(java.lang.Object entity)
dumpDetails(Object, PrintStream) to System.out |
static void |
dumpDetails(java.lang.Object entity,
java.io.PrintStream s)
dump details of entity
|
void |
dumpHelp()
dumpHelp(PrintStream, boolean) to System.out with keybindings |
void |
dumpHelp(boolean showKeybindings)
dumpHelp(PrintStream, boolean) to System.out |
void |
dumpHelp(java.io.PrintStream s,
boolean showKeybindings)
dumps help text
|
static void |
dumpPathAndClass(java.lang.Object entity)
Covers
dumpPathAndClass(Object, boolean, boolean, boolean,
PrintStream) , dumps both path and class with newline to System.out. |
static void |
dumpPathAndClass(java.lang.Object entity,
boolean dumpPath,
boolean dumpEntityClass)
Covers
dumpPathAndClass(Object, boolean, boolean, boolean,
PrintStream) , dumps with newline to System.out. |
static void |
dumpPathAndClass(java.lang.Object entity,
boolean dumpPath,
boolean dumpEntityClass,
boolean withNewline)
Covers
dumpPathAndClass(Object, boolean, boolean, boolean,
PrintStream) , dumps to System.out. |
static void |
dumpPathAndClass(java.lang.Object entity,
boolean dumpPath,
boolean dumpEntityClass,
boolean withNewline,
java.io.PrintStream s)
Dump the full path and/or display entity class of entity.
|
static void |
dumpPathOf(javax.media.j3d.Geometry geometry)
dumpPathOf(Geometry, PrintStream) , to System.out |
static void |
dumpPathOf(javax.media.j3d.Geometry geometry,
java.io.PrintStream s)
dumpPathOf(Widget, PrintStream) on containing widget, if any,
then dump index of geometry. |
static void |
dumpPathOf(LinkageNode.SubFrame subFrame)
dumpPathOf(msim.model.LinkageNode.SubFrame, PrintStream) , to
System.out |
static void |
dumpPathOf(LinkageNode.SubFrame subFrame,
java.io.PrintStream s)
dumpPathOf(LinkageNode, PrintStream) on containing node, if
any, then dump subframe name if any. |
static void |
dumpPathOf(LinkageNode node)
dumpPathOf(LinkageNode, PrintStream) , to System.out |
static void |
dumpPathOf(LinkageNode node,
java.io.PrintStream s)
Path.dumpPathOf(LinkageNode, PrintStream) if alwaysDumpNodePath , else dump node name. |
static void |
dumpPathOf(vona.j3d.Widget widget)
dumpPathOf(Widget, PrintStream) , to System.out |
static void |
dumpPathOf(vona.j3d.Widget widget,
java.io.PrintStream s)
dumpPathOf(LinkageNode, PrintStream) on containing node, if
any, then dump widget name if any. |
void |
dumpPick()
Covers
dumpPick(boolean, boolean, boolean, PrintStream) , dumps
path only to System.out. |
void |
dumpPick(boolean dumpEntityClass,
boolean dumpIndex,
boolean dumpDetails)
Covers
dumpPick(boolean, boolean, boolean, PrintStream) , dumps
to System.out. |
void |
dumpPick(boolean dumpEntityClass,
boolean dumpIndex,
boolean dumpDetails,
java.io.PrintStream s)
Dump information about the current pick, if any.
|
void |
dumpPickDetails()
Covers
dumpPick(boolean, boolean, boolean, PrintStream) , dumps
everything to System.out. |
java.lang.String |
getAcknowledgementsMessage()
get the acknowledgements message, if any
|
java.lang.String |
getAppletInitialForms()
initial scheme forms to eval at end of init in applet context
|
java.lang.String |
getApplicationInitialForms()
scheme forms to eval at end of init in application context
|
java.lang.String |
getBanner()
message to display before the first JScheme prompt
|
java.lang.String |
getBanner(boolean hasInitialForms)
Appends a note about running initial forms to
getBanner() , iff necessary. |
java.lang.String |
getDocMessage()
get the doc message
|
java.lang.String |
getDocURL()
get the doc URL
|
java.awt.Frame |
getFrame()
Get the Frame containing the display, if any.
|
java.lang.String |
getHelpMessage()
get the help message
|
java.lang.String |
getHomeURL()
get the home URL
|
java.lang.String |
getInitialFormsMessage()
get the message to inform the user we're running initial forms
|
java.lang.String |
getJSchemePrompt()
JScheme interpreter prompt to use
|
protected Joint |
getLinkManipulationJoint(Link link)
Called by
manipulateLink(Link, boolean) to get (or generate) a
Joint appropriate for manipulating link. |
int |
getMaskLinkageThreshold()
|
int |
getNumSelected()
get the number of entities in the
selection |
int |
getNumSelectedOrPicked()
Get the number of entities in the
selection , plus one if there
is a current pick. |
java.util.List<LinkageNode> |
getPickComplimentNodes()
Covers
getPickComplimentNodes(Collection) , always conses. |
java.util.Collection<LinkageNode> |
getPickComplimentNodes(java.util.Collection<LinkageNode> c)
Collect all
LinkageNode s in that are not the current pick. |
java.util.List<LinkageNode> |
getPickCycleComplimentNodes()
covers
getPickCycleComplimentNodes(List) , always conses |
java.util.List<LinkageNode> |
getPickCycleComplimentNodes(java.util.List<LinkageNode> l)
Collect all
LinkageNode s that are not curently in the pickCycle . |
java.lang.Object |
getPickedEntity()
getPickedEntity(boolean) , null ok |
java.lang.Object |
getPickedEntity(boolean nullOk)
|
javax.media.j3d.Geometry |
getPickedGeometry()
getPickedGeometry(boolean) , null ok |
javax.media.j3d.Geometry |
getPickedGeometry(boolean nullOk)
Return the
Geometry that is the current pick entity, if any. |
Joint |
getPickedJoint()
getPickedJoint(boolean) , null ok |
Joint |
getPickedJoint(boolean nullOk)
covers
getPickedNode(boolean) , returns null if not a Joint |
Link |
getPickedLink()
getPickedLink(boolean) , null ok |
Link |
getPickedLink(boolean nullOk)
covers
getPickedNode(boolean) , returns null if not a Link |
Linkage |
getPickedLinkage()
getPickedLinkage(boolean) , does not default to top-level |
Linkage |
getPickedLinkage(boolean defaultToTopLevel)
Get the
Linkage containing the node containing the current
pick, if any, else null. |
LinkageNode |
getPickedNode()
getPickedNode(boolean) , null ok |
LinkageNode |
getPickedNode(boolean nullOk)
Return the
LinkageNode that is or contains the current pick
entity, if any. |
LinkageNode.SubFrame |
getPickedSubFrame()
getPickedSubFrame(boolean) , null ok |
LinkageNode.SubFrame |
getPickedSubFrame(boolean nullOk)
Return the
LinkageNode.SubFrame that is or contains
the current pick entity, if any. |
vona.j3d.Widget |
getPickedWidget()
getPickedWidget(boolean) , null ok |
vona.j3d.Widget |
getPickedWidget(boolean nullOk)
Return the
Widget that is or contains the current pick
entity, if any. |
java.util.List<java.lang.Object> |
getSelection()
covers
getSelection(Collection) , always conses |
java.util.Collection<java.lang.Object> |
getSelection(java.util.Collection<java.lang.Object> c)
get a copy of the current
selection |
java.util.List<LinkageNode> |
getSelectionComplimentNodes()
Covers
getSelectionComplimentNodes(Collection) , always
conses. |
java.util.Collection<LinkageNode> |
getSelectionComplimentNodes(java.util.Collection<LinkageNode> c)
Collect all
LinkageNode s that are not curently in the selection . |
java.util.List<LinkageNode> |
getSelectionNodes()
Covers
getSelectionNodes(Collection) , always conses. |
java.util.Collection<LinkageNode> |
getSelectionNodes(java.util.Collection<LinkageNode> c)
get a copy of the current
LinkageNode s in selection |
java.lang.String |
getStartupMessage()
get the startup message, if any
|
java.lang.Object |
getTypedPickedEntity(EntityClass c)
|
java.lang.Object |
getTypedPickedEntity(EntityClass c,
boolean nullOk)
Return the Geometry,
Widget , or LinkageNode that is or
contains the current pick iff its most specific entity class is
c. |
java.lang.Object[] |
getTypedSelection(boolean includePick,
boolean nullOk,
EntityClass... types)
|
java.lang.Object[] |
getTypedSelection(boolean includePick,
boolean nullOk,
java.lang.Object[] ret,
EntityClass... types)
Check if the sequence of entities in the current
selection ,
plus optionally the current pick, matches the given sequence of
types, and if so, return an array of references to the
sequence. |
void |
incrementMaskLinkageThreshold()
increment
maskLinkageThreshold |
void |
individuallyPickOnly(EntityClass c)
Disable individual pickability for all entity classes except
c.
|
protected void |
initPickCycle()
|
protected void |
interactorREPL(java.lang.String initialForms)
|
void |
invertPickedJoint()
Joint.invert() the current picked node iff it's a Joint . |
protected boolean |
isEntityLive(java.lang.Object entity)
If entity is a
LinkageNode , check if it present in the
model. |
protected boolean |
isEntityVisible(java.lang.Object entity)
check if entity is currently visible
|
boolean |
isManipulating()
check if manipulation is ongoing
|
boolean |
loadJSchemeFile(java.lang.String filename)
Load a script from file iff
js is not null. |
boolean |
loadJSchemeFileFromResource(java.lang.Class clazz,
java.lang.String resourcePath)
|
void |
loadJSchemeFiles()
|
void |
loadMSimJSchemeFiles()
(Re)load all JScheme files in MSim.
|
void |
loadVonaJSchemeFiles()
(Re)load all JScheme files in Vona lib.
|
protected Display |
makeDisplay()
make the
Display |
protected jscheme.JScheme |
makeJScheme()
make the JScheme interpreter
|
void |
makePickedJointClosure()
Joint.makeClosureJoint() the current picked node iff it's a Joint . |
void |
makePickedJointTree()
Joint.makeTreeJoint() the current picked node iff it's a Joint . |
void |
makePickedLinkGround()
Link.makeGroundLink() the current picked node iff it's a Link . |
void |
makePickedLinkRoot()
Link.makeRootLink() the current picked node iff it's a Link . |
void |
manipulateJoint(Joint joint)
manipulateJoint(Joint, int, int, boolean) automatically
selecting slackID, requesting manipulation of sub-transform
Joint.RX_MOBILITY , and always driving full goal. |
void |
manipulateJoint(Joint joint,
boolean driveFullGoal)
manipulateJoint(Joint, int, int, boolean) automatically
selecting slackID and requesting manipulation of sub-transform
Joint.RX_MOBILITY . |
void |
manipulateJoint(Joint joint,
int xformID)
manipulateJoint(Joint, int, int, boolean) , automatially
selecting slackID and driving full goal. |
void |
manipulateJoint(Joint joint,
int xformID,
boolean driveFullGoal)
manipulateJoint(Joint, int, int, boolean) , automatially
selecting slackID. |
void |
manipulateJoint(Joint joint,
int xformID,
int slackID)
manipulateJoint(Joint, int, int, boolean) , always drives full
goal. |
void |
manipulateJoint(Joint joint,
int xformID,
int slackID,
boolean driveFullGoal)
Start manipulating a particular
Joint sub-transform. |
void |
manipulateLink(Link link)
manipulateLink(Link, boolean) , always drives full goal. |
void |
manipulateLink(Link link,
boolean driveFullGoal)
|
void |
manipulatePickedEntity()
|
void |
manipulatePickedJoint()
manipulatePickedJoint(int) sub-transform Joint.RX_MOBILITY . |
void |
manipulatePickedJoint(int xformID)
manipulateJoint(Joint, int) with the currently picked LinkageNode (see getPickedNode(boolean) ) if it's a Joint , or the
parent Joint if the currently picked node is a Link . |
void |
manipulatePickedLink()
manipulateLink(Link) with the currently picked LinkageNode (see getPickedNode(boolean) ) if it's a Link , or the
parent Link if the currently picked node is a Joint . |
void |
manipulatePickedNode(int xformID)
manipulateLink(Link) with the currently picked LinkageNode n (see getPickedNode(boolean) ) if it's a Link ,
or manipulateJoint(Joint, int) if n is a Joint . |
void |
manipulatePickedNodeLocalPose()
Manipulate a transform that controls the pose of the picked node
relative to its tree parent.
|
void |
manipulatePickedWidget()
manipulateWidget(vona.j3d.Widget) with the currently picked Widget , if
any, and iff it's a user widget. |
void |
manipulateWidget(vona.j3d.Widget widget)
Start manipulating a particular
Widget pose with respect to its
attachment. |
void |
markDistanceToPickedLinkage()
Compute and set
Linkage.distanceToPickedLinkage for every
linkage in the model tree by recursive DFS. |
protected void |
markDistanceToPickedLinkage(Linkage fromLinkage,
Linkage pickedLinkage)
impl of
markDistanceToPickedLinkage() |
void |
mergePickedJoint()
Joint.merge() the current picked node iff it's a Joint . |
void |
navigateToViewPickedNode()
navigateToViewPickedNode(boolean) , does not set default |
void |
navigateToViewPickedNode(boolean setDefault)
Display.navigateToView(LinkageNode, String, boolean, boolean,
boolean) the canonical subframe of the current picked node, if any. |
protected void |
pickChanged()
Called when the current
pickIndex has changed. |
protected void |
pickChanged(boolean enableManipulation,
boolean enableDump,
boolean enableRotationCenter)
Impl of
pickChanged() with gating enables for the various
subtasks. |
java.lang.Object |
pickNextInCycle()
Advance the current pick to the next entity in the current
pickCycle , i.e. |
java.lang.Object |
pickPrevInCycle()
Advance the current pick to the previous entity in the current
pickCycle , i.e. |
java.lang.Object |
removePickedEntity()
removePickedEntity(boolean) , does not remove parent |
java.lang.Object |
removePickedEntity(boolean removeParent)
Remove the picked entity, if any.
|
boolean |
restoreManipulation(boolean jump)
Restore any ongoing manipulation to its original state.
|
protected void |
runQueuedActions()
run everything in
actionQueue |
int |
select(boolean only,
java.lang.Object... entities)
Add entities to the selection, in order, iff not already
present.
|
int |
select(java.lang.Object... entities)
covers
select(boolean, Object...) , adds to existing selection |
protected void |
selectionChanged()
called when the current
selection has changed |
boolean |
selectPick()
Covers
selectPick(boolean, boolean, boolean) , adds current
pick entity to selection. |
int |
selectPick(boolean only,
boolean andDescendantNodes,
boolean andAncestorNodes)
Add the current pick entity, if any, to
selection . |
void |
setJSGlobal(java.lang.String name,
java.lang.Object value)
Bind a global JScheme value.
|
void |
setJSGlobals()
Bind global JScheme values.
|
void |
setMaskLinkageThreshold(int threshold)
|
<T> void |
setPick(T entity)
setPick(Object, float) , sets u to NaN |
<T> void |
setPick(T entity,
float u)
|
protected <T> void |
setPick(T entity,
float u,
boolean firePickChanged)
Impl of
setPick(Object, float) . |
void |
setPickedJointChildToSelectedLink()
setPickedJointChildToSelectedLink(boolean) , don't hold
absolute pose. |
void |
setPickedJointChildToSelectedLink(boolean holdAbsolutePose)
Set the child of the current picked node iff it's a
Joint . |
void |
setPickedJointChildToSelectedSubFrame()
setPickedJointChildToSelectedSubFrame(boolean) , don't hold
absolute pose. |
void |
setPickedJointChildToSelectedSubFrame(boolean holdAbsolutePose)
Set the child of the current picked node iff it's a
Joint . |
void |
setPickedJointParentToSelectedLink()
setPickedJointParentToSelectedLink(boolean) , don't hold
absolute pose. |
void |
setPickedJointParentToSelectedLink(boolean holdAbsolutePose)
Set the parent of the current picked node iff it's a
Joint . |
void |
setPickedJointParentToSelectedSubFrame()
setPickedJointParentToSelectedSubFrame(boolean) , don't hold
absolute pose. |
void |
setPickedJointParentToSelectedSubFrame(boolean holdAbsolutePose)
Set the parent of the current picked node iff it's a
Joint . |
void |
setPickedNodeSoftGoalToMobility(int xformID)
Joint.setSoftGoalToMobility(int) with the currently picked
LinkageNode n (see getPickedNode(boolean) ) if it's a Joint , or with the root joint if n is a Link . |
void |
splitPickedLink()
Link.split() the current picked node n iff it's a Link . |
void |
stopManipulating()
stopManipulating(boolean) and unset the goal, if any |
void |
stopManipulating(boolean unsetGoal)
End any ongoing manipulation.
|
void |
toggleDriveFullGoal()
toggle whether to drive all DoF while manipulating
|
void |
toggleIndividuallyPickable(EntityClass c)
Toggle individual pickability for entity class c.
|
void |
toggleNavigateWhileManipulating()
Enter or exit navigation while a manipulation is ongoing.
|
void |
togglePickedNodeLock()
toggle the lock state of the picked node, if any
|
boolean |
togglePickInSelection()
Select/deselect the current pick.
|
void |
toggleRouteConeWidgetVisibility()
toggle route cone widget visibility
|
void |
toggleSolveParameter(java.lang.String name)
|
private static final java.lang.String cvsid
public static final java.lang.String HELP_MESSAGE
public static final java.lang.String STARTUP_MESSAGE
public static final java.lang.String INITIAL_FORMS_MESSAGE
public static final int DEF_DISPLAY_WIDTH
public static final int DEF_DISPLAY_HEIGHT
public static final java.lang.String JS_INIT
public static final java.lang.String JS_PROMPT
public static final java.lang.String HOME_URL
public static final java.lang.String JS_API
public static final java.lang.String JS_EXTRA
public static final float SLIDER_HIGHLIGHT_FACTOR_SCALE
UI.SliderTarget.ST_HIGHLIGHT
public static final java.lang.String JP_MSIM_LINK_MANIPULATOR
getLinkManipulationJoint(msim.model.Link)
public final Display display
public final vona.ui.RXSInteractor navigationInteractor
public final jscheme.JScheme js
public final java.io.InputStream jsInput
public final java.io.OutputStream jsOutput
public final InteractorDriver manipulationDriver
Joint
manipulationpublic final vona.ui.RXSInteractor manipulationInteractor
Joint
manipulationpublic final WidgetInteractor widgetInteractor
Widget
manipulationpublic static java.io.InputStream defaultJSchemeInput
public static java.io.OutputStream defaultJSchemeOutput
public volatile boolean autoManipulateJoints
public volatile boolean autoManipulateLinks
public volatile boolean autoManipulateWidgets
public volatile boolean autoManipulateLockedNodes
public volatile boolean maskLinkagesBeyondThreshold
public static volatile boolean alwaysDumpNodePath
public volatile boolean clickAndDragLinks
public volatile boolean alwaysManipulateLinkGlobalPose
public volatile int linkManipulationJointPriority
public volatile float linkManipulationJointWeight
protected volatile java.awt.Frame frame
protected java.lang.Thread replThread
js
, if anyprotected interact.Interactor interactor
protected javax.swing.JFrame interactorFrame
protected int maskLinkageThreshold
Linkage.distanceToPickedLinkage
threshold beyond which linkages
are masked.
protected final java.util.Map<java.lang.Object,UI.Pick<?>> pickMap
Mapping from LinkageNode
, Widget
, Geometry
, or
LinkageNode.SubFrame
to its corresponding UI.Pick
, if any.
Insertion ordered, which corresponds to render order. The contents are
later copied to pickCycle
, which is then reversed and then stably
sorted in increasing distance from the viewer. This is so that coincident
objects will remain in reverse render order, which is important because
this means the default pick will always be on top.
protected final java.util.List<UI.Pick<?>> pickCycle
Current set of picked LinkageNode
, Widget
, Geometry
, and LinkageNode.SubFrame
, sorted in order of
increasing intersection distance.
This is a linked list to support efficient element removal in cullPickAndSelection()
.
protected volatile int pickIndex
Index of the currently picked entity in pickCycle
, or negative
if none.
public volatile boolean dumpPickAndSelectionOnChange
protected volatile boolean togglePickInSelectionPending
Whether to add or remove the new pick from the selection at the end of the next frame with picking.
protected volatile boolean pickPending
Indicates that the pick segment has been set but the render-based pick computations are still not complete.
protected volatile vona.ui.ActionMapper.Action pickAction
protected volatile boolean altDownAtLastPick
protected volatile boolean shiftDownAtLastPick
protected volatile boolean persistManipulatedGoal
Whether to persist the manip goal when stopping manip that started by a pick.
protected final java.util.Set<java.lang.Object> selection
The current set of selected LinkageNode
s, Widget
s,
Geometry
s, and LinkageNode.SubFrame
s, in
insertion order.
protected final java.util.List<UI.QueuedAction> actionQueue
actionMapper
public final vona.ui.ActionMapper actionMapper
Manages vona.ui.ActionMapper.Action
s that handle user
input.
This extends ActionMapper
to queue actions while pickPending
; they will be run after the pick has completed, working
around the issue that the action that initiates a pick may be followed by
actions that depend on the new pick, but the new pick will not be computed
until the end of the next render.
public final UI.MSimActionMap userActionMap
public final UI.MSimActionMap consWidgetActionMap
public final UI.MSimActionMap consJointActionMap
public final UI.MSimActionMap manipulationActionMap
public final UI.MSimActionMap baseActionMap
protected volatile UI.SliderTarget sliderTarget
protected final UI.MSimActionMap sliderActionMap
Implements UI.SliderTarget.ST_HIGHLIGHT
and UI.SliderTarget.ST_MASK
.
public UI(boolean withDisplay, boolean withJScheme, java.io.InputStream jschemeInput, java.io.OutputStream jschemeOutput)
Create a new UI.
withDisplay
- whether to create a graphical display with makeDisplay()
withJScheme
- whether to create a JScheme interpreter with makeJScheme()
jschemeInput
- the input stream for the JScheme interpreter, null to
use defaultJSchemeInput
jschemeOutput
- the output stream for the JScheme interpreter, null to
use defaultJSchemeOutput
public UI(boolean withDisplay, boolean withJScheme)
Covers UI(boolean, boolean, InputStream, OutputStream)
.
Attaches JScheme to defaultJSchemeInput
and defaultJSchemeOutput
.
public UI()
Covers UI(boolean, boolean, InputStream, OutputStream)
.
Enables display and JScheme, attaches JScheme to defaultJSchemeInput
and defaultJSchemeOutput
.
protected void runQueuedActions()
actionQueue
public java.lang.String getHomeURL()
public java.lang.String getDocURL()
public java.lang.String getDocMessage()
public java.lang.String getHelpMessage()
public java.lang.String getStartupMessage()
public java.lang.String getAcknowledgementsMessage()
public java.lang.String getBanner()
public java.lang.String getBanner(boolean hasInitialForms)
Appends a note about running initial forms to getBanner()
, iff necessary.
hasInitialForms
- whether there are initial formspublic java.lang.String getInitialFormsMessage()
public void applicationMain()
appletMain()
public void appletMain()
applicationMain()
public void appletDestroy(java.applet.Applet applet)
Aplet destroy method.
Default impl terminates the js
REPL, if any.
public java.awt.Frame getFrame()
protected void configureFrame(java.awt.Frame frame)
public java.lang.String getJSchemePrompt()
public java.lang.String getApplicationInitialForms()
public java.lang.String getAppletInitialForms()
public void loadJSchemeFiles()
public void loadVonaJSchemeFiles()
(Re)load all JScheme files in Vona lib.
public void loadMSimJSchemeFiles()
(Re)load all JScheme files in MSim.
public boolean loadJSchemeFileFromResource(java.lang.Class clazz, java.lang.String resourcePath)
resourcePath
- the name of the resource (i.e. the name of a scheme
file in the same package as this class)public boolean loadJSchemeFile(java.lang.String filename)
Load a script from file iff js
is not null.
filename
- the name of the fileprotected jscheme.JScheme makeJScheme()
public void setJSGlobal(java.lang.String name, java.lang.Object value)
Bind a global JScheme value.
Does nothing if js
is null.
public void setJSGlobals()
Bind global JScheme values.
Does nothing if js
is null.
protected void consoleREPL(java.lang.String initialForms)
initialForms
- the initial scheme forms to eval or nullprotected void interactorREPL(java.lang.String initialForms)
Run the js
REPL in a JScheme interactor
in its own
interactorFrame
.
initialForms
- the initial scheme forms to eval or nullpublic void individuallyPickOnly(EntityClass c)
Disable individual pickability for all entity classes except c.
This does not affect the current pick, pick cycle, or selection, if any.
public void cycleIndividuallyPickOnly()
Cycle among various combinations of individually picking EntityClass.NODES
, EntityClass.SUBFRAMES
, EntityClass.WIDGETS
, and EntityClass.GEOMETRIES
.
public void toggleIndividuallyPickable(EntityClass c)
Toggle individual pickability for entity class c.
This does not affect the current pick, pick cycle, or selection, if any.
protected void clearPick(boolean exceptCurrent, boolean firePickChanged)
Clear the current pick.
public void clearPick()
clearPick(boolean, boolean)
, including current, and fire
pickChanged(boolean, boolean, boolean)
.
protected <T> void setPick(T entity, float u, boolean firePickChanged)
Impl of setPick(Object, float)
.
public <T> void setPick(T entity, float u)
u
- signed distance along the pick segment of the nearest
intersection, normalized to the pick segment length, or NaNpublic <T> void setPick(T entity)
setPick(Object, float)
, sets u to NaNpublic java.lang.Object getPickedEntity(boolean nullOk)
Get the current picked LinkageNode
, Widget
, or Geometry
, if any else null.
public java.lang.Object getPickedEntity()
getPickedEntity(boolean)
, null okpublic java.lang.Object getTypedPickedEntity(EntityClass c, boolean nullOk)
Return the Geometry, Widget
, or LinkageNode
that is or
contains the current pick iff its most specific entity class is
c.
public java.lang.Object getTypedPickedEntity(EntityClass c)
public vona.j3d.Widget getPickedWidget(boolean nullOk)
Return the Widget
that is or contains the current pick
entity, if any.
public vona.j3d.Widget getPickedWidget()
getPickedWidget(boolean)
, null okpublic javax.media.j3d.Geometry getPickedGeometry(boolean nullOk)
Return the Geometry
that is the current pick entity, if any.
public javax.media.j3d.Geometry getPickedGeometry()
getPickedGeometry(boolean)
, null okpublic LinkageNode getPickedNode(boolean nullOk)
Return the LinkageNode
that is or contains the current pick
entity, if any.
public LinkageNode getPickedNode()
getPickedNode(boolean)
, null okpublic Joint getPickedJoint(boolean nullOk)
getPickedNode(boolean)
, returns null if not a Jointpublic Joint getPickedJoint()
getPickedJoint(boolean)
, null okpublic Link getPickedLink(boolean nullOk)
getPickedNode(boolean)
, returns null if not a Linkpublic Link getPickedLink()
getPickedLink(boolean)
, null okpublic Linkage getPickedLinkage(boolean defaultToTopLevel)
Get the Linkage
containing the node containing the current
pick, if any, else null.
public Linkage getPickedLinkage()
getPickedLinkage(boolean)
, does not default to top-levelpublic LinkageNode.SubFrame getPickedSubFrame(boolean nullOk)
Return the LinkageNode.SubFrame
that is or contains
the current pick entity, if any.
public LinkageNode.SubFrame getPickedSubFrame()
getPickedSubFrame(boolean)
, null okpublic java.util.Collection<LinkageNode> getPickComplimentNodes(java.util.Collection<LinkageNode> c)
Collect all LinkageNode
s in that are not the current pick.
public java.util.List<LinkageNode> getPickComplimentNodes()
Covers getPickComplimentNodes(Collection)
, always conses.
public java.util.List<LinkageNode> getPickCycleComplimentNodes(java.util.List<LinkageNode> l)
Collect all LinkageNode
s that are not curently in the pickCycle
.
public java.util.List<LinkageNode> getPickCycleComplimentNodes()
getPickCycleComplimentNodes(List)
, always consespublic java.lang.Object pickNextInCycle()
Advance the current pick to the next entity in the current pickCycle
, i.e. the entity next-farther away from the viewer, if any,
cycling around to the front of the cycle if the current pick is at the
end.
public java.lang.Object pickPrevInCycle()
Advance the current pick to the previous entity in the current pickCycle
, i.e. the entity next-closer to the viewer, if any, cycling
around to the end of the cycle if the current pick is at the front.
public void navigateToViewPickedNode(boolean setDefault)
Display.navigateToView(LinkageNode, String, boolean, boolean,
boolean)
the canonical subframe of the current picked node, if any.
setDefault
- whether to also set the default view and rotation centerpublic void navigateToViewPickedNode()
navigateToViewPickedNode(boolean)
, does not set defaultprotected void pickChanged(boolean enableManipulation, boolean enableDump, boolean enableRotationCenter)
Impl of pickChanged()
with gating enables for the various
subtasks.
protected void pickChanged()
Called when the current pickIndex
has changed.
This calls pickChanged(boolean, boolean, boolean)
with all
enables set.
public void markDistanceToPickedLinkage()
Compute and set Linkage.distanceToPickedLinkage
for every
linkage in the model tree by recursive DFS.
If there is no current picked linkage then the distances are all marked as 0.
This is called automatically after structure changes by the update thread.
protected void markDistanceToPickedLinkage(Linkage fromLinkage, Linkage pickedLinkage)
markDistanceToPickedLinkage()
public void cullPickAndSelection()
Go through the pick and selection data structures and cull out any entities which are no longer in the model or which are no longer visible.
This is called automatically after structure changes by the update thread.
protected boolean isEntityLive(java.lang.Object entity)
If entity is a LinkageNode
, check if it present in the
model. Otherwise, if entity is a Widget
or a Geometry
, retrieve the containing LinkageNode
, if any, and do
same.
protected boolean isEntityVisible(java.lang.Object entity)
protected void initPickCycle()
public int select(boolean only, java.lang.Object... entities)
Add entities to the selection, in order, iff not already present.
only
- whether to clear the previous selection firstpublic int select(java.lang.Object... entities)
select(boolean, Object...)
, adds to existing selectionpublic int deselect(java.lang.Object... entities)
Remove entities from the selection, iff present.
public int clearSelection()
selection
public int getNumSelected()
selection
public int getNumSelectedOrPicked()
Get the number of entities in the selection
, plus one if there
is a current pick.
public int selectPick(boolean only, boolean andDescendantNodes, boolean andAncestorNodes)
Add the current pick entity, if any, to selection
.
only
- whether to clear the previous selection firstandDescendantNodes
- if the current pick entity is a LinkageNode
then this flag indicates that all its tree descendants should
also be added to the selection
in LinkageNode.traverseTree(msim.model.LinkageNode.NodeHandler)
DFS order.andAncestorNodes
- if the current pick entity is a LinkageNode
then this flag indicates that all its tree ancestors (up to
but not including the RootJoint
) should also be added to the
selection
in order from nearest to farthestpublic boolean selectPick()
Covers selectPick(boolean, boolean, boolean)
, adds current
pick entity to selection.
public int deselectPick(boolean andDescendantNodes, boolean andAncestorNodes)
Remove the current pick entity, if any, from selection
.
andDescendantNodes
- similar to same argument in selectPick(boolean, boolean, boolean)
andAncestorNodes
- similar to same argument in selectPick(boolean, boolean, boolean)
public boolean deselectPick()
Covers deselectPick(boolean, boolean)
, only deselects current
pick entity.
public boolean togglePickInSelection()
Select/deselect the current pick.
public java.util.Collection<java.lang.Object> getSelection(java.util.Collection<java.lang.Object> c)
selection
public java.util.List<java.lang.Object> getSelection()
getSelection(Collection)
, always consespublic java.util.Collection<LinkageNode> getSelectionNodes(java.util.Collection<LinkageNode> c)
LinkageNode
s in selection
public java.util.List<LinkageNode> getSelectionNodes()
Covers getSelectionNodes(Collection)
, always conses.
public java.util.Collection<LinkageNode> getSelectionComplimentNodes(java.util.Collection<LinkageNode> c)
Collect all LinkageNode
s that are not curently in the selection
.
public java.util.List<LinkageNode> getSelectionComplimentNodes()
Covers getSelectionComplimentNodes(Collection)
, always
conses.
public java.lang.Object[] getTypedSelection(boolean includePick, boolean nullOk, java.lang.Object[] ret, EntityClass... types)
Check if the sequence of entities in the current selection
,
plus optionally the current pick, matches the given sequence of
types, and if so, return an array of references to the
sequence.
includePick
- whether to append the curent pick, if any, to the
sequence of selected objects for the purposes of this methodret
- the references are returned here, consing if nulltypes
- the expected type of each entity in the sequence (oldest
selected to newest, then pick), or null if an entity is expected but its
type is not restricted. The number of expected entities is equal to the
number of specified types (including nulls).java.lang.IllegalStateException
- if the combined pick and selection does
not currently contain the expected number and types of entities, unless
nullOkpublic java.lang.Object[] getTypedSelection(boolean includePick, boolean nullOk, EntityClass... types)
protected void selectionChanged()
selection
has changedpublic void manipulateJoint(Joint joint, int xformID, int slackID, boolean driveFullGoal)
Start manipulating a particular Joint
sub-transform.
First calls stopManipulating()
to end any prior
manipulation.
InteractorDriver.bind(java.lang.Object...)
s and InteractorDriver.activate()
s
manipulationDriver
, and
disables navigation with navigationInteractor
.
Any of the three chain sub-transforms Joint.RX_CHILD_TO_MOBILITY
, Joint.RX_MOBILITY
, Joint.RX_MOBILITY_TO_PARENT
, or the two goal transforms Joint.RX_TARGET
, Joint.RX_POSTURE
, can be manipulated.
Requests to manipulate Joint.RX_MOBILITY
on locked connected
closure joints are automatically promoted to Joint.RX_LOCK
instead. Similarly, requests to manipulate Joint.RX_MOBILITY
on
(a) unlocked connected closure joints or (b) unlocked supporting tree
joints are automatically promoted to Joint.RX_TARGET
.
joint
- the Joint to manipulatexformID
- the Joint sub-transform to manipulateslackID
- see TrajectoryActor.slackID
driveFullGoal
- public void manipulateJoint(Joint joint, int xformID, int slackID)
manipulateJoint(Joint, int, int, boolean)
, always drives full
goal.
public void manipulateJoint(Joint joint, int xformID, boolean driveFullGoal)
manipulateJoint(Joint, int, int, boolean)
, automatially
selecting slackID.
slackID is -1 unless joint Joint.isConnected()
and
xformID Joint.isPositioningSubtransform(int)
, in which case
slackID is set as Joint.otherPositioningTransform(int)
.
public void manipulateJoint(Joint joint, int xformID)
manipulateJoint(Joint, int, int, boolean)
, automatially
selecting slackID and driving full goal.
slackID is -1 unless joint Joint.isConnected()
and
xformID Joint.isPositioningSubtransform(int)
, in which case
slackID is set as Joint.otherPositioningTransform(int)
.
public void manipulateJoint(Joint joint, boolean driveFullGoal)
manipulateJoint(Joint, int, int, boolean)
automatically
selecting slackID and requesting manipulation of sub-transform
Joint.RX_MOBILITY
.
public void manipulateJoint(Joint joint)
manipulateJoint(Joint, int, int, boolean)
automatically
selecting slackID, requesting manipulation of sub-transform
Joint.RX_MOBILITY
, and always driving full goal.
public void manipulateLink(Link link, boolean driveFullGoal)
manipulateJoint(Joint, int, int, boolean)
the Joint.RX_MOBILITY
of the RootJoint
of link.
Does nothing if link is null or the ultimate ground link.
protected Joint getLinkManipulationJoint(Link link)
Called by manipulateLink(Link, boolean)
to get (or generate) a
Joint
appropriate for manipulating link.
The default is the link's root joint. This may be replaced in a few cases:
alwaysManipulateLinkGlobalPose
and link is not in
the top-level sublinkage, then a new closure joint is synthesized between
link and the ultimate ground link.clickAndDragLinks
, link is the currently picked
node, link is not a root link in the top-level sublinkage, and
there are geometric coordinates for the pick point, then a new closure
joint is synthesized from link either to the ground link of the
linkage containing link or to the ultimate ground link if alwaysManipulateLinkGlobalPose
. The child-to-mobility transform is set
to attach this joint to link at the click point.If a joint is synthesized, it is marked with JP_MSIM_LINK_MANIPULATOR
, and will be removed in stopManipulating(boolean)
. Its soft goal priority will be set to linkManipulationJointPriority
and its soft goal weight will be set to
linkManipulationJointWeight
.
public void manipulateLink(Link link)
manipulateLink(Link, boolean)
, always drives full goal.
public void manipulateWidget(vona.j3d.Widget widget)
Start manipulating a particular Widget
pose with respect to its
attachment.
First calls stopManipulating()
to end any prior
manipulation.
public void stopManipulating(boolean unsetGoal)
End any ongoing manipulation.
InteractorDriver.unbind()
s and InteractorDriver.deactivate()
s manipulationDriver
and re-enables
navigationInteractor
for navigation.
unsetGoal
- whether to unset goal iff manipulation was directed at a
goal transform (Joint.RX_TARGET
or Joint.RX_POSTURE
)public void stopManipulating()
stopManipulating(boolean)
and unset the goal, if anypublic boolean isManipulating()
public boolean restoreManipulation(boolean jump)
Restore any ongoing manipulation to its original state.
public void toggleNavigateWhileManipulating()
Enter or exit navigation while a manipulation is ongoing.
Ok to call if manipulation is not ongoing, displays an info message.
public void manipulatePickedJoint(int xformID)
manipulateJoint(Joint, int)
with the currently picked LinkageNode
(see getPickedNode(boolean)
) if it's a Joint
, or the
parent Joint
if the currently picked node is a Link
.
public void manipulatePickedJoint()
manipulatePickedJoint(int)
sub-transform Joint.RX_MOBILITY
.
public void manipulatePickedLink()
manipulateLink(Link)
with the currently picked LinkageNode
(see getPickedNode(boolean)
) if it's a Link
, or the
parent Link
if the currently picked node is a Joint
.
public void manipulatePickedNode(int xformID)
manipulateLink(Link)
with the currently picked LinkageNode
n (see getPickedNode(boolean)
) if it's a Link
,
or manipulateJoint(Joint, int)
if n is a Joint
.
xformID is ignored if the current pick is a Link
.
public void manipulatePickedWidget()
manipulateWidget(vona.j3d.Widget)
with the currently picked Widget
, if
any, and iff it's a user widget.
public void manipulatePickedEntity()
If the current pick is a Widget
, manipulatePickedWidget()
, else manipulatePickedJoint(int)
.
public void manipulatePickedNodeLocalPose()
Manipulate a transform that controls the pose of the picked node relative to its tree parent.
If the current pick is a Joint
, but not a RootJoint
,
manipulate Joint.RX_MOBILITY_TO_PARENT
; if its a RootJoint
manipulate Joint.RX_MOBILITY
; and if it's a Link
manipulate
Joint.RX_CHILD_TO_MOBILITY
.
In all cases, the manipulated Joint's overall transform is not held by putting slack in another of the joint chain sub-transforms.
public void cycleManipulationFrame()
public void toggleDriveFullGoal()
public void cycleUserLinkWidgetVisibility()
public void cycleMobilityWidgetVisibility()
public void cycleRouteWidgetVisibility()
public void toggleRouteConeWidgetVisibility()
public void cycleClassVisiblity(EntityClass c)
EntityClass
cpublic void cycleAxesVisibility()
public void setMaskLinkageThreshold(int threshold)
public int getMaskLinkageThreshold()
public void incrementMaskLinkageThreshold()
maskLinkageThreshold
public void decrementMaskLinkageThreshold()
maskLinkageThreshold
public void toggleSolveParameter(java.lang.String name)
public void togglePickedNodeLock()
public void setPickedNodeSoftGoalToMobility(int xformID)
Joint.setSoftGoalToMobility(int)
with the currently picked
LinkageNode
n (see getPickedNode(boolean)
) if it's a Joint
, or with the root joint if n is a Link
.
public java.lang.Object removePickedEntity(boolean removeParent)
Remove the picked entity, if any.
The current pick cycle, including the current pick, is cleared.
public java.lang.Object removePickedEntity()
removePickedEntity(boolean)
, does not remove parentpublic void splitPickedLink()
Link.split()
the current picked node n iff it's a Link
.
The pick cycle is cleared except for n, which remains the current pick. Manipulation is initiated for the mobility transform of the new Joint created during the split.
public void mergePickedJoint()
Joint.merge()
the current picked node iff it's a Joint
.
The current pick cycle, including the current pick, is cleared.
public void makePickedJointTree()
Joint.makeTreeJoint()
the current picked node iff it's a Joint
.
public void makePickedJointClosure()
Joint.makeClosureJoint()
the current picked node iff it's a Joint
.
public void invertPickedJoint()
Joint.invert()
the current picked node iff it's a Joint
.
public void makePickedLinkRoot()
Link.makeRootLink()
the current picked node iff it's a Link
.
public void makePickedLinkGround()
Link.makeGroundLink()
the current picked node iff it's a Link
.
public void disconnectPickedJointFromParent()
Null the parent link of the current picked node iff it's a Joint
.
public void disconnectPickedJointFromChild()
Null the child link of the current picked node iff it's a Joint
.
public void setPickedJointParentToSelectedLink(boolean holdAbsolutePose)
public void setPickedJointParentToSelectedLink()
setPickedJointParentToSelectedLink(boolean)
, don't hold
absolute pose.
public void setPickedJointParentToSelectedSubFrame(boolean holdAbsolutePose)
public void setPickedJointParentToSelectedSubFrame()
setPickedJointParentToSelectedSubFrame(boolean)
, don't hold
absolute pose.
public void setPickedJointChildToSelectedLink(boolean holdAbsolutePose)
public void setPickedJointChildToSelectedLink()
setPickedJointChildToSelectedLink(boolean)
, don't hold
absolute pose.
public void setPickedJointChildToSelectedSubFrame(boolean holdAbsolutePose)
public void setPickedJointChildToSelectedSubFrame()
setPickedJointChildToSelectedSubFrame(boolean)
, don't hold
absolute pose.
public Linkage consLinkageInteractive(Linkage.Disposition disposition, java.lang.String name)
Cons and add a new Linkage
l in-context depending on the
current pick.
If there is a current pick then the containing Linkage will be the parent of l, else l will be added as a child of the top-level Linkage.
The ground Link
of the new Linkage will appear initially under
the mouse cursor (iff the cursor is over the canvas), and its pose will be
under manipulation on return of this method.
The current pick, if any, will be cleared, and the new Linkage will be the only picked entity on return.
name
- the name of the new linkage or null to auto-namepublic Linkage consLinkageInteractive(Linkage.Disposition disposition)
public Link consLinkInteractive()
Cons and add a new Link
l in-context depending on the
current pick.
If the current picked node is a Joint
j that is attached
to a parent and child c, l is attached as a child of a new
locked Joint.Type.GENERAL
Joint attached to c,
or as the child of j if c is null.
If the current picked node is a Link p, l is attached as a child of a new locked GENERAL Joint attached to p.
In all other cases (no current picked node, or current picked node is a Joint with no parent) a new root Link is created.
Unless the parent Joint of the new Link has neither mutable positioning transforms nor unlocked mobility with at least three translation DoF, the new Link will appear initially under the mouse cursor (iff the cursor is over the canvas), and will be under manipulation on return of this method. If the parent Joint's positioning transforms are mutable, the manipulated sub-transform will be child-to-mobility; otherwise it will be mobility.
The current pick, if any, will be cleared, and the new Link will be the only picked entity on return.
public void consWidgetInteractive()
Conses a new widget and addWidgetInteractive(LinkageNode,
String, String, Widget, boolean)
in the current pick context via consWidgetActionMap
.
public java.lang.String addWidgetInteractive(LinkageNode parent, java.lang.String name, java.lang.String frame, vona.j3d.Widget widget, boolean rotX)
Add widget to the indicated parent node.
widget will appear initially under the mouse cursor (iff the cursor is over the canvas), and will be under manipulation on return of this method.
The current pick, if any, will be cleared, and the widget will be the only picked entity on return.
Also see consWidgetInteractive()
.
parent
- the parent node, if null then defaults to currently picked
node, if any, else ground Linkname
- the name to assign widget, or null to use its existing
LinkageNode.WP_NAME
, or auto-name if both nullframe
- the sub-frame, null to use widget's existing LinkageNode.WP_FRAME
if any, else getPickedSubFrame(boolean)
, or LinkageNode.SF_CANONICAL
failing thatrotX
- whether to first apply a pi/2 x-axis rotation to the widgetpublic java.lang.String addWidgetInteractive(LinkageNode parent, java.lang.String name, java.lang.String frame, vona.j3d.Widget widget)
public java.lang.String addWidgetInteractive(LinkageNode parent, vona.j3d.Widget widget, boolean rotX)
addWidgetInteractive(LinkageNode, String, String, Widget,
boolean)
, default name and frame.
public java.lang.String addWidgetInteractive(LinkageNode parent, vona.j3d.Widget widget)
addWidgetInteractive(LinkageNode, String, String, Widget,
boolean)
, default name and frame, no rotX.
public java.lang.String addWidgetInteractive(vona.j3d.Widget widget, boolean rotX)
addWidgetInteractive(LinkageNode, String, String, Widget,
boolean)
, to currently picked node or ground link, default name and
frame.
public java.lang.String addWidgetInteractive(vona.j3d.Widget widget)
addWidgetInteractive(LinkageNode, String, String, Widget,
boolean)
, to currently picked node or ground link, default name and
frame, no rotX.
public java.lang.String addWidgetInteractive(java.lang.String type)
addWidgetInteractive(LinkageNode, String, String, Widget,
boolean)
, to currently picked node or ground link, default name and
frame, no rotX.
public void consJointInteractive()
Conses a new joint and addJointInteractive(Link, Link, Joint,
boolean)
in the current pick context via consJointActionMap
.
public java.lang.String addJointInteractive(Link parent, Link child, Joint joint, boolean rotX)
Attach joint to the indicated nodes.
Iff joint Joint.positioningTransformsMutable()
the parent
mobility frame of joint will appear initially under the mouse
cursor (iff the cursor is over the canvas), and will be under manipulation
on return of this method.
The current pick, if any, will be cleared, and the joint will be the only picked entity on return.
If both parent and child are specified (non-null) then
they must differ, and joint is connected as indicated. If either
or both is null then appropriate Link
s are chosen or consed
according to the current pick/selection. Let sp be the sequence of
picked and selected entities in order from least to most recent (the
current pick, if any, is last in this order). sp is only used by
this method if its length is 1 or 2, and if each entity is either a
LinkageNode or SubFrame. If sp is length 2, then let sp0 be
the oldest and sp1 be the newest entity; otherwise let sp0
be the single selected/picked entity and let sp1 be null.
First, parent is chosen as sp0 iff that's a Link or SubFrame, or as the child Link of sp0 if that's a Joint j, or if j has no child then a new Link is consed. If sp0 is null then the ground link is used as parent. Next, child is chosen as sp1 iff that's a Link or SubFrame, or as the child Link of sp1 iff that's a Joint j, or if j has no child then a new Link is consed. If sp1 is null then child is left as null.
If new Links are consed they are placed according to the current Joint
transforms. Also, while the mobility-to-parent transform of joint
is never mutated, the child-to-mobility transform (or the mobility
transform, if not Joint.positioningTransformsMutable()
) is adjusted
to match the adjacent Link CMTs when joint is fully connected.
Also see consJointInteractive()
.
parent
- the parent Link, if null then choose or cons from
pick/selection contextchild
- the child Link, if null then choose or cons from
pick/selection contextrotX
- whether to first apply a pi/2 x-axis rotation to the parent
mobility framepublic java.lang.String addJointInteractive(Link parent, Link child, Joint joint)
public java.lang.String addJointInteractive(Link parent, Joint joint, boolean rotX)
addJointInteractive(Link, Link, Joint, boolean)
, get child
from pick or selection.
public java.lang.String addJointInteractive(Link parent, Joint joint)
addJointInteractive(Link, Link, Joint, boolean)
, get child
from pick or selection, no rotX.
public java.lang.String addJointInteractive(Joint joint, boolean rotX)
addJointInteractive(Link, Link, Joint, boolean)
, get parent
and child from pick and/or selection.
public java.lang.String addJointInteractive(Joint joint)
addJointInteractive(Link, Link, Joint, boolean)
, get parent
and child from pick and/or selection, no rotX.
public void dumpHelp(java.io.PrintStream s, boolean showKeybindings)
public void dumpHelp(boolean showKeybindings)
dumpHelp(PrintStream, boolean)
to System.outpublic void dumpHelp()
dumpHelp(PrintStream, boolean)
to System.out with keybindingspublic static void dumpDetails(java.lang.Object entity, java.io.PrintStream s)
public static void dumpDetails(java.lang.Object entity)
dumpDetails(Object, PrintStream)
to System.outpublic static void dumpPathAndClass(java.lang.Object entity, boolean dumpPath, boolean dumpEntityClass, boolean withNewline, java.io.PrintStream s)
Dump the full path and/or display entity class of entity.
public static void dumpPathAndClass(java.lang.Object entity, boolean dumpPath, boolean dumpEntityClass, boolean withNewline)
Covers dumpPathAndClass(Object, boolean, boolean, boolean,
PrintStream)
, dumps to System.out.
public static void dumpPathAndClass(java.lang.Object entity, boolean dumpPath, boolean dumpEntityClass)
Covers dumpPathAndClass(Object, boolean, boolean, boolean,
PrintStream)
, dumps with newline to System.out.
public static void dumpPathAndClass(java.lang.Object entity)
Covers dumpPathAndClass(Object, boolean, boolean, boolean,
PrintStream)
, dumps both path and class with newline to System.out.
public static void dumpPathOf(LinkageNode node, java.io.PrintStream s)
Path.dumpPathOf(LinkageNode, PrintStream)
if alwaysDumpNodePath
, else dump node name.
public static void dumpPathOf(LinkageNode node)
dumpPathOf(LinkageNode, PrintStream)
, to System.outpublic static void dumpPathOf(vona.j3d.Widget widget, java.io.PrintStream s)
dumpPathOf(LinkageNode, PrintStream)
on containing node, if
any, then dump widget name if any.
public static void dumpPathOf(vona.j3d.Widget widget)
dumpPathOf(Widget, PrintStream)
, to System.outpublic static void dumpPathOf(LinkageNode.SubFrame subFrame, java.io.PrintStream s)
dumpPathOf(LinkageNode, PrintStream)
on containing node, if
any, then dump subframe name if any.
public static void dumpPathOf(LinkageNode.SubFrame subFrame)
dumpPathOf(msim.model.LinkageNode.SubFrame, PrintStream)
, to
System.outpublic static void dumpPathOf(javax.media.j3d.Geometry geometry, java.io.PrintStream s)
dumpPathOf(Widget, PrintStream)
on containing widget, if any,
then dump index of geometry.
public static void dumpPathOf(javax.media.j3d.Geometry geometry)
dumpPathOf(Geometry, PrintStream)
, to System.outpublic void dumpPick(boolean dumpEntityClass, boolean dumpIndex, boolean dumpDetails, java.io.PrintStream s)
Dump information about the current pick, if any.
dumpEntityClass
- whether to dump the most specific display entity
class of the picked entitydumpIndex
- whether to dump info about the index of the pick within
the current pickCycle
dumpDetails
- whether to dump the type-specific details of the
current pickpublic void dumpPick(boolean dumpEntityClass, boolean dumpIndex, boolean dumpDetails)
Covers dumpPick(boolean, boolean, boolean, PrintStream)
, dumps
to System.out.
public void dumpPick()
Covers dumpPick(boolean, boolean, boolean, PrintStream)
, dumps
path only to System.out.
public void dumpPickDetails()
Covers dumpPick(boolean, boolean, boolean, PrintStream)
, dumps
everything to System.out.