Group node that traverses one chosen child. More...
#include <Inventor/VRMLnodes/SoVRMLSwitch.h>
Public Member Functions | |
virtual SoType | getTypeId () const |
SoVRMLSwitch () | |
SoVRMLSwitch (int nChoices) | |
virtual SbBool | affectsState () const |
void | addChoice (SoNode *choice1) |
void | insertChoice (SoNode *choice1, int newLevelIndex) |
SoNode * | getChoice (int index) const |
int | findChoice (const SoNode *choice1) const |
int | getNumChoices () const |
void | removeChoice (int index) |
void | removeChoice (SoNode *choice1) |
void | removeAllChoices () |
void | replaceChoice (int index, SoNode *newChoice) |
void | replaceChoice (SoNode *oldChoice, SoNode *newChoice) |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Public Attributes | |
SoMFNode | choice |
SoSFInt32 | whichChoice |
NOTE: This field is not compatible with VRML97. If you specify a non-default value for this field, when this node is written to a VRML file, the file will contain this incompatible field and standard VRML97 file readers will not be able to read it. See the VRML97 Specification, below.
This section may reference portions of the VRML97 specification that are not present in this help file. The complete VRML97 spec is available at http://www.web3d.org .
The SoVRMLSwitch grouping node traverses zero or one of the nodes specified in the choice field.
See the "Concepts - Grouping and Children Nodes" section which describes "children nodes" for a details on the types of nodes that are legal values for choice.
The whichChoice field specifies the index of the child to traverse, where the first child has index 0. If whichChoice is less than zero or greater than the number of nodes in the choice field then nothing is chosen.
The bboxCenter and bboxSize fields specify a bounding box that encloses the SoVRMLSwitch's children. This is a hint that may be used for optimization purposes. If the specified bounding box is smaller than the actual bounding box of the children at any time, then the results are undefined. A default bboxSize value, (-1 -1 -1), implies that the bounding box is not specified and if needed must be calculated by the browser. See "Concepts - Bounding Boxes" for a description of the bboxCenter and bboxSize fields.
Note that all nodes under an SoVRMLSwitch continue to receive and send events regardless of the value of whichChoice.
choice | [] // VRML97 |
children | [] // X3D |
whichChoice | -1 |
metadata | NULL |
bboxCenter | 0 0 0 |
bboxSize | -1 -1 -1 |
SoMFNode | addChildren // X3D only |
SoMFNode | removeChildren // X3D only |
SoMFNode | set_choice // VRML97 only |
SoMFNode | set_children // X3D only |
SoSFInt32 | set_whichChoice |
SoSFNode | set_metadata |
SoMFNode | choice_changed // VRML97 only |
SoMFNode | children_changed // X3D only |
SoSFInt32 | whichChoice_changed |
SoSFNode | metadata_changed |
SoVRMLSwitch::SoVRMLSwitch | ( | ) |
Constructor.
SoVRMLSwitch::SoVRMLSwitch | ( | int | nChoices | ) |
Constructor that takes approximate number of choices.
void SoVRMLSwitch::addChoice | ( | SoNode * | choice1 | ) |
Adds a choice/child as last one in group.
virtual SbBool SoVRMLSwitch::affectsState | ( | ) | const [virtual] |
Overrides method in SoNode to return FALSE if there is no selected child or the selected child does not affect the state.
Reimplemented from SoVRMLParent.
int SoVRMLSwitch::findChoice | ( | const SoNode * | choice1 | ) | const |
Finds index of given choice/child within group.
SoNode* SoVRMLSwitch::getChoice | ( | int | index | ) | const |
Returns the nth choice/child node.
static SoType SoVRMLSwitch::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoVRMLParent.
int SoVRMLSwitch::getNumChoices | ( | ) | const |
Returns number of choices/children.
virtual SoType SoVRMLSwitch::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Reimplemented from SoVRMLParent.
void SoVRMLSwitch::insertChoice | ( | SoNode * | choice1, | |
int | newLevelIndex | |||
) |
Adds a choice/child so that it becomes the one with the given index.
void SoVRMLSwitch::removeAllChoices | ( | ) |
Removes all choices/children from group.
void SoVRMLSwitch::removeChoice | ( | SoNode * | choice1 | ) | [inline] |
Removes first instance of given choice/child from group.
void SoVRMLSwitch::removeChoice | ( | int | index | ) |
Removes choice/child with given index from group.
Replaces first instance of given choice/child with new choice/child.
void SoVRMLSwitch::replaceChoice | ( | int | index, | |
SoNode * | newChoice | |||
) |
Replaces choice with given index with new choice/child.
Nodes to chose from (VRML97 only).
In X3D, the list of nodes is specified using the children field (inherited from SoVRMLParent).
NOTE: This field is not compatible with VRML97. If you specify a non-default value for this field, when this node is written to a VRML file, the file will contain this incompatible field and standard VRML97 file readers will not be able to read it.
Specifies the index of the child to traverse.