package Savage.CommunicationsAndSensors.SeaWeb;

import org.web3d.x3d.jsail.Core.*;
import org.web3d.x3d.jsail.fields.*;
import org.web3d.x3d.jsail.Grouping.*;
import org.web3d.x3d.jsail.Navigation.*;
import org.web3d.x3d.jsail.Networking.*;
import org.web3d.x3d.jsail.Scripting.*;
import org.web3d.x3d.jsail.Time.*;

// Javadoc metadata annotations follow, see below for X3DJSAIL Java source code.
/**
 * <p> Takes a communication-message input from a traversing vehicle (such as an AUV or submarine), then sets up the route/relay time delays, directions, animation and visualization of SeaWeb buoy communications among each other, all the way to the SeaWeb RACOM RF-relay buoy at the surface. </p>
 <p> Related links: Catalog page <a href="../../../../CommunicationsAndSensors/SeaWeb/BuoyCommunicationsGridExampleIndex.html" target="_blank">BuoyCommunicationsGridExample</a>,  source <a href="../../../../CommunicationsAndSensors/SeaWeb/BuoyCommunicationsGridExample.java">BuoyCommunicationsGridExample.java</a>, <a href="https://www.web3d.org/x3d/content/examples/X3dResources.html" target="_blank">X3D Resources</a>, <a href="https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html" target="_blank">X3D Scene Authoring Hints</a>, and <a href="https://www.web3d.org/x3d/content/X3dTooltips.html" target="_blank">X3D Tooltips</a>. </p>
	<table style="color:black; border:0px solid; border-spacing:10px 0px;">
        <caption>Scene Meta Information</caption>
		<tr style="background-color:silver; border-color:silver;">
			<td style="text-align:center; padding:10px 0px;"><i>meta tags</i></td>
			<td style="text-align:left;   padding:10px 0px;">&nbsp; Document Metadata </td>
		</tr>

		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> title </i> </td>
			<td> <a href="../../../../CommunicationsAndSensors/SeaWeb/BuoyCommunicationsGridExample.x3d">BuoyCommunicationsGridExample.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> description </i> </td>
			<td> Takes a communication-message input from a traversing vehicle (such as an AUV or submarine), then sets up the route/relay time delays, directions, animation and visualization of SeaWeb buoy communications among each other, all the way to the SeaWeb RACOM RF-relay buoy at the surface. </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> creator </i> </td>
			<td> Don Brutzman and MV4205 class </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> created </i> </td>
			<td> 8 June 2004 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> modified </i> </td>
			<td> 2 January 2025 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> subject </i> </td>
			<td> Buoy, SeaWeb </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> BuoyCommunicationsGridExampleRoutingTable.xls </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> identifier </i> </td>
			<td> <a href="https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/SeaWeb/BuoyCommunicationsGridExample.x3d" target="_blank">https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/SeaWeb/BuoyCommunicationsGridExample.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> generator </i> </td>
			<td> X3D-Edit, <a href="https://www.web3d.org/x3d/tools/X3D-Edit" target="_blank">https://www.web3d.org/x3d/tools/X3D-Edit</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> license </i> </td>
			<td> <a href="../../../../CommunicationsAndSensors/SeaWeb/../../license.html">../../license.html</a> </td>
		</tr>
		<tr style="background-color:silver; border-color:silver;">
			<td style="text-align:center;" colspan="2">  &nbsp; </td>
		</tr>
	</table>

	<p>
		This program uses the
		<a href="https://www.web3d.org/specifications/java/X3DJSAIL.html" target="_blank">X3D Java Scene Access Interface Library (X3DJSAIL)</a>.
		It has been produced using the 
		<a href="https://www.web3d.org/x3d/stylesheets/X3dToJava.xslt" target="_blank">X3dToJava.xslt</a>
		stylesheet
	       (<a href="https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/X3dToJava.xslt" target="_blank">version control</a>)
                which is used to create Java source code from an original <code>.x3d</code> model.
	</p>

	* @author Don Brutzman and MV4205 class
 */

public class BuoyCommunicationsGridExample
{
	/** Default constructor to create this object. */
	public BuoyCommunicationsGridExample ()
	{
	  initialize();
	}

