package Savage.ShipsMilitary.FrigateYavuzTurkey; /* 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.Interpolation.*; import org.web3d.x3d.jsail.PointingDeviceSensor.*; import org.web3d.x3d.jsail.Scripting.*; import org.web3d.x3d.jsail.Shape.*; import org.web3d.x3d.jsail.Sound.*; import org.web3d.x3d.jsail.Text.*; import org.web3d.x3d.jsail.Time.*; // Javadoc annotations follow, see below for source. /** *

A lightweight prototype of SeaZenith point defence gun.

Related links: SeaZenith.java source, SeaZenith catalog page, X3D Resources, X3D Scene Authoring Hints, and X3D Tooltips.

meta tags   Document Metadata
title SeaZenith.x3d
description A lightweight prototype of SeaZenith point defence gun
creator Ozan APAYDIN
created 20 August 2001
modified 14 January 2014
reference http://www.futura-dtp.dk/Artilleri/25mmSeaZenith.htm
identifier https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Yavuz-Turkey/SeaZenith.x3d
generator X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit
license ../../license.html
 

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 Ozan APAYDIN */ public class SeaZenith { /** Default constructor to create this object. */ public SeaZenith () { 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("SeaZenith.x3d")) .addMeta(new metaObject().setName(metaObject.NAME_DESCRIPTION).setContent("A lightweight prototype of SeaZenith point defence gun")) .addMeta(new metaObject().setName(metaObject.NAME_CREATOR ).setContent("Ozan APAYDIN")) .addMeta(new metaObject().setName(metaObject.NAME_CREATED ).setContent("20 August 2001")) .addMeta(new metaObject().setName(metaObject.NAME_MODIFIED ).setContent("14 January 2014")) .addMeta(new metaObject().setName(metaObject.NAME_REFERENCE ).setContent("http://www.futura-dtp.dk/Artilleri/25mmSeaZenith.htm")) .addMeta(new metaObject().setName(metaObject.NAME_IDENTIFIER ).setContent("https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Yavuz-Turkey/SeaZenith.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() .addComments(" Script Node to update the rotation of the gun. ") .addChild(new ScriptObject("RotUpdater").setSourceCode("\n" + " " + "\n" + "ecmascript:" + "\n" + "\n" + "function initialize() {" + "\n" + " CurRot[0] = 0.0;" + "\n" + " CurRot[1] = 1.0;" + "\n" + " CurRot[2] = 0.0;" + "\n" + " CurRot[3] = 0.0;" + "\n" + "}" + "\n" + "\n" + "function set_LRotation(bool,time) {" + "\n" + " isLeft = bool;" + "\n" + " isRight = !bool;" + "\n" + " if(isLeft) {" + "\n" + " generate_Rotation();" + "\n" + " }" + "\n" + "}" + "\n" + "\n" + "function set_RRotation(bool,time) {" + "\n" + " isRight = bool;" + "\n" + " isLeft = !bool;" + "\n" + " if(isRight) {" + "\n" + " generate_Rotation();" + "\n" + " }" + "\n" + "}" + "\n" + "\n" + "function get_CurRotation(cR,time) {" + "\n" + " CurRot = cR;" + "\n" + "}" + "\n" + "\n" + "function generate_Rotation() {" + "\n" + " newRotation = CurRot;" + "\n" + " if(isLeft) {" + "\n" + " if(CurRot[3] < 1.7) {" + "\n" + " newRotation[3] = CurRot[3] + 0.2;" + "\n" + " }" + "\n" + " }" + "\n" + " " + "\n" + " else if(isRight) {" + "\n" + " if(CurRot[3] > -1.7) {" + "\n" + " newRotation[3] = CurRot[3] - 0.2;" + "\n" + " }" + "\n" + " } " + "\n" + "}" + "\n") .addComments(" Variables and methods of the RotUpdater script ") .addField(new fieldObject().setName("set_LRotation").setType(fieldObject.TYPE_SFBOOL).setAccessType(fieldObject.ACCESSTYPE_INPUTONLY)) .addField(new fieldObject().setName("set_RRotation").setType(fieldObject.TYPE_SFBOOL).setAccessType(fieldObject.ACCESSTYPE_INPUTONLY)) .addField(new fieldObject().setName("get_CurRotation").setType(fieldObject.TYPE_SFROTATION).setAccessType(fieldObject.ACCESSTYPE_INPUTONLY)) .addField(new fieldObject().setName("isLeft").setType(fieldObject.TYPE_SFBOOL).setAccessType(fieldObject.ACCESSTYPE_INITIALIZEONLY).setValue(true)) .addField(new fieldObject().setName("isRight").setType(fieldObject.TYPE_SFBOOL).setAccessType(fieldObject.ACCESSTYPE_INITIALIZEONLY).setValue(false)) .addField(new fieldObject().setName("CurRot").setType(fieldObject.TYPE_SFROTATION).setAccessType(fieldObject.ACCESSTYPE_INITIALIZEONLY).setValue(new SFRotationObject(0.0f,1.0f,0.0f,0.0f))) .addField(new fieldObject().setName("newRotation").setType(fieldObject.TYPE_SFROTATION).setAccessType(fieldObject.ACCESSTYPE_OUTPUTONLY))) .addComments(" Script node to update elevation of the gun. ") .addChild(new ScriptObject("ElevDescUpdater").setSourceCode("\n" + " " + "\n" + "ecmascript:" + "\n" + "\n" + "function initialize() {" + "\n" + " CurOr[0] = 0.0;" + "\n" + " CurOr[1] = 1.0;" + "\n" + " CurOr[2] = 0.0;" + "\n" + " CurOr[3] = 0.0;" + "\n" + "}" + "\n" + "\n" + "function set_Elevation(bool,time) {" + "\n" + " isUp = bool;" + "\n" + " isDown = !bool;" + "\n" + " if(isUp) {" + "\n" + " generate_Rotation();" + "\n" + " }" + "\n" + "}" + "\n" + "\n" + "function set_Descendance(bool,time) {" + "\n" + " isDown = bool;" + "\n" + " isUp = !bool;" + "\n" + " if(isDown) {" + "\n" + " generate_Rotation();" + "\n" + " }" + "\n" + "}" + "\n" + "\n" + "function get_CurOrientation(cR,time) {" + "\n" + " CurOr = cR;" + "\n" + "}" + "\n" + "\n" + "function generate_Rotation() {" + "\n" + " newOrientation = CurOr;" + "\n" + " if(isUp) {" + "\n" + " if(CurOr[3] < 0.45) {" + "\n" + " newOrientation[3] = CurOr[3] + 0.05;" + "\n" + " }" + "\n" + " }" + "\n" + " " + "\n" + " else if(isDown) {" + "\n" + " if(CurOr[3] > 0.05) {" + "\n" + " newOrientation[3] = CurOr[3] - 0.05;" + "\n" + " }" + "\n" + " } " + "\n" + "}" + "\n") .addComments(" Variables and methods of the ElevDescUpdater script script ") .addField(new fieldObject().setName("set_Elevation").setType(fieldObject.TYPE_SFBOOL).setAccessType(fieldObject.ACCESSTYPE_INPUTONLY)) .addField(new fieldObject().setName("set_Descendance").setType(fieldObject.TYPE_SFBOOL).setAccessType(fieldObject.ACCESSTYPE_INPUTONLY)) .addField(new fieldObject().setName("get_CurOrientation").setType(fieldObject.TYPE_SFROTATION).setAccessType(fieldObject.ACCESSTYPE_INPUTONLY)) .addField(new fieldObject().setName("isUp").setType(fieldObject.TYPE_SFBOOL).setAccessType(fieldObject.ACCESSTYPE_INITIALIZEONLY).setValue(true)) .addField(new fieldObject().setName("isDown").setType(fieldObject.TYPE_SFBOOL).setAccessType(fieldObject.ACCESSTYPE_INITIALIZEONLY).setValue(false)) .addField(new fieldObject().setName("CurOr").setType(fieldObject.TYPE_SFROTATION).setAccessType(fieldObject.ACCESSTYPE_INITIALIZEONLY).setValue(new SFRotationObject(0.0f,1.0f,0.0f,0.0f))) .addField(new fieldObject().setName("newOrientation").setType(fieldObject.TYPE_SFROTATION).setAccessType(fieldObject.ACCESSTYPE_OUTPUTONLY))) .addComments(" Gun Controller - Heads up displays and touch sensors ") .addChild(new BackgroundObject().setSkyColor(new MFColorObject(new float[] {0.1f,0.1f,0.6f}))) .addComments(" Fire sound effect. ") .addChild(new SoundObject().setMaxBack(35f).setMaxFront(35f) .setSource(new AudioClipObject("FireSound").setDescription("machine gun sound").setUrl(new String[] {"machngun.wav","https://savage.nps.edu/Savage/ShipsMilitary/Frigate-Yavuz-Turkey/machngun.wav"}))) .addComments(" Modeling the gun ") .addChild(new TransformObject().setRotation(0.0f,1.0f,0.0f,3.14f).setScale(1.2f,1.2f,1.2f).setTranslation(0.0f,-1.5f,0.0f) .addChild(new GroupObject("GunBase") .addChild(new ShapeObject() .setGeometry(new CylinderObject().setHeight(1.0f)) .setAppearance(new AppearanceObject("GunAp") .setMaterial(new MaterialObject().setDiffuseColor(.7f,.7f,.8f).setShininess(.4f)))) .addChild(new TransformObject().setTranslation(0.0f,0.4f,0.0f) .addChild(new ShapeObject("Disk") .setGeometry(new CylinderObject().setHeight(0.1f).setRadius(1.05f)) .setAppearance(new AppearanceObject().setUSE("GunAp"))))) .addComments(" Mobile part of the gun (DEFLECTION) ") .addChild(new TransformObject("TopDondur") .addChild(new GroupObject("GunMount") .addChild(new TransformObject().setRotation(0.0f,0.0f,1.0f,0.3f).setScale(1.1f,1.0f,1.5f).setTranslation(-0.385f,1.8f,0.0f) .addChild(new ShapeObject("MountBody") .setGeometry(new CylinderObject().setRadius(0.9f)) .setAppearance(new AppearanceObject().setUSE("GunAp"))) .addChild(new TransformObject().setScale(1.0f,0.8f,1.0f).setTranslation(0.0f,1.0f,0.0f) .addChild(new ShapeObject("MountCap") .setGeometry(new SphereObject().setRadius(0.9f)) .setAppearance(new AppearanceObject().setUSE("GunAp")))) .addChild(new TransformObject().setTranslation(0.65f,0.0f,0.0f) .addChild(new ShapeObject() .setGeometry(new BoxObject().setSize(0.5f,1.8f,0.7f)) .setAppearance(new AppearanceObject().setUSE("GunAp"))) .addChild(new TransformObject().setTranslation(0.25f,0.0f,0.0f) .addChild(new ShapeObject() .setGeometry(new BoxObject().setSize(0.1f,1.8f,0.5f)) .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setDiffuseColor(0.1f,0.1f,0.1f))))))) .addChild(new TransformObject().setRotation(1.0f,0.0f,0.0f,1.57f) .addChild(new CylinderSensorObject("NamluSensor").setDescription("click and drag to rotate").setMaxAngle(0.45f)) .addComments(" Mobile part of the gun (ELEVATION) ") .addChild(new TransformObject("NamluDondur") .addChild(new TransformObject().setRotation(1.0f,0.0f,0.0f,-1.57f) .addChild(new GroupObject("NamluGROUP") .addChild(new TransformObject().setRotation(0.0f,0.0f,1.0f,1.57f).setTranslation(1.0f,2.2f,0.2f) .addChild(new GroupObject("Namlu") .addChild(new ShapeObject("InNamlu") .setGeometry(new CylinderObject().setRadius(0.08f)) .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setDiffuseColor(.3f,.3f,.3f).setShininess(0.6f)))) .addChild(new ShapeObject("HoleNamlu") .setGeometry(new CylinderObject().setHeight(2.02f).setRadius(0.06f)) .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setDiffuseColor(.0f,.0f,.0f).setShininess(0.6f)))) .addChild(new ShapeObject("OutNamlu") .setGeometry(new CylinderObject().setHeight(1.2f).setRadius(0.1f)) .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setDiffuseColor(.4f,.4f,.4f).setShininess(.6f)))) .addChild(new TransformObject("FireTransform").setRotation(0.0f,0.0f,1.0f,-3.14f).setScale(0.0001f,0.0001f,0.00001f).setTranslation(0.0f,-1.35f,0.0f) .addChild(new ShapeObject("FireCone") .setGeometry(new ConeObject().setBottomRadius(0.05f).setHeight(0.5f)) .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setDiffuseColor(0.8f,0.3f,0.0f).setShininess(0.7f).setSpecularColor(0.8f,0.3f,0.0f)))) .addChild(new TransformObject().setTranslation(0.0f,-0.2f,0.0f) .addChild(new ShapeObject("InnerFireCone") .setGeometry(new ConeObject().setBottomRadius(0.051f).setHeight(0.2f)) .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setDiffuseColor(1.0f,0.6f,0.0f).setShininess(0.7f).setSpecularColor(1.0f,0.6f,0.0f)))) .addChild(new PositionInterpolatorObject("ChScale").setKey(new float[] {0.04f,0.08f,0.12f,0.16f,0.2f,0.24f,0.28f,0.32f,0.36f,0.4f,0.44f,0.48f,0.52f,0.56f,0.6f,0.64f,0.68f,0.72f,0.76f,0.8f,0.84f,0.86f,0.9f,0.94f,1.0f}).setKeyValue(new MFVec3fObject(new float[] {0.00001f,0.00001f,0.00001f,1.0f,1.0f,1.0f,0.00001f,0.00001f,0.00001f,1.0f,1.0f,1.0f,0.00001f,0.00001f,0.00001f,1.0f,1.0f,1.0f,0.00001f,0.00001f,0.00001f,1.0f,1.0f,1.0f,0.00001f,0.00001f,0.00001f,1.0f,1.0f,1.0f,0.00001f,0.00001f,0.00001f,1.0f,1.0f,1.0f,0.00001f,0.00001f,0.00001f,1.0f,1.0f,1.0f,0.00001f,0.00001f,0.00001f,1.0f,1.0f,1.0f,0.00001f,0.00001f,0.00001f,1.0f,1.0f,1.0f,0.00001f,0.00001f,0.00001f,1.0f,1.0f,1.0f,0.00001f,0.00001f,0.00001f,1.0f,1.0f,1.0f,0.00001f,0.00001f,0.00001f,1.0f,1.0f,1.0f,0.00001f,0.00001f,0.00001f}))) .addChild(new TimeSensorObject("fireTimer").setCycleInterval(1.5)))))) .addChild(new TransformObject().setRotation(0.0f,0.0f,1.0f,1.57f).setTranslation(1.0f,2.2f,-0.2f) .addChild(new GroupObject().setUSE("Namlu"))) .addChild(new TransformObject().setRotation(0.0f,0.0f,1.0f,1.57f).setTranslation(1.0f,1.8f,-0.2f) .addChild(new GroupObject().setUSE("Namlu"))) .addChild(new TransformObject().setRotation(0.0f,0.0f,1.0f,1.57f).setTranslation(1.0f,1.8f,0.2f) .addChild(new GroupObject().setUSE("Namlu"))))))) .addChild(new CylinderSensorObject("TopSensor").setDescription("click and drag to rotate").setMaxAngle(1.7f).setMinAngle(-1.7f)) .addComments(" missing ROUTE for OrientationInterpolator, likely due to use of CylinderSensor ") .addChild(new OrientationInterpolatorObject("ButtonRotInter").setKey(new float[] {0.0f,1.0f}).setKeyValue(new MFRotationObject(new float[] {0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,1.7f}))) .addChild(new TimeSensorObject("PortSideTimer").setCycleInterval(3.0).setEnabled(false).setLoop(true)) .addChild(new TransformObject().setRotation(0.0f,0.0f,1.0f,0.3f).setTranslation(-0.1f,1.0f,0.0f) .addChild(new ShapeObject() .setGeometry(new CylinderObject().setHeight(1.5f).setRadius(0.7f)) .setAppearance(new AppearanceObject().setUSE("GunAp"))))))) .addChild(new TransformObject().setRotation(0.0f,1.0f,0.0f,1.57f) .addChild(new TransformObject().setRotation(1.0f,0.0f,0.0f,-1.4f).setScale(1.4f,1.4f,1.4f).setTranslation(0.0f,0.0f,0.5f) .addChild(new GroupObject("GunControl") .addChild(new TransformObject().setTranslation(0.0f,0.0f,3.0f) .addChild(new GroupObject() .addChild(new ShapeObject("MenuB") .setGeometry(new BoxObject().setSize(0.5f,0.2f,0.00001f)) .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setDiffuseColor(0.0f,1.0f,0.0f).setTransparency(0.6f)))) .addChild(new TransformObject().setTranslation(-0.2f,-0.05f,0.005f) .addChild(new ShapeObject() .setGeometry(new TextObject().setString(new String[] {"FIRE"}) .setFontStyle(new FontStyleObject().setSize(0.2f).setSpacing(0.1f).setStyle("BOLD"))) .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setDiffuseColor(1.0f,0.0f,0.0f))))) .addChild(new TouchSensorObject("FireSensor").setDescription("touch to fire")))) .addChild(new TransformObject().setTranslation(-0.25f,-0.2f,3.0f) .addChild(new GroupObject() .addChild(new ShapeObject().setUSE("MenuB")) .addChild(new TransformObject().setTranslation(-0.2f,-0.05f,0.005f) .addChild(new ShapeObject() .setGeometry(new TextObject().setString(new String[] {"LROT"}) .setFontStyle(new FontStyleObject().setSize(0.18f).setSpacing(0.1f).setStyle("BOLD"))) .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setDiffuseColor(1.0f,0.0f,0.0f))))) .addChild(new TouchSensorObject("LRotSensor").setDescription("touch to rotate left")))) .addChild(new TransformObject().setTranslation(0.25f,-0.2f,3.0f) .addChild(new GroupObject() .addChild(new ShapeObject().setUSE("MenuB")) .addChild(new TransformObject().setTranslation(-0.2f,-0.05f,0.005f) .addChild(new ShapeObject() .setGeometry(new TextObject().setString(new String[] {"RROT"}) .setFontStyle(new FontStyleObject().setSize(0.18f).setSpacing(0.1f).setStyle("BOLD"))) .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setDiffuseColor(1.0f,0.0f,0.0f))))) .addChild(new TouchSensorObject("RRotSensor").setDescription("touch to rotate right")))) .addChild(new TransformObject().setTranslation(-0.25f,-0.4f,3.0f) .addChild(new GroupObject() .addChild(new ShapeObject().setUSE("MenuB")) .addChild(new TransformObject().setTranslation(-0.2f,-0.05f,0.005f) .addChild(new ShapeObject() .setGeometry(new TextObject().setString(new String[] {"ELEV"}) .setFontStyle(new FontStyleObject().setSize(0.18f).setSpacing(0.1f).setStyle("BOLD"))) .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setDiffuseColor(1.0f,0.0f,0.0f))))) .addChild(new TouchSensorObject("ElevSensor").setDescription("touch to elevate")))) .addChild(new TransformObject().setTranslation(0.25f,-0.4f,3.0f) .addChild(new GroupObject() .addChild(new ShapeObject().setUSE("MenuB")) .addChild(new TransformObject().setTranslation(-0.2f,-0.05f,0.005f) .addChild(new ShapeObject() .setGeometry(new TextObject().setString(new String[] {"DESC"}) .setFontStyle(new FontStyleObject().setSize(0.18f).setSpacing(0.1f).setStyle("BOLD"))) .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setDiffuseColor(1.0f,0.0f,0.0f))))) .addChild(new TouchSensorObject("DescSensor").setDescription("touch to depress downward"))))))) .addChild(new ROUTEObject().setFromNode("TopSensor").setFromField("rotation_changed").setToNode("TopDondur").setToField("set_rotation")) .addChild(new ROUTEObject().setFromNode("NamluSensor").setFromField("rotation_changed").setToNode("NamluDondur").setToField("set_rotation")) .addChild(new ROUTEObject().setFromNode("fireTimer").setFromField("fraction_changed").setToNode("ChScale").setToField("set_fraction")) .addChild(new ROUTEObject().setFromNode("ChScale").setFromField("value_changed").setToNode("FireTransform").setToField("set_scale")) .addChild(new ROUTEObject().setFromNode("FireSensor").setFromField("touchTime").setToNode("fireTimer").setToField("set_startTime")) .addChild(new ROUTEObject().setFromNode("FireSensor").setFromField("touchTime").setToNode("FireSound").setToField("set_startTime")) .addChild(new ROUTEObject().setFromNode("PortSideTimer").setFromField("fraction_changed").setToNode("ButtonRotInter").setToField("set_fraction")) .addChild(new ROUTEObject().setFromNode("FireSensor").setFromField("isActive").setToNode("PortSideTimer").setToField("set_enabled")) .addChild(new ROUTEObject().setFromNode("LRotSensor").setFromField("isActive").setToNode("RotUpdater").setToField("set_LRotation")) .addChild(new ROUTEObject().setFromNode("RRotSensor").setFromField("isActive").setToNode("RotUpdater").setToField("set_RRotation")) .addChild(new ROUTEObject().setFromNode("TopDondur").setFromField("rotation").setToNode("RotUpdater").setToField("get_CurRotation")) .addChild(new ROUTEObject().setFromNode("RotUpdater").setFromField("newRotation").setToNode("TopDondur").setToField("set_rotation")) .addChild(new ROUTEObject().setFromNode("ElevSensor").setFromField("isActive").setToNode("ElevDescUpdater").setToField("set_Elevation")) .addChild(new ROUTEObject().setFromNode("DescSensor").setFromField("isActive").setToNode("ElevDescUpdater").setToField("set_Descendance")) .addChild(new ROUTEObject().setFromNode("NamluDondur").setFromField("rotation").setToNode("ElevDescUpdater").setToField("get_CurOrientation")) .addChild(new ROUTEObject().setFromNode("ElevDescUpdater").setFromField("newOrientation").setToNode("NamluDondur").setToField("set_rotation"))); } // 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 SeaZenith 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 SeaZenith().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: \"SeaZenith\" 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 \"SeaZenith\" self-validation test results: "); String validationResults = thisExampleX3dObject.validationReport(); System.out.println(validationResults); } } }