package Savage.ShipsMilitary.FrigateYavuzTurkey;

import org.web3d.x3d.jsail.Core.*;
import org.web3d.x3d.jsail.EnvironmentalEffects.*;
import org.web3d.x3d.jsail.fields.*;
import org.web3d.x3d.jsail.Geometry3D.*;
import org.web3d.x3d.jsail.Grouping.*;
import org.web3d.x3d.jsail.Interpolation.*;
import org.web3d.x3d.jsail.PointingDeviceSensor.*;
import org.web3d.x3d.jsail.Scripting.*;
import org.web3d.x3d.jsail.Shape.*;
import org.web3d.x3d.jsail.Sound.*;
import org.web3d.x3d.jsail.Text.*;
import org.web3d.x3d.jsail.Time.*;

// Javadoc metadata annotations follow, see below for X3DJSAIL Java source code.
/**
 * <p> A lightweight prototype of SeaZenith point defence gun. </p>
 <p> Related links: Catalog page <a href="../../../../ShipsMilitary/FrigateYavuzTurkey/SeaZenithIndex.html" target="_blank">SeaZenith</a>,  source <a href="../../../../ShipsMilitary/FrigateYavuzTurkey/SeaZenith.java">SeaZenith.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="../../../../ShipsMilitary/FrigateYavuzTurkey/SeaZenith.x3d">SeaZenith.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> description </i> </td>
			<td> A lightweight prototype of SeaZenith point defence gun </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> creator </i> </td>
			<td> Ozan APAYDIN </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> created </i> </td>
			<td> 20 August 2001 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> modified </i> </td>
			<td> 20 October 2019 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> <a href="http://www.futura-dtp.dk/Artilleri/25mmSeaZenith.htm" target="_blank">http://www.futura-dtp.dk/Artilleri/25mmSeaZenith.htm</a> </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/ShipsMilitary/FrigateYavuzTurkey/SeaZenith.x3d" target="_blank">https://www.web3d.org/x3d/content/examples/Savage/ShipsMilitary/FrigateYavuzTurkey/SeaZenith.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> generator </i> </td>
			<td> X3D-Edit 3.2, <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="../../../../ShipsMilitary/FrigateYavuzTurkey/../../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 Ozan APAYDIN
 */

