[x3d-public] How should CAD -shape containerField be expressed in X3DJSAIL

yottzumm at gmail.com yottzumm at gmail.com
Tue Feb 21 15:00:03 PST 2017


I would just like to see some consistency between output from the X3dToJson.xslt and X3DJSAIL.  If this means modifying my Java code, tell me how to do it.  I think the XML generated by X3DJSAIL is WRONG!  It’s kind of hard to capture because it’s an intermediate file.  Perhaps someone could generate XML from X3DJSAIL and compare it to the original.  It takes all my spare time to do the JSON.  That is, change toFileJSON to some XML generating method in the Java and run it.

Since I am producing XML from JSON, I may actually need the containerField in the JSON (unless I can magically figure it out).  Consider this for the V4.0 standard.  Otherwise, I may not be able to produce proper XML.

Thanks,

John

Sent from Mail for Windows 10

From: Roy Walmsley
Sent: Tuesday, February 21, 2017 8:22 AM
To: yottzumm at gmail.com
Cc: 'Don Brutzman'; 'X3D Graphics public mailing list'
Subject: RE: How should CAD -shape containerField be expressed in X3DJSAIL

John,

JSON, just like the VRML encoding, does not need containerField. This is because the child content is listed below the specific field that contains it. So, for example, consider a CADFace listing from the JSON file you attached:

{ "CADFace":
  {
    "@name":"outerSurface",
    "-shape":
      { "Shape":
        {
          "-children":[
            { "#comment":"note solid='true' and so one-sided external rendering only"
            }
          ],
          "-geometry":
            { "Cylinder":
              {
                "@bottom":false,
                "@height":3,
                "@radius":2,
                "@top":false
              }
            },
          "-appearance":
            { "Appearance":
              {
                "@DEF":"AppearanceGrey",
                "-material":
                  { "Material":
                    {
                    }
                  }
              }
            }
        }
      }
  }
}

The CADFace node has the value of two fields specified. The first is the “name” field, with the value “outerSurface”. The second is the “shape” field, with the value being the “Shape” node.

How does this appear in the XML encoding? It is :

<CADFace name="outerSurface">
  <Shape containerField="shape"><!--note solid='true' and so one-sided external rendering only-->
    <Cylinder containerField="geometry" bottom="false" height="3" radius="2" top="false"></Cylinder>
    <Appearance containerField="appearance" DEF="AppearanceGrey">
      <Material containerField="material"></Material>
    </Appearance>
  </Shape>
</CADFace> 

So could have been written as follows:

<CADFace name="outerSurface">
  <Shape><!--note solid='true' and so one-sided external rendering only-->
    <Cylinder bottom="false" height="3" radius="2" top="false"></Cylinder>
    <Appearance DEF="AppearanceGrey">
      <Material></Material>
    </Appearance>
  </Shape>
</CADFace> 

Notice that the “containerField” attributes have all been deleted. This might well fail to load. Why? Because, reference to the XML schema shows that the default value of “containerField” for the “Shape” node is “children”. However, CADFace does not have a “children” field. So, it is necessary to specify somehow which field the “Shape” node should be assigned to. Hence the “containerField” attribute.

In summary, in the X3D standard 19775-1 there is no “containerField”. In the ClassicVRML encoding 19776-2 there is no “containerField”. In the JSON encoding 19776-5 there is no “containerField”. It is, however, in the XML encoding 19776-1. This is the only text encoding that it appears in. Note that it would not be expected to be included in an implementation.  That is because, on loading into memory, and having created an instance of the “CADFace” node, the reading of the “Shape” node would create that instance, and then store the reference to it in the “shape” field of the “CADFace” node. So it is only required by the XML loader to determine which node field to add the child node reference to.

All the best,

Roy


From: yottzumm at gmail.com [mailto:yottzumm at gmail.com] 
Sent: 21 February 2017 06:38
To: Don Brutzman <brutzman at nps.edu>; Roy Walmsley <roy.walmsley at ntlworld.com>; X3D Graphics public mailing list <x3d-public at web3d.org>
Subject: How should CAD -shape containerField be expressed in X3DJSAIL

Attached input JSON and converted Java.  The Java does not produce -shape in the output JSON.json file [ not provided—compile and run the Java ].  Is this OK?  I am currently using setShape in the Java.  Why doesn’t the JSON.json have the containerField?  Thanks!

John


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170221/ce5bf544/attachment-0001.html>


More information about the x3d-public mailing list