package Savage.HarborEquipment.NavigationAids;

import org.web3d.x3d.jsail.Core.*;
import org.web3d.x3d.jsail.fields.*;
import org.web3d.x3d.jsail.Geometry3D.*;
import org.web3d.x3d.jsail.Grouping.*;
import org.web3d.x3d.jsail.Rendering.*;
import org.web3d.x3d.jsail.Shape.*;
import org.web3d.x3d.jsail.Texturing.*;

// Javadoc metadata annotations follow, see below for X3DJSAIL Java source code.
/**
 * <p> Danger Daybeacon, 4-feet tall. </p>
 <p> Related links: Catalog page <a href="../../../../HarborEquipment/NavigationAids/DangerDaybeaconIndex.html" target="_blank">DangerDaybeacon</a>,  source <a href="../../../../HarborEquipment/NavigationAids/DangerDaybeacon.java">DangerDaybeacon.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="../../../../HarborEquipment/NavigationAids/DangerDaybeacon.x3d">DangerDaybeacon.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> description </i> </td>
			<td> Danger Daybeacon, 4-feet tall </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> creator </i> </td>
			<td> Planet 9 Studios, Inc., San Francisco, CA </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> producer </i> </td>
			<td> Christian Greuel, Director of Art and Production </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> modelers </i> </td>
			<td> Danny Lee, Christian Greuel </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> <a href="http://www.planet9.com" target="_blank">http://www.planet9.com</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> translator </i> </td>
			<td> Xj3D Format Converter </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> created </i> </td>
			<td> 17 August 2006 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> translated </i> </td>
			<td> 18 August 2006 </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> license </i> </td>
			<td> <a href="../../../../HarborEquipment/NavigationAids/../../license.html">../../license.html</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/HarborEquipment/NavigationAids/DangerDaybeacon.x3d" target="_blank">https://www.web3d.org/x3d/content/examples/Savage/HarborEquipment/NavigationAids/DangerDaybeacon.x3d</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 Planet 9 Studios, Inc., San Francisco, CA
 */

