SoVRMLSwitch.3coin3 man page

SoVRMLSwitch — The SoVRMLSwitch class is a group node for traversing selected children.

The detailed class documentation is taken verbatim from the VRML97 standard (ISO/IEC 14772-1:1997). It is copyright The Web3D Consortium, and is used by permission of the Consortium:


#include <Inventor/VRMLnodes/SoVRMLSwitch.h>

Inherits SoGroup.

Public Member Functions

virtual SoType getTypeId (void) const

SoVRMLSwitch (void)

SoVRMLSwitch (int choices)

virtual SbBool affectsState (void) const

void addChoice (SoNode *choice)

void insertChoice (SoNode *choice, int idx)

SoNode * getChoice (int idx) const

int findChoice (SoNode *choice) const

int getNumChoices (void) const

void removeChoice (int idx)

void removeChoice (SoNode *node)

void removeAllChoices (void)

void replaceChoice (int idx, SoNode *choice)

void replaceChoice (SoNode *old, SoNode *choice)

virtual void doAction (SoAction *action)

virtual void callback (SoCallbackAction *action)

virtual void GLRender (SoGLRenderAction *action)

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)

virtual void audioRender (SoAudioRenderAction *action)

void addChild (SoNode *child)

void insertChild (SoNode *child, int idx)

SoNode * getChild (int idx) const

int findChild (const SoNode *child) const

int getNumChildren (void) const

void removeChild (int idx)

void removeChild (SoNode *child)

void removeAllChildren (void)

void replaceChild (int idx, SoNode *node)

void replaceChild (SoNode *old, SoNode *node)

virtual SoChildList * getChildren (void) const

Static Public Member Functions

static SoType getClassTypeId (void)

static void initClass (void)

Public Attributes

SoMFNode choice

SoSFInt32 whichChoice

Protected Member Functions

virtual const SoFieldData * getFieldData (void) const

virtual ~SoVRMLSwitch (void)

virtual void notify (SoNotList *list)

virtual SbBool readInstance (SoInput *in, unsigned short flags)

virtual void copyContents (const SoFieldContainer *from, SbBool copyConn)

Static Protected Member Functions

static const SoFieldData ** getFieldDataPtr (void)

Additional Inherited Members

Detailed Description

The SoVRMLSwitch class is a group node for traversing selected children.

The detailed class documentation is taken verbatim from the VRML97 standard (ISO/IEC 14772-1:1997). It is copyright The Web3D Consortium, and is used by permission of the Consortium:

