package Savage.Weapons.UnderwaterMines;

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

// Javadoc metadata annotations follow, see below for X3DJSAIL Java source code.
/**
 * <p> Example instance of prototype for a reported mine-like contact. </p>
 <p> Related links: Catalog page <a href="../../../../Weapons/UnderwaterMines/ReportedContactPrototypeIndex.html" target="_blank">ReportedContactPrototype</a>,  source <a href="../../../../Weapons/UnderwaterMines/ReportedContactPrototype.java">ReportedContactPrototype.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="../../../../Weapons/UnderwaterMines/ReportedContactPrototype.x3d">ReportedContactPrototype.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> description </i> </td>
			<td> Example instance of prototype for a reported mine-like contact. </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> creator </i> </td>
			<td> Don Brutzman, Jeff Weekley, Frederic Roussille and Jane Wu </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> created </i> </td>
			<td> 15 October 2001 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> modified </i> </td>
			<td> 28 November 2019 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> <a href="../../../../Weapons/UnderwaterMines//ads/src/mil/navy/nps/ads/x3dArchive/DataArchiver.java">/ads/src/mil/navy/nps/ads/x3dArchive/DataArchiver.java</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> <a href="../../../../Weapons/UnderwaterMines//ads/doc/mil/navy/nps/ads/x3dArchive/DataArchiver.html">/ads/doc/mil/navy/nps/ads/x3dArchive/DataArchiver.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/Weapons/UnderwaterMines/ReportedContactPrototype.x3d" target="_blank">https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/ReportedContactPrototype.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> generator </i> </td>
			<td> X3D-Edit 3.3, <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="../../../../Weapons/UnderwaterMines/../../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, Jeff Weekley, Frederic Roussille and Jane Wu
 */

