package Savage.Buildings.UHRB;

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.Rendering.*;
import org.web3d.x3d.jsail.Shape.*;
import org.web3d.x3d.jsail.Texturing.*;

// Javadoc metadata annotations follow, see below for X3DJSAIL Java source code.
/**
 * <p> Example use of simple prototypes for building construction: Wall, Floor, Level and Building. </p>
 <p> Related links: Catalog page <a href="../../../../Buildings/UHRB/SimpleBuildingConstructionExampleIndex.html" target="_blank">SimpleBuildingConstructionExample</a>,  source <a href="../../../../Buildings/UHRB/SimpleBuildingConstructionExample.java">SimpleBuildingConstructionExample.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="../../../../Buildings/UHRB/SimpleBuildingConstructionExample.x3d">SimpleBuildingConstructionExample.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> creator </i> </td>
			<td> Don Brutzman </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> created </i> </td>
			<td> 17 October 2001 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> modified </i> </td>
			<td> 2 January 2025 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> description </i> </td>
			<td> Example use of simple prototypes for building construction: Wall, Floor, Level and Building. </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/Buildings/UHRB/SimpleBuildingConstructionExample.x3d" target="_blank">https://www.web3d.org/x3d/content/examples/Savage/Buildings/UHRB/SimpleBuildingConstructionExample.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> generator </i> </td>
			<td> X3D-Edit 3.2, <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="../../../../Buildings/UHRB/../../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
 */

