package Savage.Environment.SeaState;

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.Navigation.*;
import org.web3d.x3d.jsail.Networking.*;
import org.web3d.x3d.jsail.PointingDeviceSensor.*;
import org.web3d.x3d.jsail.Scripting.*;
import org.web3d.x3d.jsail.Shape.*;
import org.web3d.x3d.jsail.Text.*;
import org.web3d.x3d.jsail.Texturing.*;
import org.web3d.x3d.jsail.Time.*;

// Javadoc metadata annotations follow, see below for X3DJSAIL Java source code.
/**
 * <p> Sea state rendering of ocean wave motion: prototype for reproducing sea state surface in other scenes. </p>
 <p> Related links: Catalog page <a href="../../../../Environment/SeaState/SeaStateExtrusionPrototypeIndex.html" target="_blank">SeaStateExtrusionPrototype</a>,  source <a href="../../../../Environment/SeaState/SeaStateExtrusionPrototype.java">SeaStateExtrusionPrototype.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="../../../../Environment/SeaState/SeaStateExtrusionPrototype.x3d">SeaStateExtrusionPrototype.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> creator </i> </td>
			<td> Marcus V. da S. Simoes </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> created </i> </td>
			<td> 11 January 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> description </i> </td>
			<td> Sea state rendering of ocean wave motion: prototype for reproducing sea state surface in other scenes. </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/Environment/SeaState/SeaStateExtrusionPrototype.x3d" target="_blank">https://www.web3d.org/x3d/content/examples/Savage/Environment/SeaState/SeaStateExtrusionPrototype.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="../../../../Environment/SeaState/../../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 Marcus V. da S. Simoes
 */