public class ReportedContactPrototype
{
	/** Default constructor to create this object. */
	public ReportedContactPrototype ()
	{
	  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("ReportedContactPrototype.x3d"))
    .addMeta(new meta().setName(meta.NAME_DESCRIPTION).setContent("Example instance of prototype for a reported mine-like contact."))
    .addMeta(new meta().setName(meta.NAME_CREATOR    ).setContent("Don Brutzman, Jeff Weekley, Frederic Roussille and Jane Wu"))
    .addMeta(new meta().setName(meta.NAME_CREATED    ).setContent("15 October 2001"))
    .addMeta(new meta().setName(meta.NAME_MODIFIED   ).setContent("28 November 2019"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("/ads/src/mil/navy/nps/ads/x3dArchive/DataArchiver.java"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("/ads/doc/mil/navy/nps/ads/x3dArchive/DataArchiver.html"))
    .addMeta(new meta().setName(meta.NAME_IDENTIFIER ).setContent("https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/ReportedContactPrototype.x3d"))
    .addMeta(new meta().setName(meta.NAME_GENERATOR  ).setContent("X3D-Edit 3.3, 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("ReportedContactPrototype.x3d"))
    .addChild(new ExternProtoDeclare("Pdm1BottomMine").setName("Pdm1BottomMine").setAppinfo("PDM-1 underwater mine").setUrl(new String[] {"Pdm1BottomMinePrototype.x3d#Pdm1BottomMine","https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/Pdm1BottomMinePrototype.x3d#Pdm1BottomMine","Pdm1BottomMinePrototype.wrl#Pdm1BottomMine","https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/Pdm1BottomMinePrototype.wrl#Pdm1BottomMine"})
      .addField(new field().setName("viewpointDescription").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("customize to match each instance"))
      .addField(new field().setName("mineColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("useful for classification")))
    .addChild(new ExternProtoDeclare("MantaMine").setName("MantaMine").setAppinfo("Manta underwater mine").setUrl(new String[] {"MantaMinePrototype.x3d#MantaMine","https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/MantaMinePrototype.x3d#MantaMine","MantaMinePrototype.wrl#MantaMine","https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/MantaMinePrototype.wrl#MantaMine"})
      .addField(new field().setName("MineColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("useful for visual classification"))
      .addField(new field().setName("viewpointDescription").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("describe each instance")))
    .addChild(new ExternProtoDeclare("SphericalMine").setName("SphericalMine").setAppinfo("Spherical floating mine moored to bottom").setUrl(new String[] {"SphericalMinePrototype.x3d#SphericalMine","https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/SphericalMinePrototype.x3d#SphericalMine","SphericalMinePrototype.wrl#SphericalMine","https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/SphericalMinePrototype.wrl#SphericalMine"})
      .addField(new field().setName("description").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Description for each mine contact."))
      .addField(new field().setName("color").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("Mine color can be used to indicate status (found/unknown/disabled/) tactic etc."))
      .addField(new field().setName("translation").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("Location of mine center in local world coordinates."))
      .addField(new field().setName("scale").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("Scale factor to change spherical mine size default diameter = 1m."))
      .addField(new field().setName("bboxCenter").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Bounding box for collision detection of mine."))
      .addField(new field().setName("tetherPoints").setType(field.TYPE_MFVEC3F).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("Top and bottom endpoints of line tether that anchors this mine to the bottom."))
      .addField(new field().setName("proximityIsActive").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("proximityIsActive can be used to activate information or interaction when the viewer nears the mine."))
      .addField(new field().setName("proximitySize").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("proximitySize provides overall box dimensions for proximity; thus (10 10 10) yields approximate radius 5 to 7 meters.")))
    .addChild(new ProtoDeclare("ReportedContact").setName("ReportedContact").setAppinfo("Provide icon and contact information for a reported contact. Position ProtoInstances using the depth and location where found.")
      .setProtoInterface(new ProtoInterface()
        .addField(new field().setName("name").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY))
        .addField(new field().setName("aboveViewpointLabel").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setValue("Reported Contact (100m above)"))
        .addField(new field().setName("closeViewpointLabel").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setValue("Reported Contact (10m closeup)"))
        .addField(new field().setName("description").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INPUTOUTPUT))
        .addField(new field().setName("reportedPosition").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("Latitude and longitude (or local coordinates) for display purposes."))
        .addField(new field().setName("classificationCode").setType(field.TYPE_SFINT32).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setValue(-1))
        .addField(new field().setName("imageUrl").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("provide filename and url of contact image as separate quoted strings"))
        .addField(new field().setName("imageScale").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setValue(new SFVec3f(1.00,1.00,1.0)).setAppinfo("Aspect-ratio x-y scale of image icon (keep z=1)"))
        .addField(new field().setName("imageOffset").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setValue(new SFVec3f(0.0,2.5,0.0)).setAppinfo("Relative position of image icon"))
        .addField(new field().setName("textColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setValue(new SFColor(0.4,0.4,0.0)))
        .addField(new field().setName("textOffset").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setValue(new SFVec3f(0.0,0.0,0.0)).setAppinfo("Relative position of image icon")))
      .setProtoBody(new ProtoBody()
        .addChild(new Group()
          .addChild(new Viewpoint("SeenFromAboveViewpoint").setDescription("100m above contact (overridden by field viewpointLabel)").setOrientation(1.0,0.0,0.0,-1.57).setPosition(0.0,100.0,0.0)
            .setIS(new IS()
              .addConnect(new connect().setNodeField("description").setProtoField("aboveViewpointLabel"))))
          .addChild(new Viewpoint("ContactCloseupViewpoint").setDescription("10m next to contact (overridden by closeViewpointLabel)")
            .setIS(new IS()
              .addConnect(new connect().setNodeField("description").setProtoField("closeViewpointLabel"))))
          .addChild(new LOD().setRange(new double[] {150.0,10000.0})
            .addComments(" close range ")
            .addChild(new Group()
              .addChild(new Transform("TextOffset")
                .setIS(new IS()
                  .addConnect(new connect().setNodeField("translation").setProtoField("textOffset")))
                .addChild(new Billboard()
                  .addChild(new Transform().setTranslation(0.0,-0.25,0.0)
                    .addChild(new Shape()
                      .setGeometry(new Text("PositionText")
                        .setIS(new IS()
                          .addConnect(new connect().setNodeField("string").setProtoField("reportedPosition")))
                        .setFontStyle(new FontStyle("SmallFont").setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE).setSize(0.75)))
                      .setAppearance(new Appearance("IconAppearance")
                        .setMaterial(new Material("IconMaterial")
                          .setIS(new IS()
                            .addConnect(new connect().setNodeField("diffuseColor").setProtoField("textColor")))))))
                  .addChild(new Transform().setTranslation(0.0,-1.5,0.0)
                    .addChild(new Shape()
                      .setGeometry(new Text("DescriptionText")
                        .setIS(new IS()
                          .addConnect(new connect().setNodeField("string").setProtoField("description")))
                        .setFontStyle(new FontStyle("SmallerFont").setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE).setSize(0.6)))
                      .setAppearance(new Appearance().setUSE("IconAppearance"))))))
              .addChild(new Transform("ImageOffset")
                .setIS(new IS()
                  .addConnect(new connect().setNodeField("translation").setProtoField("imageOffset")))
                .addChild(new Billboard().setAxisOfRotation(0.0,0.0,0.0)
                  .addChild(new Anchor("BillBoardAnchor").setDescription("click image to popup image viewer").setParameter(new String[] {"target=_blank"})
                    .setIS(new IS()
                      .addConnect(new connect().setNodeField("url").setProtoField("imageUrl")))
                    .addChild(new Transform("ImageFit")
                      .setIS(new IS()
                        .addConnect(new connect().setNodeField("scale").setProtoField("imageScale")))
                      .addChild(new Shape()
                        .setAppearance(new Appearance()
                          .setMaterial(new Material().setUSE("IconMaterial"))
                          .setTexture(new ImageTexture("ContactImage")
                            .setIS(new IS()
                              .addConnect(new connect().setNodeField("url").setProtoField("imageUrl")))))
                        .setGeometry(new IndexedFaceSet().setCoordIndex(new int[] {0,1,2,3,0,-1})
                          .setCoord(new Coordinate("TwoByTwoSquare").setPoint(new MFVec3f(new double[] {-1.0,-1.0,0.0,1.0,-1.0,0.0,1.0,1.0,0.0,-1.0,1.0,0.0})))))))
                  .addComments(" Unfortunately the anchor link connects to the viewpoint DEF name, which can't be overridden at runtime. This means that multiple use of the prototype will not resolve properly. ")
                  .addChild(new Anchor("ViewpointAnchor").setDescription("click text for Contact Closeup Viewpoint").setUrl(new String[] {"#ContactCloseupViewpoint"})
                    .addComments(" TODO Add children nodes here "))
                  .addChild(new Group()
                    .addChild(new Transform().setTranslation(0.0,-2.0,0.0)
                      .addChild(new Shape()
                        .setGeometry(new Text("NameText")
                          .setIS(new IS()
                            .addConnect(new connect().setNodeField("string").setProtoField("name")))
                          .setFontStyle(new FontStyle("LargeFont").setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE)))
                        .setAppearance(new Appearance().setUSE("IconAppearance"))))
                    .addChild(new TouchSensor("CloseUpTouchSensor").setDescription("bind closeup Viewpoint")))
                  .addChild(new Script("BindViewpointFilter").setSourceCode("""
ecmascript:

// only activate viewpoint when touched is true, do not unbind when false
function touched (value, timestamp)
{
	if (value == true) activate = true;
}
""")
                    .addField(new field().setName("touched").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTONLY))
                    .addField(new field().setName("activate").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_OUTPUTONLY)))
                  .addChild(new ROUTE().setFromNode("CloseUpTouchSensor").setFromField("isActive").setToNode("BindViewpointFilter").setToField("touched"))
                  .addChild(new ROUTE().setFromNode("BindViewpointFilter").setFromField("activate").setToNode("ContactCloseupViewpoint").setToField("set_bind"))))
              .addChild(new Transform().setTranslation(0.0,-3.0,0.0)
                .addChild(new Switch("MineModelSwitch").setWhichChoice(-1)
                  .setIS(new IS()
                    .addConnect(new connect().setNodeField("whichChoice").setProtoField("classificationCode")))
                  .addComments(" Mine code enumerations appear in ADS.src.mil.navy.nps.ads.x3dArchive.DataArchiver.java ")
                  .addChild(new Shape("UnknownContact")
                    .setAppearance(new Appearance()
                      .setMaterial(new Material().setDiffuseColor(0.3,0.8,0.0)))
                    .setGeometry(new Box().setSize(1.0,1.0,1.0)))
                  .addChild(new ProtoInstance("Pdm1BottomMine").setContainerField("children"))
                  .addChild(new ProtoInstance("MantaMine").setContainerField("children")
                    .addFieldValue(new fieldValue().setName("viewpointDescription").setValue("Manta mine 10m")))
                  .addChild(new Inline("RockanContact").setUrl(new String[] {"Rockan.x3d","https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/Rockan.x3d","Rockan.wrl","https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/Rockan.wrl"}))
                  .addChild(new ProtoInstance("SphericalMine").setContainerField("children")
                    .addFieldValue(new fieldValue().setName("description").setValue("Spherical Mine"))
                    .addFieldValue(new fieldValue().setName("tetherPoints").setValue(new MFVec3f(new MFVec3f(new double[] {0.0,0.0,0.0,0.0,-5.0,0.0})))))
                  .addChild(new Inline("SonarDeflectorDecoyBox").setUrl(new String[] {"SonarReflectorDecoyBox.x3d","../../Weapons/UnderwaterMines/SonarReflectorDecoyBox.x3d","https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/SonarReflectorDecoyBox.x3d","../../Weapons/UnderwaterMines/SonarReflectorDecoyBox.wrl","SonarReflectorDecoyBox.wrl","https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/SonarReflectorDecoyBox.wrl"})))))
            .addComments(" intermediate range ")
            .addChild(new Transform().setUSE("ImageOffset"))
            .addComments(" far range: might place a self-scaling icon billboard here for long-distance map-like appearance ")
            .addChild(new WorldInfo().setInfo(new String[] {"null node"}))))))
    .addComments(" ==================== ")
    .addComments(" Example scene starts here, in case this prototype is examined. ")
    .addChild(new Anchor().setDescription("ReportedContactExample").setParameter(new String[] {"target=_blank"}).setUrl(new String[] {"ReportedContactExample.x3d","https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/ReportedContactExample.x3d","ReportedContactExample.wrl","https://www.web3d.org/x3d/content/examples/Savage/Weapons/UnderwaterMines/ReportedContactExample.wrl"})
      .addChild(new Shape()
        .setGeometry(new Text().setString(new String[] {"ReportedContactPrototype","is a prototype definition file","","Click this text to see","ReportedContactExample"})
          .setFontStyle(new FontStyle().setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE)))
        .setAppearance(new Appearance()
          .setMaterial(new Material().setDiffuseColor(0.6,0.8,0.4))))));
            }
            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 ReportedContactPrototype 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 ReportedContactPrototype().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.Weapons.UnderwaterMines.ReportedContactPrototype\" 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.Weapons.UnderwaterMines.ReportedContactPrototype self-validation test confirmation: ");
                if (!validationResults.equals("success"))
                    System.out.println();
                System.out.println(validationResults.trim());

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