Class SoAction
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.actions.SoAction
-
- Direct Known Subclasses:
SoBevelAction
,SoCallbackAction
,SoDistributeAction
,SoGetBoundingBoxAction
,SoGetMatrixAction
,SoGetPrimitiveCountAction
,SoGLRenderAction
,SoHandleEventAction
,SoIntersectionDetectionAction
,SoNurbsBREPAction
,SoPickAction
,SoSearchAction
,SoSimplifyAction
,SoSplitGeometryAction
,SoToHTMLAction
,SoVectorizeAction
,SoWriteAction
public abstract class SoAction extends Inventor
Abstract base class for all actions.SoAction
is the base class for all actions. Classes derived fromSoAction
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).Hidden references:
Some actions, e.g.
SoSearchAction
andSoRayPickAction
, create one or moreSoPath
objects when they are applied to the scene graph. TheSoPath
object references each node in the path. This reference will prevent the node and its associated memory from being reclaimed for as long as theSoPath
object exists. TheseSoPath
objects are stored internally in the action and exist until the action object itself is reclaimed or reset.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoAction.AppliedCodes
(Extender API) This enum is used to determine what the action is being applied to.static class
SoAction.DistribModes
(Extender API) This is used to define the way an action is distributed across a cluster.static class
SoAction.PathCodes
(Extender API) This enum may be used during traversal of nodes to indicate where the node is with respect to the path being traversed.static class
SoAction.PathIndices
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(SoNode node)
Initiates an action on the graph defined by a node.void
apply(SoPath path)
Initiates an action on the graph defined by a path.void
clearApplyResult()
When applied, an action may reference nodes or create objects (e.g.void
forwardTraversal(SoNode node)
Traverse a node that is not part of the current scenegraph.void
forwardTraversal(SoPath path)
Traverse a path that is not part of the current scenegraph.boolean
getContinueActionInBranchFlag()
This function indicates if the action must stop in the current branch.SoPath
getCurPath()
(Extender API) Returns the path accumulated during traversal, i.e., the chain of nodes from the root of the traversed graph to the current node being traversed.SoAction.DistribModes
getDistribMode()
(Extender API) Returns the distribution mode of this action across a cluster (ScaleViz-Cluster only).SoNode
getNodeAppliedTo()
(Extender API) Returns the node the action is being applied to.java.util.Vector<SoPath>
getOriginalPathListAppliedTo()
(Extender API) Returns the original path list the action is being applied to.SoPath
getPathAppliedTo()
(Extender API) Returns the path the action is being applied to.SoAction.PathIndices
getPathCode()
(Extender API) 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.java.util.Vector<SoPath>
getPathListAppliedTo()
(Extender API) Returns the path list the action is being applied to.int
getPipeId()
(Extender API) Gets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.SoSceneManager
getSceneManager()
Return theSoSceneManager
associated with this action.SoState
getState()
(Extender API) Gets the state from the action.SoAction.AppliedCodes
getWhatAppliedTo()
(Extender API) Returns code indicating what action is being applied to.boolean
hasTerminated()
(Extender API) Returns true if the traversal has reached a termination condition.void
invalidateState()
Invalidates the current traversal state in the action, forcing it to be recreated when the action is next applied.boolean
isBeingApplied()
(Extender API) Returns true if this action is currently being applied.boolean
isLastPathListAppliedTo()
(Extender API) Returns true if the current list is the last one from the original.boolean
isUsingAlternateRep()
Returns true if current action is using alternate representations.static void
nullAction(SoAction name_7964, SoNode name_7965)
(Extender API) Null action method that can be stored in lookup table when desired.void
postDelayedTraversal()
(Extender API) Method called by SoMultiPassManager after delayed pass traversals.boolean
preDelayedTraversal()
(Extender API) Method called by SoMultiPassManager before delayed pass traversals.void
resetContinueActionInBranchFlag()
This function resets the continue action flag.void
setPipeId(int id)
(Extender API) Sets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.void
setSceneManager(SoSceneManager mgr)
Set the scene manager associated with this action (if any ).void
setUpState()
(Extender API) Creates state if it is NULL or it is no longer valid because new elements have been enabled since it was created.void
stopActionInBranch()
This function stops the action in the current Scene Graph branch.void
traverse(SoNode node)
(Extender API) Does traversal of a graph rooted by a node.void
useAlternateRep(boolean enable)
Tell the action to use alternate representations during traversal when available.-
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
-
-
-
Method Detail
-
useAlternateRep
public void useAlternateRep(boolean 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 eachSoNode
derived object to choose to provide or not an alternate representation for a given action.
-
isUsingAlternateRep
public boolean isUsingAlternateRep()
Returns true if current action is using alternate representations. Default is false.
-
resetContinueActionInBranchFlag
public void resetContinueActionInBranchFlag()
This function resets the continue action flag.
-
getOriginalPathListAppliedTo
public java.util.Vector<SoPath> getOriginalPathListAppliedTo()
(Extender API) Returns the original path list the action is being applied to.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
Returns NULL if the action is not being applied to the appropriate class.Note A single path list may be split into several, one for each different head node. This method allows subclasses to determine the original path list.
-
getCurPath
public SoPath getCurPath()
(Extender API) Returns the path accumulated during traversal, i.e., the chain of nodes from the root of the traversed graph to the current node being traversed.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
-
isLastPathListAppliedTo
public boolean isLastPathListAppliedTo()
(Extender API) Returns true if the current list is the last one from the original.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
Note A single path list may be split into several, one for each different head node. This method allows subclasses to determine whether the current list is the last one from the original.
-
hasTerminated
public boolean hasTerminated()
(Extender API) Returns true if the traversal has reached a termination condition.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
-
getContinueActionInBranchFlag
public boolean getContinueActionInBranchFlag()
This function indicates if the action must stop in the current branch.- Returns:
- true if the action must continue for this branch.
-
apply
public void apply(SoNode node)
Initiates an action on the graph defined by a node.
-
apply
public void apply(SoPath path)
Initiates an action on the graph defined by a path.
-
getPathCode
public SoAction.PathIndices getPathCode()
(Extender API) 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.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
If this returns IN_PATH, indices is set to point to an array of indices corresponding to the children that must be traversed for a correct traversal of all the paths to which the action is being applied. numIndices is set to the number of such children.
-
invalidateState
public void invalidateState()
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.
-
stopActionInBranch
public void stopActionInBranch()
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.
-
traverse
public void traverse(SoNode node)
(Extender API) Does traversal of a graph rooted by a node.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
-
clearApplyResult
public void clearApplyResult()
When applied, an action may reference nodes or create objects (e.g.SoPath
) that reference nodes. This is especially true forSoSearchAction
andSoRayPickAction
. 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.
-
getPathListAppliedTo
public java.util.Vector<SoPath> getPathListAppliedTo()
(Extender API) Returns the path list the action is being applied to.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
Returns NULL if the action is not being applied to the appropriate class.Note A single path list may be split into several, one for each different head node. This method allows subclasses to determine the current path list.
-
preDelayedTraversal
public boolean preDelayedTraversal()
(Extender API) Method called by SoMultiPassManager before delayed pass traversals.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
Overriding this method can be useful for actions that want to skip the traversal of all delayed passes. Returning false skips the delayed pass traversals.- Since:
- Open Inventor 9.1
-
forwardTraversal
public void forwardTraversal(SoNode node)
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 anSoPath
. Using the SoPath.full field 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
orSoBaseKit
. This method should not be called on nodes that are part of the public/visible scene graph.
-
isBeingApplied
public boolean isBeingApplied()
(Extender API) Returns true if this action is currently being applied.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
-
forwardTraversal
public void forwardTraversal(SoPath path)
Traverse a path that is not part of the current scenegraph. Similar toforwardTraversal(SoNode*)
but for paths.
-
nullAction
public static void nullAction(SoAction name_7964, SoNode name_7965)
(Extender API) Null action method that can be stored in lookup table when desired.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
-
setSceneManager
public void setSceneManager(SoSceneManager mgr)
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).
-
postDelayedTraversal
public void postDelayedTraversal()
(Extender API) Method called by SoMultiPassManager after delayed pass traversals.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
Overriding this method can be useful for actions that want to apply some post processing after all delayed pass traversals.- Since:
- Open Inventor 9.1
-
getSceneManager
public SoSceneManager getSceneManager()
Return theSoSceneManager
associated with this action.
-
setUpState
public void setUpState()
(Extender API) Creates state if it is NULL or it is no longer valid because new elements have been enabled since it was created.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
Automatically called by theapply()
methods, but can be useful for application to get a non-null state pointer to "pre-load" certain elements.
-
getNodeAppliedTo
public SoNode getNodeAppliedTo()
(Extender API) Returns the node the action is being applied to.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
Returns NULL if the action is not being applied to the appropriate class.
-
getState
public SoState getState()
(Extender API) Gets the state from the action.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
Note Will return NULL if action has not been applied to anything or if invalidateState has been called.
-
getPathAppliedTo
public SoPath getPathAppliedTo()
(Extender API) Returns the path the action is being applied to.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
Returns NULL if the action is not being applied to the appropriate class.
-
getPipeId
public int getPipeId()
(Extender API) Gets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
-
getDistribMode
public SoAction.DistribModes getDistribMode()
(Extender API) Returns the distribution mode of this action across a cluster (ScaleViz-Cluster only).Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
Default is LOCAL_ONLY.
-
setPipeId
public void setPipeId(int id)
(Extender API) Sets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
-
getWhatAppliedTo
public SoAction.AppliedCodes getWhatAppliedTo()
(Extender API) Returns code indicating what action is being applied to.Extender API is dedicated to extend the toolkit. This api is available to programmers who wish to extend the toolkit. We strongly suggest to use it only in the cases described in the Toolmaker guide such as creating a new class inherited from SoNode. See Open Inventor Toolmaker.
-
-