<html><head></head><body>Well... So, I used to use default coordinate system with meter as unit and center of the scene at level 0 as origin.<br>
Indeed, my conversion from default coordinate system to geo one can't work as is. I will provide again default system and fix my buggy and not tested geo X3D export.<br>
I've just updated Open Earth View wiki page with TODO notes.<br>
<br>
Thank you Don for having looked at such important details!<br>
<br>
Clément.<br><br><div class="gmail_quote">Le 19 décembre 2015 22:09:18 UTC+01:00, Don Brutzman <brutzman@nps.edu> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">1. Am thinking about how we might improve the X3D JSON encoding by treating #comment and #ROUTE as objects in an array that is contained by parent. This would reduce problems with the partial resorting that currently occurs.<br /><br />Doing it as part of "-children" isn't particularly difficult; the trick will be doing it cleanly inside of nodes that contain other non-children nodes, e.g. Shape, Appearance, singleton nodes, etc. The path to success may lead through always treating any child content as part of an array.<br /><br />Continuing this line of inquiry: we could put them inside of a "-children" JSON field consistently throughout the scene graph. Use cases:<br />a. Within "-children":[array] of Scene (which is already produced)<br />b. Within "-children":[array] of grouping nodes (which is already produced)<br />c. Within "-children":[array] of any node, even when they don't have a /children/ field<br /><br />2. So let's look at an example, in
detail.<br /><br />Example scene created is named HelloWorldCommented.x3d with XML source, current (original) JSON encoding, and alternative JSON encoding all attached.<br /><br />First excerpt follows, with the focus just for regular children (use cases 1.a and 1.b from above).<br /><br /><hr /><br />*XML encoding*<br /><hr /><br /><X3D><br /> <Scene><br /> <!-- Example scene to illustrate comments interspersed among X3D nodes and fields (XML elements and attributes) --><br /> <!-- WorldInfo begin --><br /> <WorldInfo title='Hello world!'/><br /> <!-- WorldInfo complete, Group begin --><br /> <Group><br /> <!-- Viewpoint begin --><br /> <Viewpoint DEF='ViewUpClose' centerOfRotation='0 -1 0' description='Hello world!' position='0 -1 7'/><br /> <!-- Viewpoint complete, Transform begin --><br /> <Transform/><br /> <!-- Transform complete, Transform begin --><br
/> <Transform/><br /> <!-- Transform complete --><br /> </Group><br /> <!-- Group complete --><br /> </Scene><br /></X3D><br /><hr /><br /><br />Now two corresponding JSON examples using #comment attached. (Net effect with #ROUTE would be the same.)<br /><br />Notice how comments are pulled up together in the current encoding (which partially re-sorts and thus changes the original order), but then comments are interspersed as expected in the second encoding:<br /><hr /><br />*current JSON encoding*<br /><hr /><br />{ "X3D": {<br /> "Scene": {<br /> "#comment":[<br /> "Example scene to illustrate comments interspersed among X3D nodes and fields (XML elements and attributes)",<br /> "WorldInfo begin",<br /> "WorldInfo complete, Group begin",<br /> "Group complete"<br /> ],<br /> "-children":[<br /> { "WorldInfo":<br /> {<br />
"@title":"Hello world!"<br /> }<br /> },<br /> { "Group":<br /> {<br /> "#comment":[<br /> "Viewpoint begin",<br /> "Viewpoint complete, Transform begin",<br /> "Transform complete, Transform begin",<br /> "Transform complete"<br /> ],<br /> "-children":[<br /> { "Viewpoint": { }<br /> },<br /> { "Transform": { }<br /> },<br /> { "Transform": { }<br /> }<br /> ]<br /> }<br /> }<br /> ]<br /> }<br /> }<br />}<br /><hr /><br />*alternative JSON encoding*<br /><hr /><br />{ "X3D": {<br /> "Scene": {<br /> "-children":[<br /> { "#comment":"Example scene to illustrate comments interspersed among X3D nodes and fields (XML elements and attributes)"},<br /> {
"#comment":"WorldInfo begin"},<br /> { "WorldInfo":<br /> {<br /> "@title":"Hello world!"<br /> }<br /> },<br /> { "#comment":"WorldInfo complete, Group begin"},<br /> { "Group":<br /> {<br /> "-children":[<br /> { "#comment":"Viewpoint begin"},<br /> { "Viewpoint": { }<br /> },<br /> { "#comment":"Viewpoint complete, Transform begin"},<br /> { "Transform": { }<br /> },<br /> { "#comment":"Transform complete, Transform begin"},<br /> { "Transform": { }<br /> },<br /> { "#comment":"Transform complete"}<br /> ]<br /> }<br /> },<br /> { "#comment":"Group complete"}<br /> ]<br /> }<br /> }<br />}<br /><hr /><br /><br />2. So far so good. Now let's look at how this
approach ripples through a Shape node, as an example of use case 1.c above.<br /><br /><hr /><br />*XML encoding*<br /><hr /><br /><!-- Shape begin --><br /><Shape><br /> <!-- Text begin --><br /> <Text DEF='TextMessage' string='"Hello" "world!"'><br /> <!-- FontStyle begin --><br /> <FontStyle justify='"MIDDLE" "MIDDLE"'/><br /> <!-- FontStyle complete --><br /> </Text><br /> <!-- Text complete, Appearance begin --><br /> <Appearance><br /> <!-- Material begin --><br /> <Material USE='MaterialLightBlue'/><br /> <!-- Material complete --><br /> </Appearance><br /> <!-- Material complete --><br /></Shape><br /><!-- Shape complete --><br /><hr /><br /><br />Once again the current/original X3D JSON encoding partially re-sorts the comments:<br /><hr /><br />*current JSON encoding*<br /><hr /><br />"#comment":[<br />"Shape begin",<br />"Shape
complete"<br />],<br />"-children":[<br /> { "Shape":<br /> {<br /> "#comment":[<br /> "Text begin",<br /> "Text complete, Appearance begin",<br /> "Material complete"<br /> ],<br /> "-geometry":[<br /> { "Text":<br /> {<br /> "@DEF":"TextMessage",<br /> "@string":["Hello","world!"],<br /> "#comment":[<br /> "FontStyle begin",<br /> "FontStyle complete"<br /> ],<br /> "-fontStyle":[<br /> { "FontStyle":<br /> {<br /> "@justify":["MIDDLE","MIDDLE"]<br /> }<br /> }<br /> ]<br /> }<br /> }<br /> ],<br /> "-appearance":[<br /> { "Appearance":<br /> {<br /> "#comment":[<br /> "Material begin",<br /> "Material complete"<br /> ],<br />
"-material":[<br /> { "Material":<br /> {<br /> "@USE":"MaterialLightBlue"<br /> }<br /> }<br /> ]<br /> }<br /> }<br /> ]<br /> }<br /> }<br />]<br /><hr /><br /><br />And once again the alternative intersperses the comments as part of a "-children" JSON key. Not so very different.<br /><br />Notable is that Shape and Appearance do not have /children/ fields, but they do have child ("-children") comments. Thus scene graph structure is better (though not perfectly) preserved.<br /><br />Some re-sorting of comments prior to peer nodes still appears to be unavoidable, but it is reduced overall.<br /><br />The pattern for encoding comments (and ROUTEs) is fully consistent, so parsing should still be straightforward.<br /><hr /><br />*alternative JSON encoding*<br /><hr /><br />"-children":[<br /> { "#comment":"Shape begin"},<br /> { "Shape":<br /> {<br />
"#comment":[<br /> "Sphere begin",<br /> "Sphere complete, Appearance begin",<br /> "Appearance complete"<br /> ],<br /> "-geometry":[<br /> { "Sphere":<br /> {<br /> }<br /> }<br /> ],<br /> "-appearance":[<br /> { "Appearance":<br /> {<br /> "-children":[<br /> { "#comment":"Viewpoint begin"},<br /> { "#comment":"Material begin"},<br /> { "#comment":"Material complete, ImageTexture begin"},<br /> { "#comment":"ImageTexture complete"}<br /> ],<br /> "-material":[<br /> { "Material":<br /> {<br /> "@DEF":"MaterialLightBlue",<br /> "@diffuseColor":[0.1,0.5,1]<br /> }<br /> }<br /> ],<br /> "-texture":[<br /> { "ImageTexture":<br /> {<br />
"@DEF":"ImageCloudlessEarth",<br /> "@url":["earth-topo.png","earth-topo.jpg","earth-topo-small.gif","<a href="http://www.web3d.org/x3d/content/examples/Basic/earth-topo.png">http://www.web3d.org/x3d/content/examples/Basic/earth-topo.png</a>","<a href="http://www.web3d.org/x3d/content/examples/Basic/earth-topo.jpg">http://www.web3d.org/x3d/content/examples/Basic/earth-topo.jpg</a>","<a href="http://www.web3d.org/x3d/content/examples/Basic/earth-topo-small.gif">http://www.web3d.org/x3d/content/examples/Basic/earth-topo-small.gif</a>"]<br /> }<br /> }<br /> ]<br /> }<br /> }<br /> ]<br /> }<br /> },<br /> { "#comment":"Shape complete"}<br />]<br /><hr /><br /><br />3. Analysis and next steps.<br /><br />I think that this alternative approach further reduces the special-case handling of #comment and #ROUTE which exists in the current/original JSON encoding.<br /><br />A more
consistent JSON encoding simplifies parsing rules and hopefully makes production/consumption easier to accomplish.<br /><br />Treating #comment and #ROUTE in the same fashion as other nodes, rather than as field keys, also is more consistent with the primary design pattern of the overall X3D JSON encoding.<br /><br />The alternative-encoding example was manually edited and validated using jslint in X3D-Edit. If group review indicates that this approach looks superior, I'll work on a refactoring of the X3dToJson.xslt stylesheet and re-build all the examples to support continued in-depth testing, implementation and evaluation.<br /><br />Thanks in advance for all scrutiny and review.<br /><br />all the best, Don</pre></blockquote></div><br>
clement@igonet.fr</body></html>