package Savage.ShipsMilitary.FrigateGreece;
/*
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.EnvironmentalEffects.*;
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.Shape.*;
// Javadoc annotations follow, see below for source.
/**
*
A simpler version of frigate.
Related links: GreekFrigateDesign.java source, 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 Copyright [2001] By George Stavritis
*/
public class GreekFrigateDesign
{
/** Default constructor to create this object. */
public GreekFrigateDesign ()
{
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("GreekFrigateDesign"))
.addMeta(new metaObject().setName(metaObject.NAME_CREATOR ).setContent("Copyright [2001] By George Stavritis"))
.addMeta(new metaObject().setName(metaObject.NAME_CREATED ).setContent("28 February 2001"))
.addMeta(new metaObject().setName(metaObject.NAME_MODIFIED ).setContent("16 January 2014"))
.addMeta(new metaObject().setName(metaObject.NAME_DESCRIPTION).setContent("A simpler version of frigate."))
.addMeta(new metaObject().setName(metaObject.NAME_IDENTIFIER ).setContent("https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/GreekFrigateDesign.x3d"))
.addMeta(new metaObject().setName(metaObject.NAME_GENERATOR ).setContent("X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit"))
.addMeta(new metaObject().setName(metaObject.NAME_LICENSE ).setContent("../../license.html")))
.setScene(new SceneObject()
.addChild(new BackgroundObject().setGroundAngle(new float[] {1.309f,1.570796f}).setGroundColor(new MFColorObject(new float[] {1.0f,1.0f,1.0f,0.1f,0.1f,0.5f,0.4f,0.25f,0.2f,0.1f,0.6f,0.1f})).setSkyAngle(new float[] {1.309f,1.571f}).setSkyColor(new MFColorObject(new float[] {0.0f,0.2f,0.7f,0.0f,0.5f,1.0f,1.0f,1.0f,1.0f})).setBackUrl(new String[] {"mountns.png","http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/mountns.png"}).setFrontUrl(new String[] {"mountns.png","http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/mountns.png"}).setLeftUrl(new String[] {"mountns.png","http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/mountns.png"}).setRightUrl(new String[] {"mountns.png","http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/mountns.png"}))
.addChild(new ViewpointObject().setDescription("Extruded ship hull and deck").setOrientation(0.0f,1.0f,0.0f,0.4f).setPosition(20.0f,10.0f,100.0f))
.addChild(new ViewpointObject().setDescription("High up").setOrientation(0.0f,1.0f,0.0f,0.4f).setPosition(40.0f,50.0f,250.0f))
.addChild(new ViewpointObject().setDescription("Bridge").setOrientation(0.0f,1.0f,0.0f,0.4f).setPosition(10.0f,10.0f,40.0f))
.addChild(new ViewpointObject().setDescription("Heli deck view").setOrientation(0.0f,1.0f,0.0f,-1.2f).setPosition(-120.0f,10.0f,30.0f))
.addComments(" The helicopter hagar ")
.addChild(new TransformObject().setRotation(0.0f,0.0f,1.0f,0.2f).setTranslation(0.0f,-2.0f,0.0f))
.addChild(new TransformObject().setScale(3.0f,3.0f,3.0f).setTranslation(-25.0f,26.0f,10.0f)
.addChild(new InlineObject().setUrl(new String[] {"hoistgreekflag.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/hoistgreekflag.x3d","hoistgreekflag.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/hoistgreekflag.wrl"})))
.addChild(new TransformObject().setRotation(1.0f,0.0f,0.0f,0.3f).setScale(3.0f,3.0f,3.0f).setTranslation(9.0f,-3.0f,8.0f)
.addChild(new TransformObject().setRotation(0.0f,1.0f,0.0f,0.3f)
.addChild(new InlineObject().setUrl(new String[] {"textF459.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/textF459.x3d","textF459.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/textF459.wrl"}))))
.addChild(new TransformObject().setRotation(1.0f,0.0f,0.0f,-1.2f).setScale(2.0f,2.0f,2.0f).setTranslation(-23.0f,4.0f,14.5f)
.addChild(new InlineObject().setUrl(new String[] {"harpoon.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/harpoon.x3d","harpoon.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/harpoon.wrl"})))
.addChild(new TransformObject().setRotation(1.0f,0.0f,0.0f,1.2f).setScale(2.0f,2.0f,2.0f).setTranslation(-25.0f,5.0f,-14.0f)
.addChild(new InlineObject().setUrl(new String[] {"harpoon.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/harpoon.x3d","harpoon.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/harpoon.wrl"})))
.addChild(new TransformObject().setScale(1.0f,2.0f,1.0f).setTranslation(-25.0f,15.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"flagMast.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/flagMast.x3d","flagMast.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/flagMast.wrl"})))
.addChild(new TransformObject().setRotation(1.0f,0.0f,0.0f,-0.2f).setScale(1.5f,1.5f,1.5f).setTranslation(-20.5f,4.0f,-14.0f)
.addChild(new InlineObject().setUrl(new String[] {"hoistPort.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/hoistPort.x3d","hoistPort.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/hoistPort.wrl"})))
.addChild(new TransformObject().setRotation(1.0f,0.0f,0.0f,0.2f).setScale(1.5f,1.5f,1.5f).setTranslation(-20.5f,3.0f,10.0f)
.addChild(new InlineObject().setUrl(new String[] {"hoist.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/hoist.x3d","hoist.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/hoist.wrl"})))
.addChild(new TransformObject().setRotation(0.0f,1.0f,0.0f,-1.57f).setScale(1.0f,1.0f,1.5f).setTranslation(-30.0f,10.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"funel.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/funel.x3d","funel.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/funel.wrl"})))
.addChild(new TransformObject().setScale(3.0f,3.0f,3.0f).setTranslation(-5.0f,30.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"zw06.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/zw06.x3d","zw06.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/zw06.wrl"})))
.addChild(new TransformObject().setScale(2.0f,2.0f,2.0f).setTranslation(-17.9f,42.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"wm25.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/wm25.x3d","wm25.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/wm25.wrl"})))
.addComments(" The sailors in the hangar ")
.addChild(new TransformObject().setScale(1.0f,2.0f,1.0f).setTranslation(-82.0f,1.0f,-3.0f)
.addChild(new InlineObject().setUrl(new String[] {"sailors.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/sailors.x3d","sailors.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/sailors.wrl"})))
.addChild(new TransformObject().setScale(1.0f,1.5f,1.2f).setTranslation(-81.0f,1.0f,4.0f)
.addChild(new InlineObject().setUrl(new String[] {"sailors.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/sailors.x3d","sailors.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/sailors.wrl"})))
.addChild(new TransformObject().setScale(1.0f,2.0f,1.0f).setTranslation(-80.0f,1.0f,3.0f)
.addChild(new InlineObject().setUrl(new String[] {"sailors.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/sailors.x3d","sailors.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/sailors.wrl"})))
.addChild(new TransformObject().setScale(1.0f,2.0f,1.0f).setTranslation(-80.0f,1.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"Sailors.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/Sailors.x3d","Sailors.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/Sailors.wrl"})))
.addComments(" the helicopter hagar ")
.addChild(new TransformObject().setRotation(0.0f,1.0f,0.0f,-1.57f).setTranslation(-65.0f,3.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"helideck.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/helideck.x3d","helideck.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/helideck.wrl"})))
.addComments(" The main hull of the ship ")
.addChild(new TransformObject()
.addChild(new InlineObject().setUrl(new String[] {"hull.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/hull.x3d","hull.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/hull.wrl"})))
.addChild(new TransformObject().setScale(2.0f,2.0f,2.0f).setTranslation(15.0f,5.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"OtoMelara.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/OtoMelara.x3d","OtoMelara.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/OtoMelara.wrl"})))
.addChild(new TransformObject().setRotation(0.0f,1.0f,0.0f,3.14f).setScale(2.0f,2.0f,2.0f).setTranslation(-100.0f,15.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"Otomelara.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/Otomelara.x3d","Otomelara.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/Otomelara.wrl"})))
.addChild(new TransformObject().setScale(3.0f,3.0f,3.0f).setTranslation(-70.0f,16.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"AirRadarLW08.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/AirRadarLW08.x3d","AirRadarLW08.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/AirRadarLW08.wrl"}))
.addChild(new TransformObject().setTranslation(0.0f,-1.8f,0.0f)
.addChild(new ShapeObject()
.setGeometry(new CylinderObject().setHeight(1f))
.setAppearance(new AppearanceObject()
.setMaterial(new MaterialObject())))))
.addChild(new TransformObject().setRotation(0.0f,1.0f,0.0f,1.57f).setTranslation(-25.0f,5.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"OfficersMess.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/OfficersMess.x3d","OfficersMess.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/OfficersMess.wrl"})))
.addChild(new TransformObject().setRotation(0.0f,1.0f,0.0f,1.57f).setTranslation(-20.0f,10.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"CommandOfficerRoom.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/CommandOfficerRoom.x3d","CommandOfficerRoom.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/CommandOfficerRoom.wrl"})))
.addChild(new TransformObject().setRotation(0.0f,1.0f,0.0f,1.57f).setScale(0.8f,1.0f,1.0f).setTranslation(-11.0f,18.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"Bridge.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/Bridge.x3d","Bridge.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/Bridge.wrl"})))
.addChild(new TransformObject().setScale(0.2f,0.9f,0.2f).setTranslation(-41.0f,25.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"Pyramid.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/Pyramid.x3d","Pyramid.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/Pyramid.wrl"})))
.addChild(new TransformObject().setScale(0.6f,1.2f,0.6f).setTranslation(-18.0f,15.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"Pyramid.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/Pyramid.x3d","Pyramid.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/Pyramid.wrl"})))
.addChild(new TransformObject().setRotation(0.0f,1.0f,0.0f,1.57f).setScale(1.0f,4.0f,1.0f).setTranslation(-25.0f,30.0f,0.0f)
.addChild(new InlineObject().setUrl(new String[] {"MainMast.x3d","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/MainMast.x3d","MainMast.wrl","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Greece/MainMast.wrl"}))));
}
// 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 GreekFrigateDesign 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 GreekFrigateDesign().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: \"GreekFrigateDesign\" 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 \"GreekFrigateDesign\" self-validation test results: ");
String validationResults = thisExampleX3dObject.validationReport();
System.out.println(validationResults);
}
}
}