<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
<X3D profile='Immersive'  version='3.3 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation =' https://www.web3d.org/specifications/x3d-3.3.xsd ' >
<head>
<meta name='titlecontent=' MoodSelector.x3d '/>
<meta name='descriptioncontent='Design pattern demonstrating multiple TouchSensor, IntegerTrigger, Shape and ROUTE combinations for selecting a Switch'/>
<meta name='creatorcontent='Jason Nelson and MV4205 class'/>
<meta name='createdcontent='6 April 2009'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='licensecontent='smiley images are open source'/>
<meta name='referencecontent=' http://openclipart.org/media/tags/smiley '/>
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/MoodSelector.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!-- -->
<Scene>
<WorldInfo title='MoodSelector.x3d'/>
<Viewpoint description='How do you feel today?position='0 0 15'/>
<Transform translation='0 3 0'>
<!-- ROUTE information for howFeelText node:  [from isActive to nodisplay.set_boolean ] -->
<TouchSensor DEF='howFeelTextdescription='Touch to select your mood face'/>

<Shape>
<Text string='"How do you feel today?"'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
<Appearance>
<Material/>
</Appearance>
</Shape>
</Transform>
<Transform translation='-5 0 0'>
<!-- ROUTE information for happyText node:  [from isActive to happydisplay.set_boolean ] -->
<TouchSensor DEF='happyTextdescription='I feel happy I feel happy...'/>

<Shape>
<Text string='"Happy"'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
<Appearance>
<Material diffuseColor='0.129412 1 0.019608'/>
</Appearance>
</Shape>
<Shape>
<Box size='2.5 1 0.1'/>
<Appearance DEF='TransparentAppearance'>
<Material transparency='1'/>
</Appearance>
</Shape>
</Transform>
<Transform translation='-1.3 0 0'>
<!-- ROUTE information for notBadText node:  [from isActive to nbdisplay.set_boolean ] -->
<TouchSensor DEF='notBadTextdescription='OK mediocre just plain average no comment'/>

<Shape>
<Text string='"Average"'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
<Appearance>
<Material diffuseColor='1 0.960784 0.019608'/>
</Appearance>
</Shape>
<Shape>
<Box size='3 1 0.1'/>
<Appearance USE=' TransparentAppearance'/>
</Shape>
</Transform>
<Transform translation='2.2 0 0'>
<!-- ROUTE information for sadText node:  [from isActive to saddisplay.set_boolean ] -->
<TouchSensor DEF='sadTextdescription='Poor poor pitiful me'/>

<Shape>
<Text string='"Sad"'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
<Appearance>
<Material diffuseColor='0.180392 0.705882 1'/>
</Appearance>
</Shape>
<Shape>
<Box size='2 1 0.1'/>
<Appearance USE=' TransparentAppearance'/>
</Shape>
</Transform>
<Transform translation='5 0 0'>
<!-- ROUTE information for badText node:  [from isActive to bulldisplay.set_boolean ] -->
<TouchSensor DEF='badTextdescription='Look out below!'/>

<Shape>
<Text string='"Bad"'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
<Appearance>
<Material diffuseColor='1 0.019608 0.05098'/>
</Appearance>
</Shape>
<Shape>
<Box size='4.5 1 0.1'/>
<Appearance USE=' TransparentAppearance'/>
</Shape>
</Transform>
<Transform translation='-5 -3 0'>
<Shape DEF='happyimg'> </Shape>
</Transform>
<Transform translation='-1.3 -3 0'>
<Shape DEF='nbimg'> </Shape>
</Transform>
<Transform translation='2.2 -3 0'>
<Shape DEF='sadimg'>
<Box/>
<Appearance> </Appearance>
</Shape>
</Transform>
<Transform translation='4.7 -3 0'>
<Shape DEF='bullimg'>
<Box/>
<Appearance> </Appearance>
</Shape>
</Transform>
</Switch>
<!-- ROUTE information for nodisplay node:  [from howFeelText.isActive to set_boolean ] [from triggerValue to display.whichChoice ] -->
<IntegerTrigger DEF='nodisplay'/>

