X3D Model Documentation: FilterPrototypes.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2 
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
  3  <X3D profile='Immersive' version='3.0 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'>
  4       <head>
  5            <meta name='titlecontent='FilterPrototypes.x3d'/>
  6            <meta name='descriptioncontent='Contains prototypes that filter multiple values/events to extract a single value/event.'/>
  7            <meta name='creatorcontent='Don Brutzman, James Harney, Jane Wu'/>
  8            <meta name='createdcontent='18 December 2001'/>
  9            <meta name='modifiedcontent='15 October 2023'/>
 10            <meta name='subjectcontent='event filter'/>
 11            <meta name='identifiercontent='https://savage.nps.edu/Savage/Tools/Authoring/FilterPrototypes.x3d'/>
 12            <meta name='generatorcontent='X3D-Edit 4.0, https://savage.nps.edu/X3D-Edit'/>
 13            <meta name='licensecontent='../../license.html'/>
 14       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: PassFalseScript, PassFloatScript, PassIntegerScript, PassStringScript, PassTrueScript

Index for ProtoDeclare definitions: FilterBooleanPassFalseEvents, FilterBooleanPassTrueEvents, FilterFloatsPassSingleFloat, FilterIntegersPassSingleInteger, FilterStringsPassSingleString
-->
 15       <Scene>
 16            <WorldInfo title='FilterPrototypes.x3d'/>
 17            <ProtoDeclare name='FilterBooleanPassTrueEvents'>
 18                 <ProtoInterface>
 19                      <field name='setBooleantype='SFBoolaccessType='inputOnly'/>
 20                      <field name='trueEventOuttype='SFBoolaccessType='outputOnly'/>
 21                      <field name='trueEventTimetype='SFTimeaccessType='outputOnly'/>
 22                 </ProtoInterface>
 23                 <ProtoBody>
 24                      <Script DEF='PassTrueScript'>
 25                           <field name='setBooleantype='SFBoolaccessType='inputOnly'/>
 26                           <field name='trueEventOuttype='SFBoolaccessType='outputOnly'/>
 27                           <field name='trueEventTimetype='SFTimeaccessType='outputOnly'/>
 28                           <IS>
 29                                <connect nodeField='setBooleanprotoField='setBoolean'/>
 30                                <connect nodeField='trueEventOutprotoField='trueEventOut'/>
 31                                <connect nodeField='trueEventTimeprotoField='trueEventTime'/>
 32                           </IS>
  <![CDATA[
          
ecmascript:

function setBoolean (value, timeStamp)
{
	if (value == true)
	{
		trueEventOut = value;
		trueEventTime = timeStamp;
	}
}

        
]]>
 34                      </Script>
 35                 </ProtoBody>
 36            </ProtoDeclare>
 37            <ProtoDeclare name='FilterBooleanPassFalseEvents'>
 38                 <ProtoInterface>
 39                      <field name='setBooleantype='SFBoolaccessType='inputOnly'/>
 40                      <field name='falseEventOuttype='SFBoolaccessType='outputOnly'/>
 41                      <field name='falseEventTimetype='SFTimeaccessType='outputOnly'/>
 42                 </ProtoInterface>
 43                 <ProtoBody>
 44                      <Script DEF='PassFalseScript'>
 45                           <field name='setBooleantype='SFBoolaccessType='inputOnly'/>
 46                           <field name='falseEventOuttype='SFBoolaccessType='outputOnly'/>
 47                           <field name='falseEventTimetype='SFTimeaccessType='outputOnly'/>
 48                           <IS>
 49                                <connect nodeField='setBooleanprotoField='setBoolean'/>
 50                                <connect nodeField='falseEventOutprotoField='falseEventOut'/>
 51                                <connect nodeField='falseEventTimeprotoField='falseEventTime'/>
 52                           </IS>
  <![CDATA[
          
ecmascript:

function setBoolean (value, timeStamp)
{
	if (value == false)
	{
		falseEventOut = value;
		falseEventTime = timeStamp;
	}
}

        
]]>
 54                      </Script>
 55                 </ProtoBody>
 56            </ProtoDeclare>
 57            <ProtoDeclare name='FilterIntegersPassSingleInteger'>
 58                 <ProtoInterface>
 59                      <field name='integerIndextype='SFInt32value='0accessType='initializeOnly'
                     appinfo='Index of the integer in the integer array to be extracted. Defaulted to 0.'/>
 60                      <field name='setIntegerstype='MFInt32accessType='inputOnly'/>
 61                      <field name='integerOuttype='SFInt32accessType='outputOnly'/>
 62                      <field name='integerOutTimetype='SFTimeaccessType='outputOnly'/>
 63                 </ProtoInterface>
 64                 <ProtoBody>
 65                      <Script DEF='PassIntegerScript'>
 66                           <field name='integerIndextype='SFInt32accessType='initializeOnly'/>
 67                           <field name='setIntegerstype='MFInt32accessType='inputOnly'/>
 68                           <field name='integerOuttype='SFInt32accessType='outputOnly'/>
 69                           <field name='integerOutTimetype='SFTimeaccessType='outputOnly'/>
 70                           <IS>
 71                                <connect nodeField='integerIndexprotoField='integerIndex'/>
 72                                <connect nodeField='setIntegersprotoField='setIntegers'/>
 73                                <connect nodeField='integerOutprotoField='integerOut'/>
 74                                <connect nodeField='integerOutTimeprotoField='integerOutTime'/>
 75                           </IS>
  <![CDATA[
          
ecmascript:

function setIntegers (value, timeStamp)
{
	if (integerIndex < 0)
		return;

	integerOut = value[integerIndex];
	integerOutTime = timeStamp;
}

        
]]>
 77                      </Script>
 78                 </ProtoBody>
 79            </ProtoDeclare>
 80            <ProtoDeclare name='FilterFloatsPassSingleFloat'>
 81                 <ProtoInterface>
 82                      <field name='floatIndextype='SFInt32value='0accessType='initializeOnly'
                     appinfo='Index of the float in the float array to be extracted. Defaulted to 0.'/>
 83                      <field name='setFloatstype='MFFloataccessType='inputOnly'/>
 84                      <field name='floatOuttype='SFFloataccessType='outputOnly'/>
 85                      <field name='floatOutTimetype='SFTimeaccessType='outputOnly'/>
 86                 </ProtoInterface>
 87                 <ProtoBody>
 88                      <Script DEF='PassFloatScript'>
 89                           <field name='floatIndextype='SFInt32accessType='initializeOnly'/>
 90                           <field name='setFloatstype='MFFloataccessType='inputOnly'/>
 91                           <field name='floatOuttype='SFFloataccessType='outputOnly'/>
 92                           <field name='floatOutTimetype='SFTimeaccessType='outputOnly'/>
 93                           <IS>
 94                                <connect nodeField='floatIndexprotoField='floatIndex'/>
 95                                <connect nodeField='setFloatsprotoField='setFloats'/>
 96                                <connect nodeField='floatOutprotoField='floatOut'/>
 97                                <connect nodeField='floatOutTimeprotoField='floatOutTime'/>
 98                           </IS>
  <![CDATA[
          
ecmascript:

function setFloats (value, timeStamp)
{
	if (floatIndex < 0)
		return;

	floatOut = value[floatIndex];
	floatOutTime = timeStamp;
}

        
]]>
100                      </Script>
101                 </ProtoBody>
102            </ProtoDeclare>
103            <ProtoDeclare name='FilterStringsPassSingleString'>
104                 <ProtoInterface>
105                      <field name='stringIndextype='SFInt32value='0accessType='initializeOnly'
                     appinfo='Index of the string in the string array to be extracted. Defaulted to 0.'/>
