Open Inventor Reference
|
Searches for nodes in a scene graph. More...
#include <Inventor/actions/SoSearchAction.h>
Public Types | |
enum | LookFor { NODE = 0x01, TYPE = 0x02, NAME = 0x04 } |
Enum that defines the search criterion: More... | |
enum | Interest { FIRST, LAST, ALL } |
Enum that defines which paths to return: More... | |
Public Member Functions | |
SoSearchAction () | |
Constructor. | |
virtual | ~SoSearchAction () |
Destructor. | |
void | reset () |
Resets options back to default values; clears list of returned paths. | |
void | setFind (int what) |
Sets what to look for; what is a bitmask of LookFor enum values. | |
int | getFind () |
Returns what to look for. | |
SoNode * | getNode () const |
Returns the node to search for. | |
void | setNode (SoNode *n) |
Sets the node to search for. | |
SoType | getType (SbBool &derivedIsOk) const |
Gets the node type to search for. | |
void | setType (SoType t, SbBool derivedIsOk=TRUE) |
Sets the node type to search for. | |
const SbName & | getName () const |
Sets/returns the name of the node to search for. | |
void | setName (const SbName &n) |
Sets/returns the name of the node to search for. | |
Interest | getInterest () const |
Sets/returns which paths to return. Default is FIRST. | |
void | setInterest (Interest i) |
Sets/returns which paths to return. Default is FIRST. | |
SbBool | isSearchingAll () const |
void | setSearchingAll (SbBool flag) |
Sets/returns whether searching uses regular traversal or whether it traverses every single node. | |
SoPath * | getPath () const |
Returns resulting path, or NULL if no path was found. | |
SoPathList & | getPaths () |
Returns resulting path list. This should be used if the interest is ALL. | |
void | setFound () |
Sets/returns whether action has found all desired nodes. | |
SbBool | isFound () const |
void | addPath (SoPath *path) |
Sets found path or adds to list of found paths (depending on interest) | |
Static Public Member Functions | |
static void | initClass () |
Static Public Attributes | |
static SbBool | duringSearchAll |
This flag is used by the SoSwitch node, which must return a different result from its 'affectsState' method when called during a SearchAction that is searching all children. | |
Protected Member Functions | |
virtual void | beginTraversal (SoNode *node) |
Initiates action on graph. |
This class is used to search scene graphs for specific nodes, nodes of a specific type, nodes with a specific name, or any combination of these. It can search for just the first or last node satisfying the criteria or for all such nodes. The actions return paths to each node found.
Note that by default nodekits do not search their children when a search action is applied. The man page for SoBaseKit discusses the methods SoBaseKit::isSearchingChildren() and SoBaseKit::setSearchingChildren(), which allow you to query and control this behavior.
Definition at line 86 of file SoSearchAction.h.
FIRST |
Return only the first path found. |
LAST |
Return only the last path found. |
ALL |
Return all paths found. |
Definition at line 100 of file SoSearchAction.h.
NODE |
Looking for a particular node. |
TYPE |
Looking for a particualr type of node. |
NAME |
Looking for a node with a particular name. |
Definition at line 93 of file SoSearchAction.h.
SoSearchAction::SoSearchAction | ( | ) |
virtual SoSearchAction::~SoSearchAction | ( | ) | [virtual] |
void SoSearchAction::addPath | ( | SoPath * | path | ) |
virtual void SoSearchAction::beginTraversal | ( | SoNode * | node | ) | [protected, virtual] |
Reimplemented from SoAction.
int SoSearchAction::getFind | ( | ) | [inline] |
Definition at line 124 of file SoSearchAction.h.
Interest SoSearchAction::getInterest | ( | ) | const [inline] |
Definition at line 147 of file SoSearchAction.h.
const SbName& SoSearchAction::getName | ( | ) | const [inline] |
Definition at line 142 of file SoSearchAction.h.
SoNode* SoSearchAction::getNode | ( | ) | const [inline] |
Definition at line 127 of file SoSearchAction.h.
SoPath* SoSearchAction::getPath | ( | ) | const [inline] |
This should be used if the interest is FIRST or LAST.
Definition at line 162 of file SoSearchAction.h.
SoPathList& SoSearchAction::getPaths | ( | ) | [inline] |
Definition at line 165 of file SoSearchAction.h.
If derivedIsOk
is TRUE, a node that is of a type that is derived from t
will pass this search criterion.
Definition at line 134 of file SoSearchAction.h.
static void SoSearchAction::initClass | ( | ) | [static] |
Reimplemented from SoAction.
SbBool SoSearchAction::isFound | ( | ) | const [inline] |
Definition at line 170 of file SoSearchAction.h.
References SoAction::hasTerminated().
SbBool SoSearchAction::isSearchingAll | ( | ) | const [inline] |
Definition at line 152 of file SoSearchAction.h.
void SoSearchAction::reset | ( | ) |
This can be used to apply the action again with a different set of search criteria.
void SoSearchAction::setFind | ( | int | what | ) | [inline] |
Default is no flags at all. Note that setting a node, type, and/or name to search for activates the relevant flag, so you may never need to call this method directly.
Definition at line 121 of file SoSearchAction.h.
void SoSearchAction::setFound | ( | ) | [inline] |
Definition at line 169 of file SoSearchAction.h.
References SoAction::setTerminated(), and TRUE.
void SoSearchAction::setInterest | ( | Interest | i | ) | [inline] |
Definition at line 149 of file SoSearchAction.h.
void SoSearchAction::setName | ( | const SbName & | n | ) |
void SoSearchAction::setNode | ( | SoNode * | n | ) |
void SoSearchAction::setSearchingAll | ( | SbBool | flag | ) | [inline] |
For example, if this flag is FALSE, an SoSwitch node will traverse only the child or children it would normally traverse for an action. If the flag is TRUE, the switch would always traverse all of its children. The default is FALSE.
Definition at line 158 of file SoSearchAction.h.
If derivedIsOk
is TRUE, a node that is of a type that is derived from t
will pass this search criterion.
SbBool SoSearchAction::duringSearchAll [static] |
Definition at line 181 of file SoSearchAction.h.