<!-- ROUTE information for happydisplay node:  [from happyText.isActive to set_boolean ] [from triggerValue to display.whichChoice ] -->
<IntegerTrigger DEF='happydisplayintegerKey='0'/>

<!-- ROUTE information for nbdisplay node:  [from notBadText.isActive to set_boolean ] [from triggerValue to display.whichChoice ] -->
<IntegerTrigger DEF='nbdisplayintegerKey='1'/>

<!-- ROUTE information for saddisplay node:  [from sadText.isActive to set_boolean ] [from triggerValue to display.whichChoice ] -->
<IntegerTrigger DEF='saddisplayintegerKey='2'/>

<!-- ROUTE information for bulldisplay node:  [from badText.isActive to set_boolean ] [from triggerValue to display.whichChoice ] -->
<IntegerTrigger DEF='bulldisplayintegerKey='3'/>

< ROUTE  fromNode=' howFeelText' fromField='isActive' toNode=' nodisplay' toField='set_boolean'/>
< ROUTE  fromNode=' happyText' fromField='isActive' toNode=' happydisplay' toField='set_boolean'/>
< ROUTE  fromNode=' notBadText' fromField='isActive' toNode=' nbdisplay' toField='set_boolean'/>
< ROUTE  fromNode=' sadText' fromField='isActive' toNode=' saddisplay' toField='set_boolean'/>
< ROUTE  fromNode=' badText' fromField='isActive' toNode=' bulldisplay' toField='set_boolean'/>
<!-- Note that Switch "which choice"
has FAN IN -->

< ROUTE  fromNode=' nodisplay' fromField='triggerValue' toNode=' display' toField='whichChoice'/>
< ROUTE  fromNode=' happydisplay' fromField='triggerValue' toNode=' display' toField='whichChoice'/>
< ROUTE  fromNode=' nbdisplay' fromField='triggerValue' toNode=' display' toField='whichChoice'/>
< ROUTE  fromNode=' saddisplay' fromField='triggerValue' toNode=' display' toField='whichChoice'/>
< ROUTE  fromNode=' bulldisplay' fromField='triggerValue' toNode=' display' toField='whichChoice'/>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: badText, bulldisplay, bullimg, display, happydisplay, happyimg, happyText, howFeelText, nbdisplay, nbimg, nodisplay, notBadText, saddisplay, sadimg, sadText, TransparentAppearance

Index for Viewpoint node: Viewpoint_1
-->

Event Graph ROUTE Table entries with 10 ROUTE connections total, showing X3D event-model relationships for this scene.

Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.

badText
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
bulldisplay
IntegerTrigger
set_boolean
SFBool

 
 
then
bulldisplay
IntegerTrigger
triggerValue
SFInt32

ROUTE
event to
(2)
display
Switch
whichChoice
SFInt32


happyText
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
happydisplay
IntegerTrigger
set_boolean
SFBool

 
 
then
happydisplay
IntegerTrigger
triggerValue
SFInt32

ROUTE
event to
(2)
display
Switch
whichChoice
SFInt32


howFeelText
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
nodisplay
IntegerTrigger
set_boolean
SFBool

 
 
then
nodisplay
IntegerTrigger
triggerValue
SFInt32

ROUTE
event to
(2)
display
Switch
whichChoice
SFInt32


notBadText
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
nbdisplay
IntegerTrigger
set_boolean
SFBool

 
 
then
nbdisplay
IntegerTrigger
triggerValue
SFInt32

ROUTE
event to
(2)
display
Switch
whichChoice
SFInt32


sadText
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
saddisplay
IntegerTrigger
set_boolean
SFBool

 
 
then
saddisplay
IntegerTrigger
triggerValue
SFInt32

ROUTE
event to
(2)
display
Switch
whichChoice
SFInt32


-->

<!-- Online at
https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/MoodSelectorIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/MoodSelector.x3d -->

<!-- Color legend: X3D terminology <X3dNode DEF='idName' field='value'/> matches XML terminology <XmlElement DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement) (Grey background inside box: inserted documentation) (Magenta background: X3D Extensibility)
-->

to top <!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->