public class SeaZenith
{
	/** Default constructor to create this object. */
	public SeaZenith ()
	{
	  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_0)
  .setHead(new head()
    .addMeta(new meta().setName(meta.NAME_TITLE      ).setContent("SeaZenith.x3d"))
    .addMeta(new meta().setName(meta.NAME_DESCRIPTION).setContent("A lightweight prototype of SeaZenith point defence gun"))
    .addMeta(new meta().setName(meta.NAME_CREATOR    ).setContent("Ozan APAYDIN"))
    .addMeta(new meta().setName(meta.NAME_CREATED    ).setContent("20 August 2001"))
    .addMeta(new meta().setName(meta.NAME_MODIFIED   ).setContent("20 October 2019"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("http://www.futura-dtp.dk/Artilleri/25mmSeaZenith.htm"))
    .addMeta(new meta().setName(meta.NAME_IDENTIFIER ).setContent("https://www.web3d.org/x3d/content/examples/Savage/ShipsMilitary/FrigateYavuzTurkey/SeaZenith.x3d"))
    .addMeta(new meta().setName(meta.NAME_GENERATOR  ).setContent("X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit"))
    .addMeta(new meta().setName(meta.NAME_LICENSE    ).setContent("../../license.html")))
  .setScene(new Scene()
    .addComments(" Script Node to update the rotation of the gun. ")
    .addChild(new WorldInfo().setTitle("SeaZenith.x3d"))
    .addChild(new Script("RotUpdater").setSourceCode("""
ecmascript:

function initialize() {
   CurRot[0] = 0.0;
   CurRot[1] = 1.0;
   CurRot[2] = 0.0;
   CurRot[3] = 0.0;
}

function set_LRotation(bool,time) {
   isLeft  =  bool;
   isRight = !bool;
   if(isLeft) {
      generate_Rotation();
   }
}

function set_RRotation(bool,time) {
   isRight =  bool;
   isLeft  = !bool;
   if(isRight) {
      generate_Rotation();
   }
}

function get_CurRotation(cR,time) {
   CurRot = cR;
}

function generate_Rotation() {
   newRotation = CurRot;
   if(isLeft) {
      if(CurRot[3] < 1.7) {
          newRotation[3] = CurRot[3] + 0.2;
      }
   }
   
   else if(isRight) {
      if(CurRot[3] > -1.7) {
          newRotation[3] = CurRot[3] - 0.2;
      }
   }  
}
""")
      .addComments(" Variables and methods of the RotUpdater script ")
      .addField(new field().setName("set_LRotation").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY))
      .addField(new field().setName("set_RRotation").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY))
      .addField(new field().setName("get_CurRotation").setType(field.TYPE_SFROTATION).setAccessType(field.ACCESSTYPE_INPUTONLY))
      .addField(new field().setName("isLeft").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setValue(true))
      .addField(new field().setName("isRight").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setValue(false))
      .addField(new field().setName("CurRot").setType(field.TYPE_SFROTATION).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setValue(new SFRotation(0.0,1.0,0.0,0.0)))
      .addField(new field().setName("newRotation").setType(field.TYPE_SFROTATION).setAccessType(field.ACCESSTYPE_OUTPUTONLY)))
    .addComments(" Script node to update elevation of the gun. ")
    .addChild(new Script("ElevDescUpdater").setSourceCode("""
ecmascript:

function initialize() {
   CurOr[0] = 0.0;
   CurOr[1] = 1.0;
   CurOr[2] = 0.0;
   CurOr[3] = 0.0;
}

function set_Elevation(bool,time) {
   isUp   =  bool;
   isDown = !bool;
   if(isUp) {
      generate_Rotation();
   }
}

function set_Descendance(bool,time) {
   isDown =  bool;
   isUp   = !bool;
   if(isDown) {
      generate_Rotation();
   }
}

function get_CurOrientation(cR,time) {
   CurOr = cR;
}

function generate_Rotation() {
   newOrientation = CurOr;
   if(isUp) {
      if(CurOr[3] < 0.45) {
          newOrientation[3] = CurOr[3] + 0.05;
      }
   }
   
   else if(isDown) {
      if(CurOr[3] > 0.05) {
          newOrientation[3] = CurOr[3] - 0.05;
      }
   }  
}
""")
      .addComments(" Variables and methods of the ElevDescUpdater script script ")
      .addField(new field().setName("set_Elevation").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY))
      .addField(new field().setName("set_Descendance").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY))
      .addField(new field().setName("get_CurOrientation").setType(field.TYPE_SFROTATION).setAccessType(field.ACCESSTYPE_INPUTONLY))
      .addField(new field().setName("isUp").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setValue(true))
      .addField(new field().setName("isDown").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setValue(false))
      .addField(new field().setName("CurOr").setType(field.TYPE_SFROTATION).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setValue(new SFRotation(0.0,1.0,0.0,0.0)))
      .addField(new field().setName("newOrientation").setType(field.TYPE_SFROTATION).setAccessType(field.ACCESSTYPE_OUTPUTONLY)))
    .addComments(" Gun Controller - Heads up displays and touch sensors ")
    .addChild(new Background().setSkyColor(new MFColor(new double[] {0.1,0.1,0.6})))
    .addComments(" Fire sound effect. ")
    .addChild(new Sound().setMaxBack(35).setMaxFront(35)
      .setSource(new AudioClip("FireSound").setDescription("machine gun sound").setUrl(new String[] {"machngun.wav","https://www.web3d.org/x3d/content/examples/Savage/ShipsMilitary/FrigateYavuzTurkey/machngun.wav"})))
    .addComments(" Modeling the gun ")
    .addChild(new Transform().setRotation(0.0,1.0,0.0,3.14).setScale(1.2,1.2,1.2).setTranslation(0.0,-1.5,0.0)
      .addChild(new Group("GunBase")
        .addChild(new Shape()
          .setGeometry(new Cylinder().setHeight(1.0))
          .setAppearance(new Appearance("GunAp")
            .setMaterial(new Material().setDiffuseColor(.7,.7,.8).setShininess(.4))))
        .addChild(new Transform().setTranslation(0.0,0.4,0.0)
          .addChild(new Shape("Disk")
            .setGeometry(new Cylinder().setHeight(0.1).setRadius(1.05))
            .setAppearance(new Appearance().setUSE("GunAp")))))
      .addComments(" Mobile part of the gun (DEFLECTION) ")
      .addChild(new Transform("TopDondur")
        .addChild(new Group("GunMount")
          .addChild(new Transform().setRotation(0.0,0.0,1.0,0.3).setScale(1.1,1.0,1.5).setTranslation(-0.385,1.8,0.0)
            .addChild(new Shape("MountBody")
              .setGeometry(new Cylinder().setRadius(0.9))
              .setAppearance(new Appearance().setUSE("GunAp")))
            .addChild(new Transform().setScale(1.0,0.8,1.0).setTranslation(0.0,1.0,0.0)
              .addChild(new Shape("MountCap")
                .setGeometry(new Sphere().setRadius(0.9))
                .setAppearance(new Appearance().setUSE("GunAp"))))
            .addChild(new Transform().setTranslation(0.65,0.0,0.0)
              .addChild(new Shape()
                .setGeometry(new Box().setSize(0.5,1.8,0.7))
                .setAppearance(new Appearance().setUSE("GunAp")))
              .addChild(new Transform().setTranslation(0.25,0.0,0.0)
                .addChild(new Shape()
                  .setGeometry(new Box().setSize(0.1,1.8,0.5))
                  .setAppearance(new Appearance()
                    .setMaterial(new Material().setDiffuseColor(0.1,0.1,0.1)))))))
          .addChild(new Transform().setRotation(1.0,0.0,0.0,1.57)
            .addChild(new CylinderSensor("NamluSensor").setDescription("click and drag to rotate").setMaxAngle(0.45))
            .addComments(" Mobile part of the gun (ELEVATION) ")
            .addChild(new Transform("NamluDondur")
              .addChild(new Transform().setRotation(1.0,0.0,0.0,-1.57)
                .addChild(new Group("NamluGROUP")
                  .addChild(new Transform().setRotation(0.0,0.0,1.0,1.57).setTranslation(1.0,2.2,0.2)
                    .addChild(new Group("Namlu")
                      .addChild(new Shape("InNamlu")
                        .setGeometry(new Cylinder().setRadius(0.08))
                        .setAppearance(new Appearance()
                          .setMaterial(new Material().setDiffuseColor(.3,.3,.3).setShininess(0.6))))
                      .addChild(new Shape("HoleNamlu")
                        .setGeometry(new Cylinder().setHeight(2.02).setRadius(0.06))
                        .setAppearance(new Appearance()
                          .setMaterial(new Material().setDiffuseColor(.0,.0,.0).setShininess(0.6))))
                      .addChild(new Shape("OutNamlu")
                        .setGeometry(new Cylinder().setHeight(1.2).setRadius(0.1))
                        .setAppearance(new Appearance()
                          .setMaterial(new Material().setDiffuseColor(.4,.4,.4).setShininess(.6))))
                      .addChild(new Transform("FireTransform").setRotation(0.0,0.0,1.0,-3.14).setScale(0.0001,0.0001,0.00001).setTranslation(0.0,-1.35,0.0)
                        .addChild(new Shape("FireCone")
                          .setGeometry(new Cone().setBottomRadius(0.05).setHeight(0.5))
                          .setAppearance(new Appearance()
                            .setMaterial(new Material().setDiffuseColor(0.8,0.3,0.0).setShininess(0.7).setSpecularColor(0.8,0.3,0.0))))
                        .addChild(new Transform().setTranslation(0.0,-0.2,0.0)
                          .addChild(new Shape("InnerFireCone")
                            .setGeometry(new Cone().setBottomRadius(0.051).setHeight(0.2))
                            .setAppearance(new Appearance()
                              .setMaterial(new Material().setDiffuseColor(1.0,0.6,0.0).setShininess(0.7).setSpecularColor(1.0,0.6,0.0))))
                          .addChild(new PositionInterpolator("ChScale").setKey(new double[] {0.04,0.08,0.12,0.16,0.2,0.24,0.28,0.32,0.36,0.4,0.44,0.48,0.52,0.56,0.6,0.64,0.68,0.72,0.76,0.8,0.84,0.86,0.9,0.94,1.0}).setKeyValue(new MFVec3f(new double[] {0.00001,0.00001,0.00001,1.0,1.0,1.0,0.00001,0.00001,0.00001,1.0,1.0,1.0,0.00001,0.00001,0.00001,1.0,1.0,1.0,0.00001,0.00001,0.00001,1.0,1.0,1.0,0.00001,0.00001,0.00001,1.0,1.0,1.0,0.00001,0.00001,0.00001,1.0,1.0,1.0,0.00001,0.00001,0.00001,1.0,1.0,1.0,0.00001,0.00001,0.00001,1.0,1.0,1.0,0.00001,0.00001,0.00001,1.0,1.0,1.0,0.00001,0.00001,0.00001,1.0,1.0,1.0,0.00001,0.00001,0.00001,1.0,1.0,1.0,0.00001,0.00001,0.00001,1.0,1.0,1.0,0.00001,0.00001,0.00001})))
                          .addChild(new TimeSensor("fireTimer").setCycleInterval(1.5))))))
                  .addChild(new Transform().setRotation(0.0,0.0,1.0,1.57).setTranslation(1.0,2.2,-0.2)
                    .addChild(new Group().setUSE("Namlu")))
                  .addChild(new Transform().setRotation(0.0,0.0,1.0,1.57).setTranslation(1.0,1.8,-0.2)
                    .addChild(new Group().setUSE("Namlu")))
                  .addChild(new Transform().setRotation(0.0,0.0,1.0,1.57).setTranslation(1.0,1.8,0.2)
                    .addChild(new Group().setUSE("Namlu")))))))
          .addChild(new CylinderSensor("TopSensor").setDescription("click and drag to rotate").setMaxAngle(1.7).setMinAngle(-1.7))
          .addComments(" missing ROUTE for OrientationInterpolator, likely due to use of CylinderSensor ")
          .addChild(new OrientationInterpolator("ButtonRotInter").setKey(new double[] {0.0,1.0}).setKeyValue(new MFRotation(new double[] {0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.7})))
          .addChild(new TimeSensor("PortSideTimer").setCycleInterval(3.0).setEnabled(false).setLoop(true))
          .addChild(new Transform().setRotation(0.0,0.0,1.0,0.3).setTranslation(-0.1,1.0,0.0)
            .addChild(new Shape()
              .setGeometry(new Cylinder().setHeight(1.5).setRadius(0.7))
              .setAppearance(new Appearance().setUSE("GunAp")))))))
    .addChild(new Transform().setRotation(0.0,1.0,0.0,1.57)
      .addChild(new Transform().setRotation(1.0,0.0,0.0,-1.4).setScale(1.4,1.4,1.4).setTranslation(0.0,0.0,0.5)
        .addChild(new Group("GunControl")
          .addChild(new Transform().setTranslation(0.0,0.0,3.0)
            .addChild(new Group()
              .addChild(new Shape("MenuB")
                .setGeometry(new Box().setSize(0.5,0.2,0.00001))
                .setAppearance(new Appearance()
                  .setMaterial(new Material().setDiffuseColor(0.0,1.0,0.0).setTransparency(0.6))))
              .addChild(new Transform().setTranslation(-0.2,-0.05,0.005)
                .addChild(new Shape()
                  .setGeometry(new Text().setString(new String[] {"FIRE"})
                    .setFontStyle(new FontStyle().setSize(0.2).setSpacing(0.1).setCssStyle("BOLD")))
                  .setAppearance(new Appearance()
                    .setMaterial(new Material().setDiffuseColor(1.0,0.0,0.0)))))
              .addChild(new TouchSensor("FireSensor").setDescription("touch to fire"))))
          .addChild(new Transform().setTranslation(-0.25,-0.2,3.0)
            .addChild(new Group()
              .addChild(new Shape().setUSE("MenuB"))
              .addChild(new Transform().setTranslation(-0.2,-0.05,0.005)
                .addChild(new Shape()
                  .setGeometry(new Text().setString(new String[] {"LROT"})
                    .setFontStyle(new FontStyle().setSize(0.18).setSpacing(0.1).setCssStyle("BOLD")))
                  .setAppearance(new Appearance()
                    .setMaterial(new Material().setDiffuseColor(1.0,0.0,0.0)))))
              .addChild(new TouchSensor("LRotSensor").setDescription("touch to rotate left"))))
          .addChild(new Transform().setTranslation(0.25,-0.2,3.0)
            .addChild(new Group()
              .addChild(new Shape().setUSE("MenuB"))
              .addChild(new Transform().setTranslation(-0.2,-0.05,0.005)
                .addChild(new Shape()
                  .setGeometry(new Text().setString(new String[] {"RROT"})
                    .setFontStyle(new FontStyle().setSize(0.18).setSpacing(0.1).setCssStyle("BOLD")))
                  .setAppearance(new Appearance()
                    .setMaterial(new Material().setDiffuseColor(1.0,0.0,0.0)))))
              .addChild(new TouchSensor("RRotSensor").setDescription("touch to rotate right"))))
          .addChild(new Transform().setTranslation(-0.25,-0.4,3.0)
            .addChild(new Group()
              .addChild(new Shape().setUSE("MenuB"))
              .addChild(new Transform().setTranslation(-0.2,-0.05,0.005)
                .addChild(new Shape()
                  .setGeometry(new Text().setString(new String[] {"ELEV"})
                    .setFontStyle(new FontStyle().setSize(0.18).setSpacing(0.1).setCssStyle("BOLD")))
                  .setAppearance(new Appearance()
                    .setMaterial(new Material().setDiffuseColor(1.0,0.0,0.0)))))
              .addChild(new TouchSensor("ElevSensor").setDescription("touch to elevate"))))
          .addChild(new Transform().setTranslation(0.25,-0.4,3.0)
            .addChild(new Group()
              .addChild(new Shape().setUSE("MenuB"))
              .addChild(new Transform().setTranslation(-0.2,-0.05,0.005)
                .addChild(new Shape()
                  .setGeometry(new Text().setString(new String[] {"DESC"})
                    .setFontStyle(new FontStyle().setSize(0.18).setSpacing(0.1).setCssStyle("BOLD")))
                  .setAppearance(new Appearance()
                    .setMaterial(new Material().setDiffuseColor(1.0,0.0,0.0)))))
              .addChild(new TouchSensor("DescSensor").setDescription("touch to depress downward")))))))
    .addChild(new ROUTE().setFromNode("TopSensor").setFromField("rotation_changed").setToNode("TopDondur").setToField("set_rotation"))
    .addChild(new ROUTE().setFromNode("NamluSensor").setFromField("rotation_changed").setToNode("NamluDondur").setToField("set_rotation"))
    .addChild(new ROUTE().setFromNode("fireTimer").setFromField("fraction_changed").setToNode("ChScale").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("ChScale").setFromField("value_changed").setToNode("FireTransform").setToField("set_scale"))
    .addChild(new ROUTE().setFromNode("FireSensor").setFromField("touchTime").setToNode("fireTimer").setToField("set_startTime"))
    .addChild(new ROUTE().setFromNode("FireSensor").setFromField("touchTime").setToNode("FireSound").setToField("set_startTime"))
    .addChild(new ROUTE().setFromNode("PortSideTimer").setFromField("fraction_changed").setToNode("ButtonRotInter").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("FireSensor").setFromField("isActive").setToNode("PortSideTimer").setToField("set_enabled"))
    .addChild(new ROUTE().setFromNode("LRotSensor").setFromField("isActive").setToNode("RotUpdater").setToField("set_LRotation"))
    .addChild(new ROUTE().setFromNode("RRotSensor").setFromField("isActive").setToNode("RotUpdater").setToField("set_RRotation"))
    .addChild(new ROUTE().setFromNode("TopDondur").setFromField("rotation").setToNode("RotUpdater").setToField("get_CurRotation"))
    .addChild(new ROUTE().setFromNode("RotUpdater").setFromField("newRotation").setToNode("TopDondur").setToField("set_rotation"))
    .addChild(new ROUTE().setFromNode("ElevSensor").setFromField("isActive").setToNode("ElevDescUpdater").setToField("set_Elevation"))
    .addChild(new ROUTE().setFromNode("DescSensor").setFromField("isActive").setToNode("ElevDescUpdater").setToField("set_Descendance"))
    .addChild(new ROUTE().setFromNode("NamluDondur").setFromField("rotation").setToNode("ElevDescUpdater").setToField("get_CurOrientation"))
    .addChild(new ROUTE().setFromNode("ElevDescUpdater").setFromField("newOrientation").setToNode("NamluDondur").setToField("set_rotation")));
            }
            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 SeaZenith 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 SeaZenith().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.ShipsMilitary.FrigateYavuzTurkey.SeaZenith\" 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.ShipsMilitary.FrigateYavuzTurkey.SeaZenith self-validation test confirmation: ");
                if (!validationResults.equals("success"))
                    System.out.println();
                System.out.println(validationResults.trim());

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