Open Inventor Reference
SoSwitch Class Reference

Group node that traverse one chosen child. More...

#include <Inventor/nodes/SoSwitch.h>

Inheritance diagram for SoSwitch:
SoGroup SoNode SoFieldContainer SoBase SoBlinker

List of all members.

Public Member Functions

 SoSwitch ()
 Creates a switch node with default settings.
 SoSwitch (int nChildren)
 Constructor that takes approximate number of children.
virtual SbBool affectsState () const
 Overrides method in SoNode to return FALSE if there is no selected child or the selected child does not affect the state.
virtual void doAction (SoAction *action)
 Implement actions.
virtual void callback (SoCallbackAction *action)
virtual void GLRender (SoGLRenderAction *action)
 These virtual functions implement all of the actions for nodes, Most of the default implementations do nothing.
virtual void pick (SoPickAction *action)
virtual void getBoundingBox (SoGetBoundingBoxAction *action)
virtual void handleEvent (SoHandleEventAction *action)
virtual void getMatrix (SoGetMatrixAction *action)
virtual void search (SoSearchAction *action)
virtual void write (SoWriteAction *action)

Static Public Member Functions

static void initClass ()
 Initializes base node class.

Public Attributes

Fields
SoSFInt32 whichChild
 Index of the child to traverse, or one of SO_SWITCH_NONE, SO_SWITCH_INHERIT, or SO_SWITCH_ALL.

Protected Member Functions

void traverseChildren (SoAction *action)
 Generic traversal of children.
virtual ~SoSwitch ()

Detailed Description

This group node usually traverses only one or none of its children. It implements an operation similar to the switch statement in C. One can use this node to switch on and off the effects of some properties or to switch between different properties.

The whichChild field specifies the index of the child to traverse, where the first child has index 0.

A value of SO_SWITCH_NONE (-1, the default) means do not traverse any children. A value of SO_SWITCH_INHERIT (-2) allows the index to be inherited from a previously-encountered SoSwitch node or from certain other nodes (such as SoArray or SoMultipleCopy) that set the switch value. A value of SO_SWITCH_ALL (-3) traverses all children, making the switch behave exactly like a regular SoGroup.

File Format/Default
Switch {
  whichChild -1
}
Action Behavior
SoGLRenderAction, SoCallbackAction, SoGetBoundingBoxAction, SoGetMatrixAction, SoHandleEventAction, SoRayPickAction
Traverses the chosen child or children.
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

Definition at line 111 of file SoSwitch.h.


Constructor & Destructor Documentation

SoSwitch::SoSwitch ( )
SoSwitch::SoSwitch ( int  nChildren)
virtual SoSwitch::~SoSwitch ( ) [protected, virtual]

Member Function Documentation

virtual SbBool SoSwitch::affectsState ( ) const [virtual]

Reimplemented from SoNode.

virtual void SoSwitch::callback ( SoCallbackAction action) [virtual]

Reimplemented from SoGroup.

virtual void SoSwitch::doAction ( SoAction action) [virtual]

Reimplemented from SoGroup.

virtual void SoSwitch::getBoundingBox ( SoGetBoundingBoxAction action) [virtual]

Reimplemented from SoGroup.

Reimplemented in SoBlinker.

virtual void SoSwitch::getMatrix ( SoGetMatrixAction action) [virtual]

Reimplemented from SoGroup.

virtual void SoSwitch::GLRender ( SoGLRenderAction action) [virtual]

Reimplemented from SoGroup.

virtual void SoSwitch::handleEvent ( SoHandleEventAction action) [virtual]

Reimplemented from SoGroup.

static void SoSwitch::initClass ( ) [static]

Reimplemented from SoGroup.

Reimplemented in SoBlinker.

virtual void SoSwitch::pick ( SoPickAction action) [virtual]

Reimplemented from SoGroup.

virtual void SoSwitch::search ( SoSearchAction action) [virtual]

Reimplemented from SoGroup.

void SoSwitch::traverseChildren ( SoAction action) [protected]
virtual void SoSwitch::write ( SoWriteAction action) [virtual]

Reimplemented from SoGroup.

Reimplemented in SoBlinker.


Member Data Documentation

Definition at line 121 of file SoSwitch.h.


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