SoAction Class Reference
[Actions]

Abstract base class for all actions. More...

#include <Inventor/actions/SoAction.h>

Inheritance diagram for SoAction:
SoTypedObject SoBevelAction SoCallbackAction SoCSGAction SoDistributeAction SoGetBoundingBoxAction SoGetMatrixAction SoGetPrimitiveCountAction SoGLRenderAction SoHandleEventAction SoIntersectionDetectionAction SoNurbsBREPAction SoPickAction SoSearchAction SoSimplifyAction SoSplitGeometryAction SoToHTMLAction SoToVRMLAction SoVectorizeAction SoWriteAction

List of all members.

Classes

struct  AppliedTo

Public Types

enum  DistribMode {
  LOCAL_ONLY,
  CLUSTER_ONLY,
  ALL
}

Public Member Functions

virtual ~SoAction ()
virtual void apply (SoNode *node)
virtual void apply (SoPath *path)
virtual void apply (const SoPathList &pathList, SbBool obeysRules=FALSE)
virtual void clearApplyResult ()
virtual void invalidateState ()
void stopActionInBranch ()
SbBool getContinueActionInBranchFlag () const
void resetContinueActionInBranchFlag ()
void useAlternateRep (const SbBool enable)
SbBool isUsingAlternateRep () const
void setSceneManager (SoSceneManager *mgr)
SoSceneManagergetSceneManager () const
virtual void forwardTraversal (SoNode *node)

Static Public Member Functions

static SoType getClassTypeId ()

Friends

class SoDB
class SoMultiPassElement

Detailed Description

Abstract base class for all actions.

SoAction is the 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.

An action may be applied to a node (SoNode), a path (SoPath) or a list of paths (SoPathList).

Reference counting:

Warning: Most actions call ref() on the node (or path) before traversing the scene graph, then call unref() after traversal. If the node (or path) has a reference count of zero (the default), the call to apply() will cause it to be destroyed! A warning message is posted in this case when using a debug build of Open Inventor.

Hidden references:

Some actions, e.g. SoSearchAction and SoRayPickAction, create one or more SoPath objects when they are applied to the scene graph. The SoPath object calls ref() on each node in the path. This reference will prevent the node from being destroyed for as long as the SoPath object exists. These SoPath objects are stored internally in the action and exist until the action object itself is destroyed or reset.

SEE ALSO

SoNode, SoPath, SoPathList, SoCallbackAction, SoGLRenderAction, SoGetBoundingBoxAction, SoGetMatrixAction, SoHandleEventAction, SoPickAction, SoRayPickAction, SoSearchAction, SoWriteAction


Member Enumeration Documentation

This is used to define the way an action is distributed across a cluster.

Enumerator:
LOCAL_ONLY 

Action is only applied by the application.

CLUSTER_ONLY 

Action is only applied by OIRU of the cluster.

ALL 

Both application and cluster apply the action.


Constructor & Destructor Documentation

virtual SoAction::~SoAction (  )  [virtual]

Destructor.


Member Function Documentation

virtual void SoAction::apply ( const SoPathList pathList,
SbBool  obeysRules = FALSE 
) [virtual]

Initiates an action on the graph defined by a list of paths.

TRUE can be passed for the obeysRules flag if the given path list has the following 4 properties:

  1. All paths have the same head node.
  2. Paths are sorted in traversal order.
  3. If one path ends at node A, no other path continues through A.
  4. No two paths are the same.

These rules will be obeyed by path lists returned by picking and by searches for non-group nodes.

Reimplemented in SoToU3DAction, SoVectorizeAction, SoBevelAction, SoBoxHighlightRenderAction, SoGlobalSimplifyAction, SoLineHighlightRenderAction, SoShapeSimplifyAction, SoSplitGeometryAction, SoToHTMLAction, SoToVRML2Action, SoToVRMLAction, SoIntersectionDetectionAction, PoToVRML2Action, SoSTLWriteAction, and SoCSGAction.

virtual void SoAction::apply ( SoPath path  )  [virtual]

Initiates an action on the graph defined by a path.

Warning: Most actions call ref() on the path before traversing the scene graph, then call unref() after traversal. If the path's reference count was zero (the default), the call to apply() will cause it to be destroyed.