public class SimpleBuildingConstructionExample
{
	/** Default constructor to create this object. */
	public SimpleBuildingConstructionExample ()
	{
	  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("SimpleBuildingConstructionExample.x3d"))
    .addMeta(new meta().setName(meta.NAME_CREATOR    ).setContent("Don Brutzman"))
    .addMeta(new meta().setName(meta.NAME_CREATED    ).setContent("17 October 2001"))
    .addMeta(new meta().setName(meta.NAME_MODIFIED   ).setContent("2 January 2025"))
    .addMeta(new meta().setName(meta.NAME_DESCRIPTION).setContent("Example use of simple prototypes for building construction: Wall, Floor, Level and Building."))
    .addMeta(new meta().setName(meta.NAME_IDENTIFIER ).setContent("https://www.web3d.org/x3d/content/examples/Savage/Buildings/UHRB/SimpleBuildingConstructionExample.x3d"))
    .addMeta(new meta().setName(meta.NAME_GENERATOR  ).setContent("X3D-Edit 3.2, 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("SimpleBuildingConstructionExample.x3d"))
    .addChild(new ExternProtoDeclare("Floor").setName("Floor").setAppinfo("Each Floor cantains the current floor surface plus a ceiling surface for the floor immediately underneath. A Floor does not include exterior or interior wall polygons.").setUrl(new String[] {"SimpleBuildingConstructionPrototypes.x3d#Floor","https://www.web3d.org/x3d/content/examples/Savage/Buildings/UHRB/SimpleBuildingConstructionPrototypes.x3d#Floor","SimpleBuildingConstructionPrototypes.wrl#Floor","https://www.web3d.org/x3d/content/examples/Savage/Buildings/UHRB/SimpleBuildingConstructionPrototypes.wrl#Floor"})
      .addField(new field().setName("name").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Identifying name for this Floor."))
      .addField(new field().setName("description").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Description info for this construction."))
      .addField(new field().setName("size").setType(field.TYPE_SFNODE).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("single-value Coordinate node with dimension x=width y=height z=depth in meters"))
      .addField(new field().setName("floorAppearance").setType(field.TYPE_SFNODE).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Appearance node with Material colors ImageTexture etc. for this construction."))
      .addField(new field().setName("ceilingAppearance").setType(field.TYPE_SFNODE).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Appearance node with Material colors ImageTexture etc. for this construction."))
      .addField(new field().setName("showSides").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Whether sides are visible."))
      .addField(new field().setName("width").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("width of front side of floor aligned with local X axis."))
      .addField(new field().setName("height").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("height of vertical distance between floor and ceiling directly underneath aligned with local Y axis."))
      .addField(new field().setName("depth").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("depth of horizontal side of floor aligned with local -Z axis."))
      .addField(new field().setName("built").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("Indicate whether initialization complete.")))
    .addChild(new ExternProtoDeclare("Wall").setName("Wall").setAppinfo("Each Wall contains exterior and interior walls.").setUrl(new String[] {"SimpleBuildingConstructionPrototypes.x3d#Wall","https://www.web3d.org/x3d/content/examples/Savage/Buildings/UHRB/SimpleBuildingConstructionPrototypes.x3d#Wall","SimpleBuildingConstructionPrototypes.wrl#Wall","https://www.web3d.org/x3d/content/examples/Savage/Buildings/UHRB/SimpleBuildingConstructionPrototypes.wrl#Wall"})
      .addField(new field().setName("name").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Identifying name for this Wall."))
      .addField(new field().setName("description").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Description info for this construction."))
      .addField(new field().setName("size").setType(field.TYPE_SFNODE).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("single-value Coordinate node with dimension x=width y=height z=depth in meters"))
      .addField(new field().setName("interiorAppearance").setType(field.TYPE_SFNODE).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Appearance node with Material colors ImageTexture etc. for this construction."))
      .addField(new field().setName("exteriorAppearance").setType(field.TYPE_SFNODE).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Appearance node with Material colors ImageTexture etc. for this construction."))
      .addField(new field().setName("showSides").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Whether sides are visible."))
      .addField(new field().setName("width").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("width of horizontal side of wall aligned with local X axis."))
      .addField(new field().setName("height").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("height of Wall aligned with local Y axis."))
      .addField(new field().setName("depth").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("depth of horizontal thickness of Wall aligned with local -Z axis."))
      .addField(new field().setName("built").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("Indicate whether initialization complete.")))
    .addChild(new ExternProtoDeclare("Level").setName("Level").setAppinfo("collection of a Floor and four Walls working in order up from lowest level (i.e. story) of the Building").setUrl(new String[] {"SimpleBuildingConstructionPrototypes.x3d#Level","https://www.web3d.org/x3d/content/examples/Savage/Buildings/UHRB/SimpleBuildingConstructionPrototypes.x3d#Level","SimpleBuildingConstructionPrototypes.wrl#Level","https://www.web3d.org/x3d/content/examples/Savage/Buildings/UHRB/SimpleBuildingConstructionPrototypes.wrl#Level"})
      .addField(new field().setName("name").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Identifying name for this Level."))
      .addField(new field().setName("description").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Description info for this construction."))
      .addField(new field().setName("floor").setType(field.TYPE_MFNODE).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("contains single Floor node"))
      .addField(new field().setName("frontWall").setType(field.TYPE_MFNODE).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("contains single front Wall node"))
      .addField(new field().setName("rightWall").setType(field.TYPE_MFNODE).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("contains single right-side Wall node"))
      .addField(new field().setName("rearWall").setType(field.TYPE_MFNODE).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("contains single rear Wall node"))
      .addField(new field().setName("leftWall").setType(field.TYPE_MFNODE).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("contains single left-side Wall node"))
      .addField(new field().setName("width").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("Calculated width of horizontal side of Level aligned with local X axis."))
      .addField(new field().setName("height").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("Calculated height of Level aligned with local Y axis."))
      .addField(new field().setName("depth").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("Calculated depth of horizontal thickness of Level aligned with local -Z axis."))
      .addField(new field().setName("built").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("Indicate whether initialization complete.")))
    .addChild(new ExternProtoDeclare("Building").setName("Building").setAppinfo("Collect prototypes for levels floors and walls to create a simple Building.").setUrl(new String[] {"SimpleBuildingConstructionPrototypes.x3d#Building","https://www.web3d.org/x3d/content/examples/Savage/Buildings/UHRB/SimpleBuildingConstructionPrototypes.x3d#Building","SimpleBuildingConstructionPrototypes.wrl#Building","https://www.web3d.org/x3d/content/examples/Savage/Buildings/UHRB/SimpleBuildingConstructionPrototypes.wrl#Building"})
      .addField(new field().setName("name").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Identifying name of this Building."))
      .addField(new field().setName("description").setType(field.TYPE_MFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Description info for this construction."))
      .addField(new field().setName("authorAssist").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("whether or not to display author assist tools such as coordinate axes measuring grids etc."))
      .addField(new field().setName("xHeading").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("compass direction in degrees of building X axis as seen when regarding front face of building pointing from left side to right side."))
      .addField(new field().setName("orientation").setType(field.TYPE_SFROTATION).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("output rotation value calculated from xHeading as (0 1 0 xHeading * 2pi / 360)"))
      .addField(new field().setName("latitude").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("example value: 120.30 E"))
      .addField(new field().setName("longitude").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("example value: 20.45 N"))
      .addField(new field().setName("levels").setType(field.TYPE_MFNODE).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("contains array of Level nodes"))
      .addField(new field().setName("roof").setType(field.TYPE_SFNODE).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Geometry for Roof positioned above topmost Level"))
      .addField(new field().setName("roofHeight").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("height value for provided Roof geometry."))
      .addField(new field().setName("width").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("Calculated width of horizontal side of Building aligned with local X axis."))
      .addField(new field().setName("height").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("Calculated height of Building aligned with local Y axis."))
      .addField(new field().setName("depth").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("Calculated depth of horizontal thickness of Building aligned with local -Z axis."))
      .addField(new field().setName("built").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("Indicate whether initialization complete.")))
    .addComments(" ============================ ")
    .addComments(" example instance ")
    .addChild(new Background().setGroundAngle(new double[] {1.57}).setGroundColor(new MFColor(new double[] {0.6,0.9,0.6,0.6,0.9,0.6})).setSkyColor(new MFColor(new double[] {0.6,0.6,0.9})))
    .addChild(new Viewpoint().setDescription("Building, Level, Wall and Floor prototype examples. Next Viewpoints are calculated based on Building size.").setOrientation(1.0,0.0,0.0,-0.3).setPosition(4.0,9.0,15.0))
    .addChild(new Switch("Tester").setWhichChoice(1)
      .addComments(" test one child only ")
      .addChild(new Transform().setTranslation(-5.0,0.0,0.0)
        .addChild(new ProtoInstance("Floor").setContainerField("children")
          .addFieldValue(new fieldValue().setName("name").setValue("hidden1"))
          .addFieldValue(new fieldValue().setName("description").setValue(new String[] {"simple test floor"}))
          .addFieldValue(new fieldValue().setName("size")
            .addComments(" point dimensions: width height depth ")
            .addChild(new Coordinate().setPoint(new MFVec3f(new double[] {10.0,0.2,5.0}))))
          .addFieldValue(new fieldValue().setName("floorAppearance")
            .addChild(new Appearance()
              .setMaterial(new Material().setDiffuseColor(0.3,0.3,0.1))))
          .addFieldValue(new fieldValue().setName("ceilingAppearance")
            .addChild(new Appearance()
              .setMaterial(new Material())))
          .addFieldValue(new fieldValue().setName("showSides").setValue(true)))
        .addChild(new ProtoInstance("Wall").setContainerField("children")
          .addFieldValue(new fieldValue().setName("name").setValue("hidden2"))
          .addFieldValue(new fieldValue().setName("description").setValue(new String[] {"simple test wall"}))
          .addComments(" point dimensions: width height depth ")
          .addFieldValue(new fieldValue().setName("size")
            .addChild(new Coordinate().setPoint(new MFVec3f(new double[] {10.0,2.5,0.5}))))
          .addFieldValue(new fieldValue().setName("interiorAppearance")
            .addChild(new Appearance()
              .setMaterial(new Material("Green").setDiffuseColor(0.3,0.6,0.1))))
          .addFieldValue(new fieldValue().setName("exteriorAppearance")
            .addChild(new Appearance()
              .setMaterial(new Material("LightBlue").setDiffuseColor(0.5,0.5,0.8))))
          .addFieldValue(new fieldValue().setName("showSides").setValue(true))))
      .addChild(new ProtoInstance("Building").setContainerField("children")
        .addFieldValue(new fieldValue().setName("name").setValue("exemplar"))
        .addFieldValue(new fieldValue().setName("description").setValue(new String[] {"A set of example building prototype instances."}))
        .addFieldValue(new fieldValue().setName("authorAssist").setValue(true))
        .addFieldValue(new fieldValue().setName("xHeading").setValue(335))
        .addFieldValue(new fieldValue().setName("latitude").setValue("40 52 N"))
        .addFieldValue(new fieldValue().setName("longitude").setValue("126 E"))
        .addFieldValue(new fieldValue().setName("levels")
          .addChild(new ProtoInstance("Level", "LevelOne").setContainerField("children")
            .addFieldValue(new fieldValue().setName("name").setValue("One"))
            .addFieldValue(new fieldValue().setName("description").setValue(new String[] {"first level is ground story of building"}))
            .addFieldValue(new fieldValue().setName("floor")
              .addChild(new ProtoInstance("Floor", "BottomFloor").setContainerField("children")
                .addFieldValue(new fieldValue().setName("name").setValue("bottom"))
                .addFieldValue(new fieldValue().setName("description").setValue(new String[] {"planar surface for first floor"}))
                .addFieldValue(new fieldValue().setName("size")
                  .addComments(" point dimensions: width height depth ")
                  .addChild(new Coordinate("FloorSizeCoordinateNode").setPoint(new MFVec3f(new double[] {10.0,0.2,5.0}))))
                .addFieldValue(new fieldValue().setName("floorAppearance")
                  .addChild(new Appearance("FloorAppearanceNode")
                    .setMaterial(new Material("Olive").setDiffuseColor(0.3,0.3,0.1))))
                .addFieldValue(new fieldValue().setName("ceilingAppearance")
                  .addChild(new Appearance("CeilingAppearanceNode")
                    .setMaterial(new Material("LightGrey"))))))
            .addFieldValue(new fieldValue().setName("frontWall")
              .addChild(new ProtoInstance("Wall").setContainerField("children")
                .addFieldValue(new fieldValue().setName("name").setValue("frontOne"))
                .addFieldValue(new fieldValue().setName("description").setValue(new String[] {"example front Wall"}))
                .addFieldValue(new fieldValue().setName("size")
                  .addChild(new Coordinate("FacingWallSizeCoordinateNode").setPoint(new MFVec3f(new double[] {10.0,2.5,0.5}))))
                .addFieldValue(new fieldValue().setName("interiorAppearance")
                  .addChild(new Appearance("InteriorAppearanceNode")
                    .setMaterial(new Material().setDiffuseColor(0.3,0.3,0.1))))
                .addFieldValue(new fieldValue().setName("exteriorAppearance")
                  .addChild(new Appearance("ExteriorAppearanceNode")
                    .setMaterial(new Material())))))
            .addFieldValue(new fieldValue().setName("rightWall")
              .addChild(new ProtoInstance("Wall").setContainerField("children")
                .addFieldValue(new fieldValue().setName("name").setValue("rightOne"))
                .addFieldValue(new fieldValue().setName("description").setValue(new String[] {"example right Wall"}))
                .addFieldValue(new fieldValue().setName("size")
                  .addChild(new Coordinate("SideWallSizeCoordinateNode").setPoint(new MFVec3f(new double[] {5.0,2.5,0.5}))))
                .addFieldValue(new fieldValue().setName("interiorAppearance")
                  .addChild(new Appearance().setUSE("InteriorAppearanceNode")))
                .addFieldValue(new fieldValue().setName("exteriorAppearance")
                  .addChild(new Appearance("ExteriorAppearanceNode2")
                    .setMaterial(new Material())
                    .setTexture(new ImageTexture("BrickTexture").setRepeatS(false).setUrl(new String[] {"brick.jpg","https://www.web3d.org/x3d/content/examples/Savage/Buildings/UHRB/brick.jpg","https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/brick.jpg"}))))))
            .addFieldValue(new fieldValue().setName("rearWall")
              .addChild(new ProtoInstance("Wall").setContainerField("children")
                .addFieldValue(new fieldValue().setName("name").setValue("rearOne"))
                .addFieldValue(new fieldValue().setName("description").setValue(new String[] {"example rear Wall"}))
                .addFieldValue(new fieldValue().setName("size")
                  .addChild(new Coordinate().setUSE("FacingWallSizeCoordinateNode")))
                .addFieldValue(new fieldValue().setName("interiorAppearance")
                  .addChild(new Appearance().setUSE("InteriorAppearanceNode")))
                .addFieldValue(new fieldValue().setName("exteriorAppearance")
                  .addChild(new Appearance().setUSE("ExteriorAppearanceNode")))))
            .addFieldValue(new fieldValue().setName("leftWall")
              .addChild(new ProtoInstance("Wall").setContainerField("children")
                .addFieldValue(new fieldValue().setName("name").setValue("leftOne"))
                .addFieldValue(new fieldValue().setName("description").setValue(new String[] {"example left Wall"}))
                .addFieldValue(new fieldValue().setName("size")
                  .addChild(new Coordinate().setUSE("SideWallSizeCoordinateNode")))
                .addFieldValue(new fieldValue().setName("interiorAppearance")
                  .addChild(new Appearance().setUSE("InteriorAppearanceNode")))
                .addFieldValue(new fieldValue().setName("exteriorAppearance")
                  .addChild(new Appearance().setUSE("ExteriorAppearanceNode2"))))))
          .addChild(new ProtoInstance("Level", "LevelTwo").setContainerField("children")
            .addFieldValue(new fieldValue().setName("name").setValue("Two"))
            .addFieldValue(new fieldValue().setName("description").setValue(new String[] {"second level of building has an open front Wall"}))
            .addFieldValue(new fieldValue().setName("floor")
              .addChild(new ProtoInstance("Floor").setUSE("BottomFloor").setContainerField("children")))
            .addComments(" no frontWall, but still need null-node fieldValue to avoid CosmoPlayer crash ")
            .addFieldValue(new fieldValue().setName("frontWall")
              .addChild(new ProtoInstance("Wall").setContainerField("children")
                .addFieldValue(new fieldValue().setName("name").setValue("frontTwo"))
                .addFieldValue(new fieldValue().setName("description").setValue(new String[] {"test default values are null wall"}))))
            .addFieldValue(new fieldValue().setName("rightWall")
              .addChild(new ProtoInstance("Wall").setContainerField("children")
                .addFieldValue(new fieldValue().setName("name").setValue("rightTwo"))
                .addFieldValue(new fieldValue().setName("description").setValue(new String[] {"example right Wall"}))
                .addFieldValue(new fieldValue().setName("size")
                  .addChild(new Coordinate().setUSE("SideWallSizeCoordinateNode")))
                .addFieldValue(new fieldValue().setName("interiorAppearance")
                  .addChild(new Appearance("InteriorAppearanceNode2")
                    .setMaterial(new Material().setDiffuseColor(0.8,0.8,0.2))))
                .addFieldValue(new fieldValue().setName("exteriorAppearance")
                  .addChild(new Appearance("ExteriorAppearanceNode3")
                    .setMaterial(new Material().setDiffuseColor(0.8,0.4,0.1))))
                .addFieldValue(new fieldValue().setName("showSides").setValue(true))))
            .addFieldValue(new fieldValue().setName("rearWall")
              .addChild(new ProtoInstance("Wall").setContainerField("children")
                .addFieldValue(new fieldValue().setName("name").setValue("rearTwo"))
                .addFieldValue(new fieldValue().setName("description").setValue(new String[] {"example rear Wall"}))
                .addFieldValue(new fieldValue().setName("size")
                  .addChild(new Coordinate().setUSE("FacingWallSizeCoordinateNode")))
                .addFieldValue(new fieldValue().setName("interiorAppearance")
                  .addChild(new Appearance().setUSE("InteriorAppearanceNode2")))
                .addFieldValue(new fieldValue().setName("exteriorAppearance")
                  .addChild(new Appearance().setUSE("ExteriorAppearanceNode3")))
                .addFieldValue(new fieldValue().setName("showSides").setValue(true))))
            .addFieldValue(new fieldValue().setName("leftWall")
              .addChild(new ProtoInstance("Wall").setContainerField("children")
                .addFieldValue(new fieldValue().setName("name").setValue("leftTwo"))
                .addFieldValue(new fieldValue().setName("description").setValue(new String[] {"example left Wall"}))
                .addFieldValue(new fieldValue().setName("size")
                  .addChild(new Coordinate().setUSE("SideWallSizeCoordinateNode")))
                .addFieldValue(new fieldValue().setName("interiorAppearance")
                  .addChild(new Appearance().setUSE("InteriorAppearanceNode2")))
                .addFieldValue(new fieldValue().setName("exteriorAppearance")
                  .addChild(new Appearance().setUSE("ExteriorAppearanceNode3")))
                .addFieldValue(new fieldValue().setName("showSides").setValue(true)))))
          .addChild(new ProtoInstance("Level").setUSE("LevelOne").setContainerField("children")))
        .addComments(" roof can be any geometry. a very simple roof is to re-Use initial Floor. ")
        .addFieldValue(new fieldValue().setName("roof")
          .addComments(" center of Box is at origin, so translate to get front left corner of Box at origin. Also adjust for roof overhang. ")
          .addChild(new Transform().setTranslation(5.0,0.2,-2.5)
            .addChild(new Shape()
              .setGeometry(new Box().setSize(11.0,0.4,6.0))
              .setAppearance(new Appearance()
                .setMaterial(new Material().setDiffuseColor(0.0,0.0,1.0))))))
        .addFieldValue(new fieldValue().setName("roofHeight").setValue(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 SimpleBuildingConstructionExample 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 SimpleBuildingConstructionExample().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.Buildings.UHRB.SimpleBuildingConstructionExample\" 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.Buildings.UHRB.SimpleBuildingConstructionExample self-validation test confirmation: ");
                if (!validationResults.equals("success"))
                    System.out.println();
                System.out.println(validationResults.trim());

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