package Savage.ShipsMilitary.DDGArleighBurkeUnitedStates;
/*
Copyright (c) 1995-2019 held by the author(s). All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of the Web3D Consortium (http://www.web3D.org)
nor the names of its contributors may be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import java.util.*;
import org.web3d.x3d.jsail.Core.*;
import org.web3d.x3d.jsail.fields.*;
import org.web3d.x3d.jsail.Grouping.*;
import org.web3d.x3d.jsail.Networking.*;
// Javadoc annotations follow, see below for source.
/**
*
Prototype for an Arleigh Burke (DDG51) Class Navy Destroyer. Proto allows weapon placements, hull number, and ship name markings.
Related links: ArleighBurkeHighDetailPrototype.java source, ArleighBurkeHighDetailPrototype catalog page, X3D Resources, X3D Scene Authoring Hints, and X3D Tooltips.
This program uses the
X3D Java Scene Access Interface Library (X3DJSAIL).
It has been produced using the
X3dToJava.xslt
stylesheet to create Java source code from an .x3d
model.
* @author Patrick Sullivan
*/
public class ArleighBurkeHighDetailPrototype
{
/** Default constructor to create this object. */
public ArleighBurkeHighDetailPrototype ()
{
initialize();
}
/** Create and initialize the X3D model for this object. */
public final void initialize()
{
x3dModel = new X3DObject().setProfile(X3DObject.PROFILE_IMMERSIVE).setVersion(X3DObject.VERSION_3_0)
.setHead(new headObject()
.addMeta(new metaObject().setName(metaObject.NAME_TITLE ).setContent("ArleighBurkeHighDetailPrototype.x3d"))
.addMeta(new metaObject().setName(metaObject.NAME_DESCRIPTION).setContent("Prototype for an Arleigh Burke (DDG51) Class Navy Destroyer. Proto allows weapon placements, hull number, and ship name markings"))
.addMeta(new metaObject().setName(metaObject.NAME_CREATOR ).setContent("Patrick Sullivan"))
.addMeta(new metaObject().setName(metaObject.NAME_CREATED ).setContent("27 May 2006"))
.addMeta(new metaObject().setName(metaObject.NAME_MODIFIED ).setContent("14 January 2014"))
.addMeta(new metaObject().setName(metaObject.NAME_SUBJECT ).setContent("Prototypes, DDG51, Arleigh Burke destroyer"))
.addMeta(new metaObject().setName(metaObject.NAME_IDENTIFIER ).setContent("https://savage.nps.edu/Savage/ShipsMilitary/DDG-ArleighBurke-UnitedStates/ArleighBurkeHighDetailPrototype.x3d"))
.addMeta(new metaObject().setName(metaObject.NAME_LICENSE ).setContent("../../license.html")))
.setScene(new SceneObject()
.addChild(new ExternProtoDeclareObject("HullNumber").setName("HullNumber").setUrl(new String[] {"../../../Savage/ModelDetailing/HullNumbers/HullNumberPrototype.x3d#HullNumber","https://savage.nps.edu/Savage/ModelDetailing/HullNumbers/HullNumberPrototype.x3d#HullNumber"})
.addField(new fieldObject().setName("FirstNumber").setType(fieldObject.TYPE_SFINT32).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setAppinfo("[0-9] (-1 will prevent rendering)"))
.addField(new fieldObject().setName("SecondNumber").setType(fieldObject.TYPE_SFINT32).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setAppinfo("[0-9] (-1 will prevent rendering)")))
.addChild(new ProtoDeclareObject("DDG51").setName("DDG51").setAppinfo("Prototype of a DDG51 Class Destroyer")
.setProtoInterface(new ProtoInterfaceObject()
.addField(new fieldObject().setName("ISIC").setType(fieldObject.TYPE_MFSTRING).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setValue(new String[] {"none"}).setAppinfo("URL for the ISIC seal that is found on the side of most navy ships (e.g. \"../../ShipCrests/COMDESRON31/DESRON31.x3d\")"))
.addField(new fieldObject().setName("HullNumber1").setType(fieldObject.TYPE_SFINT32).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setValue(-1).setAppinfo("The first (or only) digit of the ship's hull number [0-9]. Note -1 for no number"))
.addField(new fieldObject().setName("HullNumber2").setType(fieldObject.TYPE_SFINT32).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setValue(-1).setAppinfo("The second digit of the ship's hull number [0-9]. Note: -1 for no number"))
.addField(new fieldObject().setName("ForwardBowWeapon").setType(fieldObject.TYPE_MFSTRING).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setValue(new String[] {"none"}).setAppinfo("URL for the model that represents the weapon at this location. [example \"http://www.web3d.org/content/examples/Savage/Weapons/50Cal.x3d\")"))
.addField(new fieldObject().setName("StarboardBowWeapon").setType(fieldObject.TYPE_MFSTRING).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setValue(new String[] {"none"}).setAppinfo("URL for the model that represents the weapon at this location. [example \"http://www.web3d.org/content/examples/Savage/Weapons/50Cal.x3d\")"))
.addField(new fieldObject().setName("PortBowWeapon").setType(fieldObject.TYPE_MFSTRING).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setValue(new String[] {"none"}).setAppinfo("URL for the model that represents the weapon at this location. [example \"http://www.web3d.org/content/examples/Savage/Weapons/50Cal.x3d\")"))
.addField(new fieldObject().setName("StarboardBridgeWeapon").setType(fieldObject.TYPE_MFSTRING).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setValue(new String[] {"none"}).setAppinfo("URL for the model that represents the weapon at this location. [example \"http://www.web3d.org/content/examples/Savage/Weapons/50Cal.x3d\")"))
.addField(new fieldObject().setName("PortBridgeWeapon").setType(fieldObject.TYPE_MFSTRING).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setValue(new String[] {"none"}).setAppinfo("URL for the model that represents the weapon at this location. [example \"http://www.web3d.org/content/examples/Savage/Weapons/50Cal.x3d\")"))
.addField(new fieldObject().setName("StarboardMidshipWeapon").setType(fieldObject.TYPE_MFSTRING).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setValue(new String[] {"none"}).setAppinfo("URL for the model that represents the weapon at this location. [example \"http://www.web3d.org/content/examples/Savage/Weapons/50Cal.x3d\")"))
.addField(new fieldObject().setName("PortMidshipWeapon").setType(fieldObject.TYPE_MFSTRING).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setValue(new String[] {"none"}).setAppinfo("URL for the model that represents the weapon at this location. [example \"http://www.web3d.org/content/examples/Savage/Weapons/50Cal.x3d\")"))
.addField(new fieldObject().setName("StarboardFlightDeckWeapon").setType(fieldObject.TYPE_MFSTRING).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setValue(new String[] {"none"}).setAppinfo("URL for the model that represents the weapon at this location. [example \"http://www.web3d.org/content/examples/Savage/Weapons/50Cal.x3d\")"))
.addField(new fieldObject().setName("PortFlightDeckWeapon").setType(fieldObject.TYPE_MFSTRING).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setValue(new String[] {"none"}).setAppinfo("URL for the model that represents the weapon at this location. [example \"http://www.web3d.org/content/examples/Savage/Weapons/50Cal.x3d\")"))
.addField(new fieldObject().setName("SternFlightDeckWeapon").setType(fieldObject.TYPE_MFSTRING).setAccessType(fieldObject.ACCESSTYPE_INPUTOUTPUT).setValue(new String[] {"none"}).setAppinfo("URL for the model that represents the weapon at this location. [example \"http://www.web3d.org/content/examples/Savage/Weapons/50Cal.x3d\")")))
.setProtoBody(new ProtoBodyObject()
.addChild(new TransformObject()
.addComments(" Ship Model ")
.addChild(new TransformObject("DDG51ShipModel")
.addChild(new InlineObject().setUrl(new String[] {"../../../Savage/ShipsMilitary/DDG-ArleighBurke-UnitedStates/ArleighBurkeHighDetail.x3d","https://savage.nps.edu/Savage/ShipsMilitary/DDG-ArleighBurke-UnitedStates/ArleighBurkeHighDetail.x3d"})))
.addComments(" Hull Numbers ")
.addChild(new TransformObject("StarboardBowHullNumber").setRotation(0.85f,0.499f,-0.163f,.729f).setTranslation(70.513f,5.099f,2.082f)
.addChild(new ProtoInstanceObject("HullNumber", "ShipNumber")
.setIS(new ISObject()
.addConnect(new connectObject().setNodeField("FirstNumber").setProtoField("HullNumber1"))
.addConnect(new connectObject().setNodeField("SecondNumber").setProtoField("HullNumber2")))))
.addChild(new TransformObject("PortBowHullNumber").setRotation(.047f,.967f,-.249f,2.776f).setTranslation(71.44f,5.429f,-3.826f)
.addChild(new ProtoInstanceObject("HullNumber")
.setIS(new ISObject()
.addConnect(new connectObject().setNodeField("FirstNumber").setProtoField("HullNumber1"))
.addConnect(new connectObject().setNodeField("SecondNumber").setProtoField("HullNumber2")))))
.addComments(" ISIC Seals ")
.addChild(new TransformObject("StarboardSeal").setRotation(1.0f,0.0f,0.0f,-.249f).setTranslation(16.615f,16.528f,1.856f)
.addChild(new TransformObject()
.addChild(new InlineObject("ISICSeal")
.setIS(new ISObject()
.addConnect(new connectObject().setNodeField("url").setProtoField("ISIC"))))))
.addChild(new TransformObject("PortSeal").setRotation(1.0f,0.0f,0.0f,.251f).setTranslation(16.615f,16.528f,-3.808f)
.addChild(new TransformObject().setRotation(0.0f,1.0f,0.0f,-3.14f)
.addChild(new InlineObject().setUSE("ISICSeal"))))
.addComments(" Weapon Placements ")
.addChild(new TransformObject("ForwardBowWeapon").setRotation(0.0f,1.0f,0.0f,3.14f).setTranslation(75.405f,10.171f,2.394f)
.addChild(new InlineObject()
.setIS(new ISObject()
.addConnect(new connectObject().setNodeField("url").setProtoField("ForwardBowWeapon")))))
.addChild(new TransformObject("StarboardBowWeapon").setRotation(0.0f,1.0f,0.0f,3.14f).setTranslation(43.981f,7.816f,8.47f)
.addChild(new InlineObject()
.setIS(new ISObject()
.addConnect(new connectObject().setNodeField("url").setProtoField("StarboardBowWeapon")))))
.addChild(new TransformObject("PortBowWeapon").setTranslation(43.981f,7.816f,-10.049f)
.addChild(new InlineObject()
.setIS(new ISObject()
.addConnect(new connectObject().setNodeField("url").setProtoField("PortBowWeapon")))))
.addChild(new TransformObject("StarboardBridgeWeapon").setRotation(0.0f,1.0f,0.0f,-1.57f).setTranslation(29.833f,16.4f,7.702f)
.addChild(new InlineObject()
.setIS(new ISObject()
.addConnect(new connectObject().setNodeField("url").setProtoField("StarboardBridgeWeapon")))))
.addChild(new TransformObject("PortBridgeWeapon").setRotation(0.0f,1.0f,0.0f,1.57f).setTranslation(30.399f,16.4f,-9.104f)
.addChild(new InlineObject()
.setIS(new ISObject()
.addConnect(new connectObject().setNodeField("url").setProtoField("PortBridgeWeapon")))))
.addChild(new TransformObject("StarboardMidshipWeapon").setRotation(0.0f,1.0f,0.0f,-1.57f).setTranslation(10.066f,6.2f,8.632f)
.addChild(new InlineObject()
.setIS(new ISObject()
.addConnect(new connectObject().setNodeField("url").setProtoField("StarboardMidshipWeapon")))))
.addChild(new TransformObject("PortMidshipWeapon").setRotation(0.0f,1.0f,0.0f,1.57f).setTranslation(10.066f,6.2f,-9.793f)
.addChild(new InlineObject()
.setIS(new ISObject()
.addConnect(new connectObject().setNodeField("url").setProtoField("PortMidshipWeapon")))))
.addChild(new TransformObject("StarboardFlightDeckWeapon").setRotation(0.0f,1.0f,0.0f,3.14f).setTranslation(-51.47f,3.922f,8.129f)
.addChild(new InlineObject()
.setIS(new ISObject()
.addConnect(new connectObject().setNodeField("url").setProtoField("StarboardFlightDeckWeapon")))))
.addChild(new TransformObject("PortFlightDeckWeapon").setTranslation(-51.686f,3.922f,-9.088f)
.addChild(new InlineObject()
.setIS(new ISObject()
.addConnect(new connectObject().setNodeField("url").setProtoField("PortFlightDeckWeapon")))))
.addChild(new TransformObject("SternFlightDeckWeapon").setRotation(0.0f,1.0f,0.0f,1.57f).setTranslation(-71.592f,3.922f,6.292f)
.addChild(new InlineObject()
.setIS(new ISObject()
.addConnect(new connectObject().setNodeField("url").setProtoField("SternFlightDeckWeapon")))))))));
}
// end of initialize() method
/** The initialized model object, created within initialize() method. */
private X3DObject x3dModel;
/** Provide a
* shallow copy
* of the X3D model.
* @see X3DObject
* @return ArleighBurkeHighDetailPrototype model
*/
public X3DObject 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 X3DObject.handleArguments(args)
* @see X3DObject.validationReport()
* @see CommandLine
* @see CommandLine.USAGE
* @see ConfigurationProperties
*/
public static void main(String args[])
{
X3DObject thisExampleX3dObject = new ArleighBurkeHighDetailPrototype().getX3dModel();
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(X3DObject.FILE_EXTENSION_X3D) ||
arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_CLASSICVRML) ||
arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_X3DB) ||
arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_VRML97) ||
arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_EXI) ||
arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_GZIP) ||
arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_ZIP) ||
arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_HTML) ||
arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_XHTML))
{
argumentsLoadNewModel = true;
fileName = arg;
}
}
}
if (argumentsLoadNewModel)
System.out.println("WARNING: \"ArleighBurkeHighDetailPrototype\" 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
thisExampleX3dObject.handleArguments(args);
if (validate)
{
System.out.print("Java program \"ArleighBurkeHighDetailPrototype\" self-validation test results: ");
String validationResults = thisExampleX3dObject.validationReport();
System.out.println(validationResults);
}
}
}