public class SoSearchPathAction extends SoSearchAction
SoSearchAction
to search for a sequence of items defined in a string, e.g., "Wheel1/Hub/Bearing". Each item can be a
When the action finds a node that satisfies the current search item, it effectively restarts the search from that node, using the next search item. This means that the search for each item (after the first) is confined to the subgraph under the node that satisfied the previous search item. In most cases each item (except possibly the last one) will be a grouping node, but this is not enforced by the action.
Finding nodes by name is a useful technique for modifying a scene graph, but using SoNode.getByName
or SoSearchAction
requires assigning a unique name to every (interesting) node. Often the same subgraph will be used multiple times and it would be convenient to assign each instance of the subgraph a unique name, but reuse the same names for the nodes inside the subgraph. SoSearchPathAction
allows this kind of hierarchical naming.
Given a scene graph with hierarchical names, for example:
DEF Wheel1 Separator { DEF Hub Separator { DEF Bolt Separator { Cylinder { height 3 } } } } DEF Wheel2 Separator { DEF Hub Separator { DEF Bolt Separator { Cylinder { height 13 } } } }
"Wheel1/Hub/Bolt" would find "Bolt" in the first wheel. Intermediate names may be omitted if the search string is still unambiguous. For example "Wheel1/Bolt" would find the same node in this simple case. "Wheel2/Hub/Bolt/<Cylinder>" would return a path including the leaf SoCylinder
node in the second wheel.
Most of the methods inherited from SoSearchAction
are ignored and do not return useful information (set/getNode, set/getName, etc.). Relevant inherited methods are set/isSearchingAll, getPath, and reset.
Note that by default nodekits do not search their children when a search action is applied. The reference page for SoBaseKit
discusses the methods SoBaseKit.isSearchingChildren()
and SoBaseKit.setSearchingChildren()
, which allow you to query and control this behavior.
See also:
SoSearchAction.Interests, SoSearchAction.LookFors
SoAction.AppliedCodes, SoAction.DistribModes, SoAction.PathCodes, SoAction.PathIndices
Inventor.ConstructorCommand
ALL, FIRST, LAST, NAME, NODE, TYPE
BELOW_PATH, CLUSTER_ONLY, IN_PATH, LOCAL_ONLY, NO_PATH, OFF_PATH, PATH, PATH_LIST
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoSearchPathAction()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
enableElement(java.lang.Class<? extends Inventor> t,
int stkIndex) |
boolean |
getDerivedIsOK()
Gets flag to allow search on a type to match derived types.
|
int |
getNumItemsFound()
Get the number of search items that were successfully found.
|
java.lang.String |
getSearchString()
Gets the search path string.
|
byte |
getSeparatorChar()
Gets separator char for search string.
|
void |
setDerivedIsOK(boolean derivedIsOK)
Sets flag to allow search on a type to match derived types.
|
void |
setFound() |
void |
setSearchString(java.lang.String searchString)
Sets the search path string.
|
void |
setSeparatorChar(byte sepChar)
Sets separator char for search string.
|
addPath, getFind, getInterest, getName, getNode, getNodeClass, getPath, getPaths, isFound, isSearchingAll, isSearchingExtendedClass, reset, setFind, setInterest, setName, setNode, setNodeClass, setNodeClass, setSearchingAll
apply, apply, clearApplyResult, forwardTraversal, getContinueActionInBranchFlag, getCurPath, getNodeAppliedTo, getOriginalPathListAppliedTo, getPathAppliedTo, getPathCode, getPathListAppliedTo, getPipeId, getSceneManager, getState, getWhatAppliedTo, hasTerminated, invalidateState, isBeingApplied, isLastPathListAppliedTo, isUsingAlternateRep, nullAction, postDelayedTraversal, preDelayedTraversal, resetContinueActionInBranchFlag, setPipeId, setSceneManager, setUpState, stopActionInBranch, traverse, useAlternateRep
dispose, getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
public SoSearchPathAction()
public java.lang.String getSearchString()
public byte getSeparatorChar()
public void setDerivedIsOK(boolean derivedIsOK)
public void setSeparatorChar(byte sepChar)
public void setSearchString(java.lang.String searchString)
public boolean getDerivedIsOK()
public static void enableElement(java.lang.Class<? extends Inventor> t, int stkIndex)
public void setFound()
setFound
in class SoSearchAction
public int getNumItemsFound()
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com