package Savage.ShipsMilitary.PatrolCraftNavalAcademyBrazil;
/*
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.Geometry3D.*;
import org.web3d.x3d.jsail.Grouping.*;
import org.web3d.x3d.jsail.Rendering.*;
import org.web3d.x3d.jsail.Shape.*;
// Javadoc annotations follow, see below for source.
/**
*
Brazilian Naval Academy Training Ship.
Related links: Compass.java source, Compass 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 Claudio Coreixas
*/
public class Compass
{
/** Default constructor to create this object. */
public Compass ()
{
initialize();
}
/** Create and initialize the X3D model for this object. */
public final void initialize()
{
x3dModel = new X3DObject().setProfile(X3DObject.PROFILE_INTERCHANGE).setVersion(X3DObject.VERSION_3_1)
.setHead(new headObject()
.addMeta(new metaObject().setName(metaObject.NAME_TITLE ).setContent("Compass.x3d"))
.addMeta(new metaObject().setName(metaObject.NAME_DESCRIPTION).setContent("Brazilian Naval Academy Training Ship"))
.addMeta(new metaObject().setName(metaObject.NAME_CREATOR ).setContent("Claudio Coreixas"))
.addMeta(new metaObject().setName(metaObject.NAME_CREATED ).setContent("20 October 2009"))
.addMeta(new metaObject().setName(metaObject.NAME_MODIFIED ).setContent("14 January 2014"))
.addMeta(new metaObject().setName(metaObject.NAME_REFERENCE ).setContent("http://www.en.mar.mil.br"))
.addMeta(new metaObject().setName(metaObject.NAME_SUBJECT ).setContent("ships parts"))
.addMeta(new metaObject().setName(metaObject.NAME_IDENTIFIER ).setContent("https://savage.nps.edu/Savage/ShipsMilitary/PatrolCraft-NavalAcademy-Brazil/Compass.x3d"))
.addMeta(new metaObject().setName(metaObject.NAME_GENERATOR ).setContent("X3D-Edit, https://savage.nps.edu/X3D-Edit"))
.addMeta(new metaObject().setName(metaObject.NAME_LICENSE ).setContent("../../license.html")))
.setScene(new SceneObject()
.addChild(new TransformObject("Cylinder01")
.addChild(new TransformObject().setTranslation(0.0f,5.904f,0.0f)
.addChild(new ShapeObject()
.setAppearance(new AppearanceObject()
.setMaterial(new MaterialObject().setDiffuseColor(0.82f,0.78f,0.74f)))
.setGeometry(new CylinderObject().setHeight(11.81f).setRadius(5.373f)))))
.addChild(new TransformObject("Sphere01").setTranslation(-0.02133f,13.3f,-0.00694f)
.addChild(new ShapeObject()
.setAppearance(new AppearanceObject()
.setMaterial(new MaterialObject().setAmbientIntensity(0.02f).setDiffuseColor(0.701961f,0.588235f,0.0f).setShininess(0.29f).setSpecularColor(1.0f,0.887979f,0.0f)))
.setGeometry(new SphereObject().setRadius(5.567f))))
.addChild(new TransformObject("Cylinder02").setScale(1.0f,0.7737f,1.0f)
.addChild(new TransformObject().setTranslation(0.0f,0.8903f,0.0f)
.addChild(new ShapeObject()
.setAppearance(new AppearanceObject()
.setMaterial(new MaterialObject().setDiffuseColor(0.82f,0.78f,0.74f)))
.setGeometry(new CylinderObject().setHeight(1.781f).setRadius(6.611f)))))
.addChild(new TransformObject("Box01").setTranslation(0.001388f,9.608f,-0.05238f)
.addChild(new TransformObject().setTranslation(0.0f,0.6588f,0.0f)
.addChild(new ShapeObject()
.setAppearance(new AppearanceObject()
.setMaterial(new MaterialObject().setDiffuseColor(0.82f,0.78f,0.74f)))
.setGeometry(new BoxObject().setSize(17.75f,1.318f,1.851f)))))
.addChild(new TransformObject("Sphere02").setTranslation(-8.315f,12.98f,-0.00694f)
.addChild(new ShapeObject()
.setAppearance(new AppearanceObject()
.setMaterial(new MaterialObject().setAmbientIntensity(1.0f).setDiffuseColor(0.03922f,0.5647f,0.0f).setShininess(0.145f)))
.setGeometry(new SphereObject().setRadius(1.781f))))
.addChild(new TransformObject("Sphere03").setTranslation(8.403f,12.98f,-0.00694f)
.addChild(new ShapeObject()
.setAppearance(new AppearanceObject()
.setMaterial(new MaterialObject().setAmbientIntensity(1.0f).setDiffuseColor(0.9765f,0.0f,0.0f).setShininess(0.145f)))
.setGeometry(new SphereObject().setRadius(1.781f))))
.addChild(new TransformObject("Ellipse01").setRotation(-1.0f,0.0f,0.0f,-1.833f).setTranslation(-0.1223f,15.26f,-5.407f)
.addChild(new ShapeObject()
.setAppearance(new AppearanceObject()
.setMaterial(new MaterialObject().setAmbientIntensity(0.02f).setDiffuseColor(0.701961f,0.588235f,0.0f).setShininess(0.29f).setSpecularColor(1.0f,0.887979f,0.0f)))
.setGeometry(new IndexedFaceSetObject("Ellipse01-FACES").setDEF("Ellipse01-FACES").setCoordIndex(getEllipse01_FACES_5_47_coordIndex())
.setCoord(new CoordinateObject("Ellipse01-COORD").setPoint(new MFVec3fObject(new float[] {3.059f,0.0f,0.0f,2.978f,0.0f,-0.4736f,2.748f,0.0f,-0.9084f,2.386f,0.0f,-1.292f,1.912f,0.0f,-1.612f,1.344f,0.0f,-1.856f,0.7009f,0.0f,-2.012f,0.0f,0.0f,-2.067f,-0.7009f,0.0f,-2.012f,-1.344f,0.0f,-1.856f,-1.912f,0.0f,-1.612f,-2.386f,0.0f,-1.292f,-2.748f,0.0f,-0.9084f,-2.978f,0.0f,-0.4736f,-3.059f,0.0f,0.0f,-2.978f,0.0f,0.4736f,-2.748f,0.0f,0.9084f,-2.386f,0.0f,1.292f,-1.912f,0.0f,1.612f,-1.344f,0.0f,1.856f,-0.7009f,0.0f,2.012f,0.0f,0.0f,2.067f,0.7009f,0.0f,2.012f,1.344f,0.0f,1.856f,1.912f,0.0f,1.612f,2.386f,0.0f,1.292f,2.748f,0.0f,0.9084f,2.978f,0.0f,0.4736f,3.059f,1.5f,0.0f,2.978f,1.5f,-0.4736f,2.748f,1.5f,-0.9084f,2.386f,1.5f,-1.292f,1.912f,1.5f,-1.612f,1.344f,1.5f,-1.856f,0.7009f,1.5f,-2.012f,0.0f,1.5f,-2.067f,-0.7009f,1.5f,-2.012f,-1.344f,1.5f,-1.856f,-1.912f,1.5f,-1.612f,-2.386f,1.5f,-1.292f,-2.748f,1.5f,-0.9084f,-2.978f,1.5f,-0.4736f,-3.059f,1.5f,0.0f,-2.978f,1.5f,0.4736f,-2.748f,1.5f,0.9084f,-2.386f,1.5f,1.292f,-1.912f,1.5f,1.612f,-1.344f,1.5f,1.856f,-0.7009f,1.5f,2.012f,0.0f,1.5f,2.067f,0.7009f,1.5f,2.012f,1.344f,1.5f,1.856f,1.912f,1.5f,1.612f,2.386f,1.5f,1.292f,2.748f,1.5f,0.9084f,2.978f,1.5f,0.4736f})))))));
}
// end of initialize() method
/** Define subarrays using type int[] */
private int[] getEllipse01_FACES_5_47_coordIndex_1()
{
int[] value = {0,1,29,-1,0,29,28,-1,1,2,30,-1,1,30,29,-1,2,3,31,-1,2,31,30,-1,3,4,32,-1,3,32,31,-1,4,5,33,-1,4,33,32,-1,5,6,34,-1,5,34,33,-1,6,7,35,-1,6,35,34,-1,7,8,36,-1,7,36,35,-1,8,9,37,-1,8,37,36,-1,9,10,38,-1,9,38,37,-1,10,11,39,-1,10,39,38,-1,11,12,40,-1,11,40,39,-1,12,13,41,-1,12,41,40,-1,13,14,42,-1,13,42,41,-1,14,15,43,-1,14,43,42,-1,15,16,44,-1,15,44,43,-1,16,17,45,-1,16,45,44,-1,17,18,46,-1,17,46,45,-1,18,19,47,-1,18,47,46,-1,19,20,48,-1,19,48,47,-1,20,21,49,-1,20,49,48,-1,21,22,50,-1,21,50,49,-1,22,23,51,-1,22,51,50,-1,23,24,52,-1,23,52,51,-1,24,25,53,-1,24,53,52,-1,25,26,54,-1,25,54,53,-1,26,27,55,-1,26,55,54,-1,27,0,28,-1,27,28,55,-1,27,1,0,-1,27,2,1,-1,26,2,27,-1,26,3,2,-1,25,3,26,-1,24,3,25,-1,24,4,3,-1,24,5,4,-1,23,5,24,-1,22,5,23,-1,22,6,5,-1,21,6,22,-1,21,7,6,-1,20,7,21,-1,20,8,7,-1,19,8,20,-1,19,9,8,-1,19,10,9,-1,18,10,19,-1,17,10,18,-1,17,11,10,-1,17,12,11,-1,16,12,17,-1,15,12,16,-1,15,13,12,-1,14,13,15,-1,55,28,29,-1,55,29,30,-1,54,55,30,-1,54,30,31,-1,53,54,31,-1,52,53,31,-1,52,31,32,-1,52,32,33,-1,51,52,33,-1,50,51,33,-1,50,33,34,-1,49,50,34,-1,49,34,35,-1,48,49,35,-1,48,35,36,-1,47,48,36,-1,47,36,37,-1,47,37,38,-1,46,47,38,-1,45,46,38,-1,45,38,39,-1,45,39,40,-1,44,45,40,-1,43,44,40,-1,43,40,41,-1,42,43,41,-1};
return value;
}
/** Large attribute array: IndexedFaceSet DEF='Ellipse01-FACES' coordIndex field, scene-graph level=5, element #47, 432 total numbers.
* 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 MFInt32Object getEllipse01_FACES_5_47_coordIndex()
{
MFInt32Object Ellipse01_FACES_5_47_coordIndex = new MFInt32Object()/*2.finalize*/
.append(new MFInt32Object(getEllipse01_FACES_5_47_coordIndex_1()));
return Ellipse01_FACES_5_47_coordIndex;
}
/** The initialized model object, created within initialize() method. */
private X3DObject x3dModel;
/** Provide a
* shallow copy
* of the X3D model.
* @see X3DObject
* @return Compass 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 Compass().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: \"Compass\" 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 \"Compass\" self-validation test results: ");
String validationResults = thisExampleX3dObject.validationReport();
System.out.println(validationResults);
}
}
}