Package com.openinventor.inventor
Class SoPath
java.lang.Object
com.openinventor.inventor.Inventor
com.openinventor.inventor.misc.SoBase
com.openinventor.inventor.SoPath
- All Implemented Interfaces:
SafeDisposable
A path represents a scene graph or subgraph. It contains a list of pointers to nodes
forming a chain from some root to some descendent. Each node in the chain is a
child of the previous node. Paths are used to refer to some object in a scene graph
precisely and unambiguously, even if there are many instances of the object.
Therefore, paths are returned by both the SoRayPickAction and SoSearchAction.
When an action is applied to a path, only the nodes in the subgraph defined by the path are traversed. These include : the nodes in the path chain, all nodes (if any) below the last node in the path, and all nodes whose effects are inherited by any of these nodes.
SoPath attempts to maintain consistency of paths even when the structure of the scene graph changes. For example, removing a child from its parent when both are in a path chain cuts the path chain at that point, leaving the top part intact. Removing the node to the left of a node in a path adjusts the index for that node. Replacing a child in the chain with the new child, truncating the path below the new child.
Since nodekits hide their children, there are 3 ways to view the differents nodes contained by the path
When an action is applied to a path, only the nodes in the subgraph defined by the path are traversed. These include : the nodes in the path chain, all nodes (if any) below the last node in the path, and all nodes whose effects are inherited by any of these nodes.
SoPath attempts to maintain consistency of paths even when the structure of the scene graph changes. For example, removing a child from its parent when both are in a path chain cuts the path chain at that point, leaving the top part intact. Removing the node to the left of a node in a path adjusts the index for that node. Replacing a child in the chain with the new child, truncating the path below the new child.
Since nodekits hide their children, there are 3 ways to view the differents nodes contained by the path
- the regular path (field regular) do not contains hidden childrens of nodekits
- the nodekit path (field nodekit) contains only the nodekits
- the full path (field full) contains all nodes (public and hidden)
- full.getLength() returns the number of public and hidden nodes in the path
- nodekit.getLength() returns the number of nodekits in the path
- regular.getLength() returns the number of nodes up to the first nodekit in the path
- Author:
- Jean-Michel Godinaud
-
Nested Class Summary
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
FieldsModifier and TypeFieldDescriptionaccess to all nodes (public and hidden) in the pathaccess only to nodekits in the pathaccess to all public nodes in the path except hidden children in nodekits.Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares this object against the specified object.static SoPath[]
getAllByName
(String name) Returns an array of all path with the given name.static SoPath
Returns the last path that was given the name, either bySoBase.setName(java.lang.String)
or by reading in a named path from a file.Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable, touch
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
Field Details
-
full
access to all nodes (public and hidden) in the path -
regular
access to all public nodes in the path except hidden children in nodekits. -
nodekit
access only to nodekits in the path
-
-
Constructor Details
-
SoPath
public SoPath() -
SoPath
-
SoPath
public SoPath(int approxLength)
-
-
Method Details
-
getByName
Returns the last path that was given the name, either bySoBase.setName(java.lang.String)
or by reading in a named path from a file. If there is no path with the given name, null will be returned. -
getAllByName
Returns an array of all path with the given name. Paths are named by calling theirSoBase.setName(java.lang.String)
. -
equals
Compares this object against the specified object. The result is true if and only if the argument is not null, is an instance of this's class and has the same value(s).
-