Switch {
  exposedField    MFNode  choice      []
  exposedField    SFInt32 whichChoice -1    # [-1, inf)

The Switch grouping node traverses zero or one of the nodes specified in the choice field. 4.6.5, Grouping and children nodes (…), describes details on the types of nodes that are legal values for choice.

The whichChoice field specifies the index of the child to traverse, with the first child having index 0. If whichChoice is less than zero or greater than the number of nodes in the choice field, nothing is chosen. All nodes under a Switch continue to receive and send events regardless of the value of whichChoice. For example, if an active SoVRMLTimeSensor is contained within an inactive choice of an Switch, the SoVRMLTimeSensor sends events regardless of the Switch's state.

Constructor & Destructor Documentation

SoVRMLSwitch::SoVRMLSwitch (void)


SoVRMLSwitch::SoVRMLSwitch (int choices)

Constructor. choices is the expected number of children.

SoVRMLSwitch::~SoVRMLSwitch (void) [protected], [virtual]


Member Function Documentation

SoType SoVRMLSwitch::getTypeId (void) const [virtual]

Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and 'downward' casting.

Usage example:

void foo(SoNode * node)
  if (node->getTypeId() == SoFile::getClassTypeId()) {
    SoFile * filenode = (SoFile *)node;  // safe downward cast, knows the type

For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in all subclasses. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance Inventor/nodes/SoSubNode.h (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine.h (for engine classes) and so on.

For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups.

Reimplemented from SoGroup.

const SoFieldData * SoVRMLSwitch::getFieldData (void) const [protected], [virtual]

Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL.

Reimplemented from SoGroup.

SbBool SoVRMLSwitch::affectsState (void) const [virtual]

Returns TRUE if the node could have any effect on the state during traversal.

If it returns FALSE, no data in the traversal-state will change from the pre-traversal state to the post-traversal state. The SoSeparator node will for instance return FALSE, as it pushes and pops the state before and after traversal of its children. All SoShape nodes will also return FALSE, as just pushing out geometry data to the rendering engine won't affect the actual rendering state.

The default method returns TRUE, on a 'better safe than sorry' philosophy.

Reimplemented from SoNode.

void SoVRMLSwitch::addChoice (SoNode * choiceptr)

Adds choice to the choice field.

void SoVRMLSwitch::insertChoice (SoNode * choiceptr, int idx)

Inserts choice at index idx.

SoNode * SoVRMLSwitch::getChoice (int idx) const

Returns the choice at index idx.

int SoVRMLSwitch::findChoice (SoNode * choiceptr) const

Finds the index for choice, or -1 if not found.

int SoVRMLSwitch::getNumChoices (void) const

Returns the number of choices.

void SoVRMLSwitch::removeChoice (int idx)

Removes the choice at index idx.

void SoVRMLSwitch::removeChoice (SoNode * choiceptr)

If choice is found, remove it.

void SoVRMLSwitch::removeAllChoices (void)

Removes all choices.

void SoVRMLSwitch::replaceChoice (int idx, SoNode * choiceptr)

Replace the choice at index idx with choice.

void SoVRMLSwitch::replaceChoice (SoNode * old, SoNode * choiceptr)

Find old, and replace it with choice.

void SoVRMLSwitch::doAction (SoAction * action) [virtual]

This function performs the typical operation of a node for any action.

Reimplemented from SoGroup.

void SoVRMLSwitch::callback (SoCallbackAction * action) [virtual]

Action method for SoCallbackAction.

Simply updates the state according to how the node behaves for the render action, so the application programmer can use the SoCallbackAction for extracting information about the scene graph.

Reimplemented from SoGroup.

void SoVRMLSwitch::GLRender (SoGLRenderAction * action) [virtual]

Action method for the SoGLRenderAction.

This is called during rendering traversals. Nodes influencing the rendering state in any way or who wants to throw geometry primitives at OpenGL overrides this method.

Reimplemented from SoGroup.

void SoVRMLSwitch::pick (SoPickAction * action) [virtual]

Action method for SoPickAction.

Does common processing for SoPickAction action instances.

Reimplemented from SoGroup.

void SoVRMLSwitch::getBoundingBox (SoGetBoundingBoxAction * action) [virtual]

Action method for the SoGetBoundingBoxAction.

Calculates bounding box and center coordinates for node and modifies the values of the action to encompass the bounding box for this node and to shift the center point for the scene more towards the one for this node.

Nodes influencing how geometry nodes calculates their bounding box also overrides this method to change the relevant state variables.

Reimplemented from SoGroup.

void SoVRMLSwitch::handleEvent (SoHandleEventAction * action) [virtual]

Action method for SoHandleEventAction.

Inspects the event data from action, and processes it if it is something which this node should react to.

Nodes influencing relevant state variables for how event handling is done also overrides this method.

Reimplemented from SoGroup.

void SoVRMLSwitch::getMatrix (SoGetMatrixAction * action) [virtual]

Action method for SoGetMatrixAction.

Updates action by accumulating with the transformation matrix of this node (if any).

Reimplemented from SoGroup.

void SoVRMLSwitch::search (SoSearchAction * action) [virtual]

Action method for SoSearchAction.

Compares the search criteria from the action to see if this node is a match. Searching is done by matching up all criteria set