	/** Create and initialize the X3D model for this object. */
	public final void initialize()
	{
            try { // catch-all
  x3dModel = new X3D().setProfile(X3D.PROFILE_IMMERSIVE).setVersion(X3D.VERSION_3_3)
  .setHead(new head()
    .addMeta(new meta().setName(meta.NAME_TITLE      ).setContent("BuoyCommunicationsGridExample.x3d"))
    .addMeta(new meta().setName(meta.NAME_DESCRIPTION).setContent("Takes a communication-message input from a traversing vehicle (such as an AUV or submarine), then sets up the route/relay time delays, directions, animation and visualization of SeaWeb buoy communications among each other, all the way to the SeaWeb RACOM RF-relay buoy at the surface."))
    .addMeta(new meta().setName(meta.NAME_CREATOR    ).setContent("Don Brutzman and MV4205 class"))
    .addMeta(new meta().setName(meta.NAME_CREATED    ).setContent("8 June 2004"))
    .addMeta(new meta().setName(meta.NAME_MODIFIED   ).setContent("2 January 2025"))
    .addMeta(new meta().setName(meta.NAME_SUBJECT    ).setContent("Buoy, SeaWeb"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("BuoyCommunicationsGridExampleRoutingTable.xls"))
    .addMeta(new meta().setName(meta.NAME_IDENTIFIER ).setContent("https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/SeaWeb/BuoyCommunicationsGridExample.x3d"))
    .addMeta(new meta().setName(meta.NAME_GENERATOR  ).setContent("X3D-Edit, https://www.web3d.org/x3d/tools/X3D-Edit"))
    .addMeta(new meta().setName(meta.NAME_LICENSE    ).setContent("../../license.html")))
  .setScene(new Scene()
    .addComments(" ========== ")
    .addComments(" ExternProtoDeclare statements precede the scene elements utilizing them ")
    .addComments(" ========== ")
    .addChild(new WorldInfo().setTitle("BuoyCommunicationsGridExample.x3d"))
    .addChild(new ExternProtoDeclare("BuoyCommunicationsGrid").setName("BuoyCommunicationsGrid").setAppinfo("BuoyCommunicationsGrid prototype takes a communication-message input from a traversing vehicle (such as an AUV or submarine) then sets up the route/relay time delays directions animation and visualization of SeaWeb buoy communications among each other all the way to the SeaWeb RACOM RF-relay buoy at the surface.").setUrl(new String[] {"BuoyCommunicationsGridPrototype.x3d#BuoyCommunicationsGrid","../../../Savage/CommunicationsAndSensors/SeaWeb/BuoyCommunicationsGridPrototype.x3d#BuoyCommunicationsGrid","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/SeaWeb/BuoyCommunicationsGridPrototype.x3d#BuoyCommunicationsGrid","BuoyCommunicationsGridPrototype.wrl#BuoyCommunicationsGrid","../../../Savage/CommunicationsAndSensors/SeaWeb/BuoyCommunicationsGridPrototype.wrl#BuoyCommunicationsGrid","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/SeaWeb/BuoyCommunicationsGridPrototype.wrl#BuoyCommunicationsGrid"})
      .addField(new field().setName("buoyArray").setType(field.TYPE_MFNODE).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("array of SeaWebBuoy nodes index starting at 0"))
      .addField(new field().setName("buoyCommunicationsRoutingTable").setType(field.TYPE_MFINT32).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("2D array of routing connectivity for buoys consisting either of index of next buoy in line -1 for same buoy or else 0 for no route connection. legal values range [-1..n-1] for n buoys."))
      .addField(new field().setName("set_senderPosition").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("set position of entity sending the message"))
      .addField(new field().setName("senderPosition").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("position of entity sending the message"))
      .addField(new field().setName("set_receiverPosition").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("set position of entity receiving the message"))
      .addField(new field().setName("receiverPosition").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("position of entity receiving the message"))
      .addField(new field().setName("set_textMessage").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INPUTONLY))
      .addField(new field().setName("textMessage").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY))
      .addField(new field().setName("sendMessage").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("send it! (note: maybe should rename as activate)")))
    .addComments(" ========== ")
    .addChild(new ExternProtoDeclare("CameraCompass36").setName("CameraCompass36").setAppinfo("Circular set of compass bearings that follow the active viewpoint set at 360/36 = 10 degree intervals. North = +X axis East = +Z axis up = +Y axis.").setUrl(new String[] {"../../../Savage/Tools/HeadsUpDisplays/CameraCompassPrototypes.x3d#CameraCompass36","https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/CameraCompassPrototypes.x3d#CameraCompass36","../../../Savage/Tools/HeadsUpDisplays/CameraCompassPrototypes.wrl#CameraCompass36","https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/CameraCompassPrototypes.wrl#CameraCompass36"})
      .addField(new field().setName("enabled").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTOUTPUT))
      .addField(new field().setName("positionOffsetFromCamera").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTOUTPUT))
      .addField(new field().setName("markerColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT))
      .addField(new field().setName("labelColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT)))
    .addChild(new ExternProtoDeclare("DvdController").setName("DvdController").setAppinfo("Digital Virtual Display (DVD) Controller Prototype definition to control a scenario's animation timing").setUrl(new String[] {"../../../Savage/Tools/HeadsUpDisplays/DvdControllerPrototype.x3d#DvdController","https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/DvdControllerPrototype.x3d#DvdController","../../../Savage/Tools/HeadsUpDisplays/DvdControllerPrototype.wrl#DvdController","https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/DvdControllerPrototype.wrl#DvdController"})
      .addField(new field().setName("description").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Short description of what is animated by this DvdController."))
      .addField(new field().setName("playEnabled").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Whether or not play mode is enabled including during startup."))
      .addField(new field().setName("displayMode").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Initializes how control buttons and slider are displayed. The control buttons include DIS control (i.e. Master Ghost Local) and Playback control (i.e. Reset to Start Fast Rewind Rewind Pause Play Fast Forward Reset to End). Possible values are (case sensitive): ALL DIS_ONLY PLAYBACK_ONLY SLIDER_ONLY DIS_PLAYBACK DIS_SLIDER PLAYBACK_SLIDER and NONE."))
      .addField(new field().setName("setDisplayMode").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Sets how control buttons and slider are displayed. The control buttons include DIS control (i.e. Master Ghost Local) and Playback control (i.e. Reset to Start Fast Rewind Rewind Pause Play Fast Forward Reset to End). Possible values are (case sensitive): ALL DIS_ONLY PLAYBACK_ONLY SLIDER_ONLY DIS_PLAYBACK DIS_SLIDER PLAYBACK_SLIDER and NONE."))
      .addField(new field().setName("buttonColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Default button color."))
      .addField(new field().setName("selectedButtonColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Button color when selected by user."))
      .addField(new field().setName("labelColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Default label color."))
      .addField(new field().setName("selectedLabelColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Label color when selected by user."))
      .addField(new field().setName("locationOffset").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Modified screen location and distance (for size)."))
      .addField(new field().setName("clockEnabled").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY))
      .addField(new field().setName("cycleInterval").setType(field.TYPE_SFTIME).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Time for complete loop cycle in seconds."))
      .addField(new field().setName("set_cycleInterval").setType(field.TYPE_SFTIME).setAccessType(field.ACCESSTYPE_INPUTONLY))
      .addField(new field().setName("cycleInterval_changed").setType(field.TYPE_SFTIME).setAccessType(field.ACCESSTYPE_OUTPUTONLY))
      .addField(new field().setName("speedFactor").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Factor used to determine the speed increase/decrease for Fast Rewind and Fast Forward action."))
      .addField(new field().setName("isActive").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_OUTPUTONLY))
      .addField(new field().setName("startTime_changed").setType(field.TYPE_SFTIME).setAccessType(field.ACCESSTYPE_OUTPUTONLY))
      .addField(new field().setName("stopTime_changed").setType(field.TYPE_SFTIME).setAccessType(field.ACCESSTYPE_OUTPUTONLY))
      .addField(new field().setName("time_changed").setType(field.TYPE_SFTIME).setAccessType(field.ACCESSTYPE_OUTPUTONLY))
      .addField(new field().setName("fraction_changed").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_OUTPUTONLY))
      .addField(new field().setName("secondsElapsed").setType(field.TYPE_SFTIME).setAccessType(field.ACCESSTYPE_OUTPUTONLY))
      .addField(new field().setName("isMaster").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("isMaster isRemote and isLocal are booleans represent a 3-way toggle. Only one of them can have a true value at any time."))
      .addField(new field().setName("isRemote").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("isMaster isRemote and isLocal are booleans represent a 3-way toggle. Only one of them can have a true value at any time."))
      .addField(new field().setName("isLocal").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("isMaster isRemote and isLocal are booleans represent a 3-way toggle. Only one of them can have a true value at any time."))
      .addField(new field().setName("isPaused").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("isPaused and isRunning always have opposite values. When isPaused is true isRunning will be false and vice versa."))
      .addField(new field().setName("isRunning").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("isPaused and isRunning always have opposite values. When isPaused is true isRunning will be false and vice versa."))
      .addField(new field().setName("traceEnabled").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Enable/disable console output for troubleshooting."))
      .addField(new field().setName("testTimeVal").setType(field.TYPE_SFTIME).setAccessType(field.ACCESSTYPE_INITIALIZEONLY)))
    .addChild(new ExternProtoDeclare("GridXZ").setName("GridXZ").setAppinfo("Line grid authoring tool to enable precise measurement of objects in 3D space - fixed position. Oriented along XZ plane size 20m by 20m.").setUrl(new String[] {"../../../Savage/Tools/Authoring/GridXZPrototype.x3d#GridXZ","https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/GridXZPrototype.x3d#GridXZ","../../../Savage/Tools/Authoring/GridXZPrototype.wrl#GridXZ","https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/GridXZPrototype.wrl#GridXZ"})
      .addField(new field().setName("description").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Purpose of this grid displayed for overall Viewpoint"))
      .addField(new field().setName("labelColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("color for descriptive labels at grid edges and corners"))
      .addField(new field().setName("scale").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("default unscaled size: 10m by 10m"))
      .addField(new field().setName("originLabel").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INPUTOUTPUT))
      .addField(new field().setName("WestLabel").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("-X axis"))
      .addField(new field().setName("NorthWestLabel").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INPUTOUTPUT))
      .addField(new field().setName("NorthLabel").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("-Z axis"))
      .addField(new field().setName("NorthEastLabel").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INPUTOUTPUT))
      .addField(new field().setName("EastLabel").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("+X axis"))
      .addField(new field().setName("SouthEastLabel").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INPUTOUTPUT))
      .addField(new field().setName("SouthLabel").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("+Z axis"))
      .addField(new field().setName("SouthWestLabel").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INPUTOUTPUT))
      .addField(new field().setName("labelsOffset").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("label location offset (in meters) to improve readability")))
    .addChild(new ExternProtoDeclare("SeaWebBuoy").setName("SeaWebBuoy").setAppinfo("SeaWeb acoustic-radio gateway communications buoy").setUrl(new String[] {"../../../Savage/CommunicationsAndSensors/SeaWeb/SeaWebBuoyPrototype.x3d#SeaWebBuoy","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/SeaWeb/SeaWebBuoyPrototype.x3d#SeaWebBuoy","../../../Savage/CommunicationsAndSensors/SeaWeb/SeaWebBuoyPrototype.wrl#SeaWebBuoy","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/SeaWeb/SeaWebBuoyPrototype.wrl#SeaWebBuoy"})
      .addField(new field().setName("set_position").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Position of buoy."))
      .addField(new field().setName("position").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Position of buoy."))
      .addField(new field().setName("set_targetPosition").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Position of target of transmission."))
      .addField(new field().setName("targetPosition").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Position of target of transmission."))
      .addField(new field().setName("targetIdNumber").setType(field.TYPE_SFINT32).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Id number of target."))
      .addField(new field().setName("set_targetIdNumber").setType(field.TYPE_SFINT32).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Id number of target."))
      .addField(new field().setName("set_enabled").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Enable buoy for transmission."))
      .addField(new field().setName("enabled").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Enable buoy for transmission."))
      .addField(new field().setName("set_activated").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Start transmission."))
      .addField(new field().setName("activated").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Start transmission."))
      .addField(new field().setName("set_transmissionDuration").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Duration in seconds needed to transmit message (does not include transmissionTimeDelay or propagation delay)."))
      .addField(new field().setName("transmissionDuration").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Duration in seconds needed to transmit message (does not include transmissionTimeDelay or propagation delay)."))
      .addField(new field().setName("transmissionTimeDelay").setType(field.TYPE_SFTIME).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Time delay before transmission begins."))
      .addField(new field().setName("set_transmissionTimeDelay").setType(field.TYPE_SFTIME).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Time delay before transmission begins."))
      .addField(new field().setName("set_directionalTransmission").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Select between directional (true) or omni-directional (false) transmission."))
      .addField(new field().setName("directionalTransmission").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Select between directional (true) or omni-directional (false) transmission."))
      .addField(new field().setName("set_buoyType").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Determine which buoy type to use. \"Racom\" for Racom Buoy. \"Telesonar\" for Telesonar Repeater."))
      .addField(new field().setName("buoyType").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Determine which buoy type to use. \"Racom\" for Racom Buoy. \"Telesonar\" for Telesonar Repeater."))
      .addField(new field().setName("set_textMessage").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INPUTONLY))
      .addField(new field().setName("textMessage").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY))
      .addField(new field().setName("textMessageColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT))
      .addField(new field().setName("set_description").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INPUTONLY))
      .addField(new field().setName("description").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY))
      .addField(new field().setName("traceEnabled").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY))
      .addField(new field().setName("set_soundSpeedInWater").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Sound speed in water default value 1500 m/s"))
      .addField(new field().setName("soundSpeedInWater").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Sound speed in water default value 1500 m/s")))
    .addChild(new ExternProtoDeclare("WaypointInterpolator").setName("WaypointInterpolator").setAppinfo("Reads waypoints and legSpeeds/legDurations/defaultSpeed to provide a customizable position/orientation interpolator.").setUrl(new String[] {"../../../Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d#WaypointInterpolator","https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d#WaypointInterpolator","../../../Savage/Tools/Animation/WaypointInterpolatorPrototype.wrl#WaypointInterpolator","https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/WaypointInterpolatorPrototype.wrl#WaypointInterpolator"})
      .addComments(" Priority of use: legSpeeds (m/sec), legDurations (seconds), defaultSpeed (m/sec) ")
      .addField(new field().setName("description").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Short description of what is animated by this WaypointInterpolator."))
      .addField(new field().setName("waypoints").setType(field.TYPE_MFVEC3F).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Waypoints being traversed with interpolation of intermediate positions and orientations."))
      .addField(new field().setName("add_waypoint").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Add another single waypoint to array of waypoints recalculate interpolator values."))
      .addField(new field().setName("set_waypoints").setType(field.TYPE_MFVEC3F).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Replace all waypoints recalculate interpolator values."))
      .addField(new field().setName("pitchUpDownForVerticalWaypoints").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Whether to pitch child geometry (such as a vehicle) up or down to match vertical slope"))
      .addField(new field().setName("legSpeeds").setType(field.TYPE_MFFLOAT).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Units m/sec. If used array lengths for legSpeeds and legDurations must be one less than number of waypoints."))
      .addField(new field().setName("legDurations").setType(field.TYPE_MFTIME).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Units in seconds. If used array lengths for legSpeeds and legDurations must be one less than number of waypoints."))
      .addField(new field().setName("defaultSpeed").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Units m/sec."))
      .addField(new field().setName("turningRate").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("turningRate (degrees/second) also determines standoff distance prior to waypoint where turn commences. If 0 turns are instantaneous."))
      .addField(new field().setName("totalDuration").setType(field.TYPE_SFTIME).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("Output calculation summing all leg durations, useful for setting TimeSensor cycleInterval. Units in seconds."))
      .addComments(" interpolation fields ")
      .addField(new field().setName("set_fraction").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("exposed PositionInterpolator and OrientationInterpolator setting"))
      .addField(new field().setName("position_changed").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("exposed PositionInterpolator setting"))
      .addField(new field().setName("orientation_changed").setType(field.TYPE_SFROTATION).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("exposed OrientationInterpolator setting"))
      .addComments(" display-related fields ")
      .addField(new field().setName("lineColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("default color for non-active line segments"))
      .addField(new field().setName("highlightSegmentColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("active segment highlight color"))
      .addField(new field().setName("transparency").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("1.0 is completely transparent, 0.0 is completely opaque."))
      .addField(new field().setName("labelDisplayMode").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("allowed values: none; waypoints (produce labels at each waypoint); or interpolation (produce single moving label at interpolator time course speed location)"))
      .addField(new field().setName("heightLabel").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("allowed values: altitude depth (negate Y value) none"))
      .addField(new field().setName("labelOffset").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("heightLabel relative location"))
      .addField(new field().setName("labelFontSize").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("heightLabel text size"))
      .addField(new field().setName("labelColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("heightLabel text color"))
      .addField(new field().setName("traceEnabled").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("enable console output to trace script computations and prototype progress"))
      .addField(new field().setName("outputInitializationComputations").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Output the number of waypoints totalDistance and totalDuration to console upon initialization"))
      .addField(new field().setName("verticalDropLineColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("default color for vertical drop-line segments"))
      .addField(new field().setName("verticalDropLineTransparency").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("1.0 is completely transparent, 0.0 is completely opaque.")))
    .addComments(" ========== ")
    .addChild(new NavigationInfo().setAvatarSize(new double[] {2.0,1.6,0.75}).setSpeed(1000))
    .addChild(new Transform().setRotation(0.0,1.0,0.0,-1.578).setTranslation(5000.0,15000.0,5000.0)
      .addChild(new Viewpoint().setDescription("Buoy communications grid (15000m up)").setOrientation(1.0,0.0,0.0,-1.578).setPosition(0.0,0.0,0.0)))
    .addChild(new Inline("ViewPositionOrientationHUD").setUrl(new String[] {"../../../Savage/Tools/HeadsUpDisplays/ViewPositionOrientationHUD.x3d","https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/ViewPositionOrientationHUD.x3d","../../../Savage/Tools/HeadsUpDisplays/ViewPositionOrientationHUD.wrl","https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/ViewPositionOrientationHUD.wrl"}))
    .addChild(new ProtoInstance("GridXZ").setContainerField("children")
      .addFieldValue(new fieldValue().setName("description").setValue("Sonobuoy Field Scenario"))
      .addFieldValue(new fieldValue().setName("labelColor").setValue(new SFColor(0.8,0.8,1.0)))
      .addFieldValue(new fieldValue().setName("scale").setValue(new SFVec3f(1000.0,1000.0,1000.0)))
      .addFieldValue(new fieldValue().setName("originLabel").setValue(new String[] {"origin"}))
      .addFieldValue(new fieldValue().setName("WestLabel").setValue(new String[] {"West","-Z"}))
      .addFieldValue(new fieldValue().setName("NorthWestLabel").setValue(new String[] {"10000 0 -10000"}))
      .addFieldValue(new fieldValue().setName("NorthLabel").setValue(new String[] {"North","+X"}))
      .addFieldValue(new fieldValue().setName("NorthEastLabel").setValue(new String[] {"10000 0 10000"}))
      .addFieldValue(new fieldValue().setName("EastLabel").setValue(new String[] {"East","+Z"}))
      .addFieldValue(new fieldValue().setName("SouthEastLabel").setValue(new String[] {"-10000 0 10000"}))
      .addFieldValue(new fieldValue().setName("SouthLabel").setValue(new String[] {"South","-X"}))
      .addFieldValue(new fieldValue().setName("SouthWestLabel").setValue(new String[] {"-10000 0 -10000"})))
    .addChild(new ProtoInstance("CameraCompass36").setContainerField("children")
      .addFieldValue(new fieldValue().setName("enabled").setValue(true))
      .addFieldValue(new fieldValue().setName("positionOffsetFromCamera").setValue(new SFVec3f(0.0,5.0,0.0)))
      .addFieldValue(new fieldValue().setName("markerColor").setValue(new SFColor(0.9,0.9,0.9)))
      .addFieldValue(new fieldValue().setName("labelColor").setValue(new SFColor(0.9,0.9,0.9))))
    .addChild(new Group("SeaWebBuoyNodes")
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy0").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Racom"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(6000.0,-100.0,0.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy0")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy1").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Telesonar"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(6000.0,-100.0,2000.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy1")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy2").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Telesonar"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(6000.0,-100.0,4000.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy2")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy3").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Telesonar"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(6000.0,-100.0,6000.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy3")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy4").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Telesonar"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(4000.0,-100.0,0.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy4")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy5").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Telesonar"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(4000.0,-100.0,2000.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy5")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy6").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Telesonar"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(4000.0,-100.0,4000.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy6")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy7").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Telesonar"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(4000.0,-100.0,6000.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy7")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy8").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Telesonar"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(2000.0,-100.0,0.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy8")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy9").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Telesonar"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(2000.0,-100.0,2000.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy9")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy10").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Telesonar"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(2000.0,-100.0,4000.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy10")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy11").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Telesonar"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(2000.0,-100.0,6000.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy11")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy12").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Telesonar"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(0.0,-100.0,0.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy12")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy13").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Telesonar"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(0.0,-100.0,2000.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy13")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy14").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Telesonar"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(0.0,-100.0,4000.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy14")))
      .addChild(new ProtoInstance("SeaWebBuoy", "SeaWebBuoy15").setContainerField("children")
        .addFieldValue(new fieldValue().setName("buoyType").setValue("Racom"))
        .addFieldValue(new fieldValue().setName("position").setValue(new SFVec3f(0.0,-100.0,6000.0)))
        .addFieldValue(new fieldValue().setName("description").setValue("SeaWebBuoy15"))))
    .addChild(new Group("BuoyCommunicationsGridGroup")
      .addChild(new ProtoInstance("BuoyCommunicationsGrid", "BuoyCommsGrid").setContainerField("children")
        .addFieldValue(new fieldValue().setName("textMessage").setValue(new String[] {"testing 1 2 3"}))
        .addFieldValue(new fieldValue().setName("buoyArray")
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy0").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy1").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy2").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy3").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy4").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy5").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy6").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy7").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy8").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy9").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy10").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy11").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy12").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy13").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy14").setContainerField("children"))
          .addChild(new ProtoInstance("SeaWebBuoy").setUSE("SeaWebBuoy15").setContainerField("children")))
        .addFieldValue(new fieldValue().setName("buoyCommunicationsRoutingTable").setValue(new int[] {-1,1,1,1,4,5,5,5,4,5,5,5,4,5,5,5,0,-1,2,2,4,5,6,6,4,5,6,6,4,5,6,6,1,1,-1,3,5,5,6,7,5,5,6,7,5,5,6,7,2,2,2,-1,6,6,6,7,6,6,6,7,6,6,6,7,0,1,1,1,-1,5,5,5,8,9,9,9,8,9,9,9,0,1,2,2,4,-1,6,6,8,9,10,10,8,9,10,10,1,1,2,3,5,5,-1,7,9,9,10,11,9,9,10,11,2,2,2,3,6,6,6,-1,10,10,10,11,10,10,10,11,4,5,5,5,4,5,5,5,-1,9,9,9,12,13,13,13,4,5,6,6,4,5,6,6,8,-1,10,10,12,13,14,14,5,5,6,7,5,5,6,7,9,9,-1,11,13,13,14,15,6,6,6,7,6,6,6,7,10,10,10,-1,14,14,14,15,8,9,9,9,8,9,9,9,8,9,9,9,-1,13,13,13,8,9,10,10,8,9,10,10,8,9,10,10,12,-1,14,14,9,9,10,11,9,9,10,11,9,9,10,11,13,13,-1,15,10,10,10,11,10,10,10,11,10,10,10,11,14,14,14,-1}))))
    .addChild(new Group("AnimationControl")
      .addChild(new ProtoInstance("DvdController", "MasterDvdClock").setContainerField("children")
        .addFieldValue(new fieldValue().setName("displayMode").setValue("PLAYBACK_SLIDER"))
        .addFieldValue(new fieldValue().setName("playEnabled").setValue(true))
        .addFieldValue(new fieldValue().setName("buttonColor").setValue(new SFColor(0.655,0.655,0.655)))
        .addFieldValue(new fieldValue().setName("selectedButtonColor").setValue(new SFColor(0.675,0.675,0.675)))
        .addFieldValue(new fieldValue().setName("selectedLabelColor").setValue(new SFColor(0.9,0.0,0.0)))
        .addFieldValue(new fieldValue().setName("locationOffset").setValue(new SFVec3f(-4.0,3.0,-10.0)))
        .addFieldValue(new fieldValue().setName("cycleInterval").setValue(60))
        .addFieldValue(new fieldValue().setName("speedFactor").setValue(10.0))
        .addFieldValue(new fieldValue().setName("traceEnabled").setValue(false))))
    .addChild(new Group("TransitingVehiclesGroup")
      .addChild(new Group("MantaGroup")
        .addChild(new Transform("MantaTransform")
          .addChild(new Viewpoint().setDescription("Manta side view").setOrientation(0.0,1.0,0.0,-1.57).setPosition(-20.0,3.0,0.0))
          .addChild(new Inline("Manta4").setUrl(new String[] {"../../Robots/UnmannedUnderwaterVehicles/Manta4.x3d","https://www.web3d.org/x3d/content/examples/Savage/Robots/UnmannedUnderwaterVehicles/Manta4.x3d","../../Robots/UnmannedUnderwaterVehicles/Manta4.wrl","https://www.web3d.org/x3d/content/examples/Savage/Robots/UnmannedUnderwaterVehicles/Manta4.wrl"})))
        .addChild(new ProtoInstance("WaypointInterpolator", "MantaWaypointInterpolator").setContainerField("children")
          .addFieldValue(new fieldValue().setName("description").setValue("Manta AUV"))
          .addFieldValue(new fieldValue().setName("waypoints").setValue(new MFVec3f(new MFVec3f(new double[] {1100.0,-5.0,6100.0,1100.0,-5.0,8100.0,7500.0,-5.0,8100.0,7500.0,-5.0,1100.0,6100.0,-5.0,1100.0,1100.0,-5.0,6100.0}))))
          .addFieldValue(new fieldValue().setName("pitchUpDownForVerticalWaypoints").setValue(false))
          .addFieldValue(new fieldValue().setName("defaultSpeed").setValue(100))
          .addFieldValue(new fieldValue().setName("lineColor").setValue(new SFColor(0.8,0.8,0.2)))
          .addFieldValue(new fieldValue().setName("highlightSegmentColor").setValue(new SFColor(0.2,0.2,1.0)))
          .addFieldValue(new fieldValue().setName("transparency").setValue(0))
          .addFieldValue(new fieldValue().setName("labelDisplayMode").setValue("interpolation"))
          .addFieldValue(new fieldValue().setName("heightLabel").setValue("altitude"))
          .addFieldValue(new fieldValue().setName("labelOffset").setValue(new SFVec3f(0.0,4.0,0.0)))
          .addFieldValue(new fieldValue().setName("labelFontSize").setValue(0.5))
          .addFieldValue(new fieldValue().setName("labelColor").setValue(new SFColor(0.3,0.9,0.3)))
          .addFieldValue(new fieldValue().setName("traceEnabled").setValue(false)))
        .addChild(new ROUTE().setFromNode("MasterDvdClock").setFromField("fraction_changed").setToNode("MantaWaypointInterpolator").setToField("set_fraction"))
        .addComments(" global fix needed: change toField set_cycleInterval ")
        .addChild(new ROUTE().setFromNode("MantaWaypointInterpolator").setFromField("totalDuration").setToNode("MasterDvdClock").setToField("set_cycleInterval"))
        .addChild(new ROUTE().setFromNode("MantaWaypointInterpolator").setFromField("position_changed").setToNode("MantaTransform").setToField("set_translation"))
        .addChild(new ROUTE().setFromNode("MantaWaypointInterpolator").setFromField("orientation_changed").setToNode("MantaTransform").setToField("set_rotation"))
        .addChild(new ROUTE().setFromNode("MantaWaypointInterpolator").setFromField("position_changed").setToNode("BuoyCommsGrid").setToField("set_receiverPosition")))
      .addChild(new Group("SolarAuvGroup")
        .addChild(new Transform("SolarAuvTransform")
          .addChild(new Inline("SolarAuv").setUrl(new String[] {"../../Robots/UnmannedUnderwaterVehicles/SolarAUV.x3d","https://www.web3d.org/x3d/content/examples/Savage/Robots/UnmannedUnderwaterVehicles/SolarAUV.x3d","../../Robots/UnmannedUnderwaterVehicles/SolarAUV.wrl","https://www.web3d.org/x3d/content/examples/Savage/Robots/UnmannedUnderwaterVehicles/SolarAUV.wrl"}))
          .addComments(" looping clock trigger follows ")
          .addChild(new TimeSensor("SolarAuvMessageSendClock").setCycleInterval(15).setLoop(true))
          .addChild(new Script("SolarAuvMessageScript").setSourceCode("""
ecmascript:

function timeToPrepareMessage (value, timestamp)
{
	messageCounter++;
	newMessage[0] ='SolarAUV' + messageCounter; // set
	sendMessage = true; // send
	Browser.println ('[SolarAuvMessageScript] timeToPrepareMessage() complete:' + newMessage[0]);
}
""")
            .addField(new field().setName("timeToPrepareMessage").setType(field.TYPE_SFTIME).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("trigger when time to create new message"))
            .addField(new field().setName("messageCounter").setType(field.TYPE_SFINT32).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setValue(0))
            .addField(new field().setName("newMessage").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("text of next message to be sent"))
            .addField(new field().setName("sendMessage").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_OUTPUTONLY)))
          .addChild(new ROUTE().setFromNode("SolarAuvMessageSendClock").setFromField("cycleTime").setToNode("SolarAuvMessageScript").setToField("timeToPrepareMessage"))
          .addChild(new ROUTE().setFromNode("SolarAuvMessageScript").setFromField("newMessage").setToNode("BuoyCommsGrid").setToField("set_textMessage"))
          .addChild(new ROUTE().setFromNode("SolarAuvMessageScript").setFromField("sendMessage").setToNode("BuoyCommsGrid").setToField("sendMessage")))
        .addChild(new ProtoInstance("WaypointInterpolator", "SolarAuvWaypointInterpolator").setContainerField("children")
          .addFieldValue(new fieldValue().setName("description").setValue("Solar AUV"))
          .addFieldValue(new fieldValue().setName("waypoints").setValue(new MFVec3f(new MFVec3f(new double[] {-1000.0,-1.0,-1000.0,0.0,-1.0,0.0,2000.0,-1.0,2000.0,3000.0,-1.0,3000.0,4000.0,-1.0,4000.0,5000.0,-1.0,5000.0,6000.0,-1.0,6000.0,7000.0,-1.0,7000.0,7000.0,-1.0,6000.0,6000.0,-1.0,5000.0,5000.0,-1.0,4000.0,4000.0,-1.0,3000.0,3000.0,-1.0,2000.0,2000.0,-1.0,1000.0,1000.0,-1.0,0.0,0.0,-1.0,-1000.0,-1000.0,-1.0,-1000.0}))))
          .addFieldValue(new fieldValue().setName("pitchUpDownForVerticalWaypoints").setValue(false))
          .addFieldValue(new fieldValue().setName("defaultSpeed").setValue(10))
          .addFieldValue(new fieldValue().setName("lineColor").setValue(new SFColor(0.8,0.8,0.2)))
          .addFieldValue(new fieldValue().setName("highlightSegmentColor").setValue(new SFColor(0.2,0.2,1.0)))
          .addFieldValue(new fieldValue().setName("transparency").setValue(0))
          .addFieldValue(new fieldValue().setName("labelDisplayMode").setValue("interpolation"))
          .addFieldValue(new fieldValue().setName("heightLabel").setValue("altitude"))
          .addFieldValue(new fieldValue().setName("labelOffset").setValue(new SFVec3f(0.0,1.0,0.0)))
          .addFieldValue(new fieldValue().setName("labelFontSize").setValue(0.2))
          .addFieldValue(new fieldValue().setName("labelColor").setValue(new SFColor(0.9,0.9,0.3)))
          .addFieldValue(new fieldValue().setName("traceEnabled").setValue(false)))
        .addChild(new ROUTE().setFromNode("MasterDvdClock").setFromField("fraction_changed").setToNode("SolarAuvWaypointInterpolator").setToField("set_fraction"))
        .addChild(new ROUTE().setFromNode("SolarAuvWaypointInterpolator").setFromField("position_changed").setToNode("SolarAuvTransform").setToField("set_translation"))
        .addChild(new ROUTE().setFromNode("SolarAuvWaypointInterpolator").setFromField("orientation_changed").setToNode("SolarAuvTransform").setToField("set_rotation"))
        .addChild(new ROUTE().setFromNode("SolarAuvWaypointInterpolator").setFromField("position_changed").setToNode("BuoyCommsGrid").setToField("set_senderPosition")))));
            }
            catch (Exception ex)
            {       
                System.err.println ("*** Further hints on X3DJSAIL errors and exceptions at");
                System.err.println ("*** https://www.web3d.org/specifications/java/X3DJSAIL.html");
                throw (ex);
            }
	}
	// end of initialize() method

	/** The initialized model object, created within initialize() method. */
	private X3D x3dModel;

	/** 
	 * Provide a 
	 * <a href="https://dzone.com/articles/java-copy-shallow-vs-deep-in-which-you-will-swim" target="_blank">shallow copy</a>
	 * of the X3D model.
	 * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3D.html">X3D</a>
	 * @return BuoyCommunicationsGridExample model
	 */
	public X3D getX3dModel()
	{	  
		return x3dModel;
	}
	   
    /** 
     * Default main() method provided for test purposes, uses CommandLine to set global ConfigurationProperties for this object.
     * @param args array of input parameters, provided as arguments
     * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3D.html#handleArguments-java.lang.String:A-">X3D.handleArguments(args)</a>
     * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3D.html#validationReport--">X3D.validationReport()</a>
     * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/CommandLine.html">CommandLine</a>
     * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/CommandLine.html#USAGE">CommandLine.USAGE</a>
     * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/ConfigurationProperties.html">ConfigurationProperties</a>
     */
    public static void main(String args[])
    {
        System.out.println("Build this X3D model, showing validation diagnostics...");
        X3D thisExampleX3dModel = new BuoyCommunicationsGridExample().getX3dModel();
//      System.out.println("X3D model construction complete.");
	
        // next handle command line arguments
        boolean hasArguments = (args != null) && (args.length > 0);
        boolean validate = true; // default
        boolean argumentsLoadNewModel = false;
        String  fileName = new String();

        if (args != null)
        {
                for (String arg : args)
                {
                        if (arg.toLowerCase().startsWith("-v") || arg.toLowerCase().contains("validate"))
                        {
                                validate = true; // making sure
                        }
                        if (arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_X3D) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_CLASSICVRML) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_X3DB) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_VRML97) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_EXI) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_GZIP) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_ZIP) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_HTML) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_XHTML))
                        {
                                argumentsLoadNewModel = true;
                                fileName = arg;
                        }
                }
        }
        if      (argumentsLoadNewModel)
                System.out.println("WARNING: \"Savage.CommunicationsAndSensors.SeaWeb.BuoyCommunicationsGridExample\" model invocation is attempting to load file \"" + fileName + "\" instead of simply validating itself... file loading ignored.");
        else if (hasArguments) // if no arguments provided, this method produces usage warning
                thisExampleX3dModel.handleArguments(args);
	
        if (validate)
        {
            //  System.out.println("--- TODO fix duplicated outputs ---"); // omit when duplicated outputs problem is solved/refactored
		String validationResults = thisExampleX3dModel.validationReport();
            //  System.out.println("-----------------------------------"); // omit when duplicated outputs problem is solved/refactored
                System.out.print("Savage.CommunicationsAndSensors.SeaWeb.BuoyCommunicationsGridExample self-validation test confirmation: ");
                if (!validationResults.equals("success"))
                    System.out.println();
                System.out.println(validationResults.trim());

                // experimental: test X3DJSAIL output files
                // CommunicationsAndSensors/SeaWeb/BuoyCommunicationsGridExample_JavaExport.* file validation is checked when building X3D Example Archives
                String filenameX3D  = "CommunicationsAndSensors/SeaWeb/BuoyCommunicationsGridExample_JavaExport.x3d"; 
                String filenameX3DV = "CommunicationsAndSensors/SeaWeb/BuoyCommunicationsGridExample_JavaExport.x3dv"; 
                String filenameJSON = "CommunicationsAndSensors/SeaWeb/BuoyCommunicationsGridExample_JavaExport.json";
                thisExampleX3dModel.toFileX3D        (filenameX3D);
                thisExampleX3dModel.toFileClassicVRML(filenameX3DV);
// TODO         thisExampleX3dModel.toFileJSON       (filenameJSON);
        }
    }
}
