import classpath
from org.web3d.x3d.jsail.Core.X3DObject import X3DObject as X3D
from org.web3d.x3d.jsail.fields.SFStringObject import SFStringObject as SFString
from org.web3d.x3d.jsail.Core.headObject import headObject as head
from org.web3d.x3d.jsail.Core.metaObject import metaObject as meta
from org.web3d.x3d.jsail.Core.SceneObject import SceneObject as Scene
from org.web3d.x3d.jsail.Grouping.GroupObject import GroupObject as Group
from org.web3d.x3d.jsail.Navigation.ViewpointObject import ViewpointObject as Viewpoint
from org.web3d.x3d.jsail.fields.SFVec3fObject import SFVec3fObject as SFVec3f
from org.web3d.x3d.jsail.Grouping.TransformObject import TransformObject as Transform
from org.web3d.x3d.jsail.fields.SFRotationObject import SFRotationObject as SFRotation
from org.web3d.x3d.jsail.Shape.ShapeObject import ShapeObject as Shape
from org.web3d.x3d.jsail.Geometry3D.SphereObject import SphereObject as Sphere
from org.web3d.x3d.jsail.Shape.AppearanceObject import AppearanceObject as Appearance
from org.web3d.x3d.jsail.Shape.MaterialObject import MaterialObject as Material
from org.web3d.x3d.jsail.fields.SFColorObject import SFColorObject as SFColor
from org.web3d.x3d.jsail.Texturing.ImageTextureObject import ImageTextureObject as ImageTexture
from org.web3d.x3d.jsail.fields.MFStringObject import MFStringObject as MFString
from org.web3d.x3d.jsail.Text.TextObject import TextObject as Text
from org.web3d.x3d.jsail.Text.FontStyleObject import FontStyleObject as FontStyle
X3D0 = X3D() \
   .setProfile(SFString("Immersive")) \
   .setVersion(SFString("3.3")) \
   .setHead(head() \
    .addMeta(meta() \
     .setContent(SFString("HelloWorld.x3d")) \
     .setName(SFString("title")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("Simple X3D scene example: Hello World!")) \
     .setName(SFString("description")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("30 October 2000")) \
     .setName(SFString("created")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("28 July 2015")) \
     .setName(SFString("modified")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("Don Brutzman")) \
     .setName(SFString("creator")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("HelloWorld.tall.png")) \
     .setName(SFString("Image")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("http://en.wikipedia.org/wiki/Hello_world")) \
     .setName(SFString("reference")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("https://en.wikipedia.org/wiki/Hello#.22Hello.2C_World.22_computer_program")) \
     .setName(SFString("reference")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("https://en.wikipedia.org/wiki/\"Hello,_World!\"_program")) \
     .setName(SFString("reference")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("http://en.wikibooks.org/w/index.php?title=Computer_Programming/Hello_world")) \
     .setName(SFString("reference")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("http://www.HelloWorldExample.net")) \
     .setName(SFString("reference")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("http://www.web3D.org")) \
     .setName(SFString("reference")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("http://www.web3d.org/realtime-3d/news/internationalization-x3d")) \
     .setName(SFString("reference")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("http://www.web3d.org/x3d/content/examples/HelloWorld.x3d")) \
     .setName(SFString("reference")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("http://X3dGraphics.com/examples/X3dForAdvancedModeling/HelloWorldScenes")) \
     .setName(SFString("reference")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld.x3d")) \
     .setName(SFString("identifier")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("http://www.web3d.org/x3d/content/examples/license.html")) \
     .setName(SFString("license")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit")) \
     .setName(SFString("generator")) \
    ) \
# Alternate encodings: VRML97, X3D ClassicVRML Encoding, X3D Compressed Binary Encoding (CBE), X3DOM, JSON 
    .addMeta(meta() \
     .setContent(SFString("HelloWorld.wrl")) \
     .setName(SFString("reference")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("HelloWorld.x3dv")) \
     .setName(SFString("reference")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("HelloWorld.x3db")) \
     .setName(SFString("reference")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("HelloWorld.xhtml")) \
     .setName(SFString("reference")) \
    ) \
    .addMeta(meta() \
     .setContent(SFString("HelloWorld.json")) \
     .setName(SFString("reference")) \
    ) \
   ) \
   .setScene(Scene() \
# Example scene to illustrate X3D nodes and fields (XML elements and attributes) 
    .addChild(Group() \
     .addChild(Viewpoint() \
      .setDEF(SFString("ViewUpClose")) \
      .setCenterOfRotation(SFVec3f([0,-1,0])) \
      .setDescription(SFString("Hello world!")) \
      .setPosition(SFVec3f([0,-1,7])) \
     ) \
     .addChild(Transform() \
      .setRotation(SFRotation([0,1,0,3])) \
      .addChild(Shape() \
       .setGeometry(Sphere() \
       ) \
       .setAppearance(Appearance() \
        .setMaterial(Material() \
         .setDEF(SFString("MaterialLightBlue")) \
         .setDiffuseColor(SFColor([0.1,0.5,1])) \
        ) \
        .setTexture(ImageTexture() \
         .setDEF(SFString("ImageCloudlessEarth")) \
         .setUrl(MFString(["earth-topo.png","earth-topo.jpg","earth-topo-small.gif","http://www.web3d.org/x3d/content/examples/Basic/earth-topo.png","http://www.web3d.org/x3d/content/examples/Basic/earth-topo.jpg","http://www.web3d.org/x3d/content/examples/Basic/earth-topo-small.gif"])) \
        ) \
       ) \
      ) \
     ) \
     .addChild(Transform() \
      .setTranslation(SFVec3f([0,-2,0])) \
      .addChild(Shape() \
       .setGeometry(Text() \
        .setDEF(SFString("TextMessage")) \
        .setString(MFString(["Hello","world!"])) \
        .setFontStyle(FontStyle() \
         .setJustify(MFString(["MIDDLE","MIDDLE"])) \
        ) \
       ) \
       .setAppearance(Appearance() \
        .setMaterial(Material() \
         .setUSE(SFString("MaterialLightBlue")) \
        ) \
       ) \
      ) \
     ) \
    ) \
   ) \

X3D0.toFileX3D("/x3d-code/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter01TechnicalOverview//HelloWorld_RoundTrip.x3d")
