1SoSearchAction(3IV)() SoSearchAction(3IV)()
2
3
4
6 SoSearchAction — searches for nodes in a scene graph
7
9 SoAction > SoSearchAction
10
12 #include <Inventor/actions/SoSearchAction.h>
13
14 enum LookFor {
15 SoSearchAction::NODE Search for a particular node (by pointer)
16 SoSearchAction::TYPE Search for a particular type of node
17 SoSearchAction::NAME Search for a node with a particular name
18 }
19
20 enum Interest {
21 SoSearchAction::FIRST Return only the first path found
22 SoSearchAction::LAST Return only the last path found
23 SoSearchAction::ALL Return all paths found
24 }
25
26 Methods from class SoSearchAction:
27
28 SoSearchAction()
29 void setNode(SoNode *n)
30 SoNode * getNode() const
31 void setType(SoType t, SbBool derivedIsOk = TRUE)
32 SoType getType(SbBool &derivedIsOk) const
33 void setName(const SbName &n)
34 const SbName & getName() const
35 void setFind(int what)
36 int getFind()
37 void setInterest(Interest interest)
38 Interest getInterest() const
39 void setSearchingAll(SbBool flag)
40 SbBool isSearchingAll() const
41 SoPath * getPath() const
42 SoPathList & getPaths()
43 void reset()
44
45 Methods from class SoAction:
46
47 virtual void apply(SoNode *node)
48 virtual void apply(SoPath *path)
49 virtual void apply(const SoPathList &pathList, SbBool obeysRules =
50 FALSE)
51 static SoType getClassTypeId()
52 virtual SoType getTypeId()
53 virtual SbBool isOfType(SoType type)
54 virtual void invalidateState()
55
56
58 This class is used to search scene graphs for specific nodes, nodes of
59 a specific type, nodes with a specific name, or any combination of
60 these. It can search for just the first or last node satisfying the
61 criteria or for all such nodes. The actions return paths to each node
62 found.
63
64 Note that by default nodekits do not search their children when a
65 search action is applied. The man page for SoBaseKit discusses the
66 methods SoBaseKit::isSearchingChildren() and SoBaseKit::setSearch‐
67 ingChildren(), which allow you to query and control this behavior.
68
70 SoSearchAction()
71 Constructor.
72
73 void setNode(SoNode *n)
74 SoNode * getNode() const
75 Sets/returns the node to search for.
76
77 void setType(SoType t, SbBool derivedIsOk = TRUE)
78 SoType getType(SbBool &derivedIsOk) const
79 Sets/returns the node type to search for. If derivedIsOk is TRUE, a
80 node that is of a type that is derived from t will pass this search
81 criterion.
82
83 void setName(const SbName &n)
84 const SbName & getName() const
85 Sets/returns the name of the node to search for.
86
87 void setFind(int what)
88 int getFind()
89 Sets/returns what to look for; what is a bitmask of LookFor enum
90 values. Default is no flags at all. Note that setting a node, type,
91 and/or name to search for activates the relevant flag, so you may
92 never need to call this method directly.
93
94 void setInterest(Interest interest)
95 Interest getInterest() const
96 Sets/returns which paths to return. Default is FIRST.
97
98 void setSearchingAll(SbBool flag)
99 SbBool isSearchingAll() const
100 Sets/returns whether searching uses regular traversal or whether it
101 traverses every single node. For example, if this flag is FALSE, an
102 SoSwitch node will traverse only the child or children it would nor‐
103 mally traverse for an action. If the flag is TRUE, the switch would
104 always traverse all of its children. The default is FALSE.
105
106 SoPath * getPath() const
107 Returns resulting path, or NULL if no path was found. This should be
108 used if the interest is FIRST or LAST.
109
110 SoPathList & getPaths()
111 Returns resulting path list. This should be used if the interest is
112 ALL.
113
114 void reset()
115 Resets options back to default values; clears list of returned
116 paths. This can be used to apply the action again with a different
117 set of search criteria.
118
119
121 SoPath, SoBaseKit
122
123
124
125
126 SoSearchAction(3IV)()