public class SeaStateExtrusionPrototype
{
	/** Default constructor to create this object. */
	public SeaStateExtrusionPrototype ()
	{
	  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("SeaStateExtrusionPrototype.x3d"))
    .addMeta(new meta().setName(meta.NAME_CREATOR    ).setContent("Marcus V. da S. Simoes"))
    .addMeta(new meta().setName(meta.NAME_CREATED    ).setContent("11 January 2001"))
    .addMeta(new meta().setName(meta.NAME_MODIFIED   ).setContent("20 October 2019"))
    .addMeta(new meta().setName(meta.NAME_DESCRIPTION).setContent("Sea state rendering of ocean wave motion: prototype for reproducing sea state surface in other scenes."))
    .addMeta(new meta().setName(meta.NAME_IDENTIFIER ).setContent("https://www.web3d.org/x3d/content/examples/Savage/Environment/SeaState/SeaStateExtrusionPrototype.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()
    .addChild(new WorldInfo().setTitle("SeaStateExtrusionPrototype.x3d"))
    .addChild(new ProtoDeclare("SeaStateExtrusion").setName("SeaStateExtrusion")
      .setProtoInterface(new ProtoInterface()
        .addField(new field().setName("shipPitch").setType(field.TYPE_SFROTATION).setAccessType(field.ACCESSTYPE_OUTPUTONLY))
        .addField(new field().setName("shipRoll").setType(field.TYPE_SFROTATION).setAccessType(field.ACCESSTYPE_OUTPUTONLY)))
      .setProtoBody(new ProtoBody()
        .addChild(new Group()
          .addComments(" AnimationClock ")
          .addComments(" ================================================= ")
          .addChild(new Group("TimeSensors")
            .addChild(new TimeSensor("WaveClock").setCycleInterval(15).setLoop(true))
            .addChild(new TimeSensor("PitchandRollClock").setCycleInterval(10).setLoop(true)))
          .addComments(" ================================================= ")
          .addComments(" Interpolators ")
          .addComments(" ================================================= ")
          .addComments(" MovingTheShip ")
          .addChild(new Group("OrientationInterpolators")
            .addChild(new OrientationInterpolator("PitchInterpolator").setKey(new double[] {0.0,0.5,1.0}).setKeyValue(new MFRotation(new double[] {0.0,0.0,1.0,-0.05,0.0,0.0,1.0,0.0,0.0,0.0,1.0,-0.05}))
              .setIS(new IS()
                .addConnect(new connect().setNodeField("value_changed").setProtoField("shipPitch"))))
            .addChild(new OrientationInterpolator("RollInterpolator").setKey(new double[] {0.0,0.5,1.0}).setKeyValue(new MFRotation(new double[] {1.0,0.0,0.0,-0.05,1.0,0.0,0.0,0.0,1.0,0.0,0.0,-0.05}))
              .setIS(new IS()
                .addConnect(new connect().setNodeField("value_changed").setProtoField("shipRoll")))))
          .addComments(" ================================================= ")
          .addComments(" MovingTheSea ")
          .addChild(new Group("CoordinateInterpolator")
            .addChild(new CoordinateInterpolator("Ondulation").setKey(new double[] {0.0,0.25,0.50,0.75,1.0}).setKeyValue(getOndulation_7_24_keyValue())))
          .addComments(" ================================================= ")
          .addComments(" SeaLevelChoiceGroup ")
          .addChild(new Switch("SeaStateNumber").setWhichChoice(0)
            .addChild(new Group("SeaState_1")
              .addChild(new Transform()
                .addChild(new Transform("TheSea")
                  .addComments(" BasicWave ")
                  .addChild(new Transform("Basic").setScale(250.0,1.0,10.0)
                    .addChild(new Shape("BasicWave")
                      .setAppearance(new Appearance("SeaColor")
                        .setTexture(new ImageTexture().setUrl(new String[] {"../../Environment/SeaState/pool.jpg","https://www.web3d.org/x3d/content/examples/Savage/Environment/SeaState/pool.jpg"}))
                        .setMaterial(new Material().setDiffuseColor(0.0,0.0,0.0).setTransparency(0.3)))
                      .setGeometry(new Extrusion("BasicExtrusion").setBeginCap(false).setConvex(false).setCreaseAngle(0.01).setCrossSection(new MFVec2f(new double[] {0.0,0.0,0.0,200.0,0.0,0.0})).setEndCap(false).setSolid(false).setSpine(getBasicExtrusion_12_29_spine())))))))
            .addChild(new Group("SeaState_2")
              .addChild(new Transform().setScale(1.0,5.0,1.0)
                .addChild(new Group().setUSE("SeaState_1"))))
            .addChild(new Group("SeaState_3")
              .addChild(new Transform().setScale(1.0,8.0,1.0)
                .addChild(new Group().setUSE("SeaState_1"))))
            .addChild(new Group("SeaState_4")
              .addChild(new Transform().setScale(1.0,12.0,1.0)
                .addChild(new Group().setUSE("SeaState_1"))))
            .addChild(new Group("SeaState_5")
              .addChild(new Transform().setScale(1.0,15.0,1.0)
                .addChild(new Group().setUSE("SeaState_1"))))
            .addChild(new Group("SeaState_6")
              .addChild(new Transform().setScale(1.0,20.0,1.0)
                .addChild(new Group().setUSE("SeaState_1"))))
            .addChild(new Group("SeaState_7")
              .addChild(new Transform().setScale(1.0,25.0,1.0)
                .addChild(new Group().setUSE("SeaState_1"))))
            .addChild(new Group("SeaState_8")
              .addChild(new Transform().setScale(1.0,32.0,1.0)
                .addChild(new Group().setUSE("SeaState_1")))))
          .addComments(" ================================================= ")
          .addComments(" Sea State Control Panel ")
          .addChild(new Group("SeaStateAndDirection")
            .addChild(new Transform().setTranslation(0.0,100.0,4000.0)
              .addChild(new Viewpoint().setDescription("Sea State Control Panel").setPosition(-2.0,0.0,6.0))
              .addChild(new Billboard()
                .addChild(new Group("SeaStateChoice")
                  .addChild(new Transform("Option1").setTranslation(0.0,-2.0,0.0)
                    .addChild(new Transform("Box1").setTranslation(0.0,.1,0.0)
                      .addChild(new Shape("BoxSensor")
                        .setGeometry(new Box().setSize(1.0,.4,.1))
                        .setAppearance(new Appearance()
                          .setMaterial(new Material().setDiffuseColor(0.0,0.0,1.0).setSpecularColor(0.0,0.0,1.0).setTransparency(.9))))
                      .addChild(new TouchSensor("TouchSensorSeaState1").setDescription("click to select sea state"))
                      .addChild(new Transform("Text1").setScale(.25,.25,.25).setTranslation(0.0,0.0,.1)
                        .addChild(new Shape()
                          .setGeometry(new Text().setString(new String[] {"SST 1"})
                            .setFontStyle(new FontStyle().setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE)))
                          .setAppearance(new Appearance()
                            .setMaterial(new Material().setEmissiveColor(.8,.8,.8)))))))
                  .addChild(new Transform("Option2").setTranslation(0.0,-1.5,0.0)
                    .addChild(new Transform("Box2").setTranslation(0.0,.1,0.0)
                      .addChild(new Shape()
                        .setGeometry(new Box().setSize(1.0,.4,.1))
                        .setAppearance(new Appearance()
                          .setMaterial(new Material().setDiffuseColor(0.0,0.0,.8).setTransparency(.7))))
                      .addChild(new TouchSensor("TouchSensorSeaState2").setDescription("click to select sea state"))
                      .addChild(new Transform("Text2").setScale(.25,.25,.25).setTranslation(0.0,0.0,.1)
                        .addChild(new Shape()
                          .setGeometry(new Text().setString(new String[] {"SST 2"})
                            .setFontStyle(new FontStyle().setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE)))
                          .setAppearance(new Appearance()
                            .setMaterial(new Material().setEmissiveColor(.8,.8,.8)))))))
                  .addChild(new Transform("Option3").setTranslation(0.0,-1.0,0.0)
                    .addChild(new Transform("Box3").setTranslation(0.0,.1,0.0)
                      .addChild(new Shape()
                        .setGeometry(new Box().setSize(1.0,.4,.1))
                        .setAppearance(new Appearance()
                          .setMaterial(new Material().setDiffuseColor(0.0,0.0,.8).setTransparency(.7))))
                      .addChild(new TouchSensor("TouchSensorSeaState3").setDescription("click to select sea state"))
                      .addChild(new Transform("Text3").setScale(.25,.25,.25).setTranslation(0.0,0.0,.1)
                        .addChild(new Shape()
                          .setGeometry(new Text().setString(new String[] {"SST 3"})
                            .setFontStyle(new FontStyle().setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE)))
                          .setAppearance(new Appearance()
                            .setMaterial(new Material().setEmissiveColor(.8,.8,.8)))))))
                  .addChild(new Transform("Option4").setTranslation(0.0,-0.5,0.0)
                    .addChild(new Transform("Box4").setTranslation(0.0,.1,0.0)
                      .addChild(new Shape()
                        .setGeometry(new Box().setSize(1.0,.4,.1))
                        .setAppearance(new Appearance()
                          .setMaterial(new Material().setDiffuseColor(0.0,0.8,0.0).setTransparency(0.8))))
                      .addChild(new TouchSensor("TouchSensorSeaState4").setDescription("click to select sea state"))
                      .addChild(new Transform("Text4").setScale(.25,.25,.25).setTranslation(0.0,0.0,.1)
                        .addChild(new Shape()
                          .setGeometry(new Text().setString(new String[] {"SST 4"})
                            .setFontStyle(new FontStyle().setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE)))
                          .setAppearance(new Appearance()
                            .setMaterial(new Material().setEmissiveColor(.8,.8,.8)))))))
                  .addChild(new Transform("Option5")
                    .addChild(new Transform("Box5").setTranslation(0.0,.1,0.0)
                      .addChild(new Shape()
                        .setGeometry(new Box().setSize(1.0,.4,.1))
                        .setAppearance(new Appearance()
                          .setMaterial(new Material().setDiffuseColor(0.0,.5,0.0).setTransparency(.4))))
                      .addChild(new Transform("Text5").setScale(.25,.25,.25).setTranslation(0.0,0.0,.1)
                        .addChild(new Shape()
                          .setGeometry(new Text().setString(new String[] {"SST 5"})
                            .setFontStyle(new FontStyle().setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE)))
                          .setAppearance(new Appearance()
                            .setMaterial(new Material().setEmissiveColor(.8,.8,.8)))))
                      .addChild(new TouchSensor("TouchSensorSeaState5").setDescription("click to select sea state"))))
                  .addChild(new Transform("Option6").setTranslation(0.0,.5,0.0)
                    .addChild(new Transform("Box6").setTranslation(0.0,.1,0.0)
                      .addChild(new Transform("Text6").setScale(.25,.25,.25).setTranslation(0.0,0.0,.1)
                        .addChild(new Shape()
                          .setGeometry(new Text().setString(new String[] {"SST 6"})
                            .setFontStyle(new FontStyle().setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE)))
                          .setAppearance(new Appearance()
                            .setMaterial(new Material().setEmissiveColor(.8,.8,.8)))))
                      .addChild(new Shape()
                        .setGeometry(new Box().setSize(1.0,.4,.1))
                        .setAppearance(new Appearance()
                          .setMaterial(new Material().setDiffuseColor(.2,0.0,0.0).setTransparency(0.8))))
                      .addChild(new TouchSensor("TouchSensorSeaState6").setDescription("click to select sea state"))))
                  .addChild(new Transform("Option7").setTranslation(0.0,1.0,0.0)
                    .addChild(new Transform("Box7").setTranslation(0.0,.1,0.0)
                      .addChild(new Transform("Text7").setScale(.25,.25,.25).setTranslation(0.0,0.0,.1)
                        .addChild(new Shape()
                          .setGeometry(new Text().setString(new String[] {"SST 7"})
                            .setFontStyle(new FontStyle().setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE)))
                          .setAppearance(new Appearance()
                            .setMaterial(new Material().setEmissiveColor(.8,.8,.8)))))
                      .addChild(new Shape()
                        .setGeometry(new Box().setSize(1.0,.4,.1))
                        .setAppearance(new Appearance()
                          .setMaterial(new Material().setDiffuseColor(.5,0.0,0.0).setTransparency(0.7))))
                      .addChild(new TouchSensor("TouchSensorSeaState7").setDescription("click to select sea state"))))
                  .addChild(new Transform("Option8").setTranslation(0.0,1.5,0.0)
                    .addChild(new Transform("Box8").setTranslation(0.0,.1,0.0)
                      .addChild(new Transform("Text8").setScale(.25,.25,.25).setTranslation(0.0,0.0,.1)
                        .addChild(new Shape()
                          .setGeometry(new Text().setString(new String[] {"SST 8"})
                            .setFontStyle(new FontStyle().setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE)))
                          .setAppearance(new Appearance()
                            .setMaterial(new Material().setEmissiveColor(.8,.8,.8)))))
                      .addChild(new Shape()
                        .setGeometry(new Box().setSize(1.0,.4,.1))
                        .setAppearance(new Appearance()
                          .setMaterial(new Material().setDiffuseColor(1.0,0.0,0.0).setTransparency(0.5))))
                      .addChild(new TouchSensor("TouchSensorSeaState8").setDescription("click to select sea state"))))
                  .addChild(new Transform().setTranslation(0.0,0.0,-3.0)
                    .addChild(new Shape()
                      .setGeometry(new Box().setSize(2.0,6.5,0.2))
                      .setAppearance(new Appearance()
                        .setMaterial(new Material().setDiffuseColor(.3,.3,.3))
                        .setTexture(new ImageTexture()))))))))
          .addChild(new Group("ScriptsForWaveMovement")
            .addChild(new Script("SeaStateChoiceToValue").setSourceCode("""
ecmascript:

// Return the numeric value of SST button clicked

function initialize ()
{
	SeaStateValue = 2;


}
function SeaStateChoice1 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 0;
}
function SeaStateChoice2 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 1;
}
function SeaStateChoice3 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 2;
}
function SeaStateChoice4 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 3;
}
function SeaStateChoice5 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 4;
}
function SeaStateChoice6 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 5;
}
function SeaStateChoice7 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 6;
}
function SeaStateChoice8 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 7;
}
""")
              .addField(new field().setName("SeaStateChoice0").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY))
              .addField(new field().setName("SeaStateChoice1").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY))
              .addField(new field().setName("SeaStateChoice2").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY))
              .addField(new field().setName("SeaStateChoice3").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY))
              .addField(new field().setName("SeaStateChoice4").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY))
              .addField(new field().setName("SeaStateChoice5").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY))
              .addField(new field().setName("SeaStateChoice6").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY))
              .addField(new field().setName("SeaStateChoice7").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY))
              .addField(new field().setName("SeaStateChoice8").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY))
              .addField(new field().setName("SeaStateValue").setType(field.TYPE_SFINT32).setAccessType(field.ACCESSTYPE_OUTPUTONLY)))))
        .addComments(" ================================================= ")
        .addComments(" RoutesToChooseSST ")
        .addChild(new ROUTE().setFromNode("TouchSensorSeaState1").setFromField("isActive").setToNode("SeaStateChoiceToValue").setToField("SeaStateChoice1"))
        .addChild(new ROUTE().setFromNode("TouchSensorSeaState2").setFromField("isActive").setToNode("SeaStateChoiceToValue").setToField("SeaStateChoice2"))
        .addChild(new ROUTE().setFromNode("TouchSensorSeaState3").setFromField("isActive").setToNode("SeaStateChoiceToValue").setToField("SeaStateChoice3"))
        .addChild(new ROUTE().setFromNode("TouchSensorSeaState4").setFromField("isActive").setToNode("SeaStateChoiceToValue").setToField("SeaStateChoice4"))
        .addChild(new ROUTE().setFromNode("TouchSensorSeaState5").setFromField("isActive").setToNode("SeaStateChoiceToValue").setToField("SeaStateChoice5"))
        .addChild(new ROUTE().setFromNode("TouchSensorSeaState6").setFromField("isActive").setToNode("SeaStateChoiceToValue").setToField("SeaStateChoice6"))
        .addChild(new ROUTE().setFromNode("TouchSensorSeaState7").setFromField("isActive").setToNode("SeaStateChoiceToValue").setToField("SeaStateChoice7"))
        .addChild(new ROUTE().setFromNode("TouchSensorSeaState8").setFromField("isActive").setToNode("SeaStateChoiceToValue").setToField("SeaStateChoice8"))
        .addChild(new ROUTE().setFromNode("SeaStateChoiceToValue").setFromField("SeaStateValue").setToNode("SeaStateNumber").setToField("whichChoice"))
        .addComments(" ================================================= ")
        .addComments(" RoutesToMoveTheSea ")
        .addChild(new ROUTE().setFromNode("WaveClock").setFromField("fraction_changed").setToNode("Ondulation").setToField("set_fraction"))
        .addChild(new ROUTE().setFromNode("PitchandRollClock").setFromField("fraction_changed").setToNode("PitchInterpolator").setToField("set_fraction"))
        .addChild(new ROUTE().setFromNode("PitchandRollClock").setFromField("fraction_changed").setToNode("RollInterpolator").setToField("set_fraction"))
        .addChild(new ROUTE().setFromNode("Ondulation").setFromField("value_changed").setToNode("BasicExtrusion").setToField("set_spine"))))
    .addComments(" ================================================= ")
    .addChild(new NavigationInfo().setSpeed(100))
    .addChild(new Background().setGroundAngle(new double[] {1.309,1.570796}).setGroundColor(new MFColor(new double[] {0.0,0.2,0.7,0.0,0.5,1.0,0.6,0.6,0.6})).setSkyAngle(new double[] {1.309,1.571}).setSkyColor(new MFColor(new double[] {0.0,0.2,0.7,0.0,0.5,1.0,0.6,0.6,0.6})))
    .addChild(new Anchor().setDescription("Sea State Extrusion Example").setParameter(new String[] {"target=_blank"}).setUrl(new String[] {"SeaStateExtrusionExample.x3d","https://www.web3d.org/x3d/content/examples/Savage/Environment/SeaState/SeaStateExtrusionExample.x3d","SeaStateExtrusionExample.wrl","https://www.web3d.org/x3d/content/examples/Savage/Environment/SeaState/SeaStateExtrusionExample.wrl"})
      .addChild(new Shape()
        .setGeometry(new Text().setString(new String[] {"SeaStateExtrusionPrototype","is a prototype definition file","","To see an example scene","click on this text and view","SeaStateExtrusionExample"})
          .setFontStyle(new FontStyle().setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE)))
        .setAppearance(new Appearance()
          .setMaterial(new Material().setDiffuseColor(1.0,1.0,0.0))))));
            }
            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


		/** Define subarrays using type double[] */
		private double[] getBasicExtrusion_12_29_spine_1()
		{
			double[] value = {0.0,0.0,0.0000,1.0,0.0204,1.0000,2.0,0.0161,2.0000,3.0,-0.0218,3.0000,4.0,-0.0791,4.0000,5.0,-0.1237,5.0000,6.0,-0.1224,6.0000,7.0,-0.0598,7.0000,8.0,0.0503,8.0000,9.0,0.1661,9.0000,10.0,0.2348,10.0000,11.0,0.2163,11.0000,12.0,0.1041,12.0000,13.0,-0.0672,13.0000,14.0,-0.2326,14.0000,15.0,-0.3224,15.0000,16.0,-0.2920,16.0000,17.0,-0.1434,17.0000,18.0,0.0723,18.0000,19.0,0.2728,19.0000,20.0,0.3776,20.0000,21.0,0.3408,21.0000,22.0,0.1718,22.0000,23.0,-0.0670,23.0000,24.0,-0.2840,24.0000,25.0,-0.3951,25.0000,26.0,-0.3568,26.0000,27.0,-0.1846,27.0000,28.0,0.0541,28.0000,29.0,0.2668,29.0000,30.0,0.3734,30.0000,31.0,0.3373,31.0000,32.0,0.1782,32.0000,33.0,-0.0373,33.0000,34.0,-0.2246,34.0000,35.0,-0.3153,35.0000,36.0,-0.2831,36.0000,37.0,-0.1513,37.0000,38.0,0.0205,38.0000,39.0,0.1632,39.0000,40.0,0.2269,40.0000,41.0,0.1990,41.0000,42.0,0.1048,42.0000,43.0,-0.0074,43.0000,44.0,-0.0903,44.0000,45.0,-0.1177,45.0000,46.0,-0.0928,46.0000,47.0,-0.0423,47.0000,48.0,0.0006,48.0000,49.0,0.0142,49.0000,50.0,-0.0012,50.0000,51.0,-0.0251,51.0000,52.0,-0.0307,52.0000,53.0,-0.0015,53.0000,54.0,0.0571,54.0000,55.0,0.1175,55.0000,56.0,0.1429,56.0000,57.0,0.1069,57.0000,58.0,0.0098,58.0000,59.0,-0.1166,59.0000,60.0,-0.2197,60.0000,61.0,-0.2485,61.0000,62.0,-0.1780,62.0000,63.0,-0.0240,63.0000,64.0,0.1590,64.0000,65.0,0.2978,65.0000,66.0,0.3309,66.0000,67.0,0.2357,67.0000,68.0,0.0411,68.0000,69.0,-0.1814,69.0000,70.0,-0.3446,70.0000,71.0,-0.3815,71.0000,72.0,-0.2729,72.0000,73.0,-0.0574,73.0000,74.0,0.1834,74.0000,75.0,0.3563,75.0000,76.0,0.3946,76.0000,77.0,0.2841,77.0000,78.0,0.0689,78.0000,79.0,-0.1668,79.0000,80.0,-0.3327,80.0000,81.0,-0.3686,81.0000,82.0,-0.2664,82.0000,83.0,-0.0721,83.0000,84.0,0.1355,84.0000,85.0,0.2774,85.0000,86.0,0.3057,86.0000,87.0,0.2201,87.0000,88.0,0.0645,88.0000,89.0,-0.0946,89.0000,90.0,-0.1969,90.0000,91.0,-0.2121,91.0000,92.0,-0.1485,92.0000,93.0,-0.0450,93.0000,94.0,0.0499,94.0000,95.0,0.1004,95.0000,96.0,0.0972,96.0000,97.0,0.0580,97.0000,98.0,0.0142,98.0000,99.0,-0.0071,99.0000};
			return value;
		}
		private double[] getBasicExtrusion_12_29_spine_2()
		{
			double[] value = {100.0,0.0020,100.0};
			return value;
		}

		/** Large attribute array: CoordinateInterpolator DEF='Ondulation' keyValue field, scene-graph level=7, element #24, 285 total numbers made up of 95 3-tuple values.
		 * Reassemble split array as single method to improve readability and runnability.
		 * Provide large array values via separate methods, hoping to avoid 'code too large' Java compilation errors. 
		 * Individual Java methods (including aggregated initializations) are limited to 64KB.
		 * @see https://stackoverflow.com/questions/2407912/code-too-large-compilation-error-in-java
		 * @see https://stackoverflow.com/questions/11437905/java-too-many-constants-jvm-error
		 */
		private MFVec3f getOndulation_7_24_keyValue()
		{
			MFVec3f Ondulation_7_24_keyValue = new MFVec3f(new double[] {-4.100,0.0,0.0,-4.0,0.0,0.0,-3.529,0.674,0.0,-3.059,0.996,0.0,-2.588,0.798,0.0,-2.118,0.184,0.0,-1.647,-0.526,0.0,-1.176,-0.962,0.0,-0.706,-0.895,0.0,-0.235,-0.361,0.0,0.235,0.361,0.0,0.706,0.895,0.0,1.176,0.962,0.0,1.647,0.526,0.0,2.118,-0.184,0.0,2.588,-0.798,0.0,3.059,-0.996,0.0,3.529,-0.674,0.0,4.0,0.0,0.0,-4.100,-1.0,0.0,-4.0,-1.0,0.0,-3.529,-0.739,0.0,-3.059,-0.092,0.0,-2.588,0.603,0.0,-2.118,0.983,0.0,-1.647,0.850,0.0,-1.176,0.274,0.0,-0.706,-0.446,0.0,-0.235,-0.932,0.0,0.235,-0.932,0.0,0.706,-0.446,0.0,1.176,0.274,0.0,1.647,0.850,0.0,2.118,0.983,0.0,2.588,0.603,0.0,3.059,-0.092,0.0,3.529,-0.739,0.0,4.0,-1.0,0.0,-4.100,0.0,0.0,-4.0,0.0,0.0,-3.529,-0.674,0.0,-3.059,-0.996,0.0,-2.588,-0.798,0.0,-2.118,-0.184,0.0,-1.647,0.526,0.0,-1.176,0.962,0.0,-0.706,0.895,0.0,-0.235,0.361,0.0,0.235,-0.361,0.0,0.706,-0.895,0.0,1.176,-0.962,0.0,1.647,-0.526,0.0,2.118,0.184,0.0,2.588,0.798,0.0,3.059,0.996,0.0,3.529,0.674,0.0,4.0,0.0,0.0,-4.100,1.0,0.0,-4.0,1.0,0.0,-3.529,0.739,0.0,-3.059,0.092,0.0,-2.588,-0.603,0.0,-2.118,-0.983,0.0,-1.647,-0.850,0.0,-1.176,-0.274,0.0,-0.706,0.446,0.0,-0.235,0.932,0.0,0.235,0.932,0.0,0.706,0.446,0.0,1.176,-0.274,0.0,1.647,-0.850,0.0,2.118,-0.983,0.0,2.588,-0.603,0.0,3.059,0.092,0.0,3.529,0.739,0.0,4.0,1.0,0.0,-4.100,0.0,0.0,-4.0,0.0,0.0,-3.529,0.674,0.0,-3.059,0.996,0.0,-2.588,0.798,0.0,-2.118,0.184,0.0,-1.647,-0.526,0.0,-1.176,-0.962,0.0,-0.706,-0.895,0.0,-0.235,-0.361,0.0,0.235,0.361,0.0,0.706,0.895,0.0,1.176,0.962,0.0,1.647,0.526,0.0,2.118,-0.184,0.0,2.588,-0.798,0.0,3.059,-0.996,0.0,3.529,-0.674,0.0,4.0,0.0,0.0});
			return Ondulation_7_24_keyValue;
		}
		/** Large attribute array: Extrusion DEF='BasicExtrusion' spine field, scene-graph level=12, element #29, 303 total numbers made up of 101 3-tuple values.
		 * Reassemble split array as single method to improve readability and runnability.
		 * Provide large array values via separate methods, hoping to avoid 'code too large' Java compilation errors. 
		 * Individual Java methods (including aggregated initializations) are limited to 64KB.
		 * @see https://stackoverflow.com/questions/2407912/code-too-large-compilation-error-in-java
		 * @see https://stackoverflow.com/questions/11437905/java-too-many-constants-jvm-error
		 */
		private MFVec3f getBasicExtrusion_12_29_spine()
		{
			MFVec3f BasicExtrusion_12_29_spine = new MFVec3f()/*2.finalize*/
				.append(new MFVec3f(getBasicExtrusion_12_29_spine_1()))
				.append(new MFVec3f(getBasicExtrusion_12_29_spine_2()));
			return BasicExtrusion_12_29_spine;
		}

	/** 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 SeaStateExtrusionPrototype 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 SeaStateExtrusionPrototype().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.Environment.SeaState.SeaStateExtrusionPrototype\" 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.Environment.SeaState.SeaStateExtrusionPrototype self-validation test confirmation: ");
                if (!validationResults.equals("success"))
                    System.out.println();
                System.out.println(validationResults.trim());

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