106                      <field name='setStringstype='MFStringaccessType='inputOnly'/>
107                      <field name='stringOuttype='SFStringaccessType='outputOnly'/>
108                      <field name='stringOutTimetype='SFTimeaccessType='outputOnly'/>
109                 </ProtoInterface>
110                 <ProtoBody>
111                      <Script DEF='PassStringScript'>
112                           <field name='stringIndextype='SFInt32accessType='initializeOnly'/>
113                           <field name='setStringstype='MFStringaccessType='inputOnly'/>
114                           <field name='stringOuttype='SFStringaccessType='outputOnly'/>
115                           <field name='stringOutTimetype='SFTimeaccessType='outputOnly'/>
116                           <IS>
117                                <connect nodeField='stringIndexprotoField='stringIndex'/>
118                                <connect nodeField='setStringsprotoField='setStrings'/>
119                                <connect nodeField='stringOutprotoField='stringOut'/>
120                                <connect nodeField='stringOutTimeprotoField='stringOutTime'/>
121                           </IS>
  <![CDATA[
          
ecmascript:

function setStrings (value, timeStamp)
{
	if (stringIndex < 0)
		return;

	stringOut = value[stringIndex];
	stringOutTime = timeStamp;
}

        
]]>
123                      </Script>
124                 </ProtoBody>
125            </ProtoDeclare>
126            <!-- ==================== -->
127            <Anchor description='FilterExamplesparameter='"target=_blank"'   url=' "FilterExamples.x3d" "https://savage.nps.edu/Savage/Tools/Authoring/FilterExamples.x3d" "FilterExamples.wrl" "https://savage.nps.edu/Savage/Tools/Authoring/FilterExamples.wrl" '>
128                 <Shape>
129                      <Appearance>
130                           <Material diffuseColor='0 1 1emissiveColor='0 1 1'/>
131                      </Appearance>
132                      <Text string='"FilterPrototypes.wrl" "is a Prototype definition file." "" "To see an example scene" "using these new nodes" "click this text and view" "FilterExamples.wrl"'>
133                           <FontStyle justify='"MIDDLE" "MIDDLE"size='0.8'/>
134                      </Text>
135                 </Shape>
136            </Anchor>
137       </Scene>
138  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: PassFalseScript, PassFloatScript, PassIntegerScript, PassStringScript, PassTrueScript

Index for ProtoDeclare definitions: FilterBooleanPassFalseEvents, FilterBooleanPassTrueEvents, FilterFloatsPassSingleFloat, FilterIntegersPassSingleInteger, FilterStringsPassSingleString
-->
X3D Tooltips element index: Anchor, Appearance, connect, field, FontStyle, head, IS, Material, meta, ProtoBody, ProtoDeclare, ProtoInterface, Scene, Script, Shape, Text, WorldInfo, X3D, accessType and type, XML data types, field types

-->
<!-- Online at
https://savage.nps.edu/Savage/Tools/Authoring/FilterPrototypesIndex.html -->
<!-- Version control at
https://gitlab.nps.edu/Savage/Savage/Tools/Authoring/FilterPrototypes.x3d -->

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

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