.TH "SoVRMLSwitch" 3 "Sat Oct 12 2013" "Version 4.0.0a" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SoVRMLSwitch \- .PP The \fBSoVRMLSwitch\fP class is a group node for traversing selected children\&. .PP \fBThe 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:\fP .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBSoGroup\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "virtual \fBSoType\fP \fBgetTypeId\fP (void) const " .br .RI "\fIReturns the type identification of an object derived from a class inheriting \fBSoBase\fP\&. This is used for run-time type checking and 'downward' casting\&. \fP" .ti -1c .RI "\fBSoVRMLSwitch\fP (void)" .br .ti -1c .RI "\fBSoVRMLSwitch\fP (int choices)" .br .ti -1c .RI "virtual SbBool \fBaffectsState\fP (void) const " .br .ti -1c .RI "void \fBaddChoice\fP (\fBSoNode\fP *\fBchoice\fP)" .br .ti -1c .RI "void \fBinsertChoice\fP (\fBSoNode\fP *\fBchoice\fP, int idx)" .br .ti -1c .RI "\fBSoNode\fP * \fBgetChoice\fP (int idx) const " .br .ti -1c .RI "int \fBfindChoice\fP (\fBSoNode\fP *\fBchoice\fP) const " .br .ti -1c .RI "int \fBgetNumChoices\fP (void) const " .br .ti -1c .RI "void \fBremoveChoice\fP (int idx)" .br .ti -1c .RI "void \fBremoveChoice\fP (\fBSoNode\fP *node)" .br .ti -1c .RI "void \fBremoveAllChoices\fP (void)" .br .ti -1c .RI "void \fBreplaceChoice\fP (int idx, \fBSoNode\fP *\fBchoice\fP)" .br .ti -1c .RI "void \fBreplaceChoice\fP (\fBSoNode\fP *old, \fBSoNode\fP *\fBchoice\fP)" .br .ti -1c .RI "virtual void \fBdoAction\fP (\fBSoAction\fP *action)" .br .ti -1c .RI "virtual void \fBcallback\fP (\fBSoCallbackAction\fP *action)" .br .ti -1c .RI "virtual void \fBGLRender\fP (\fBSoGLRenderAction\fP *action)" .br .ti -1c .RI "virtual void \fBpick\fP (\fBSoPickAction\fP *action)" .br .ti -1c .RI "virtual void \fBgetBoundingBox\fP (\fBSoGetBoundingBoxAction\fP *action)" .br .ti -1c .RI "virtual void \fBhandleEvent\fP (\fBSoHandleEventAction\fP *action)" .br .ti -1c .RI "virtual void \fBgetMatrix\fP (\fBSoGetMatrixAction\fP *action)" .br .ti -1c .RI "virtual void \fBsearch\fP (\fBSoSearchAction\fP *action)" .br .ti -1c .RI "virtual void \fBwrite\fP (\fBSoWriteAction\fP *action)" .br .ti -1c .RI "virtual void \fBaudioRender\fP (\fBSoAudioRenderAction\fP *action)" .br .ti -1c .RI "void \fBaddChild\fP (\fBSoNode\fP *child)" .br .ti -1c .RI "void \fBinsertChild\fP (\fBSoNode\fP *child, int idx)" .br .ti -1c .RI "\fBSoNode\fP * \fBgetChild\fP (int idx) const " .br .ti -1c .RI "int \fBfindChild\fP (const \fBSoNode\fP *child) const " .br .ti -1c .RI "int \fBgetNumChildren\fP (void) const " .br .ti -1c .RI "void \fBremoveChild\fP (int idx)" .br .ti -1c .RI "void \fBremoveChild\fP (\fBSoNode\fP *child)" .br .ti -1c .RI "void \fBremoveAllChildren\fP (void)" .br .ti -1c .RI "void \fBreplaceChild\fP (int idx, \fBSoNode\fP *node)" .br .ti -1c .RI "void \fBreplaceChild\fP (\fBSoNode\fP *old, \fBSoNode\fP *node)" .br .ti -1c .RI "virtual \fBSoChildList\fP * \fBgetChildren\fP (void) const " .br .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static \fBSoType\fP \fBgetClassTypeId\fP (void)" .br .RI "\fIThis static method returns the \fBSoType\fP object associated with objects of this class\&. \fP" .ti -1c .RI "static void \fBinitClass\fP (void)" .br .RI "\fISets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system\&. \fP" .in -1c .SS "Public Attributes" .in +1c .ti -1c .RI "\fBSoMFNode\fP \fBchoice\fP" .br .ti -1c .RI "\fBSoSFInt32\fP \fBwhichChoice\fP" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "virtual const \fBSoFieldData\fP * \fBgetFieldData\fP (void) const " .br .ti -1c .RI "virtual \fB~SoVRMLSwitch\fP (void)" .br .ti -1c .RI "virtual void \fBnotify\fP (\fBSoNotList\fP *list)" .br .ti -1c .RI "virtual SbBool \fBreadInstance\fP (\fBSoInput\fP *in, unsigned short flags)" .br .ti -1c .RI "virtual void \fBcopyContents\fP (const \fBSoFieldContainer\fP *from, SbBool copyConn)" .br .in -1c .SS "Static Protected Member Functions" .in +1c .ti -1c .RI "static const \fBSoFieldData\fP ** \fBgetFieldDataPtr\fP (void)" .br .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP The \fBSoVRMLSwitch\fP class is a group node for traversing selected children\&. .PP \fBThe 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:\fP .PP .nf Switch { exposedField MFNode choice [] exposedField SFInt32 whichChoice -1 # [-1, inf) } .fi .PP .PP The Switch grouping node traverses zero or one of the nodes specified in the choice field\&. 4\&.6\&.5, Grouping and children nodes (http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/concepts.html#4.6.5), describes details on the types of nodes that are legal values for choice\&. .PP The \fIwhichChoice\fP 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 \fBSoVRMLTimeSensor\fP is contained within an inactive choice of an Switch, the \fBSoVRMLTimeSensor\fP sends events regardless of the Switch's state\&. .SH "Constructor & Destructor Documentation" .PP .SS "SoVRMLSwitch::SoVRMLSwitch (void)" Constructor\&. .SS "SoVRMLSwitch::SoVRMLSwitch (intchoices)" Constructor\&. \fIchoices\fP is the expected number of children\&. .SS "SoVRMLSwitch::~SoVRMLSwitch (void)\fC [protected]\fP, \fC [virtual]\fP" Destructor\&. .SH "Member Function Documentation" .PP .SS "\fBSoType\fP SoVRMLSwitch::getTypeId (void) const\fC [virtual]\fP" .PP Returns the type identification of an object derived from a class inheriting \fBSoBase\fP\&. This is used for run-time type checking and 'downward' casting\&. Usage example: .PP .PP .nf void foo(SoNode * node) { if (node->getTypeId() == SoFile::getClassTypeId()) { SoFile * filenode = (SoFile *)node; // safe downward cast, knows the type } } .fi .PP .PP For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in \fIall\fP 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 \fBInventor/nodes/SoSubNode\&.h\fP (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine\&.h (for engine classes) and so on\&. .PP For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "const \fBSoFieldData\fP ** SoVRMLSwitch::getFieldDataPtr (void)\fC [static]\fP, \fC [protected]\fP" \fIThis API member is considered internal to the library, as it is not likely to be of interest to the application programmer\&.\fP .PP Reimplemented from \fBSoGroup\fP\&. .SS "const \fBSoFieldData\fP * SoVRMLSwitch::getFieldData (void) const\fC [protected]\fP, \fC [virtual]\fP" Returns a pointer to the class-wide field data storage object for this instance\&. If no fields are present, returns \fCNULL\fP\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "SbBool SoVRMLSwitch::affectsState (void) const\fC [virtual]\fP" Returns \fCTRUE\fP if the node could have any effect on the state during traversal\&. .PP If it returns \fCFALSE\fP, no data in the traversal-state will change from the pre-traversal state to the post-traversal state\&. The \fBSoSeparator\fP node will for instance return \fCFALSE\fP, as it pushes and pops the state before and after traversal of its children\&. All \fBSoShape\fP nodes will also return \fCFALSE\fP, as just pushing out geometry data to the rendering engine won't affect the actual rendering state\&. .PP The default method returns \fCTRUE\fP, on a 'better safe than sorry' philosophy\&. .PP Reimplemented from \fBSoNode\fP\&. .SS "void SoVRMLSwitch::addChoice (\fBSoNode\fP *choiceptr)" Adds \fIchoice\fP to the \fIchoice\fP field\&. .SS "void SoVRMLSwitch::insertChoice (\fBSoNode\fP *choiceptr, intidx)" Inserts \fIchoice\fP at index \fIidx\fP\&. .SS "\fBSoNode\fP * SoVRMLSwitch::getChoice (intidx) const" Returns the choice at index \fIidx\fP\&. .SS "int SoVRMLSwitch::findChoice (\fBSoNode\fP *choiceptr) const" Finds the index for \fIchoice\fP, or -1 if not found\&. .SS "int SoVRMLSwitch::getNumChoices (void) const" Returns the number of choices\&. .SS "void SoVRMLSwitch::removeChoice (intidx)" Removes the choice at index \fIidx\fP\&. .SS "void SoVRMLSwitch::removeChoice (\fBSoNode\fP *choiceptr)" If \fIchoice\fP is found, remove it\&. .SS "void SoVRMLSwitch::removeAllChoices (void)" Removes all choices\&. .SS "void SoVRMLSwitch::replaceChoice (intidx, \fBSoNode\fP *choiceptr)" Replace the choice at index \fIidx\fP with \fIchoice\fP\&. .SS "void SoVRMLSwitch::replaceChoice (\fBSoNode\fP *old, \fBSoNode\fP *choiceptr)" Find \fIold\fP, and replace it with \fIchoice\fP\&. .SS "void SoVRMLSwitch::doAction (\fBSoAction\fP *action)\fC [virtual]\fP" This function performs the typical operation of a node for any action\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::callback (\fBSoCallbackAction\fP *action)\fC [virtual]\fP" Action method for \fBSoCallbackAction\fP\&. .PP Simply updates the state according to how the node behaves for the render action, so the application programmer can use the \fBSoCallbackAction\fP for extracting information about the scene graph\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::GLRender (\fBSoGLRenderAction\fP *action)\fC [virtual]\fP" Action method for the \fBSoGLRenderAction\fP\&. .PP 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\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::pick (\fBSoPickAction\fP *action)\fC [virtual]\fP" Action method for \fBSoPickAction\fP\&. .PP Does common processing for \fBSoPickAction\fP \fIaction\fP instances\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::getBoundingBox (\fBSoGetBoundingBoxAction\fP *action)\fC [virtual]\fP" Action method for the \fBSoGetBoundingBoxAction\fP\&. .PP Calculates bounding box and center coordinates for node and modifies the values of the \fIaction\fP to encompass the bounding box for this node and to shift the center point for the scene more towards the one for this node\&. .PP Nodes influencing how geometry nodes calculates their bounding box also overrides this method to change the relevant state variables\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::handleEvent (\fBSoHandleEventAction\fP *action)\fC [virtual]\fP" Action method for \fBSoHandleEventAction\fP\&. .PP Inspects the event data from \fIaction\fP, and processes it if it is something which this node should react to\&. .PP Nodes influencing relevant state variables for how event handling is done also overrides this method\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::getMatrix (\fBSoGetMatrixAction\fP *action)\fC [virtual]\fP" Action method for \fBSoGetMatrixAction\fP\&. .PP Updates \fIaction\fP by accumulating with the transformation matrix of this node (if any)\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::search (\fBSoSearchAction\fP *action)\fC [virtual]\fP" Action method for \fBSoSearchAction\fP\&. .PP Compares the search criteria from the \fIaction\fP to see if this node is a match\&. Searching is done by matching up \fIall\fP criteria set up in the \fBSoSearchAction\fP -- if \fIany\fP of the requested criteria is a miss, the search is not deemed successful for the node\&. .PP \fBSee Also:\fP .RS 4 \fBSoSearchAction\fP .RE .PP .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::write (\fBSoWriteAction\fP *action)\fC [virtual]\fP" Action method for \fBSoWriteAction\fP\&. .PP Writes out a node object, and any connected nodes, engines etc, if necessary\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::audioRender (\fBSoAudioRenderAction\fP *action)\fC [virtual]\fP" Action method for \fBSoAudioRenderAction\fP\&. .PP Does common processing for \fBSoAudioRenderAction\fP \fIaction\fP instances\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::addChild (\fBSoNode\fP *node)\fC [virtual]\fP" Append a child \fInode\fP to the list of children nodes this group node is managing\&. .PP Please note that this method is not virtual in the original SGI Inventor API\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::insertChild (\fBSoNode\fP *child, intnewchildindex)\fC [virtual]\fP" Insert a \fIchild\fP node at position \fInewchildindex\fP\&. .PP \fInewchildindex\fP must be <= this->\fBgetNumChildren()\fP .PP Please note that this method is not virtual in the original SGI Inventor API\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "\fBSoNode\fP * SoVRMLSwitch::getChild (intindex) const\fC [virtual]\fP" Returns pointer to child node at \fIindex\fP\&. .PP Please note that this method is not virtual in the original SGI Inventor API\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "int SoVRMLSwitch::findChild (const \fBSoNode\fP *node) const\fC [virtual]\fP" Returns index in our list of children for child \fInode\fP, or -1 if \fInode\fP is not a child of this group node\&. .PP Please note that this method is not virtual in the original SGI Inventor API\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "int SoVRMLSwitch::getNumChildren (void) const\fC [virtual]\fP" Returns number of child nodes managed by this group\&. .PP Please note that this method is not virtual in the original SGI Inventor API\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::removeChild (intchildindex)\fC [virtual]\fP" Remove node at \fIchildindex\fP in our list of children\&. .PP Please note that this method is not virtual in the original SGI Inventor API\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::removeChild (\fBSoNode\fP *child)\fC [virtual]\fP" Remove \fIchild\fP from the set of children managed by this group node\&. Will decrease the reference count of \fIchild\fP by 1\&. .PP This is a convenience method\&. It will simply call \fBfindChild()\fP with \fIchild\fP as argument, and then call \fBremoveChild(int)\fP if the child is found\&. .PP Please note that this method is not virtual in the original SGI Inventor API\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::removeAllChildren (void)\fC [virtual]\fP" Do not manage the children anymore\&. Will dereference all children by 1 as they are removed\&. .PP Please note that this method is not virtual in the original SGI Inventor API\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::replaceChild (intindex, \fBSoNode\fP *newchild)\fC [virtual]\fP" Replace child at \fIindex\fP with \fInewChild\fP\&. .PP Dereferences the child previously at \fIindex\fP, and increases the reference count of \fInewChild\fP by 1\&. .PP \fIindex\fP must be < this->\fBgetNumChildren()\fP .PP Please note that this method is not virtual in the original SGI Inventor API\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::replaceChild (\fBSoNode\fP *oldchild, \fBSoNode\fP *newchild)\fC [virtual]\fP" Replace \fIoldchild\fP with \fInewchild\fP\&. .PP Dereferences \fIoldchild\fP by 1, and increases the reference count of \fInewchild\fP by 1\&. .PP This is a convenience method\&. It will simply call \fBfindChild()\fP with \fIoldchild\fP as argument, and call \fBreplaceChild(int, SoNode*)\fP if the child is found\&. .PP Please note that this method is not virtual in the original SGI Inventor API\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "\fBSoChildList\fP * SoVRMLSwitch::getChildren (void) const\fC [virtual]\fP" Returns list of children\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::notify (\fBSoNotList\fP *l)\fC [protected]\fP, \fC [virtual]\fP" Notifies all auditors for this instance when changes are made\&. .PP Reimplemented from \fBSoNode\fP\&. .SS "SbBool SoVRMLSwitch::readInstance (\fBSoInput\fP *in, unsigned shortflags)\fC [protected]\fP, \fC [virtual]\fP" This method is mainly intended for internal use during file import operations\&. .PP It reads a definition of an instance from the input stream \fIin\fP\&. The input stream state points to the start of a serialized / persistant representation of an instance of this class type\&. .PP \fCTRUE\fP or \fCFALSE\fP is returned, depending on if the instantiation and configuration of the new object of this class type went ok or not\&. The import process should be robust and handle corrupted input streams by returning \fCFALSE\fP\&. .PP \fIflags\fP is used internally during binary import when reading user extension nodes, group nodes or engines\&. .PP Reimplemented from \fBSoGroup\fP\&. .SS "void SoVRMLSwitch::copyContents (const \fBSoFieldContainer\fP *from, SbBoolcopyconnections)\fC [protected]\fP, \fC [virtual]\fP" Makes a deep copy of all data of \fIfrom\fP into this instance, \fIexcept\fP external scenegraph references if \fIcopyconnections\fP is \fCFALSE\fP\&. .PP This is the method that should be overridden by extension node / engine / dragger / whatever subclasses which needs to account for internal data that are not handled automatically\&. .PP For copying nodes from application code, you should not invoke this function directly, but rather call the \fBSoNode::copy()\fP function: .PP .PP .nf SoNode * mynewnode = templatenode->copy(); .fi .PP .PP The same also goes for engines\&. .PP Make sure that when you override the \fBcopyContents()\fP method in your extension class that you also make it call upwards to it's parent superclass in the inheritance hierarchy, as \fBcopyContents()\fP in for instance \fBSoNode\fP and \fBSoFieldContainer\fP does important work\&. It should go something like this: .PP .PP .nf void MyCoinExtensionNode::copyContents(const SoFieldContainer * from, SbBool copyconnections) { // let parent superclasses do their thing (copy fields, copy // instance name, etc etc) SoNode::copyContents(from, copyconnections); // [\&.\&.then copy internal data\&.\&.] } .fi .PP .PP Reimplemented from \fBSoGroup\fP\&. .SH "Member Data Documentation" .PP .SS "\fBSoMFNode\fP SoVRMLSwitch::choice" Contains the children\&. .SS "\fBSoSFInt32\fP SoVRMLSwitch::whichChoice" Selected choice\&. Can be a positive number from 0 to , or one of the constants SO_SWITCH_NODE, SO_SWITCH_ALL or SO_SWITCH_INHERIT\&. Default value is SO_SWITCH_NONE\&. .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.