public class SoSwitch extends SoGroup
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:
SoSwitchnode or from certain other nodes (such as
SoMultipleCopy) that set the switch value.
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.
whichChildis 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.
whichChildis 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
SoSearchActioncauses it to traverse all the children of
SoSwitchis 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
SoSwitchwith SO_SWITCH_NONE is much more efficient than removing geometry from the scene graph because previously built caches are preserved. Using
SoSwitchis 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
SoSeparatorto make render caching more effective.
If the action's Searching-All flag is set, always traverses all children. Otherwise, traverses just the chosen child or children.
|Modifier and Type||Class and Description|
|Modifier and Type||Field and Description|
Index of the child to traverse, or one of SO_SWITCH_NONE, SO_SWITCH_INHERIT, or SO_SWITCH_ALL.
|Constructor and Description|
Creates a switch node with default settings.
Constructor that takes approximate number of children.
addChild, findChild, getChild, getNumChildren, insertChild, removeAllChildren, removeChild, removeChild, replaceChild, replaceChild
affectsState, 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, write
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
dispose, getEXTERNPROTO, getName, getPROTO, isDisposable, isSynchronizable, setName, setSynchronizable
getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
public 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 17, 2020, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com