Open Inventor Reference
|
Abstract base class for all actions. More...
#include <Inventor/actions/SoAction.h>
Public Types | |
enum | AppliedCode { NODE , PATH , PATH_LIST } |
This enum is used to determine what the action is being applied to. More... | |
enum | PathCode { NO_PATH , IN_PATH , BELOW_PATH , OFF_PATH } |
This enum may be used during traversal of nodes to indicate where the node is with respect to the path being traversed. More... | |
Public Member Functions | |
virtual | ~SoAction () |
Destructor. | |
virtual SoType | getTypeId () const =0 |
Returns the type identifier for a specific instance. | |
bool | isOfType (SoType type) const |
Returns TRUE if this instance is of the type specified in type or is derived from that type. | |
virtual void | apply (SoNode *node) |
virtual void | apply (SoPath *path) |
virtual void | apply (const SoPathList &pathList, bool obeysRules=FALSE) |
Initiates an action on the graph defined either by a node, path, or list of paths. | |
virtual void | invalidateState () |
Invalidates the current traversal state in the action, forcing it to be recreated when the action is next applied. | |
AppliedCode | getWhatAppliedTo () const |
Returns code indicating what action is being applied to. | |
SoNode * | getNodeAppliedTo () const |
These returns a pointer to the node, path, or path list the action is being applied to. | |
SoPath * | getPathAppliedTo () const |
const SoPathList * | getPathListAppliedTo () const |
A single path list may be split into several, one for each different head node. | |
const SoPathList * | getOriginalPathListAppliedTo () const |
bool | isLastPathListAppliedTo () const |
PathCode | getPathCode (int &numIndices, const int *&indices) |
Returns path code based on where current node (the node at the end of the current path) lies with respect to the path(s) the action is being applied to. | |
void | traverse (SoNode *node) |
Does traversal of a graph rooted by a node. | |
bool | hasTerminated () const |
Returns TRUE if the traversal has reached a termination condition. | |
const SoPath * | getCurPath () |
Returns a pointer to the path accumulated during traversal, i.e., the chain of nodes from the root of the traversed graph to the current node being traversed. | |
SoState * | getState () const |
Get the state from the action. | |
PathCode | getCurPathCode () const |
These methods maintain the current path accumulated so far during traversal. | |
void | pushCurPath (int childIndex) |
void | popCurPath (PathCode prevPathCode) |
virtual SoNode * | getCurPathTail () |
This is virtual, so that SoCallbackAction can use current node. | |
void | usePathCode (int &numIndices, const int *&indices) |
called by inline getPathCode: | |
void | pushCurPath () |
Optimized versions of push/pop when we know path codes won't change: | |
void | popPushCurPath (int childIndex) |
void | popCurPath () |
const SoLightweightPath & | getCurrentLightweightPath () const |
Returns the current "light" path. | |
void | setCurrentLightweightPath (const SoLightweightPath &path) |
Sets the current "light" path. | |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
static void | nullAction (SoAction *, SoNode *) |
Null action method that can be stored in lookup table when desired. | |
static void | initClass () |
static void | initClasses () |
Initialize ALL Inventor action classes. | |
Protected Member Functions | |
SoAction () | |
Constructor. | |
virtual const SoEnabledElementsList & | getEnabledElements () const |
Returns the list of enabled elements for a given action subclass. | |
virtual void | beginTraversal (SoNode *node) |
Begins traversal of an action at the given node. | |
void | setTerminated (bool flag) |
Allows subclass instance to indicate that traversal has reached a termination condition. | |
virtual bool | shouldCompactPathLists () const |
This method is used when applying an action to an SoPathList. | |
Protected Attributes | |
SoState * | state |
Traversal state. | |
SoActionMethodList * | traversalMethods |
The list of what to do when. | |
Static Protected Attributes | |
static SoEnabledElementsList * | enabledElements |
Holds list of enabled elements for the SoAction class. | |
static SoActionMethodList * | methods |
... and the methods | |
Friends | |
class | SoDB |
SoAction is the abstract base class for all actions. Classes derived from SoAction define operations to be applied at each node encountered during traversal of a scene graph. The function that gets called to implement the action for a particular node type is determined by a lookup table in the global database.
Definition at line 179 of file SoAction.h.
Enumerator | |
---|---|
NODE | Applied to graph rooted by a node. |
PATH | Applied to graph defined by a path. |
PATH_LIST | Applied to graphs defined by list of paths. |
Definition at line 235 of file SoAction.h.
enum SoAction::PathCode |
Enumerator | |
---|---|
NO_PATH | Not traversing a path. |
IN_PATH | In middle of path chain (not tail node) |
BELOW_PATH | Tail node of path or below tail node. |
OFF_PATH | None of the above (Probably to the left) |
Definition at line 243 of file SoAction.h.
|
virtual |
|
protected |
|
virtual |
TRUE can be passed for the obeysRules
flag if the given path list has the following 4 properties:
These rules will be obeyed by path lists returned by picking and by searches for non-group nodes.
Reimplemented in SoBoxHighlightRenderAction, and SoLineHighlightRenderAction.
|
virtual |
Reimplemented in SoBoxHighlightRenderAction, and SoLineHighlightRenderAction.
|
virtual |
Reimplemented in SoBoxHighlightRenderAction, and SoLineHighlightRenderAction.
|
protectedvirtual |
The default method just calls traverse(node). This is virtual to allow subclasses to do extra work before or after traversing the node.
Reimplemented in SoCallbackAction, SoGetBoundingBoxAction, SoGetMatrixAction, SoGLRenderAction, SoHandleEventAction, SoPickAction, SoRayPickAction, SoSearchAction, and SoWriteAction.
|
inlinestatic |
Definition at line 187 of file SoAction.h.
const SoPath * SoAction::getCurPath | ( | ) |
|
inline |
The action needs to know whether this path is a subset of the path being applied to; it saves this info in the onPath variable. Before a node is pushed onto the current path, call getOnPath() to determine the current setting. The value of this flag should be passed in to popCurPath() so the onPath variable can be restored.
Definition at line 310 of file SoAction.h.
|
virtual |
Reimplemented in SoCallbackAction.
|
inline |
MeVis extension which was needed for some rendering scenarios where the intermediate path needs to be stored and restored.
Definition at line 332 of file SoAction.h.
|
protectedvirtual |
|
inline |
Each returns NULL if the action is not being applied to the appropriate class.
Definition at line 256 of file SoAction.h.
|
inline |
Definition at line 264 of file SoAction.h.
|
inline |
Definition at line 257 of file SoAction.h.
|
inline |
If this returns IN_PATH, indices is set to point to an array of indices corresponding to the children that continue the paths and numIndices is set to the number of such children.
Definition at line 275 of file SoAction.h.
|
inline |
These methods allow subclasses to determine the current path list, the original path list, and whether the current list is the last one from the original
Definition at line 262 of file SoAction.h.
|
inline |
Definition at line 295 of file SoAction.h.
Referenced by SoBundle::SoBundle().
|
pure virtual |
|
inline |
Definition at line 251 of file SoAction.h.
|
inline |
Definition at line 287 of file SoAction.h.
Referenced by SoGLRenderAction::abortNow(), SoSearchAction::isFound(), and SoHandleEventAction::isHandled().
|
static |
|
static |
|
virtual |
This is typically unnecessary in most applications.
Reimplemented in SoGLRenderAction.
|
inline |
Definition at line 266 of file SoAction.h.
bool SoAction::isOfType | ( | SoType | type | ) | const |
Otherwise, it returns FALSE. For example,
returns TRUE if actionPtr
is an instance of SoGetMatrixAction or one of its subclasses.
|
inline |
Definition at line 327 of file SoAction.h.
void SoAction::popCurPath | ( | PathCode | prevPathCode | ) |
|
inline |
Definition at line 325 of file SoAction.h.
|
inline |
Definition at line 323 of file SoAction.h.
void SoAction::pushCurPath | ( | int | childIndex | ) |
|
inline |
MeVis extension which was needed for some rendering scenarios where the intermediate path needs to be stored and restored.
Definition at line 337 of file SoAction.h.
|
inlineprotected |
Definition at line 353 of file SoAction.h.
Referenced by SoSearchAction::setFound(), and SoHandleEventAction::setHandled().
|
protectedvirtual |
It returns TRUE if the action should create a compact version of the path list before applying itself to it. The default method returns TRUE, since the compact version is more efficient. Some actions may choose to return FALSE; for example, the SoWriteAction applies itself to each path separately, so it doesn't need the extra overhead of compacting the list.
Reimplemented in SoWriteAction.
void SoAction::traverse | ( | SoNode * | node | ) |
void SoAction::usePathCode | ( | int & | numIndices, |
const int *& | indices | ||
) |
|
friend |
Definition at line 434 of file SoAction.h.
|
staticprotected |
Definition at line 373 of file SoAction.h.
|
staticprotected |
Definition at line 376 of file SoAction.h.
|
protected |
Definition at line 366 of file SoAction.h.
|
protected |
Subclasses set this pointer to their per-class instance in their constructors.
Definition at line 370 of file SoAction.h.