X3D Example Archives: Conformance Nist, Special Groups, Switch

 

Switch is a Grouping node that only renders one (or zero) child at a time. Switch can contain most nodes. (Contained nodes are now called 'children' rather than 'choice', for consistent naming among all GroupingNodeType nodes.) All child choices continue to receive and send events regardless of whichChoice is active.

X3D Tooltips of interest: Switch.

X3D Specification sections of interest: 10 Grouping component, 10.2 Concepts and 10.4.3 Switch.

X3D Examples Archives of related interest:

 
  6 X3D Models       X3D Model Descriptions
   bound_500 bound 500 This tests check the boundary condition of 500 children per grouping node. A Switch node is defined with 500 children in its "switch" field. Section 7.3 (Minimum Support Requirements) of the VRML specifications 500 children within a single grouping node. The test should generate 500 default color spheres and radius 0.3 meters.
   less_than_zero less than zero This tests addresses the ability of a browser to set the "whichChoice" field to a negative value. A Switch node with one single item in its "choice" field is defined and the "whichChoice" field is set to -1 (the default value), which indicates that nothing shall be selected from the "choice" field. The test shall generate a green box with some text on top of it If a red box is generated, then a failure occurred.
   more_than_max more than max This tests addresses the ability of a browser to set the "whichChoice" field to a value that is higher than the number of items in the "choice" field. A Switch node is defined with one item in its "choice" field and the "whichChoice" field is set to 1. This value is higher than the number of items in the "choice" field, therefore nothing shall be chosen at all. The test should generate a green box with some text on top of it. If a red box is generated then a failure occurred.
   nested_switch nested switch Test browser to nest Switch node. A Switch node is defined with two items in its "choice" field. The second item is in turn another Switch node with one item in its "choice" field (which is selected). The outer Switch then selects the second item (the inside Switch node) in its "whichChoice" field. The test should generate a green box with some text on top of it. If a red box is generated, then a failure occurred.
   select_firstchoice select firstchoice This test sets the "choice" field to three "Shape" node, and the "whichChoice" field to 0. Under these conditions the first choice should be chosen from the "choice" field. The test should generate a green sphere with some text on top of it. If any other geometry is generated, then a failure has occurred.
   select_lastchoice select lastchoice This test sets the "choice" field to three "Shape" node, and the whichChoice field to 2. Under these conditions the third choice should be chosen from the "choice" field. The test should generate a green box with some text on top of it. If any other geometry is generated, then a failure has occurred.

The X3D Resources: Examples page and Savage Developers Guide provide more information about the production of this archive.