@ThreadSafe public abstract class LinkageNode extends java.lang.Object implements java.lang.Comparable<LinkageNode>
Generic base class for MSim model nodes.
See additional description in header doc for Linkage
.
Copyright (C) 2008 Marsette A. Vona, III
Modifier and Type | Class and Description |
---|---|
static class |
LinkageNode.ApplyingNodeHandler
Generic
LinkageNode.NodeHandler impl that delegates to an object
implementing an apply(Object[]) method. |
static interface |
LinkageNode.NodeHandler
callback interface for
traverseTree(msim.model.LinkageNode.NodeHandler) |
static class |
LinkageNode.SubFrame
identifies a specific subframe of a specific node
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
autoNamed
whether this node is automatically named
|
vona.math.RX |
cmt
The Composite Model Transform taking points from the canonical
coordinate frame of this node to the ground frame.
|
private static java.lang.String |
cvsid |
static float |
DEF_WIDGET_LENGTH
default widget length [m]
|
int |
depth
Current depth of this node from ultimate ground link or -1 if unset.
|
EntityClass |
entityClass
model entity class
|
boolean |
explicitlyHidden
Explicit render state.
|
boolean |
explicitlyHighlighted
Explicit render state.
|
boolean |
explicitlyMasked
Explicit render state.
|
boolean |
explicitlyVisible
Explicit render state.
|
Linkage |
linkage
the
Linkage to which this node belongs |
protected java.lang.String |
name
the name of this node
|
protected int |
nextAnonymousWidgetNumber
used to make unique names
|
protected java.util.List<java.lang.String> |
nodeWidgets
names of the current node-internal
Widget s |
protected int |
numUserWidgets
number of user widgets as of last
updateWidgets() |
protected java.util.Map<java.lang.String,java.lang.Object> |
propertyMap
the property map or null if none
|
static java.lang.String |
SF_CANONICAL
canonical subframe
|
static int |
TM_JOINT_TYPE_START
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_CLOSURE_JOINTS
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_CONSTRAINED_CLOSURE_JOINTS
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_DANGLING_JOINTS
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_JOINT_WIDGETS
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_JOINTS
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_LINK_WIDGETS
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_LINKAGES
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_LINKS
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_LOCKED_LINKS
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_NODES
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_SUPPORTING_TREE_JOINTS
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_TREE_JOINTS
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_UNCONSTRAINED_CLOSURE_JOINTS
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_UNLOCKED_TREE_JOINTS
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_NUM_WIDGETS
metrics index for
collectTreeMetrics(int[]) |
static int |
TM_SIZE
metrics size for
collectTreeMetrics(int[]) |
protected java.util.Collection<vona.j3d.Widget> |
unmodifiableWidgets
unmodifiable view of
widgets |
protected float |
widgetLength
current widget length [m]
|
protected java.util.Map<java.lang.String,vona.j3d.Widget> |
widgetMap
node-referenced
Widget s, indexed by name |
protected java.util.Collection<vona.j3d.Widget> |
widgets
value set of
widgetMap |
protected boolean |
widgetsDirty
widgets dirty flag, see
updateWidgets() , initially true |
static java.lang.String |
WP_CACHED_SUBFRAME
|
static java.lang.String |
WP_EXPLICIT_HIDDEN
Explicit
Widget render state. |
static java.lang.String |
WP_EXPLICIT_HIGHLIGHT
Explicit
Widget render state. |
static java.lang.String |
WP_EXPLICIT_MASK
Explicit
Widget render state. |
static java.lang.String |
WP_EXPLICIT_VISIBLE
Explicit
Widget render state. |
static java.lang.String |
WP_FRAME
Widget property that identifies its parent coordinate frame |
static java.lang.String |
WP_NAME
Widget property that gives its name in containing LinkageNode |
static java.lang.String |
WP_NODE
Widget property that references the containing LinkageNode |
static java.lang.String |
WP_USER_SUBFRAME
Widget property that identifies an associated user subframe, if
any. |
Modifier | Constructor and Description |
---|---|
protected |
LinkageNode(Linkage linkage,
java.lang.String name)
Make a new LinakgeNode.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
addWidget(java.lang.String type)
addWidget(Widget, String, String) , default frame and name |
java.lang.String |
addWidget(java.lang.String type,
java.lang.String name)
addWidget(Widget, String, String) , default frame |
java.lang.String |
addWidget(java.lang.String type,
java.lang.String name,
java.lang.String frame)
cons
Widget and addWidget(Widget, String, String) |
java.lang.String |
addWidget(vona.j3d.Widget widget)
addWidget(Widget, String, String) , default frame and name |
java.lang.String |
addWidget(vona.j3d.Widget widget,
java.lang.String name)
addWidget(Widget, String, String) , default frame |
java.lang.String |
addWidget(vona.j3d.Widget widget,
java.lang.String name,
java.lang.String frame)
Add a
Widget . |
boolean |
checkName(java.lang.String name)
Check if name would be acceptable for this node.
|
static boolean |
checkNamePattern(java.lang.String name)
Checkif name matches
MSim.VALID_NAME_PATTERN . |
int[] |
collectTreeMetrics()
Covers
collectTreeMetrics(int[]) , conses. |
int[] |
collectTreeMetrics(int[] metrics)
Collect metrics on the subtree rooted at this node.
|
int |
compareTo(LinkageNode o)
Compares this node with the specified node for order by
depth . |
void |
dump()
dump(java.io.PrintStream) to System.out |
void |
dump(java.io.PrintStream s)
dump node details
|
void |
dumpSubFrames()
dumpSubFrames(PrintStream) to System.out |
void |
dumpSubFrames(java.io.PrintStream s)
Dump all available subframes.
|
void |
dumpTree()
dumpTree(PrintStream) to System.out |
void |
dumpTree(java.io.PrintStream s)
Recursively
dump(PrintStream) the sub-tree starting at this
node. |
protected void |
dumpTree(java.lang.String prefix,
java.io.PrintStream s)
impl of
dumpTree(PrintStream) |
void |
dumpTreeMetrics()
dumpTreeMetrics(PrintStream) to System.out |
void |
dumpTreeMetrics(java.io.PrintStream s)
collectTreeMetrics(int[]) and dump them |
void |
enableDBGNormals(boolean enable)
similar to
enableDBGSpheres(boolean) |
void |
enableDBGNormalsRecursively(boolean enable)
enableDBGNormals(boolean) in recursive tree DFS pre-order from this
node. |
void |
enableDBGSpheres(boolean enable)
Enable/disable debug spheres for all current
widgets . |
void |
enableDBGSpheresRecursively(boolean enable)
enableDBGSpheres(boolean) in recursive tree DFS pre-order from this
node. |
protected <T extends LinkageNode> |
findImpl(java.lang.String namePattern,
int nth,
java.lang.Class<T> type)
Common impl of
findNode(String, int) and similar. |
Joint |
findJoint(java.lang.String namePattern)
findJoint(String, int) , returning the first Joint with
the given namePattern. |
Joint |
findJoint(java.lang.String namePattern,
int nth)
Similar to
findNode(String, int) . |
java.util.ArrayList<Joint> |
findJoints(java.lang.String namePattern)
findJoints(String, Collection) , consing a new ArrayList . |
java.util.Collection<Joint> |
findJoints(java.lang.String namePattern,
java.util.Collection<Joint> joints)
Similar to
findLinks(String, Collection) . |
Link |
findLink(java.lang.String namePattern)
findLink(String, int) , returning the first Link with
the given namePattern. |
Link |
findLink(java.lang.String namePattern,
int nth)
Similar to
findNode(String, int) . |
java.util.ArrayList<Link> |
findLinks(java.lang.String namePattern)
findLinks(String, Collection) , consing a new ArrayList . |
java.util.Collection<Link> |
findLinks(java.lang.String namePattern,
java.util.Collection<Link> links)
Get all
Link s with a name matching namePattern in
recursive tree DFS pre-order from this node. |
protected <T extends LinkageNode> |
findMultipleImpl(java.lang.String namePattern,
java.util.Collection<T> ret,
java.lang.Class<T> type)
Common impl of
findNodes(String, Collection) and similar. |
LinkageNode |
findNode(java.lang.String namePattern)
findNode(String, int) , returning the first LinkageNode
with the given namePattern. |
LinkageNode |
findNode(java.lang.String namePattern,
int nth)
Get the nth
LinkageNode with a name matching
namePattern in recursive tree DFS pre-order from this node. |
java.util.ArrayList<LinkageNode> |
findNodes(java.lang.String namePattern)
findNodes(String, Collection) , consing a new ArrayList . |
java.util.Collection<LinkageNode> |
findNodes(java.lang.String namePattern,
java.util.Collection<LinkageNode> nodes)
Get all
LinkageNode s with a name matching namePattern in
recursive tree DFS pre-order from this node. |
abstract LinkageNode |
getChild(java.lang.String name)
get the named child in the
Linkage tree, null if none |
abstract java.util.Collection<? extends LinkageNode> |
getChildren()
get the children of this node in the
Linkage tree |
vona.math.RX |
getCMT()
Get a copy of
cmt , always conses. |
vona.math.RX |
getCMT(vona.math.RX rx)
Get a copy of
cmt . |
int |
getDepth()
get
depth |
java.lang.String |
getName()
get the name of this node, even if auto-named
|
protected abstract java.lang.String |
getNodeWidgetProperty()
Return the
Widget property name that indicates an internal
(i.e. |
int |
getNumUserWidgets()
get the number of user widges
|
int |
getNumWidgets()
get the number of widgets
|
abstract LinkageNode |
getParent()
get the parent of this node in the
Linkage tree |
java.lang.Object |
getProperty(java.lang.String key)
get a property
|
LinkageNode.SubFrame |
getSubFrame(java.lang.String name)
Hook to get or cons the indicated
LinkageNode.SubFrame of this
LinkageNode. |
static LinkageNode.SubFrame |
getSubFrame(vona.j3d.Widget w)
Get the subframe containing w, or null if none.
|
vona.math.RX |
getSubFrameCMT(java.lang.String frame)
getSubFrameCMT(String, RX) , always conses |
vona.math.RX |
getSubFrameCMT(java.lang.String frame,
vona.math.RX rx)
Convenience method appends
cmt to getSubFrameRX(String, RX) . |
vona.math.RX |
getSubFrameCMT(vona.j3d.Widget widget)
Calls
getSubFrameCMT(String, RX) with the WP_FRAME
of widget, always conses. |
vona.math.RX |
getSubFrameCMT(vona.j3d.Widget widget,
vona.math.RX rx)
Calls
getSubFrameCMT(String, RX) with the WP_FRAME
of widget. |
static java.lang.String |
getSubFrameName(vona.j3d.Widget w)
get the name of the subframe containing w
|
vona.math.RX |
getSubFrameRX(java.lang.String frame)
getSubFrameRX(String, RX) , always conses |
vona.math.RX |
getSubFrameRX(java.lang.String frame,
vona.math.RX rx)
Get the transform taking coordinates in a sub-frame to the canonical
(i.e.
|
vona.math.RX |
getSubFrameRX(vona.j3d.Widget widget)
Calls
getSubFrameRX(String, RX) with the WP_FRAME
of widget, always conses. |
vona.math.RX |
getSubFrameRX(vona.j3d.Widget widget,
vona.math.RX rx)
Calls
getSubFrameRX(String, RX) with the WP_FRAME
of widget. |
vona.j3d.Widget |
getWidget(java.lang.String name)
Get a
Widget . |
float |
getWidgetLength()
get
widgetLength |
java.util.Collection<vona.j3d.Widget> |
getWidgets()
Get an unmodifiable view of the collection of
Widget s. |
boolean |
hasChildren()
check whether this node has any children
|
boolean |
hasDescendant(LinkageNode other)
check if this node is an ancestor of (or the same as) other
|
boolean |
hasProperty(java.lang.String key)
check existence of a property
|
boolean |
hasSubFrame(java.lang.String frame)
Check if the named subframe is present.
|
boolean |
hasWidgets()
check if this node has any widgets
|
boolean |
isAutoNamed()
check whether this node is auto-named
|
static boolean |
isExplicitlyHidden(vona.j3d.Widget w)
check if w is explicitly hidden
|
static boolean |
isExplicitlyHighlighted(vona.j3d.Widget w)
check if w is explicitly highlighted
|
static boolean |
isExplicitlyMasked(vona.j3d.Widget w)
check if w is explicitly masked
|
static boolean |
isExplicitlyVisible(vona.j3d.Widget w)
check if w is explicitly visible
|
boolean |
isInternalFrame(java.lang.String frame)
Check if frame is an internal (i.e.
|
boolean |
isLive()
check if this node is actually present in its
linkage |
abstract boolean |
isLocked()
check if this node is locked
|
boolean |
isTreeLeaf()
Check if this is a leaf in the model tree.
|
static boolean |
isUserWidget(vona.j3d.Widget w)
check if w is a user widget
|
LinkageNode |
lock()
covers
setLocked(boolean) |
abstract void |
remove()
Remove this node from the
Linkage tree. |
int |
removeAllWidgets()
Remove all
Widget s. |
java.lang.Object |
removeProperty(java.lang.String key)
remove a property
|
vona.j3d.Widget |
removeWidget(java.lang.String name)
Remove a
Widget . |
boolean |
removeWidget(vona.j3d.Widget widget)
similar to
removeWidget(String) |
void |
renameWidget(vona.j3d.Widget w,
java.lang.String name)
Rename a widget.
|
void |
reparentUserWidgets(LinkageNode newParent)
reparentUserWidgets(LinkageNode, boolean) holding global
poses. |
void |
reparentUserWidgets(LinkageNode newParent,
boolean holdAbsolutePose)
reparentWidget(String, LinkageNode, boolean) all user Widget s. |
void |
reparentWidget(java.lang.String name,
LinkageNode newParent)
reparentWidget(String, LinkageNode, boolean) , holding global
pose. |
java.lang.String |
reparentWidget(java.lang.String name,
LinkageNode newParent,
boolean holdAbsolutePose)
Move a
Widget from this LinkageNode to another. |
protected java.lang.String |
reparentWidgetImpl(java.lang.String name,
LinkageNode newParent,
boolean holdAbsolutePose,
boolean iffUserWidget)
Shared impl for
reparentWidget(String, LinkageNode, boolean)
and reparentWidgets(LinkageNode, boolean) . |
void |
reparentWidgets(LinkageNode newParent)
reparentWidgets(LinkageNode, boolean) holding global poses |
void |
reparentWidgets(LinkageNode newParent,
boolean holdAbsolutePose)
reparentWidget(String, LinkageNode, boolean) all Widget s. |
void |
setAllTreeJointsToGoal(int goal)
Set all tree joints in recursive DFS pre-order from this node to the
indicated goal,
Joint.RX_POSTURE or Joint.RX_TARGET , if
set. |
void |
setAllTreeJointsToHighestPrioritySoftGoal()
Set all tree joints in recursive DFS pre-order from this node to their
highest-priority soft goal,
Joint.RX_POSTURE or Joint.RX_TARGET , if any. |
void |
setAllTreeJointsToPosture()
|
void |
setAllTreeJointsToTarget()
|
static void |
setExplicitlyHidden(vona.j3d.Widget w,
boolean hidden)
Mark a
Widget to be explicitly hidden. |
static void |
setExplicitlyHighlighted(vona.j3d.Widget w,
boolean highlighted)
Mark a
Widget to be explicitly highlighted. |
static void |
setExplicitlyMasked(vona.j3d.Widget w,
boolean masked)
Mark a
Widget to be explicitly masked. |
static void |
setExplicitlyVisible(vona.j3d.Widget w,
boolean visible)
Mark a
Widget to be explicitly visible. |
abstract LinkageNode |
setLocked(boolean locked)
lock the state of this node
|
void |
setLockedRecursively(boolean locked)
setLocked(boolean) in recursive tree DFS pre-order from this node |
abstract java.lang.String |
setName(java.lang.String name)
Set the name of this node.
|
java.lang.Object |
setProperty(java.lang.String key,
java.lang.Object value)
covers
setProperty(String, Object, boolean) , replaces |
java.lang.Object |
setProperty(java.lang.String key,
java.lang.Object value,
boolean replace)
Set a property.
|
boolean |
setWidgetLength(float widgetLength)
covers
setWidgetLength(float, boolean) , updates if different |
boolean |
setWidgetLength(float widgetLength,
boolean updateIfDifferent)
Set
widgetLength [m]. |
boolean |
setWidgetLengthRecursively(float widgetLength)
Covers
setWidgetLengthRecursively(float, boolean) , updates if
different. |
boolean |
setWidgetLengthRecursively(float widgetLength,
boolean updateIfDifferent)
setWidgetLength(float, boolean) in recursive tree DFS pre-order from this
node. |
protected boolean |
suppressTreeDump()
Whether to suppress this node in
dumpTree(String,
PrintStream) , default false. |
java.lang.String |
toString()
toString(boolean) without details |
abstract java.lang.String |
toString(boolean details)
returns a short human-readable identifying string for this node
|
boolean |
traverseTree(LinkageNode.NodeHandler nodeHandler)
DFS the
Linkage tree starting from this node. |
LinkageNode |
unlock()
covers
setLocked(boolean) |
abstract void |
updateCMTs()
|
void |
updateCMTsRecursively()
updateCMTs() in recursive tree DFS pre-order from this node |
void |
updateWidgets()
Defers to
updateWidgetsImpl() to update widgetMap , then
counts numUserWidgets and clears widgetsDirty . |
protected void |
updateWidgetsImpl()
Hook for lazy
widgetMap update. |
void |
updateWidgetsRecursively()
updateWidgets() in recursive tree DFS pre-order from this
node. |
private static final java.lang.String cvsid
public static final float DEF_WIDGET_LENGTH
public static final java.lang.String WP_NODE
Widget
property that references the containing LinkageNodepublic static final java.lang.String WP_NAME
Widget
property that gives its name in containing LinkageNodepublic static final java.lang.String WP_FRAME
Widget
property that identifies its parent coordinate framepublic static final java.lang.String WP_USER_SUBFRAME
Widget
property that identifies an associated user subframe, if
any.
public static final java.lang.String WP_CACHED_SUBFRAME
public static final java.lang.String WP_EXPLICIT_VISIBLE
Explicit Widget
render state.
When set these override the render state of a Widget
's EntityClass
. If both WP_EXPLICIT_VISIBLE and
WP_EXPLICIT_HIDDEN are set the latter is ignored.
public static final java.lang.String WP_EXPLICIT_HIDDEN
Explicit Widget
render state.
When set these override the render state of a Widget
's EntityClass
. If both WP_EXPLICIT_VISIBLE and
WP_EXPLICIT_HIDDEN are set the latter is ignored.
public static final java.lang.String WP_EXPLICIT_HIGHLIGHT
Explicit Widget
render state.
When set these override the render state of a Widget
's EntityClass
. If both WP_EXPLICIT_VISIBLE and
WP_EXPLICIT_HIDDEN are set the latter is ignored.
public static final java.lang.String WP_EXPLICIT_MASK
Explicit Widget
render state.
When set these override the render state of a Widget
's EntityClass
. If both WP_EXPLICIT_VISIBLE and
WP_EXPLICIT_HIDDEN are set the latter is ignored.
public static final java.lang.String SF_CANONICAL
public static final int TM_NUM_LINKAGES
collectTreeMetrics(int[])
public static final int TM_NUM_NODES
collectTreeMetrics(int[])
public static final int TM_NUM_LINKS
collectTreeMetrics(int[])
public static final int TM_NUM_JOINTS
collectTreeMetrics(int[])
public static final int TM_NUM_WIDGETS
collectTreeMetrics(int[])
public static final int TM_NUM_LOCKED_LINKS
collectTreeMetrics(int[])
public static final int TM_NUM_TREE_JOINTS
collectTreeMetrics(int[])
public static final int TM_NUM_CLOSURE_JOINTS
collectTreeMetrics(int[])
public static final int TM_NUM_DANGLING_JOINTS
collectTreeMetrics(int[])
public static final int TM_NUM_UNLOCKED_TREE_JOINTS
collectTreeMetrics(int[])
public static final int TM_NUM_SUPPORTING_TREE_JOINTS
collectTreeMetrics(int[])
public static final int TM_NUM_CONSTRAINED_CLOSURE_JOINTS
collectTreeMetrics(int[])
public static final int TM_NUM_UNCONSTRAINED_CLOSURE_JOINTS
collectTreeMetrics(int[])
public static final int TM_NUM_LINK_WIDGETS
collectTreeMetrics(int[])
public static final int TM_NUM_JOINT_WIDGETS
collectTreeMetrics(int[])
public static final int TM_JOINT_TYPE_START
collectTreeMetrics(int[])
public static final int TM_SIZE
collectTreeMetrics(int[])
protected java.lang.String name
protected boolean autoNamed
public final vona.math.RX cmt
The Composite Model Transform taking points from the canonical coordinate frame of this node to the ground frame.
see Linkage
class header doc for details.
protected volatile boolean widgetsDirty
updateWidgets()
, initially trueprotected volatile float widgetLength
protected java.util.Map<java.lang.String,vona.j3d.Widget> widgetMap
Widget
s, indexed by nameprotected java.util.Collection<vona.j3d.Widget> widgets
widgetMap
protected final java.util.Collection<vona.j3d.Widget> unmodifiableWidgets
widgets
protected int nextAnonymousWidgetNumber
protected int numUserWidgets
updateWidgets()
protected final java.util.List<java.lang.String> nodeWidgets
Widget
spublic volatile boolean explicitlyVisible
Explicit render state.
When set these override the render state of a node's EntityClass
. explicitlyVisible overrides
explicitlyHidden and explicitlyMasked.
public volatile boolean explicitlyHidden
Explicit render state.
When set these override the render state of a node's EntityClass
. explicitlyVisible overrides
explicitlyHidden and explicitlyMasked.
public volatile boolean explicitlyHighlighted
Explicit render state.
When set these override the render state of a node's EntityClass
. explicitlyVisible overrides
explicitlyHidden and explicitlyMasked.
public volatile boolean explicitlyMasked
Explicit render state.
When set these override the render state of a node's EntityClass
. explicitlyVisible overrides
explicitlyHidden and explicitlyMasked.
public volatile EntityClass entityClass
public volatile int depth
Current depth of this node from ultimate ground link or -1 if unset.
Set by Controller.analyzeStructure(msim.model.Link, int)
. Used by
compareTo(msim.model.LinkageNode)
.
protected java.util.Map<java.lang.String,java.lang.Object> propertyMap
public static java.lang.String getSubFrameName(vona.j3d.Widget w)
public static LinkageNode.SubFrame getSubFrame(vona.j3d.Widget w)
Get the subframe containing w, or null if none.
The result is cached as WP_CACHED_SUBFRAME
.
public LinkageNode.SubFrame getSubFrame(java.lang.String name)
Hook to get or cons the indicated LinkageNode.SubFrame
of this
LinkageNode.
public static void setExplicitlyVisible(vona.j3d.Widget w, boolean visible)
Mark a Widget
to be explicitly visible.
Also see explicitlyVisible
to explicitly show a whole
node.
Adds or removes the WP_EXPLICIT_VISIBLE
property.
public static boolean isExplicitlyVisible(vona.j3d.Widget w)
public static void setExplicitlyHidden(vona.j3d.Widget w, boolean hidden)
Mark a Widget
to be explicitly hidden.
Also see explicitlyHidden
to explicitly hide a whole node.
Adds or removes the WP_EXPLICIT_HIDDEN
property.
public static boolean isExplicitlyHidden(vona.j3d.Widget w)
public static void setExplicitlyHighlighted(vona.j3d.Widget w, boolean highlighted)
Mark a Widget
to be explicitly highlighted.
Also see explicitlyHighlighted
to explicitly highlight a whole
node.
Adds or removes the WP_EXPLICIT_HIGHLIGHT
property.
public static boolean isExplicitlyHighlighted(vona.j3d.Widget w)
public static void setExplicitlyMasked(vona.j3d.Widget w, boolean masked)
Mark a Widget
to be explicitly masked.
Also see explicitlyMasked
to explicitly mask a whole node.
Adds or removes the WP_EXPLICIT_MASK
property.
public static boolean isExplicitlyMasked(vona.j3d.Widget w)
public java.lang.String getName()
public boolean isAutoNamed()
public abstract java.lang.String setName(java.lang.String name)
Set the name of this node.
name
- the new name of the node, or null to auto-namejava.lang.IllegalArgumentException
- if name is non-null and fails checkName(java.lang.String)
public boolean checkName(java.lang.String name)
Check if name would be acceptable for this node.
Default impl does checkNamePattern(java.lang.String)
.
public static boolean checkNamePattern(java.lang.String name)
Checkif name matches MSim.VALID_NAME_PATTERN
.
public abstract LinkageNode getParent()
Linkage
treepublic abstract LinkageNode getChild(java.lang.String name)
Linkage
tree, null if nonepublic abstract java.util.Collection<? extends LinkageNode> getChildren()
Linkage
treepublic boolean hasChildren()
public boolean isTreeLeaf()
Check if this is a leaf in the model tree.
Default impl checks if not hasChildren()
.
public boolean hasDescendant(LinkageNode other)
public boolean traverseTree(LinkageNode.NodeHandler nodeHandler)
DFS the Linkage
tree starting from this node.
The search is pruned at isTreeLeaf()
.
nodeHandler
- called in DFS pre-order for each node visitedpublic abstract void updateCMTs()
public void updateCMTsRecursively()
updateCMTs()
in recursive tree DFS pre-order from this nodepublic vona.math.RX getCMT(vona.math.RX rx)
Get a copy of cmt
.
public vona.math.RX getCMT()
Get a copy of cmt
, always conses.
public abstract void remove()
Remove this node from the Linkage
tree.
All adjacent Joint endpoints are dangled.
Once a node has been removed it cannot be re-added.
public boolean isLive()
linkage
public abstract LinkageNode setLocked(boolean locked)
public LinkageNode lock()
setLocked(boolean)
public LinkageNode unlock()
setLocked(boolean)
public abstract boolean isLocked()
public void setLockedRecursively(boolean locked)
setLocked(boolean)
in recursive tree DFS pre-order from this nodepublic void setAllTreeJointsToHighestPrioritySoftGoal()
Set all tree joints in recursive DFS pre-order from this node to their
highest-priority soft goal, Joint.RX_POSTURE
or Joint.RX_TARGET
, if any.
public void setAllTreeJointsToGoal(int goal)
Set all tree joints in recursive DFS pre-order from this node to the
indicated goal, Joint.RX_POSTURE
or Joint.RX_TARGET
, if
set.
public void setAllTreeJointsToPosture()
public void setAllTreeJointsToTarget()
public java.lang.String addWidget(vona.j3d.Widget widget, java.lang.String name, java.lang.String frame)
Add a Widget
.
widget
- the Widget
to add, stored by ref, not nullname
- the name of the widget, or null to generate a unique nameframe
- the WP_FRAME
, or SF_CANONICAL
if nullWidget
java.lang.IllegalArgumentException
- if name is not null and not
uniquepublic java.lang.String addWidget(java.lang.String type, java.lang.String name, java.lang.String frame)
Widget
and addWidget(Widget, String, String)
public java.lang.String addWidget(vona.j3d.Widget widget, java.lang.String name)
addWidget(Widget, String, String)
, default framepublic java.lang.String addWidget(java.lang.String type, java.lang.String name)
addWidget(Widget, String, String)
, default framepublic java.lang.String addWidget(vona.j3d.Widget widget)
addWidget(Widget, String, String)
, default frame and namepublic java.lang.String addWidget(java.lang.String type)
addWidget(Widget, String, String)
, default frame and namepublic vona.j3d.Widget removeWidget(java.lang.String name)
Remove a Widget
.
public boolean removeWidget(vona.j3d.Widget widget)
removeWidget(String)
public int removeAllWidgets()
Remove all Widget
s.
public void renameWidget(vona.j3d.Widget w, java.lang.String name)
Rename a widget.
Has no effect if the new name is the same as the old name.
java.lang.IllegalArgumentException
- if name is not a unique widget
name in this LinkageNode, or if w is not a widget in this
LinkageNodepublic java.util.Collection<vona.j3d.Widget> getWidgets()
Get an unmodifiable view of the collection of Widget
s.
First calls updateWidgets()
iff widgetsDirty
.
public vona.j3d.Widget getWidget(java.lang.String name)
Get a Widget
.
First calls updateWidgets()
iff widgetsDirty
.
protected abstract java.lang.String getNodeWidgetProperty()
Return the Widget
property name that indicates an internal
(i.e. non-user) Widget.
public static boolean isUserWidget(vona.j3d.Widget w)
public void updateWidgets()
Defers to updateWidgetsImpl()
to update widgetMap
, then
counts numUserWidgets
and clears widgetsDirty
.
protected void updateWidgetsImpl()
Hook for lazy widgetMap
update.
Default impl updates all widgets to current widgetLength
, sets
their EntityClass.WP_ENTITY_CLASS
, and updates existing dbg
geometry iff enabled.
public void updateWidgetsRecursively()
updateWidgets()
in recursive tree DFS pre-order from this
node.
public void enableDBGSpheres(boolean enable)
Enable/disable debug spheres for all current widgets
.
public void enableDBGSpheresRecursively(boolean enable)
enableDBGSpheres(boolean)
in recursive tree DFS pre-order from this
node.
public void enableDBGNormals(boolean enable)
enableDBGSpheres(boolean)
public void enableDBGNormalsRecursively(boolean enable)
enableDBGNormals(boolean)
in recursive tree DFS pre-order from this
node.
public vona.math.RX getSubFrameRX(java.lang.String frame, vona.math.RX rx)
Get the transform taking coordinates in a sub-frame to the canonical
(i.e. cmt
) frame of this LinkageNode.
frame
- the sub-frame or null to imply SF_CANONICAL
rx
- the transform is written here on return, consing if nullpublic vona.math.RX getSubFrameRX(java.lang.String frame)
getSubFrameRX(String, RX)
, always consespublic vona.math.RX getSubFrameRX(vona.j3d.Widget widget, vona.math.RX rx)
Calls getSubFrameRX(String, RX)
with the WP_FRAME
of widget.
public vona.math.RX getSubFrameRX(vona.j3d.Widget widget)
Calls getSubFrameRX(String, RX)
with the WP_FRAME
of widget, always conses.
public vona.math.RX getSubFrameCMT(java.lang.String frame, vona.math.RX rx)
Convenience method appends cmt
to getSubFrameRX(String, RX)
.
public vona.math.RX getSubFrameCMT(java.lang.String frame)
getSubFrameCMT(String, RX)
, always consespublic vona.math.RX getSubFrameCMT(vona.j3d.Widget widget, vona.math.RX rx)
Calls getSubFrameCMT(String, RX)
with the WP_FRAME
of widget.
public vona.math.RX getSubFrameCMT(vona.j3d.Widget widget)
Calls getSubFrameCMT(String, RX)
with the WP_FRAME
of widget, always conses.
public java.lang.String reparentWidget(java.lang.String name, LinkageNode newParent, boolean holdAbsolutePose)
Move a Widget
from this LinkageNode to another.
First calls updateWidgets()
iff widgetsDirty
.
holdAbsolutePose
- whether to preserve the current pose of the widget
relative to the Linkage.groundLink
by appending to the Widget.rx
(relies on up-to-date cmt
for this node and for
newParent)protected java.lang.String reparentWidgetImpl(java.lang.String name, LinkageNode newParent, boolean holdAbsolutePose, boolean iffUserWidget)
Shared impl for reparentWidget(String, LinkageNode, boolean)
and reparentWidgets(LinkageNode, boolean)
.
public void reparentWidget(java.lang.String name, LinkageNode newParent)
reparentWidget(String, LinkageNode, boolean)
, holding global
pose.
public void reparentWidgets(LinkageNode newParent, boolean holdAbsolutePose)
reparentWidget(String, LinkageNode, boolean)
all Widget
s.
public void reparentWidgets(LinkageNode newParent)
reparentWidgets(LinkageNode, boolean)
holding global posespublic void reparentUserWidgets(LinkageNode newParent, boolean holdAbsolutePose)
reparentWidget(String, LinkageNode, boolean)
all user Widget
s.
public void reparentUserWidgets(LinkageNode newParent)
reparentUserWidgets(LinkageNode, boolean)
holding global
poses.
public boolean hasWidgets()
public int getNumWidgets()
public int getNumUserWidgets()
public boolean setWidgetLength(float widgetLength, boolean updateIfDifferent)
Set widgetLength
[m].
updateIfDifferent
- whether to updateWidgets()
if the new
length differs from old, if not, widgetsDirty
is setpublic boolean setWidgetLength(float widgetLength)
setWidgetLength(float, boolean)
, updates if differentpublic float getWidgetLength()
widgetLength
public boolean setWidgetLengthRecursively(float widgetLength, boolean updateIfDifferent)
setWidgetLength(float, boolean)
in recursive tree DFS pre-order from this
node.
public boolean setWidgetLengthRecursively(float widgetLength)
Covers setWidgetLengthRecursively(float, boolean)
, updates if
different.
public LinkageNode findNode(java.lang.String namePattern, int nth)
Get the nth LinkageNode
with a name matching
namePattern in recursive tree DFS pre-order from this node.
nth
- 0 to return the first matching LinkageNode
, 1 to return
the 2nd, etcLink
, null if not foundpublic LinkageNode findNode(java.lang.String namePattern)
findNode(String, int)
, returning the first LinkageNode
with the given namePattern.
public Link findLink(java.lang.String namePattern, int nth)
Similar to findNode(String, int)
.
public Link findLink(java.lang.String namePattern)
findLink(String, int)
, returning the first Link
with
the given namePattern.
public Joint findJoint(java.lang.String namePattern, int nth)
Similar to findNode(String, int)
.
public Joint findJoint(java.lang.String namePattern)
findJoint(String, int)
, returning the first Joint
with
the given namePattern.
public java.util.Collection<LinkageNode> findNodes(java.lang.String namePattern, java.util.Collection<LinkageNode> nodes)
Get all LinkageNode
s with a name matching namePattern in
recursive tree DFS pre-order from this node.
public java.util.ArrayList<LinkageNode> findNodes(java.lang.String namePattern)
findNodes(String, Collection)
, consing a new ArrayList
.
public java.util.Collection<Link> findLinks(java.lang.String namePattern, java.util.Collection<Link> links)
Get all Link
s with a name matching namePattern in
recursive tree DFS pre-order from this node.
public java.util.ArrayList<Link> findLinks(java.lang.String namePattern)
findLinks(String, Collection)
, consing a new ArrayList
.
public java.util.Collection<Joint> findJoints(java.lang.String namePattern, java.util.Collection<Joint> joints)
Similar to findLinks(String, Collection)
.
public java.util.ArrayList<Joint> findJoints(java.lang.String namePattern)
findJoints(String, Collection)
, consing a new ArrayList
.
protected <T extends LinkageNode> T findImpl(java.lang.String namePattern, int nth, java.lang.Class<T> type)
Common impl of findNode(String, int)
and similar.
protected <T extends LinkageNode> java.util.Collection<T> findMultipleImpl(java.lang.String namePattern, java.util.Collection<T> ret, java.lang.Class<T> type)
Common impl of findNodes(String, Collection)
and similar.
public int[] collectTreeMetrics(int[] metrics)
Collect metrics on the subtree rooted at this node.
Each metric is an int in the metrics array, as defined by the
TM_*
constants.
metrics
- the array in which to collect the metrics, or null or
smaller than TM_SIZE
to conspublic int[] collectTreeMetrics()
Covers collectTreeMetrics(int[])
, conses.
public abstract java.lang.String toString(boolean details)
public java.lang.String toString()
toString(boolean)
without detailstoString
in class java.lang.Object
public void dump(java.io.PrintStream s)
public void dump()
dump(java.io.PrintStream)
to System.outpublic void dumpTree(java.io.PrintStream s)
Recursively dump(PrintStream)
the sub-tree starting at this
node.
public void dumpTree()
dumpTree(PrintStream)
to System.outprotected void dumpTree(java.lang.String prefix, java.io.PrintStream s)
dumpTree(PrintStream)
protected boolean suppressTreeDump()
Whether to suppress this node in dumpTree(String,
PrintStream)
, default false.
public void dumpTreeMetrics(java.io.PrintStream s)
collectTreeMetrics(int[])
and dump thempublic void dumpTreeMetrics()
dumpTreeMetrics(PrintStream)
to System.outpublic int getDepth()
depth
public int compareTo(LinkageNode o)
Compares this node with the specified node for order by depth
.
compareTo
in interface java.lang.Comparable<LinkageNode>
depth
is less than, equal to, or greater than o.depth
public boolean hasSubFrame(java.lang.String frame)
public void dumpSubFrames(java.io.PrintStream s)
public void dumpSubFrames()
dumpSubFrames(PrintStream)
to System.outpublic boolean isInternalFrame(java.lang.String frame)
Check if frame is an internal (i.e. non-user) subframe.
Default impl checks SF_CANONICAL
.
public java.lang.Object setProperty(java.lang.String key, java.lang.Object value, boolean replace)
Set a property.
replace
- whether to replace the value if the key is already presentpublic java.lang.Object setProperty(java.lang.String key, java.lang.Object value)
setProperty(String, Object, boolean)
, replacespublic java.lang.Object removeProperty(java.lang.String key)
public java.lang.Object getProperty(java.lang.String key)
public boolean hasProperty(java.lang.String key)