public class SoSwitch extends SoGroup
The whichChild field specifies the index of the child to traverse, where the first child has index 0. There are several special values that can be used:
SoSwitch node or from certain other nodes (such as SoArray or SoMultipleCopy) that set the switch value.
SoGroup.
There are several extended versions of this node with additional/different behavior:
SoInteractiveSwitch: During a user interaction, for example moving the camera, traverses a different (or no) child specified by its whichInteractiveChild field.
SoMultiSwitch: Traverses any number of its children (specified in a list of indices).
SoPathSwitch: Only traverses its children if the current path (when it is traversed) matches or contains a path specified in its
path field.
SoMultiPathSwitch: Only traverses its children if the current path matches or contains any of the paths specified in its
paths field.
NOTES:
whichChild is SO_SWITCH_NONE, meaning that
nothing is displayed by default. In most cases you will want to set some other initial value in this field.
whichChild is SO_SWITCH_INHERIT, if the inherited value is larger than the number of children in the current node, the actual value used is "modulo" the number of children.
whichChild. For example, calling setSearchingAll(true) on an SoSearchAction causes it to traverse all the children of SoSwitch nodes.
SoSwitch is commonly used to control the visibility of a geometry. For example an application might allow the user to create multiple slices through a volume (SoOrthoSlice) or mesh (MoLogicalSlice) data set, but also allow the user to control the visibility of each slice separately. Using SoSwitch with SO_SWITCH_NONE is much more efficient than removing geometry from the scene graph because previously built caches are preserved. Using SoSwitch is also much more efficient than using draw style INVISIBLE (SoDrawStyle) because the children are not traversed.
SoGroup, not an SoSeparator, and therefore does not provide render caching. Generally if the children contain geometry, it is good practice to make each child an SoSeparator to make render caching more effective.
File format/default:
Switch {
| whichChild | -1 |
Action behavior:
SoGLRenderAction, SoCallbackAction, SoGetBoundingBoxAction, SoGetMatrixAction, SoHandleEventAction, SoRayPickAction
Traverses the chosen child or children. Sets: SoSwitchElement
SoSearchAction
If the action's Searching-All flag is set, always traverses all children. Otherwise, traverses just the chosen child or children.
See also:
SoArray, SoLevelOfDetail, SoMultipleCopy, SoPathSwitch, SoMultiSwitch, SoInteractiveSwitch
| Modifier and Type | Class and Description |
|---|---|
static class |
SoSwitch.WhichChild |
Inventor.ConstructorCommand| Modifier and Type | Field and Description |
|---|---|
static int |
SO_SWITCH_ALL |
static int |
SO_SWITCH_INHERIT |
static int |
SO_SWITCH_NONE |
SoSFInt32 |
whichChild
Index of the child to traverse, or one of SO_SWITCH_NONE, SO_SWITCH_INHERIT, or SO_SWITCH_ALL.
|
boundingBoxIgnoringVERBOSE_LEVEL, ZeroHandle| Constructor and Description |
|---|
SoSwitch()
Creates a switch node with default settings.
|
SoSwitch(int nChildren)
Constructor that takes approximate number of children.
|
addChild, findChild, getChild, getNumChildren, insertChild, removeAllChildren, removeChild, removeChild, replaceChild, replaceChildaffectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, writecopyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaultsdispose, getEXTERNPROTO, getName, getPROTO, isDisposable, isSynchronizable, setName, setSynchronizablegetAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreadspublic static final int SO_SWITCH_NONE
public static final int SO_SWITCH_INHERIT
public static final int SO_SWITCH_ALL
public final SoSFInt32 whichChild
Generated on July 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com