#VRML V2.0 utf8 EXTERNPROTO ScrollPane [ # field SFInt32 maxCharsOnALine # field SFFloat charAspect # field SFFloat minMargin # field SFFloat lineSpacing # field SFFloat charSpacing # field SFString textFont # field SFString linkFont eventIn SFString loadURL eventIn SFString setText eventIn SFInt32 scrollText eventOut SFString linkClicked ] "music-dossier-text.wrl#ScrollPane" EXTERNPROTO magnifyGlasPlus [] "models\Magnify\magnify_button_plus.wrl#ModelSearchNode" EXTERNPROTO magnifyGlasMin [] "models\Magnify\magnify_button_min.wrl#ModelSearchNode" EXTERNPROTO exit[] "models\exit.wrl#exitButton" EXTERNPROTO videoTypeSwitchLow[ exposedField SFVec3f scale exposedField SFColor diffuseColor ] "models\conceptGraph\VideoType\VideoTypeLow.wrl" EXTERNPROTO videoTypeSwitchHigh [ exposedField SFVec3f scale exposedField SFColor diffuseColor ] "models\conceptGraph\VideoType\VideoTypeHigh.wrl" PROTO textPresentationEnvironment [ eventIn SFNode textItem eventIn SFString text eventOut SFString linkClicked ]{ DEF boxSwitch Switch { whichChoice -1 choice [ DEF boxTransfrom Transform { translation 0 0 0.1 scale 1.95 1.95 1.95 children [ DEF scrollPane ScrollPane{setText IS text linkClicked IS linkClicked } ] } ] } DEF textScript Script { eventIn SFNode textItem IS textItem eventOut SFString textURL eventOut SFInt32 whichChoice eventOut SFString text url "javascript: // if item of type Text: pass the string text to the scrollPane, display text environment function textItem (value) { if(value.getType()=='Text') { whichChoice=0; text = value.text; } else // type is TextItem: display text environment { //print(value.ID); if (value.ID != null) { whichChoice = 0; //textURL = value.url; //print(value.url); } else { whichChoice = -1; } } } " } ROUTE textScript.whichChoice TO boxSwitch.whichChoice ROUTE textScript.textURL TO scrollPane.loadURL ROUTE textScript.text TO scrollPane.setText } PROTO picturePresentationEnvironment [ eventIn SFNode pictureItem ]{ DEF boxSwitch Switch { whichChoice -1 choice [ DEF boxTransfrom Transform { translation 0 0 0.1 children [ Shape { geometry Box { size 1.95 1.95 0 } appearance Appearance { material Material { transparency 0 } texture DEF picture ImageTexture { } } } ] } ] } DEF pictureScript Script { eventIn SFNode pictureItem IS pictureItem eventOut MFString pictureURL eventOut SFVec3f boxSize eventOut SFInt32 whichChoice url "javascript: function pictureItem (value) { //print(value.ID); if (value.ID != null) { // if picture is available whichChoice = 0; //show picture box pictureURL = value.url; if (value.height > value.width) { //scales picture box according to the width-height ratio of the picture boxSize = new SFVec3f(value.width/value.height,1,1); } else { boxSize = new SFVec3f(1,value.height/value.width,1); } //print('picture'); } else { whichChoice = -1; // no picture to show: hide picture box } } " } ROUTE pictureScript.whichChoice TO boxSwitch.whichChoice ROUTE pictureScript.pictureURL TO picture.url ROUTE pictureScript.boxSize TO boxTransfrom.scale } PROTO videoPresentationEnvironment [ eventIn SFNode videoItem ]{ DEF boxSwitch Switch { whichChoice -1 choice Group { children [ Transform{ scale 1.95 1.95 1 translation 0 0 0.1 children [ # Shape # { # geometry Box # { # size 1 1 0 # } # appearance Appearance # { # material Material { # diffuseColor 0 .35 .25 # specularColor 0 .16 .18 # emissiveColor .14 .18 .28 # ambientIntensity .0533 # shininess .06 # } # } # } DEF boxTransfrom Transform { children [ Shape { geometry Box { size 1 1 0.005 } appearance Appearance { texture DEF video MovieTexture { } } } ] } Transform # Movie-controls { scale .1 .1 1 translation 0.16 -.435 0 children [ Script { field MFNode definitions [ DEF boxAppearance Appearance { material DEF boxAppearanceColor Material { diffuseColor 0 0 0 ambientIntensity 0 shininess 0 emissiveColor .2 0 0 } } DEF buttonAppearance Appearance { material DEF buttonAppearanceColor Material { diffuseColor 0 0 0 ambientIntensity 0 shininess 0 emissiveColor .65 0 0 } } DEF boxShape Shape { geometry Box { size 1 1 0.015 } appearance USE boxAppearance } DEF buttonBox Shape { geometry Box { size .7 .7 .025 } appearance USE buttonAppearance } DEF arrowShape Shape { geometry Extrusion { crossSection [-0.5 0.5, 0.5 0.5, 0 -0.5,-0.5 0.5] spine [0 0 -0.0125, 0 0 0.0125] } appearance USE buttonAppearance } ] } DEF switchMovieControls Switch { whichChoice 0 choice [ DEF moviecontrols_with_video Group { children [ Transform { translation -2.2 0 0 children [ DEF rewind TouchSensor {} USE boxShape Transform { scale .8 .41 .8 rotation 0 0 1 1.5707963268 translation -.22 0 0 children USE arrowShape } Transform { scale .8 .41 .8 rotation 0 0 1 1.5707963268 translation .21 0 0 children USE arrowShape } ] } Transform { translation -1.1 0 0 children [ DEF play TouchSensor {} USE boxShape Transform { scale .8 .8 .8 rotation 0 0 1 -1.5707963268 children USE arrowShape } ] } Transform { translation 0 0 0 children [ DEF pause TouchSensor {} USE boxShape Transform { scale .4 1 1 translation -.2 0 0 children USE buttonBox } Transform { scale .4 1 1 translation .2 0 0 children USE buttonBox } ] } Transform { translation 1.1 0 0 children [ DEF stop TouchSensor {} USE boxShape USE buttonBox ] } Transform { translation 2.2 0 0 children [ DEF forward TouchSensor {} USE boxShape Transform { scale .8 .41 .8 rotation 0 0 1 -1.5707963268 translation -.21 0 0 children USE arrowShape } Transform { scale .8 .41 .8 rotation 0 0 1 -1.5707963268 translation .22 0 0 children USE arrowShape } ] } ] } DEF moviecontrols_without_video Group { children [ Transform { translation -2.2 0 0 children [ USE boxShape Transform { scale .8 .41 .8 rotation 0 0 1 1.5707963268 translation -.22 0 0 children USE arrowShape } Transform { scale .8 .41 .8 rotation 0 0 1 1.5707963268 translation .21 0 0 children USE arrowShape } ] } Transform { translation -1.1 0 0 children [ USE boxShape Transform { scale .8 .8 .8 rotation 0 0 1 -1.5707963268 children USE arrowShape } ] } Transform { translation 0 0 0 children [ USE boxShape Transform { scale .4 1 1 translation -.2 0 0 children USE buttonBox } Transform { scale .4 1 1 translation .2 0 0 children USE buttonBox } ] } Transform { translation 1.1 0 0 children [ USE boxShape USE buttonBox ] } Transform { translation 2.2 0 0 children [ USE boxShape Transform { scale .8 .41 .8 rotation 0 0 1 -1.5707963268 translation -.21 0 0 children USE arrowShape } Transform { scale .8 .41 .8 rotation 0 0 1 -1.5707963268 translation .22 0 0 children USE arrowShape } ] } ] } ] } Transform # video type switch button low (RM) { translation -5.7 8.8 0 children [ DEF setVideoLowTS TouchSensor {} DEF setVideoTypeLow videoTypeSwitchLow {scale 0.6 0.6 0.1 diffuseColor 1 1 0} Transform { # invisible box translation 0 0.25 0 children [ Shape { geometry Box {size 1 0.5 0} appearance Appearance { material Material { transparency 1 } } } ] } ] } Transform # video type switch button high (MPEG2) { translation -5.7 8.2 0 children [ DEF setVideoHighTS TouchSensor {} DEF setVideoTypeHigh videoTypeSwitchHigh {scale 0.6 0.6 0.1 diffuseColor 0.8 0.8 0.8} Transform { # invisible box translation 0 0.25 0 children [ Shape { geometry Box {size 1 0.5 0} appearance Appearance { material Material { transparency 1 } } } ] } ] } Transform # Time-indicator { scale 1 1 .015 translation -2.9 -0.05 -0.0005 children [ Shape { geometry DEF timeText Text { string "--:--" fontStyle FontStyle { family "TYPEWRITER" justify "END" style "WEIGHT1000 EXTRUDE" size 0.8 } } appearance DEF textAppearance Appearance { material Material { diffuseColor 0 0 0 emissiveColor .4 0 0 ambientIntensity 0 shininess 0 } } } Transform { translation 0 -.4 0 children Shape { geometry DEF durationText Text { string "(--:--)" fontStyle FontStyle { family "TYPEWRITER" justify "END" style "WEIGHT1000 EXTRUDE" size .5 } } appearance USE textAppearance } } ] } ] } ] } ] } } DEF seekPauseTimer TimeSensor { cycleInterval .3 } DEF videoTimer TimeSensor {} DEF pauseAnimationTimer TimeSensor { cycleInterval .8 loop TRUE enabled FALSE } DEF videoScript Script { directOutput TRUE eventIn SFNode videoItem IS videoItem eventIn SFTime rewind eventIn SFTime forward eventIn SFTime play eventIn SFTime pause eventIn SFTime stop eventIn SFTime setVideoTypeLow eventIn SFTime setVideoTypeHigh eventIn SFBool videoActive eventIn SFBool timerActive eventIn SFTime durationChanged eventIn SFFloat videoTimeChanged eventIn SFTime pauseAnimation field SFNode video USE video field SFBool paused FALSE field SFTime pauseVideoTime 0 field SFBool seek FALSE field SFTime newStartTime 0 field SFNode seekPauseTimer USE seekPauseTimer field SFNode pauseAnimationTimer USE pauseAnimationTimer field SFNode videoScript USE videoScript field SFNode durationText USE durationText field SFNode timeText USE timeText field SFInt32 currentSecond 0 field SFInt32 setVideoTypeButton 0 eventOut SFInt32 setVideoControlsSwitch eventOut MFString videoURL eventOut SFVec3f boxSize eventOut SFInt32 whichChoice eventOut SFColor setColorLowButton eventOut SFColor setColorHighButton url "javascript: function durationChanged(duration) { var minute=leadZero(Math.floor(duration/60)); var second=leadZero(Math.floor(duration%60)); durationText.string=new MFString('('+minute+':'+second+') '); currentSecond=0; displayCurrentVideoTime(); } function videoTimeChanged(fraction) { var time=Math.floor(fraction*video.duration_changed); if(time==currentSecond) return; currentSecond=time; displayCurrentVideoTime(); } function displayCurrentVideoTime() { var minute=leadZero(Math.floor(currentSecond/60)); var second=leadZero(Math.floor(currentSecond%60)); timeText.string=new MFString(minute+':'+second+' '); } function leadZero(number) { if(number<10) return '0'+number; return number; } function videoItem (value,time) { if(value.ID != null) { if(setVideoTypeButton == 0 && value.url != 'UNDEFINED'){ timeText.string=new MFString('Loading'); durationText.string=new MFString('Please wait'); setVideoControlsSwitch = 0; } else if(setVideoTypeButton == 1 && value.MPEGurl != 'UNDEFINED'){ timeText.string=new MFString('Loading'); durationText.string=new MFString('Please wait'); setVideoControlsSwitch = 0; } else{ timeText.string=new MFString('NO VIDEO'); durationText.string=new MFString(''); setVideoControlsSwitch = 1; } whichChoice = 0; if(setVideoTypeButton == 0){ // hiermee wordt gecontroleerd of er op de button setVideoType is gedrukt om te switchen tussen .rm video's en mpeg2 video. videoURL = value.url; //.RM videos } else{ videoURL = value.MPEGurl; // MPEG videos } var ratio = value.width / value.height; //print (ratio); if (ratio < 1) { boxSize = new SFVec3f(ratio,1,1); } else { boxSize = new SFVec3f(1,1/ratio,1); } } else { whichChoice = -1; if(video!=null) { video.stopTime=time; //video.isActive = false; <- dit is geen eventIn maar een eventOut en geeft dus alleen een error } } //print('video, niet echt best'); } function play(time) { if(!video.isActive && !paused) { video.stopTime=time+video.duration_changed; video.startTime=time; } else if (!video.isActive && paused) { //paused=false; unsetPaused(); var videoTimeLeft=video.duration_changed-pauseVideoTime; video.stopTime=time+videoTimeLeft; video.startTime=time-pauseVideoTime; } } function pause(time) { if(!video.isActive && paused) play(time); if(!video.isActive && !paused) return; //paused=true; setPaused(); pauseVideoTime=time-video.startTime; video.stopTime=time; } function stop(time) { if(video.isActive) { video.stopTime=time; } else if (paused) { unsetPaused(); //paused=false; } } function rewind(time) { if(video.isActive) { newStartTime=video.startTime+5; if(newStartTime>time) newStartTime=time; seek=true; stop(time); } } function forward(time) { if(video.isActive) { newStartTime=video.startTime-5; seek=true; stop(time); } } function setVideoTypeLow(value, time) { if(value) { setVideoTypeButton = 0; videoItem(videoItem, time); setColorLowButton = '1 1 0'; setColorHighButton = '0.8 0.8 0.8'; } stop(time); } function setVideoTypeHigh(value, time) { if(value) { setVideoTypeButton = 1; videoItem(videoItem, time); setColorLowButton = '0.8 0.8 0.8'; setColorHighButton = '1 1 0'; } stop(time); } function videoActive(active,time) { if(!active && seek) { Browser.addRoute(seekPauseTimer, 'isActive', videoScript, 'timerActive'); seekPauseTimer.startTime=time; seek=false; } } function timerActive(active) { if(active) return; Browser.deleteRoute(seekPauseTimer, 'isActive', videoScript, 'timerActive'); video.stopTime=newStartTime+video.duration_changed; video.startTime=newStartTime; } function setPaused() { pauseAnimationTimer.enabled=true; paused=true; } function unsetPaused() { pauseAnimationTimer.enabled=false; displayCurrentVideoTime(); paused=false; } function pauseAnimation() { if(timeText.string[0]!='PAUSE ') timeText.string[0]='PAUSE '; else displayCurrentVideoTime(); } " } ROUTE rewind.touchTime TO videoScript.rewind ROUTE forward.touchTime TO videoScript.forward ROUTE play.touchTime TO videoScript.play ROUTE setVideoLowTS.touchTime TO videoScript.setVideoTypeLow ROUTE setVideoHighTS.touchTime TO videoScript.setVideoTypeHigh ROUTE pause.touchTime TO videoScript.pause ROUTE stop.touchTime TO videoScript.stop ROUTE video.isActive TO videoScript.videoActive ROUTE video.duration_changed TO videoScript.durationChanged ROUTE video.duration_changed TO videoTimer.cycleInterval ROUTE video.startTime TO videoTimer.startTime ROUTE video.stopTime TO videoTimer.stopTime ROUTE video.isActive TO videoTimer.enabled ROUTE videoTimer.fraction_changed TO videoScript.videoTimeChanged ROUTE videoScript.whichChoice TO boxSwitch.whichChoice ROUTE videoScript.videoURL TO video.url ROUTE videoScript.boxSize TO boxTransfrom.scale ROUTE pauseAnimationTimer.cycleTime TO videoScript.pauseAnimation ROUTE videoScript.setVideoControlsSwitch TO switchMovieControls.whichChoice ROUTE videoScript.setColorLowButton TO setVideoTypeLow.diffuseColor ROUTE videoScript.setColorHighButton TO setVideoTypeHigh.diffuseColor } PROTO audioPresentationEnvironment [ eventIn SFNode audioItem eventIn SFTime play ]{ DEF boxSwitch Switch { whichChoice -1 choice Group { children [ Transform{ scale 1.95 1.95 1 translation 0 0 0.1 children [ DEF boxTransfrom Transform { children [ Shape { geometry Box { size 1 1 0.005 } appearance Appearance { texture DEF audio MovieTexture { url "" } } } Shape { geometry Box { size 1 1 0.005 } appearance Appearance { texture ImageTexture { # audioIcon shown in player. url "images/audioIcon.png" repeatS FALSE repeatT FALSE } textureTransform TextureTransform { scale 5 5 translation -0.4 -0.4 } # material Material { # diffuseColor 0 0 0 # specularColor .29 .3 .29 # ambientIntensity 0 # shininess .08 # } } } ] } Transform { # audio command << play >> <> etc. scale .1 .1 .1 translation -.1 .2 .1 children [ Shape { geometry DEF audioActionDisplay Text { string "" fontStyle FontStyle { family "Verdana" size 0.7 } } } ] } Transform { # audio picture display scale .1 .1 .1 translation -.2 0 .2 children [ Shape { appearance Appearance { texture ImageTexture { url "images/audioIcon.gif" } } } ] } Transform # Movie-controls { scale .1 .1 1 translation 0.16 -.435 0 children [ Script { field MFNode definitions [ DEF boxAppearance Appearance { material DEF boxAppearanceColor Material { diffuseColor 0 0 0 ambientIntensity 0 shininess 0 emissiveColor .2 0 0 } } DEF buttonAppearance Appearance { material DEF buttonAppearanceColor Material { diffuseColor 0 0 0 ambientIntensity 0 shininess 0 emissiveColor .65 0 0 } } DEF boxShape Shape { geometry Box { size 1 1 0.015 } appearance USE boxAppearance } DEF buttonBox Shape { geometry Box { size .7 .7 .025 } appearance USE buttonAppearance } DEF arrowShape Shape { geometry Extrusion { crossSection [-0.5 0.5, 0.5 0.5, 0 -0.5,-0.5 0.5] spine [0 0 -0.0125, 0 0 0.0125] } appearance USE buttonAppearance } ] } DEF audiocontrols Group { children [ Transform { translation -2.2 0 0 children [ DEF rewind TouchSensor {} USE boxShape Transform { scale .8 .41 .8 rotation 0 0 1 1.5707963268 translation -.22 0 0 children USE arrowShape } Transform { scale .8 .41 .8 rotation 0 0 1 1.5707963268 translation .21 0 0 children USE arrowShape } ] } Transform { translation -1.1 0 0 children [ DEF play TouchSensor {} USE boxShape Transform { scale .8 .8 .8 rotation 0 0 1 -1.5707963268 children USE arrowShape } ] } Transform { translation 0 0 0 children [ DEF pause TouchSensor {} USE boxShape Transform { scale .4 1 1 translation -.2 0 0 children USE buttonBox } Transform { scale .4 1 1 translation .2 0 0 children USE buttonBox } ] } Transform { translation 1.1 0 0 children [ DEF stop TouchSensor {} USE boxShape USE buttonBox ] } Transform { translation 2.2 0 0 children [ DEF forward TouchSensor {} USE boxShape Transform { scale .8 .41 .8 rotation 0 0 1 -1.5707963268 translation -.21 0 0 children USE arrowShape } Transform { scale .8 .41 .8 rotation 0 0 1 -1.5707963268 translation .22 0 0 children USE arrowShape } ] } ] } Transform # Time-indicator { scale 1 1 .015 translation -2.9 -0.05 -0.0005 children [ Shape { geometry DEF timeText Text { string "--:--" fontStyle FontStyle { family "TYPEWRITER" justify "END" style "WEIGHT1000 EXTRUDE" size 0.8 } } appearance DEF textAppearance Appearance { material Material { diffuseColor 0 0 0 emissiveColor .4 0 0 ambientIntensity 0 shininess 0 } } } Transform { translation 0 -.4 0 children Shape { geometry DEF durationText Text { string "(--:--)" fontStyle FontStyle { family "TYPEWRITER" justify "END" style "WEIGHT1000 EXTRUDE" size .5 } } appearance USE textAppearance } } ] } ] } ] } ] } } DEF seekPauseTimer TimeSensor { cycleInterval .3 } DEF audioTimer TimeSensor {} DEF pauseAnimationTimer TimeSensor { cycleInterval .8 loop TRUE enabled FALSE } DEF audioScript Script { directOutput TRUE eventIn SFNode audioItem IS audioItem eventIn SFTime rewind eventIn SFTime forward eventIn SFTime play IS play eventIn SFTime pause eventIn SFTime stop # eventIn SFTime setVideoTypeLow # eventIn SFTime setVideoTypeHigh eventIn SFBool audioActive eventIn SFBool timerActive eventIn SFTime durationChanged eventIn SFFloat audioTimeChanged eventIn SFTime pauseAnimation field SFNode audio USE audio field SFBool paused FALSE field SFTime pauseAudioTime 0 field SFBool seek FALSE field SFTime newStartTime 0 field SFNode seekPauseTimer USE seekPauseTimer field SFNode pauseAnimationTimer USE pauseAnimationTimer field SFNode audioScript USE audioScript field SFNode durationText USE durationText field SFNode timeText USE timeText field SFInt32 currentSecond 0 eventOut MFString audioURL eventOut SFVec3f boxSize eventOut SFInt32 whichChoice eventOut MFString audioAction field SFInt32 statusAudioAction 0 field SFNode touch USE play url "javascript: function durationChanged(duration) { //play(time); var minute=leadZero(Math.floor(duration/60)); var second=leadZero(Math.floor(duration%60)); durationText.string=new MFString('('+minute+':'+second+') '); currentSecond=0; displayCurrentAudioTime(); } function audioTimeChanged(fraction) { var time=Math.floor(fraction*audio.duration_changed); if(time==currentSecond) return; currentSecond=time; displayCurrentAudioTime(); } function displayCurrentAudioTime() { var minute=leadZero(Math.floor(currentSecond/60)); var second=leadZero(Math.floor(currentSecond%60)); timeText.string=new MFString(minute+':'+second+' '); } function leadZero(number) { if(number<10) return '0'+number; return number; } function audioItem (value,time) { // print('audioItem(audioItem) '+ value.ID); if(value.ID != null) { timeText.string=new MFString('Loading'); durationText.string=new MFString('Please wait'); whichChoice = 0; audioURL = value.url; //print('audioURL(audioItem):'+ audio.url ); } else { whichChoice = -1; if(audio!=null) { audio.stopTime=time; } } } function play(time) { if(!audio.isActive && !paused) { audioAction = 'playing'; audio.stopTime=time+audio.duration_changed; audio.startTime=time; } else if (!audio.isActive && paused) { audioAction = 'playing'; unsetPaused(); var audioTimeLeft=audio.duration_changed-pauseAudioTime; audio.stopTime=time+audioTimeLeft; audio.startTime=time-pauseAudioTime; } } function pause(time) { audioAction = 'paused'; if(!audio.isActive && paused) play(time); if(!audio.isActive && !paused) return; //paused=true; setPaused(); pauseAudioTime=time-audio.startTime; audio.stopTime=time; } function stop(time) { if(audio.isActive) { audio.stopTime=time; } else if (paused) { unsetPaused(); //paused=false; } if(statusAudioAction == 0){ audioAction = 'stopped'; } else if(statusAudioAction == 1) { audioAction = 'playing'; statusAudioAction = 0; } } function rewind(time) { if(audio.isActive) { newStartTime=audio.startTime+5; if(newStartTime>time) newStartTime=time; seek=true; statusAudioAction = 1; stop(time); } } function forward(time) { if(audio.isActive) { newStartTime=audio.startTime-5; seek=true; statusAudioAction = 1; stop(time); } } function audioActive(active,time) { if(!active && seek) { Browser.addRoute(seekPauseTimer, 'isActive', audioScript, 'timerActive'); seekPauseTimer.startTime=time; seek=false; } } function timerActive(active) { if(active) return; Browser.deleteRoute(seekPauseTimer, 'isActive', audioScript, 'timerActive'); audio.stopTime=newStartTime+audio.duration_changed; audio.startTime=newStartTime; } function setPaused() { pauseAnimationTimer.enabled=true; paused=true; } function unsetPaused() { pauseAnimationTimer.enabled=false; displayCurrentAudioTime(); paused=false; } function pauseAnimation() { if(timeText.string[0]!='PAUSE ') timeText.string[0]='PAUSE '; else displayCurrentAudioTime(); } " } ROUTE rewind.touchTime TO audioScript.rewind ROUTE forward.touchTime TO audioScript.forward ROUTE play.touchTime TO audioScript.play ROUTE pause.touchTime TO audioScript.pause ROUTE stop.touchTime TO audioScript.stop ROUTE audio.isActive TO audioScript.audioActive ROUTE audio.duration_changed TO audioScript.durationChanged ROUTE audio.duration_changed TO audioTimer.cycleInterval ROUTE audio.startTime TO audioTimer.startTime ROUTE audio.stopTime TO audioTimer.stopTime ROUTE audio.isActive TO audioTimer.enabled ROUTE audioTimer.fraction_changed TO audioScript.audioTimeChanged ROUTE audioScript.whichChoice TO boxSwitch.whichChoice ROUTE audioScript.audioURL TO audio.url ROUTE audioScript.boxSize TO boxTransfrom.scale ROUTE pauseAnimationTimer.cycleTime TO audioScript.pauseAnimation ROUTE audioScript.audioAction TO audioActionDisplay.string # ROUTE GT.startaudio TO audioScript.playAudio # ROUTE GT.audioURL TO audioScript.urlAudio # ROUTE audioScript.test TO audioScript.play } PROTO presentationBox [ eventIn SFNode indexObject eventIn SFString text field SFInt32 parentPlaneID -1 eventOut SFString linkClicked eventOut SFNode currentIndexObject eventIn SFTime playAudio ]{ DEF presentationScript Script { eventIn SFNode indexObject IS indexObject eventOut SFNode nodeToTextEnvironment eventOut SFNode nodeToPictureEnvironment eventOut SFNode nodeToVideoEnvironment eventOut SFNode nodeToAudioEnvironment eventOut SFNode currentIndexObject IS currentIndexObject url "javascript: // Sends index object to corresponding display environment, // other environments are given a null reference to indicate nothing has to be shown function indexObject (value) { currentIndexObject=value; //used for swapping info items between panes, see mouseScript in Main.wrl if (value.getType() == 'Picture') { nodeToPictureEnvironment = value; nodeToVideoEnvironment = null; nodeToTextEnvironment = null; nodeToAudioEnvironment = null; } else if (value.getType() == 'Video') { nodeToVideoEnvironment = value; nodeToTextEnvironment = null; nodeToPictureEnvironment = null; nodeToAudioEnvironment = null; } else if (value.getType() == 'Audio') { nodeToVideoEnvironment = null; nodeToTextEnvironment = null; nodeToPictureEnvironment = null; nodeToAudioEnvironment = value; } else if (value.getType() == 'TextItem' || value.getType() == 'Text') { nodeToTextEnvironment = value; nodeToVideoEnvironment = null; nodeToPictureEnvironment = null; nodeToAudioEnvironment = null; } else { nodeToTextEnvironment = null; nodeToVideoEnvironment = null; nodeToPictureEnvironment = null; nodeToAudioEnvironment = null; //print('No presentation environment for this type: ' + value.getType()); } } " } DEF pictureEnvironment picturePresentationEnvironment {} DEF videoEnvironment videoPresentationEnvironment {} DEF audioEnvironment audioPresentationEnvironment {play IS playAudio} DEF textEnvironment textPresentationEnvironment {text IS text linkClicked IS linkClicked } ROUTE presentationScript.nodeToPictureEnvironment TO pictureEnvironment.pictureItem ROUTE presentationScript.nodeToVideoEnvironment TO videoEnvironment.videoItem ROUTE presentationScript.nodeToTextEnvironment TO textEnvironment.textItem ROUTE presentationScript.nodeToAudioEnvironment TO audioEnvironment.audioItem } PROTO MiddlePlane [ field MFNode childLeft [] field MFNode childRight [] eventIn SFNode indexObject eventIn SFTime playAudio eventIn SFString text exposedField SFRotation setRotationChildLeft 0 1 0 1.257 exposedField SFRotation setRotationChildRight 0 1 0 -1.257 eventOut SFNode presBoxOut eventOut SFString linkClicked ] { Shape { geometry Box { size 2 2 0 } appearance Appearance { material Material { diffuseColor .38 .38 .42 specularColor .53 .53 .53 ambientIntensity .0933 shininess .93 } } } DEF presBox presentationBox { parentPlaneID 1 indexObject IS indexObject text IS text linkClicked IS linkClicked playAudio IS playAudio } Transform { translation -2 0 0 children [ Transform { center 1 0 0 rotation IS setRotationChildLeft children IS childLeft } ] } Transform { translation 2 0 0 children [ Transform { center -1 0 0 rotation IS setRotationChildRight children IS childRight } ] } Script { eventIn SFNode indexObject IS indexObject field SFNode presBoxIn USE presBox eventOut SFNode presBoxOut IS presBoxOut url "javascript: function indexObject() { presBoxOut = presBoxIn; } " } } PROTO LeftPlane [ field MFNode childLeft [] eventIn SFNode indexObject eventIn SFString text exposedField SFRotation setRotationChildLeft 0 1 0 0.6 eventOut SFNode presBoxOut eventOut SFString linkClicked ] { Shape { geometry Box { size 2 2 0 } appearance Appearance { material Material { diffuseColor .38 .38 .42 specularColor .53 .53 .53 ambientIntensity .0933 shininess .93 } } } DEF presBox presentationBox { parentPlaneID 0 indexObject IS indexObject text IS text linkClicked IS linkClicked} Transform { translation -2 0 0 children [ Transform { center 1 0 0 rotation IS setRotationChildLeft children IS childLeft } ] } Script { eventIn SFNode indexObject IS indexObject field SFNode presBoxIn USE presBox eventOut SFNode presBoxOut IS presBoxOut url "javascript: function indexObject() { presBoxOut = presBoxIn; } " } } PROTO RightPlane [ field MFNode childRight [] eventIn SFNode indexObject eventIn SFString text exposedField SFRotation setRotationChildRight 0 1 0 -0.6 eventOut SFNode presBoxOut eventOut SFString linkClicked ] { Shape { geometry Box { size 2 2 0 } appearance Appearance { material Material { diffuseColor .38 .38 .42 specularColor .53 .53 .53 ambientIntensity .0933 shininess .93 } } } DEF presBox presentationBox { parentPlaneID 2 indexObject IS indexObject text IS text linkClicked IS linkClicked } Transform { translation 2 0 0 children [ Transform { center -1 0 0 rotation IS setRotationChildRight children IS childRight } ] } Script { eventIn SFNode indexObject IS indexObject field SFNode presBoxIn USE presBox eventOut SFNode presBoxOut IS presBoxOut url "javascript: function indexObject() { presBoxOut = presBoxIn; } " } } PROTO PresentationEnvironment [ eventIn SFBool show eventIn SFString text eventIn SFNode contentLeft eventIn SFNode contentMiddle eventIn SFNode contentRight eventIn SFString titleText eventOut SFBool closeButtons eventOut SFBool ready eventOut SFString exit eventIn SFNode onlyContent eventIn SFString returnNodeID # eventOut SFInt32 setVideoTypeBackToRM eventIn MFNode nodes eventOut SFString exitNodeID eventOut SFBool closeEnv eventIn SFBool clickedMiddle # eventIn SFBool clickedMinimize # eventIn SFTime playAudioMiddle # calls play function in audio environment (pres. env contains middlepane, middlepane contains presentationbox, presentationbox contains audio environment) ]{ # presentation enviroment consists of 1 middle pane, # the middle pane has a pane on its left. This left pane has another pane to its left. # the middle pane has a pane on its right. This right pane has another pane to its right. # information is presented on the middle pane and on the panes on its sides (left & right) # the ordering in middle, right left panes makes an unfolding animtation possible # by changing the angle between the middle pane and both its left pane and right pane # and between the left pane and its child left pane and the right pane and the child right pane. DEF environment Transform { children [ DEF magSwitch Switch { whichChoice 0 choice [ Group { children [ DEF middlePlane MiddlePlane { indexObject IS contentMiddle playAudio IS playAudioMiddle childLeft [ DEF leftPlane1 LeftPlane { indexObject IS contentLeft childLeft [ DEF leftPlane2 LeftPlane { } ] } ] childRight [ DEF rightPlane1 RightPlane { indexObject IS contentRight childRight [ DEF rightPlane2 RightPlane { } ] } ] } DEF titlesPanes Transform { # titles categories children [ Transform { translation 0 1.1 0 children [ Shape { geometry DEF TitleMiddle Text { # video list title string "Video Clips" fontStyle FontStyle { justify "MIDDLE" family "arial" size 0.1 } } appearance Appearance { material Material { diffuseColor 1 1 1 } } } ] } Transform { rotation 0 1 0 0.650 translation -1.8 1.1 0.6 children [ Shape { geometry DEF TitleLeft Text { # picture list title string "Pictures" fontStyle FontStyle { justify "MIDDLE" family "arial" size 0.1 } } appearance Appearance { material Material { diffuseColor 1 1 1 } } } ] } Transform { rotation 0 1 0 -0.650 translation 1.8 1.1 0.6 children [ Shape { geometry DEF TitleRight Text { # text list title string "Texts" fontStyle FontStyle { justify "MIDDLE" family "arial" size 0.1 } } appearance Appearance { material Material { diffuseColor 1 1 1 } } } ] } ] } DEF mainTitle Transform { translation 0 1.5 0 children [ Shape { geometry DEF nodeTitleText Text { # text main title string "Main Title" fontStyle FontStyle { justify "MIDDLE" family "arial" size 0.2 } } appearance Appearance { material Material { diffuseColor 1 1 1 } } } ] } # magnify buttons DEF middleMag Switch { whichChoice 0 choice [ Transform { # zoom optie middle pane scale 0.1 0.1 0.1 translation 0.9 1.2 -0.1 children [ magnifyGlasPlus {} DEF touchMMiddle TouchSensor{} ] } Transform { scale 0.05 0.05 0.05 translation 0.9 1.07 0 children [ magnifyGlasMin {} USE touchMMiddle ] } ] } DEF leftMag Switch { whichChoice 0 choice [ Transform { # zoom optie left pane scale 0.1 0.1 0.1 rotation 0 1 0 0.650 translation -1.2 1.2 0 children [ magnifyGlasPlus {} DEF touchMLeft TouchSensor{} ] } Transform { scale 0.05 0.05 0.05 translation -1.1 1.1 0 rotation 0 1 0 0.650 children [ magnifyGlasMin {} USE touchMLeft ] } ] } DEF rightMag Switch { whichChoice 0 choice [ Transform { # zoom optie right pane scale 0.1 0.1 0.1 rotation 0 1 0 0.150 translation 2.4 1.12 1.4 children [ magnifyGlasPlus {} DEF touchMRight TouchSensor{} ] } Transform { scale 0.05 0.05 0.05 translation 2.7 1.12 1.1 rotation 10 1 0 0.250 children [ magnifyGlasMin {} USE touchMLeft ] } ] } ] } Group { #magnify content children [ DEF magContentGroup Transform { #magnified # scale 2.4 2.4 1 scale 2.0 2.0 1 translation 0 -0.18 0 children [] #children [ # DEF magContent presentationBox {text IS text } #] } Transform { # minimize scale 0.1 0.1 0.1 # translation 2.7 1.85 0 translation 2.2 1.65 0 children [ magnifyGlasMin {} DEF touchMinimize TouchSensor{} ] } ] } Group { #show only 1 item children [ DEF magContentGroup_OneContent Transform { #magnified scale 2.0 2.0 1 translation 0 -0.18 0 children [ DEF magContent presentationBox {text IS text } ] } Transform { # exit scale 0.3 0.3 0.3 translation 2.4 1.85 0 children [ exit {} DEF touchExit TouchSensor{} ] } ] } ] } ] } DEF magnifyScript Script { eventIn SFBool clickedLeft eventIn SFBool clickedMiddle IS clickedMiddle # eventIn SFBool clickedRight eventIn SFBool clickedMinimize IS clickedMinimize # eventIn SFBool clickedExit eventIn SFNode contentLeft IS contentLeft eventIn SFNode contentMiddle IS contentMiddle eventIn SFNode contentRight IS contentRight eventIn SFNode onlyContent IS onlyContent eventIn SFString returnNodeID IS returnNodeID eventOut SFNode content eventOut SFBool closeButtons IS closeButtons eventOut SFInt32 showExit eventOut SFString exit IS exit field SFNode leftPlane1 USE leftPlane1 field SFNode rightPlane1 USE rightPlane1 field SFNode middlePlane USE middlePlane field SFNode magContentGroup USE magContentGroup # field SFNode magContentGroup_OneContent USE magContentGroup_OneContent #eventOut SFNode showPresBox url "javascript: function contentMiddle(value) { if(value.getType()!=null) { showExit =0; //normal window } } function onlyContent(value) { if(value!=null) { // magContentGroup_OneContent.children = new MFNode(middlePlane.presBoxOut); content = onlyContent; //closeButtons = true; showExit = 2; } } function clickedMinimize(value) { if(value) { closeButtons=false; showExit = 0; } } function clickedExit(value) { if(value) { //closeButtons=false; exit = returnNodeID; //returnToNormal(); content =null; //showExit = 0; //exit = true; } } function clickedLeft(value) { if(value) { if(showExit==0) { magContentGroup.children = new MFNode(leftPlane1.presBoxOut); closeButtons = true; showExit = 1; } else { returnToNormal(); } } } function clickedMiddle(value) { if(value) { if(showExit==0) { magContentGroup.children = new MFNode(middlePlane.presBoxOut); closeButtons = true; showExit = 1; } else { returnToNormal(); } } } function clickedRight(value) { if(value) { if(showExit==0) { magContentGroup.children = new MFNode(rightPlane1.presBoxOut); closeButtons = true; showExit = 1; } else { returnToNormal(); } } } function returnToNormal() { closeButtons=false; showExit = 0; exit = returnNodeID; content=null; }" } DEF text Script { eventIn SFNode contentLeft IS contentLeft eventIn SFNode contentMiddle IS contentMiddle eventIn SFNode contentRight IS contentRight eventIn SFNode onlyContent IS onlyContent eventOut SFString textLeft eventOut SFString textMiddle eventOut SFString textRight eventIn SFString text IS text field MFInt32 textToBeDone [] url "javascript: // a text event happens when a text has been loaded in the load frame and the text is send back to the application function text(value) { if(textToBeDone.length==0) { print ('Error: text load queue empty, place to display text unknown.') ; return; } var textPos = dequeue();// takes item location from the FIFO queue, this is the location that belongs to the text that has been loaded if(textPos==0)textLeft=text;// sends text to the correct location else if(textPos==1)textMiddle =text; else if(textPos==2)textRight =text; if (textToBeDone.length > 0) { // if queue not empty if (textToBeDone[0] == 0) loadURL(contentLeft.url); // load next text else if (textToBeDone[0] == 1) loadURL(contentMiddle.url); else if (textToBeDone[0] == 2) loadURL(contentRight.url); } } // takes item from the queue and makes the queue shorter function dequeue() { var result = textToBeDone[0]; for (var i = 1; i < textToBeDone.length; i ++) { textToBeDone[i - 1] = textToBeDone[i]; } textToBeDone.length = textToBeDone.length - 1; return result; } // loads a new text // if queue is empty: load text directly // adds location to queue to remember where to put text when finished loading function loadText(location,url) { if (textToBeDone.length == 0) loadURL(url); textToBeDone[textToBeDone.length] = location; } // calles loadNewURL function that loads the text in the load frame function loadURL(url) { Browser.loadURL('javascript:loadNewURL(\"'+url+'\");'); } // calls loadText with corresponding location and url upon event in function contentLeft(value) { if(value.getType()=='TextItem') { loadText(0,value.url); // textToBeDone[textToBeDone.length] =0; } } function contentMiddle(value) { if(value.getType()=='TextItem') { loadText(1,value.url); // textToBeDone[textToBeDone.length]=1; } } function onlyContent(value) { if(value.getType()=='TextItem') { loadText(1,value.url); // textToBeDone[textToBeDone.length]=1; } } function contentRight(value) { if(value.getType()=='TextItem') { loadText(2,value.url); // textToBeDone[textToBeDone.length]=2; } } " } DEF setTitleScript Script { eventIn SFNode contentLeft IS contentLeft eventIn SFNode contentMiddle IS contentMiddle eventIn SFNode contentRight IS contentRight eventIn SFNode onlyContent IS onlyContent eventIn SFString titleText IS titleText eventIn SFBool show IS show eventOut MFString titleLeft eventOut MFString titleMiddle eventOut MFString titleRight eventOut MFString nodeTitle url "javascript: function contentLeft(value) { //print('settitle: ' + value); if(value.getType()=='Text') titleLeft = 'Used Materials'; else titleLeft = value.shortName; } function contentMiddle(value) { if(value.getType()=='Text') titleMiddle = 'Used Materials'; else titleMiddle = value.shortName; } function onlyContent(value) { if(value.getType()=='Text') titleMiddle = 'Used Materials'; else titleMiddle = value.shortName; } function contentRight(value) { if(value.getType()=='Text') titleRight = 'Used Materials'; else titleRight = value.shortName; } function show(value) { if(titleLeft==null)titleLeft = ''; if(titleMiddle==null)titleMiddle = ''; if(titleRight==null)titleRight = ''; } function titleText(value) { nodeTitle = value; } " } DEF unfoldScript Script { eventIn SFBool show IS show eventIn SFTime timer # eventIn SFNode onlyContent IS onlyContent eventOut SFNode content eventOut SFRotation rotationLeft eventOut SFRotation rotationRight eventOut SFVec3f scale eventOut SFVec3f translation eventOut SFBool ready IS ready field SFFloat beginAngle 1.257 field SFFloat endAngle 0.6 field SFVec3f beginScale 0 0 0 field SFVec3f endScale 10 10 10 field SFVec3f beginTranslation 0 0 2 field SFVec3f endTranslation 0 0 10 field SFBool on FALSE field SFFloat totalTime 2 field SFTime beginTime 0 url "javascript: //begin of interpolation: sets intial values function show(value,time) { beginTime = time; beginAngle = rotationLeft.angle; beginScale = scale; beginTranslation = translation; if (value) { endAngle = 0.6; endScale = new SFVec3f(1, 1, 1); endTranslation = new SFVec3f(0, 0.2, 33); } else { endAngle = 1.257; endScale = new SFVec3f(0, 0, 0); endTranslation = new SFVec3f(0, 0, 0); } on = true; } // function onlyContent() // { // endScale = new SFVec3f(1, 1, 1); // endTranslation = new SFVec3f(0, 0.2, 33); // scale = endScale; // translation = endTranslation; // } function initialize () { rotationLeft = new SFRotation(0, 1, 0, beginAngle); rotationRight = new SFRotation(0, 1, 0, -beginAngle); translation = new SFVec3f(beginTranslation); scale = new SFVec3f(beginScale); ready = true; } // interpolates scale, translation, rotation of the left panes and rotation of the right panes of the presentation environment function timer (value) { if (on) { var factor = (value - beginTime) / totalTime; if (factor < 1) { scale = new SFVec3f(factor * (endScale.x - beginScale.x) + beginScale.x,factor * (endScale.y - beginScale.y) + beginScale.y, factor * (endScale.z - beginScale.z) + beginScale.z); rotationLeft = new SFRotation(0, 1, 0, factor * factor * (endAngle - beginAngle) + beginAngle); rotationRight = new SFRotation(0, 1, 0, -factor * factor * (endAngle - beginAngle) - beginAngle); translation = new SFVec3f(factor * (endTranslation.x - beginTranslation.x) + beginTranslation.x,factor * (endTranslation.y - beginTranslation.y) + beginTranslation.y,factor * (endTranslation.z - beginTranslation.z) + beginTranslation.z); } else { scale = endScale; translation = endTranslation; rotationLeft = new SFRotation(0, 1, 0, endAngle); rotationRight = new SFRotation(0, 1, 0, -endAngle); if(endScale.y <1) { content = null;//stop videos if zoomed in } on = false; } } } " } DEF linkClickedScript Script { eventIn SFString linkClickedMagContent eventIn SFString linkClickedLeftPlane eventIn SFString linkClickedMiddlePlane eventIn SFString linkClickedRightPlane eventIn MFNode nodes IS nodes eventOut SFNode contentLeftPlane eventOut SFNode contentMiddlePlane eventOut SFNode contentRightPlane eventOut SFNode contentMagContent eventOut SFString exitNodeID IS exitNodeID eventOut SFBool closeEnv IS closeEnv url "javascript: // event:link has been clicked in the pane: // finds node the link points to // if it is an end node: set the content of the current pane to the linked node // otherwise: move concept graph to the linked node and close presentation environment function linkClickedLeftPlane (value) { node = getNode(value); if (isEndNode(node)) contentLeftPlane = node; else { exitNodeID = value; closeEnv = true; } } function linkClickedRightPlane (value) { node = getNode(value); if (isEndNode(node)) contentRightPlane = node; else { exitNodeID = value; closeEnv = true; } } function linkClickedMiddlePlane (value) { node = getNode(value); if (isEndNode(node)) contentMiddlePlane = node; else { exitNodeID = value; closeEnv = true; } } function linkClickedMagContent(value) { node = getNode(value); if (isEndNode(node)) contentMagContent = node; else { exitNodeID = value; closeEnv = true; } } // returns node with ID function getNode(ID) { for (i = 0; i < nodes.length; i ++) { if (nodes[i].ID == ID) return nodes[i].infoObject; } print('node not found: ' + ID); return null; } function isEndNode(node) { if (node.getType() == 'Video' ||node.getType() == 'TextItem' ||node.getType() == 'Picture' ||node.getType() =='Audio') return true; else return false; } " } DEF timer TimeSensor { enabled TRUE loop TRUE } ROUTE timer.time TO unfoldScript.timer ROUTE unfoldScript.rotationLeft TO middlePlane.setRotationChildLeft ROUTE unfoldScript.rotationLeft TO leftPlane1.setRotationChildLeft ROUTE unfoldScript.rotationRight TO middlePlane.setRotationChildRight ROUTE unfoldScript.rotationRight TO rightPlane1.setRotationChildRight ROUTE unfoldScript.scale TO environment.scale ROUTE unfoldScript.translation TO environment.translation ROUTE text.textLeft TO leftPlane1.text ROUTE text.textMiddle TO middlePlane.text ROUTE text.textRight TO rightPlane1.text ROUTE setTitleScript.nodeTitle TO nodeTitleText.string ROUTE setTitleScript.titleLeft TO TitleLeft.string ROUTE setTitleScript.titleMiddle TO TitleMiddle.string ROUTE setTitleScript.titleRight TO TitleRight.string ROUTE touchMLeft.isActive TO magnifyScript.clickedLeft ROUTE magnifyScript.showExit TO leftMag.whichChoice ROUTE touchMMiddle.isActive TO magnifyScript.clickedMiddle ROUTE magnifyScript.showExit TO middleMag.whichChoice ROUTE touchMRight.isActive TO magnifyScript.clickedRight ROUTE magnifyScript.showExit TO rightMag.whichChoice ROUTE magnifyScript.content TO magContent.indexObject # ROUTE unfoldScript.content TO magContent.indexObject ROUTE magnifyScript.showExit TO magSwitch.whichChoice ROUTE touchMinimize.isActive TO magnifyScript.clickedMinimize ROUTE touchExit.isActive TO magnifyScript.clickedExit # ROUTE infoDistributionScript.indexObjectLeft TO leftPlane1.indexObject # ROUTE infoDistributionScript.indexObjectMiddle TO middlePlane.indexObject # ROUTE infoDistributionScript.indexObjectRight TO rightPlane1.indexObject ROUTE leftPlane1.linkClicked TO linkClickedScript.linkClickedLeftPlane ROUTE rightPlane1.linkClicked TO linkClickedScript.linkClickedRightPlane ROUTE middlePlane.linkClicked TO linkClickedScript.linkClickedMiddlePlane ROUTE magContent.linkClicked TO linkClickedScript.linkClickedMagContent ROUTE linkClickedScript.contentLeftPlane TO magnifyScript.contentLeft ROUTE linkClickedScript.contentLeftPlane TO text.contentLeft ROUTE linkClickedScript.contentLeftPlane TO setTitleScript.contentLeft ROUTE linkClickedScript.contentLeftPlane TO leftPlane1.indexObject ROUTE linkClickedScript.contentMiddlePlane TO magnifyScript.contentMiddle ROUTE linkClickedScript.contentMiddlePlane TO text.contentMiddle ROUTE linkClickedScript.contentMiddlePlane TO setTitleScript.contentMiddle ROUTE linkClickedScript.contentMiddlePlane TO middlePlane.indexObject ROUTE linkClickedScript.contentRightPlane TO magnifyScript.contentRight ROUTE linkClickedScript.contentRightPlane TO text.contentRight ROUTE linkClickedScript.contentRightPlane TO setTitleScript.contentRight ROUTE linkClickedScript.contentRightPlane TO rightPlane1.indexObject ROUTE linkClickedScript.contentMagContent TO text.onlyContent ROUTE linkClickedScript.contentMagContent TO setTitleScript.onlyContent ROUTE linkClickedScript.contentMagContent TO magContent.indexObject } # PresentationEnvironment {}