public class DangerDaybeacon
{
	/** Default constructor to create this object. */
	public DangerDaybeacon ()
	{
	  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("DangerDaybeacon.x3d"))
    .addMeta(new meta().setName(meta.NAME_DESCRIPTION).setContent("Danger Daybeacon, 4-feet tall"))
    .addMeta(new meta().setName(meta.NAME_CREATOR    ).setContent("Planet 9 Studios, Inc., San Francisco, CA"))
    .addMeta(new meta().setName("producer").setContent("Christian Greuel, Director of Art and Production"))
    .addMeta(new meta().setName("modelers").setContent("Danny Lee, Christian Greuel"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("http://www.planet9.com"))
    .addMeta(new meta().setName(meta.NAME_TRANSLATOR ).setContent("Xj3D Format Converter"))
    .addMeta(new meta().setName(meta.NAME_CREATED    ).setContent("17 August 2006"))
    .addMeta(new meta().setName(meta.NAME_TRANSLATED ).setContent("18 August 2006"))
    .addMeta(new meta().setName(meta.NAME_MODIFIED   ).setContent("20 October 2019"))
    .addMeta(new meta().setName(meta.NAME_LICENSE    ).setContent("../../license.html"))
    .addMeta(new meta().setName(meta.NAME_IDENTIFIER ).setContent("https://www.web3d.org/x3d/content/examples/Savage/HarborEquipment/NavigationAids/DangerDaybeacon.x3d")))
  .setScene(new Scene()
    .addChild(new WorldInfo().setTitle("DangerDaybeacon.x3d"))
    .addChild(new Group("DangerDaybeacon")
      .addChild(new Group("DaybeaconDangerPile")
        .addChild(new Shape()
          .setAppearance(new Appearance()
            .setMaterial(new Material("Danger_1").setAmbientIntensity(0.0).setDiffuseColor(0.588235,0.588235,0.588235).setShininess(0.145))
            .setTexture(new ImageTexture().setUrl(new String[] {"Textures/BeaconStand06.jpg","https://www.web3d.org/x3d/content/examples/Savage/HarborEquipment/NavigationAids/Textures/BeaconStand06.jpg"})))
          .setGeometry(new IndexedFaceSet().setCoordIndex(new int[] {0,9,8,-1,0,1,9,-1,1,10,9,-1,1,2,10,-1,2,11,10,-1,2,3,11,-1,3,12,11,-1,3,4,12,-1,4,13,12,-1,4,5,13,-1,5,14,13,-1,5,6,14,-1,6,15,14,-1,6,7,15,-1,7,8,15,-1,7,0,8,-1}).setNormalIndex(new int[] {3,3,3,-1,3,3,3,-1,4,4,4,-1,4,4,4,-1,8,8,8,-1,8,8,8,-1,6,6,6,-1,6,6,6,-1,0,0,0,-1,0,0,0,-1,1,1,1,-1,1,1,1,-1,7,7,7,-1,7,7,7,-1,5,5,5,-1,5,5,5,-1}).setTexCoordIndex(new int[] {0,9,8,-1,0,1,9,-1,1,10,9,-1,1,2,10,-1,16,11,17,-1,16,3,11,-1,3,12,11,-1,3,4,12,-1,4,13,12,-1,4,5,13,-1,5,14,13,-1,5,6,14,-1,6,15,14,-1,6,7,15,-1,7,8,15,-1,7,0,8,-1})
            .setCoord(new Coordinate("DaybeaconDangerPile-COORD").setPoint(new MFVec3f(new double[] {0.0,0.0,0.0865,0.061165,0.0,0.061165,0.0865,0.0,0.0,0.061165,0.0,-0.061165,0.0,0.0,-0.0865,-0.061165,0.0,-0.061165,-0.0865,0.0,0.0,-0.061165,0.0,0.061165,0.0,0.879067,0.0865,0.061165,0.879067,0.061165,0.0865,0.879067,0.0,0.061165,0.879067,-0.061165,0.0,0.879067,-0.0865,-0.061165,0.879067,-0.061165,-0.0865,0.879067,0.0,-0.061165,0.879067,0.061165})))
            .setNormal(new Normal("Danger_2").setVector(new MFVec3f(new double[] {-0.3826,0.0,-0.9238,-0.9238,0.0,-0.3826,0.0,1.0,0.0,0.3826,0.0,0.9238,0.9238,0.0,0.3826,-0.3826,0.0,0.9238,0.3826,0.0,-0.9238,-0.9238,0.0,0.3826,0.9238,0.0,-0.3826})))
            .setTexCoord(new TextureCoordinate("DaybeaconDangerPile-TEXCOORD").setPoint(new MFVec2f(new double[] {2.25,0.235249,2.625,0.235249,3.0,0.235249,0.375,0.235249,0.75,0.235249,1.125,0.235249,1.5,0.235249,1.875,0.235249,2.25,0.963385,2.625,0.963385,3.0,0.963385,0.375,0.963385,0.75,0.963385,1.125,0.963385,1.5,0.963385,1.875,0.963385,0.0,0.235249,0.0,0.963385,1.4612,1.4612,1.85934,0.5,0.5,1.85934,-0.461196,1.4612,-0.859337,0.5,-0.461196,-0.461196,0.5,-0.859337,1.4612,-0.461196})))))
        .addChild(new Shape()
          .setAppearance(new Appearance()
            .setMaterial(new Material().setUSE("Danger_1"))
            .setTexture(new ImageTexture().setUrl(new String[] {"Textures/BeaconStand03.jpg","https://www.web3d.org/x3d/content/examples/Savage/HarborEquipment/NavigationAids/Textures/BeaconStand03.jpg"})))
          .setGeometry(new IndexedFaceSet().setCoordIndex(new int[] {8,9,10,-1,8,10,11,-1,8,11,12,-1,8,12,13,-1,8,13,14,-1,8,14,15,-1}).setNormalIndex(new int[] {2,2,2,-1,2,2,2,-1,2,2,2,-1,2,2,2,-1,2,2,2,-1,2,2,2,-1}).setTexCoordIndex(new int[] {19,18,20,-1,19,20,21,-1,19,21,22,-1,19,22,23,-1,19,23,24,-1,19,24,25,-1})
            .setCoord(new Coordinate().setUSE("DaybeaconDangerPile-COORD"))
            .setNormal(new Normal().setUSE("Danger_2"))
            .setTexCoord(new TextureCoordinate().setUSE("DaybeaconDangerPile-TEXCOORD")))))
      .addChild(new Transform("DaybeaconDangerText1").setTranslation(0.0,0.878791,0.0)
        .addChild(new Shape()
          .setAppearance(new Appearance("Danger_3")
            .setMaterial(new Material().setUSE("Danger_1"))
            .setTexture(new ImageTexture().setUrl(new String[] {"Textures/DaybeaconWarning.jpg","https://www.web3d.org/x3d/content/examples/Savage/HarborEquipment/NavigationAids/Textures/DaybeaconWarning.jpg"})))
          .setGeometry(new IndexedFaceSet().setCoordIndex(new int[] {6,7,4,-1,5,4,7,-1}).setNormalIndex(new int[] {0,0,0,-1,0,0,0,-1}).setTexCoordIndex(new int[] {8,9,10,-1,11,10,9,-1})
            .setCoord(new Coordinate("DaybeaconDangerText1-COORD").setPoint(new MFVec3f(new double[] {0.000275,-0.340394,0.0962,-0.339843,-0.000275,0.0962,0.339843,0.000275,0.0962,-0.000275,0.340394,0.0962,-0.000101,-0.26277,0.0962,-0.262972,0.000101,0.0962,0.262609,0.000262,0.0962,-0.000261,0.263134,0.0962})))
            .setNormal(new Normal("Danger_4").setVector(new MFVec3f(new double[] {0.0,0.0,1.0,0.0,0.0,-1.0})))
            .setTexCoord(new TextureCoordinate("DaybeaconDangerText1-TEXCOORD").setPoint(new MFVec2f(new double[] {0.999501,0.000499,0.002115,0.000499,0.997885,0.999501,0.000499,0.9995,0.948565,0.05045,0.050918,0.050449,0.948015,0.949551,0.050368,0.949551,0.999501,0.500153,0.499847,0.999501,0.500153,0.000499,0.000499,0.499847})))))
        .addChild(new Shape()
          .setAppearance(new Appearance("Danger_5")
            .setMaterial(new Material().setAmbientIntensity(0.0).setDiffuseColor(0.752941,0.305882,0.066666).setEmissiveColor(0.752941,0.305882,0.066666).setShininess(0.145))
            .setTexture(new ImageTexture().setUrl(new String[] {"Textures/DaybeaconOrange.jpg","https://www.web3d.org/x3d/content/examples/Savage/HarborEquipment/NavigationAids/Textures/DaybeaconOrange.jpg"})))
          .setGeometry(new IndexedFaceSet().setCoordIndex(new int[] {2,3,7,-1,7,6,2,-1,0,2,6,-1,6,4,0,-1,1,0,4,-1,4,5,1,-1,3,1,5,-1,5,7,3,-1}).setNormalIndex(new int[] {0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0,0,-1}).setTexCoordIndex(new int[] {2,3,7,-1,7,6,2,-1,0,2,6,-1,6,4,0,-1,1,0,4,-1,4,5,1,-1,3,1,5,-1,5,7,3,-1})
            .setCoord(new Coordinate().setUSE("DaybeaconDangerText1-COORD"))
            .setNormal(new Normal().setUSE("Danger_4"))
            .setTexCoord(new TextureCoordinate().setUSE("DaybeaconDangerText1-TEXCOORD"))))
        .addChild(new Shape()
          .setAppearance(new Appearance("Danger_6")
            .setMaterial(new Material().setUSE("Danger_1"))
            .setTexture(new ImageTexture().setUrl(new String[] {"Textures/DaybeaconBack.jpg","https://www.web3d.org/x3d/content/examples/Savage/HarborEquipment/NavigationAids/Textures/DaybeaconBack.jpg"})))
          .setGeometry(new IndexedFaceSet().setCoordIndex(new int[] {3,2,0,-1,0,1,3,-1}).setNormalIndex(new int[] {1,1,1,-1,1,1,1,-1}).setTexCoordIndex(new int[] {7,6,4,-1,4,5,7,-1})
            .setCoord(new Coordinate().setUSE("DaybeaconDangerText1-COORD"))
            .setNormal(new Normal().setUSE("Danger_4"))
            .setTexCoord(new TextureCoordinate().setUSE("DaybeaconDangerText1-TEXCOORD")))))
      .addChild(new Transform("DaybeaconDangerText2").setRotation(0.0,-1.0,0.0,-3.14159).setTranslation(0.0,0.878791,0.0)
        .addChild(new Shape()
          .setAppearance(new Appearance().setUSE("Danger_3"))
          .setGeometry(new IndexedFaceSet().setCoordIndex(new int[] {6,7,4,-1,5,4,7,-1}).setNormalIndex(new int[] {0,0,0,-1,0,0,0,-1}).setTexCoordIndex(new int[] {8,9,10,-1,11,10,9,-1})
            .setCoord(new Coordinate("DaybeaconDangerText2-COORD").setPoint(new MFVec3f(new double[] {2.75E-4,-0.340394,0.0962,-0.339843,-2.75E-4,0.0962,0.339843,2.75E-4,0.0962,-2.75E-4,0.340394,0.0962,-1.01E-4,-0.26277,0.0962,-0.262972,1.01E-4,0.0962,0.262609,2.62E-4,0.0962,-2.61E-4,0.263134,0.0962})))
            .setNormal(new Normal().setUSE("Danger_4"))
            .setTexCoord(new TextureCoordinate("DaybeaconDangerText2-TEXCOORD").setPoint(new MFVec2f(new double[] {0.999501,4.99E-4,0.002115,4.99E-4,0.997885,0.999501,4.99E-4,0.9995,0.948565,0.05045,0.050918,0.050449,0.948015,0.949551,0.050368,0.949551,0.999501,0.500153,0.499847,0.999501,0.500153,4.99E-4,4.99E-4,0.499847})))))
        .addChild(new Shape()
          .setAppearance(new Appearance().setUSE("Danger_5"))
          .setGeometry(new IndexedFaceSet().setCoordIndex(new int[] {2,3,7,-1,7,6,2,-1,0,2,6,-1,6,4,0,-1,1,0,4,-1,4,5,1,-1,3,1,5,-1,5,7,3,-1}).setNormalIndex(new int[] {0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0,0,-1}).setTexCoordIndex(new int[] {2,3,7,-1,7,6,2,-1,0,2,6,-1,6,4,0,-1,1,0,4,-1,4,5,1,-1,3,1,5,-1,5,7,3,-1})
            .setCoord(new Coordinate().setUSE("DaybeaconDangerText2-COORD"))
            .setNormal(new Normal().setUSE("Danger_4"))
            .setTexCoord(new TextureCoordinate().setUSE("DaybeaconDangerText2-TEXCOORD"))))
        .addChild(new Shape()
          .setAppearance(new Appearance().setUSE("Danger_6"))
          .setGeometry(new IndexedFaceSet().setCoordIndex(new int[] {3,2,0,-1,0,1,3,-1}).setNormalIndex(new int[] {1,1,1,-1,1,1,1,-1}).setTexCoordIndex(new int[] {7,6,4,-1,4,5,7,-1})
            .setCoord(new Coordinate().setUSE("DaybeaconDangerText2-COORD"))
            .setNormal(new Normal().setUSE("Danger_4"))
            .setTexCoord(new TextureCoordinate().setUSE("DaybeaconDangerText2-TEXCOORD")))))));
            }
            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 DangerDaybeacon 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 DangerDaybeacon().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.HarborEquipment.NavigationAids.DangerDaybeacon\" 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.HarborEquipment.NavigationAids.DangerDaybeacon self-validation test confirmation: ");
                if (!validationResults.equals("success"))
                    System.out.println();
                System.out.println(validationResults.trim());

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