Reimplemented in SoToU3DAction, SoVectorizeAction, SoBevelAction, SoBoxHighlightRenderAction, SoGlobalSimplifyAction, SoLineHighlightRenderAction, SoShapeSimplifyAction, SoSplitGeometryAction, SoToHTMLAction, SoToVRML2Action, SoToVRMLAction, SoIntersectionDetectionAction, PoToVRML2Action, SoSTLWriteAction, and SoCSGAction.

virtual void SoAction::apply ( SoNode node  )  [virtual]

Initiates an action on the graph defined by a node.

Warning: Most actions call ref() on the node before traversing the scene graph, then call unref() after traversal. If the node's reference count was zero (the default), the call to apply() will cause it to be destroyed.

Reimplemented in SoToU3DAction, SoVectorizeAction, SoBevelAction, SoBoxHighlightRenderAction, SoGlobalSimplifyAction, SoLineHighlightRenderAction, SoShapeSimplifyAction, SoSplitGeometryAction, SoToHTMLAction, SoToVRML2Action, SoToVRMLAction, SoIntersectionDetectionAction, PoToVRML2Action, SoSTLWriteAction, ScGetBoundingBoxAction, ScGetPrimitiveCountAction, ScRayPickAction, and SoCSGAction.

virtual void SoAction::clearApplyResult (  )  [inline, virtual]

When applied, an action may reference nodes or create objects (e.g.

SoPath) that reference nodes. This is especially true for SoSearchAction and SoRayPickAction. These references will prevent the nodes from being destroyed and so may appear to be a "memory leak".

All references are cleared when the action is destroyed or re-applied. However it may be useful to clear them explicitly to remove references to nodes.

Reimplemented in SoBoxHighlightRenderAction, SoGlobalSimplifyAction, SoHandleEventAction, SoLineHighlightRenderAction, SoRayPickAction, and SoSearchAction.

virtual void SoAction::forwardTraversal ( SoNode node  )  [virtual]

Traverse a node that is not part of the current scenegraph.

Like an SoNodeKit, the contents of the specified sub-scenegraph won't be visible as an SoPath. Casting the path to a SoFullPath allows access to the whole path.

This method can be used to delegate an action to an internal/private scene graph. So a node can have an internal scene graph without actually being a "group" node. This is a convenient way to implement "composite" nodes that create their behavior using other Open Inventor nodes.

The node parameter can be of any type. Sensors may still be attached directly to nodes and fields in the internal scene graph.

This method must not be called from a node derived from SoGroup or SoBaseKit. This method should not be called on nodes that are part of the public/visible scene graph.

Reimplemented in SoCallbackAction.

static SoType SoAction::getClassTypeId (  )  [static]
SbBool SoAction::getContinueActionInBranchFlag (  )  const [inline]

This function indicates if the action must stop in the current branch.

Returns:
TRUE if the action must continue for this branch.
SoSceneManager* SoAction::getSceneManager (  )  const [inline]

Return the SoSceneManager associated with this action.

virtual void SoAction::invalidateState (  )  [virtual]

Invalidates the current traversal state in the action, forcing it to be recreated when the action is next applied.

This is typically unnecessary in most applications.

Reimplemented in SoGLRenderAction.

SbBool SoAction::isUsingAlternateRep (  )  const

Returns TRUE if current action is using alternate representations.

Default is FALSE.

void SoAction::resetContinueActionInBranchFlag (  )  [inline]

This function resets the continue action flag.

void SoAction::setSceneManager ( SoSceneManager mgr  )  [inline]

Set the scene manager associated with this action (if any ).

When appropriate, this allows the action to query information like the OpenGL rendering context. The SoSCeneManager class calls this method automatically for the actions that it creates (SoHandleEventAction, SoRayPickAction, etc).

void SoAction::stopActionInBranch (  )  [inline]

This function stops the action in the current Scene Graph branch.

Note: It doesn't mean we kill the action!

It is mainly used to stop the GetBoundingBox action in the SoBBox node.

void SoAction::useAlternateRep ( const SbBool  enable  ) 

Tell the action to use alternate representations during traversal when available.


See SoNode::getAternateRep(). Default is FALSE. When true, it is the responsibility of each SoNode derived object to choose to provide or not an alternate representation for a given action.


Friends And Related Function Documentation

friend class SoDB [friend]
friend class SoMultiPassElement [friend]

The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 12 Feb 2024
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/