Debian Codegraph @

doc/man/man3/ivm/general/SoPath.ivm

raw
1 NAME SoPath SoPath "" { path that points to a list of hierarchical nodes }
2
3 INCLUDE SoPath.h
4
5 DESC {
6
7 A path represents a scene graph or subgraph. It contains a list of
8 pointers to nodes forming a chain from some root to some descendent.
9 Each node in the chain is a child of the previous node. Paths are used
10 to refer to some object in a scene graph precisely and unambiguously,
11 even if there are many instances of the object. Therefore, paths are
12 returned by both the \cSoRayPickAction\. and \cSoSearchAction\..
13 \p
14 When an action is applied to a path, only the nodes in the subgraph
15 defined by the path are traversed. These include: the nodes in the
16 path chain, all nodes (if any) below the last node in the path, and
17 all nodes whose effects are inherited by any of these nodes.
18 \p
19 \cSoPath\. attempts to maintain consistency of paths even when the
20 structure of the scene graph changes. For example, removing a child
21 from its parent when both are in a path chain cuts the path chain at
22 that point, leaving the top part intact. Removing the node to the left
23 of a node in a path adjusts the index for that node. Replacing a child
24 of a node when both the parent and the child are in the chain replaces
25 the child in the chain with the new child, truncating the path below
26 the new child.
27 \p
28 Note that only public children of nodes are accessible from an
29 \cSoPath\.. Nodes like node kits that limit access to their children
30 may provide other ways to get more information, such as by using the
31 \cSoNodeKitPath\. class.
32 }
33
34 METHOD "" SoPath() {
35 Constructs an empty path.
36 }
37
38 METHOD CreateLen SoPath(int approxLength) {
39 Constructs a path with a hint to length (number of nodes in chain).
40 }
41
42 METHOD CreateNode SoPath(SoNode *node) {
43 Constructs a path and sets the head node to the given node.
44 }
45
46 METHOD "" void setHead(SoNode *node) {
47 Sets head node (first node in chain). The head node must be set before the
48 \+\mappend()\. or \mpush()\. methods\.
49 \-\mSoPathAppend()\. or \mSoPathPush()\. functions\.
50 may be called.
51 }
52
53 METHOD AppendInd void append(int childIndex) {
54 Adds node to end of chain; the node is the \achildIndex\.'th child of
55 the current tail node.
56 }
57
58 METHOD AppendNode void append(SoNode *childNode) {
59 Adds node to end of chain; uses the first occurrence of \achildNode\.
60 as child of current tail node. If the path is empty, this is
61 equivalent to
62 \+\msetHead(childNode)\..\.
63 \-\mSoPathSetHead(childNode)\..\.
64 }
65
66 METHOD AppendPath void append(const SoPath *fromPath) {
67 Adds all nodes in \afromPath\.'s chain to end of chain; the head node
68 of \afromPath\. must be the same as or a child of the current tail node.
69 }
70
71 METHOD "" void push(int childIndex) {}
72 METHOD "" void pop() {
73 These allow a path to be treated as a stack; they push a node at the
74 end of the chain and pop the last node off.
75 }
76
77 METHOD "" SoNode * getHead() const {}
78 METHOD "" SoNode * getTail() const {
79 These return the first and last nodes in a path chain.
80 }
81
82 METHOD "" SoNode * getNode(int i) const {}
83 METHOD getInd int getIndex(int i) const {
84 These return a pointer to the \ai\.'th node or the index of the
85 \ai\.'th node (within its parent) in the chain.
86 \+Calling \mgetNode(0)\. is equivalent to calling \mgetHead()\..\.
87 \-Calling \mSoPathGetNode(path, 0)\. is equivalent to calling
88 \mSoPathGetHead(path)\..\.
89 }
90
91 METHOD "" SoNode * getNodeFromTail(int i) const {}
92 METHOD getIndFromTail int getIndexFromTail(int i) const {
93 These return a pointer to the \ai\.'th node or the index of the
94 \ai\.'th node (within its parent) in the chain, counting backward from
95 the tail node. Passing 0 for \ai\. returns the tail node or its index.
96 }
97
98 METHOD getLen int getLength() const {
99 Returns length of path chain (number of nodes).
100 }
101
102 METHOD "" void truncate(int start) {
103 Truncates the path chain, removing all nodes from index \astart\. on.
104 Calling
105 \+\mtruncate(0)\.\.
106 \-\mSoPathTruncate(0)\.\.
107 empties the path entirely.
108 }
109
110 METHOD "" SbBool containsNode(const SoNode *node) const {
111 Returns TRUE if the node is found anywhere in the path chain.
112 }
113
114 METHOD "" SbBool containsPath(const SoPath *path) const {
115 Returns TRUE if the nodes in the chain in the passed path are
116 contained (in consecutive order) in this path chain.
117 }
118
119 METHOD "" int findFork(const SoPath *path) const {
120 If the two paths have different head nodes, this returns -1.
121 Otherwise, it returns the path chain index of the last node (starting
122 at the head) that is the same for both paths.
123 }
124
125 METHOD "" SoPath * copy(int startFromNodeIndex = 0, int numNodes = 0) const {
126 Creates and returns a new path that is a copy of some or all of this
127 path. Copying starts at the given index (default is 0, which is the
128 head node). A \anumNodes\. of 0 (the default) means copy all nodes
129 from the starting index to the end. Returns NULL on error.
130 }
131
132 METHOD "" friend int operator ==(const SoPath &p1, const SoPath &p2) {
133 Returns TRUE if all node pointers in the two path chains are identical.
134 }
135
136 METHOD "" static SoPath * getByName(const SbName &name) {}
137 METHOD getByNameList static int getByName(const SbName &name,
138 SoPathList &list) {
139 These methods lookup and return paths with a given name. Paths are
140 named by calling their
141 \+\msetName()\. method\.\-\mSoPathSetName()\. function\.
142 (defined by the \cSoBase\. class). The first form returns the last
143 path that was given that name, either by
144 \+\msetName()\.\.\-\mSoPathSetName()\.\.
145 or by reading in a named path from a file. If there is no path with
146 the given name, NULL will be returned. The second form appends all
147 paths with the given name to the given path list and returns the
148 number of paths that were added. If there are no paths with the given
149 name, zero will be returned and nothing will be added to the list.
150 }
151
152 ALSO { SoNode, SoRayPickAction, SoSearchAction, SoNodeKitPath }
153