[x3d-public] Possible error in X3dToNodeJS.xslt? LayerSet handling, multiple Mantis issues, class simplification for Java/Node SAI

John Carlson yottzumm at gmail.com
Sat May 30 09:29:18 PDT 2020


Yes, a temporary prefix.  autoclass is the first step, then shortening
later.

Thus:

let autoclass = require("./X3Dautoclass.js"); // should already be present

let X3D = autoclass.X3D;
// need a let for every X3D-based constructor used in file.

new X3D(); // without the autoclass.

We can work on changing the stylesheet Monday.

I am not sure how else to do this besides using ES6 imports. Hence my
desire to use ES6.  Possibly we could use a NodeJS file as an ES6 module?

If you want to work on an X3dToES6.xslt as alternative to X3dToNodeJS.xslt,
that would be cool.   I have tapped my friend Jeff to work on
something that imports XML and populates my ES6 library, but not sure if
he's going to do it or not.  You're welcome to have your hand at it.  I
have somewhat tested way of importing JSON.  But outputting XML from the
data structure seems problematic, even though I've exported XML in other
places.

Code is at:  https://github.com/coderextreme/es6x3d

I think you want to focus on X3DOM, possibly providing an SAI for it.  I've
gone a long way towards that with my Script.js file in X3DJSONLD, but I
need to hook my code into the X3DOM event loop, I think.

https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Script.js

A key issue for X3D4 is the integration of Scripts and ROUTEs in X3DOM.
The above is my first attempt at it.  Is anyone else working on this?
Likely this is more important to X3D4 than Protos is.  Leonard suggested
that Scripts came *before* Protos.

Maybe create an agenda for the Monday meeting?

I apologize for not documenting my trail through ECMAScript.  I am trying
to do that in bits and pieces now.

Thanks,

John

On Sat, May 30, 2020 at 8:40 AM Don Brutzman <brutzman at nps.edu> wrote:

> 1. Thanks for your notes John.  I've reset our calendar appointment on
> Mondays for weekly recurrence.
>
> Note that Anita intends to consolidate Web3D zoom rooms starting next
> week.  Once that is in place we can switch our rendezvous coordinates and
> add this regular review event to the Web3D calendar.
>
> 2. Of note regarding LayerSet is that it has a special inheritance
> hierarchy, which leads to the special handling below.  We likely need to
> consider and apply your fix for each of the conversion stylesheets.
>
> 3. Meanwhile, it turns out that there are 9 active issues on LayerSet in
> Mantis!  I just connected them as related so that they can be addressed
> coherently, there is definitely some overlap in there.
>
> * Mantis: View Issues, then apply search filter "LayerSet"
>    https://www.web3d.org/member-only/mantis/view_all_bug_page.php
>
> 4. Wondering if you consider "autoclass" a temporary prefix while
> designing the library.  It will certainly simplify authoring if a
> programmer can simply say
>
>     .addLayerSet((new LayerSet()).setDEF("scene.addChildLayerSetTest"))
>
> 5. Corresponding X3DJSAIL Java invocation looks like this:
>
>   * Filename:     HelloWorldProgram.java
>   * Description:  Example "smoke test" program to create an X3D model
> using the X3D Java Scene Access Interface Library (X3DJSAIL).
>   * Identifier:
> https://www.web3d.org/specifications/java/examples/HelloWorldProgram.java
>
>         scene.addLayerSet (new
> LayerSetObject("scene.addChildLayerSetTest")); // string is DEF name
>
> It would be a powerful improvement if the Java might become similarly
> simplified.  Non-trivial, will keep looking at it.
>
>         scene.addLayerSet (new LayerSet
> ("scene.addChildLayerSetTest")); // string is DEF name
>
> v/r Don
>
>
> On 5/29/2020 10:43 AM, John Carlson wrote:
> > This line from my serialized code does the trick.  Let's revisit how to
> do this in X3dToNodeJS.xslt on Monday.
> >
> >          .addLayerSet((new
> autoclass.LayerSet()).setDEF("scene.addChildLayerSetTest"))
> >
> > Will now check in my "repairs."
> >
> > John
> >
> > On Fri, May 29, 2020 at 12:22 PM John Carlson <yottzumm at gmail.com
> <mailto:yottzumm at gmail.com>> wrote:
> >
> >     java -cp ../jars/X3DJSAIL.4.0.full.jar
> org.web3d.x3d.jsail.CommandLine examples/HelloWorldProgramOutput.x3d -tojs
> -toFile examples/HelloWorldProgramOutput.Node.js
> >     parameter: source file HelloWorldProgramOutput.x3d filesize 22317
> bytes
> >     CommandLine parameter: "-tojs" for conversion to X3DJSONLD
> JavaScript source
> >     CommandLine parameter: "-toFile"
> "examples/HelloWorldProgramOutput.Node.js" for result file name root
> examples/HelloWorldProgramOutput.Node
> >     Parsing using Document Object Model (DOM) based X3DLoaderDOM...
> >     [X3DLoaderDOM] <meta name='info' content='continued development and
> testing in progress'/>
> >     convert to JS JavaScript:
> >     Warning: toFileStylesheetConversion(X3dToNodeJS.xslt) is overwriting
> prior file examples/HelloWorldProgramOutput.Node.js
> >     className='HelloWorldProgramOutput.Node' has illegal character(s) (
> -.,;) replaced with '_' underscore character.
> newClassName='HelloWorldProgramOutput_Node'
> >     file conversion successful: HelloWorldProgramOutput.Node.js (37121
> bytes)
> >
> >     coderextreme at DESKTOP-DOPK2VD MINGW64 /c/x3d-code/
> www.web3d.org/x3d/stylesheets/java/node <
> http://www.web3d.org/x3d/stylesheets/java/node>
> >     $ node examples/HelloWorldProgramOutput.Node.js
> >     C:\x3d-code\www.web3d.org <http://www.web3d.org
> >\x3d\stylesheets\java\node\examples\HelloWorldProgramOu
> >     tput.Node.js:176
> >          .addChild((new
> autoclass.LayerSet("scene.addChildLayerSetTest")))
> >           ^
> >
> >     Error: Could not find method
> "addChild(org.web3d.x3d.jsail.Layering.LayerSetObje
> >     ct)" on class "class org.web3d.x3d.jsail.Core.SceneObject". Possible
> matches:
> >        public org.web3d.x3d.jsail.Core.SceneObject
> org.web3d.x3d.jsail.Core.SceneObje
> >     ct.addChild(org.web3d.x3d.sai.Core.X3DChildNode)
> >
> >          at HelloWorldProgramOutput_Node.initialize (C:\x3d-code\
> www.web3d.org <http://www.web3d.org>\x3d\st
> >     ylesheets\java\node\examples\HelloWorldProgramOutput.Node.js:176:6)
> >          at new HelloWorldProgramOutput_Node (C:\x3d-code\www.web3d.org
> <http://www.web3d.org>\x3d\styleshee
> >     ts\java\node\examples\HelloWorldProgramOutput.Node.js:123:10)
> >          at Object.<anonymous> (C:\x3d-code\www.web3d.org <
> http://www.web3d.org>\x3d\stylesheets\java\node\e
> >     xamples\HelloWorldProgramOutput.Node.js:484:1)
> >     ?[90m    at Module._compile
> (internal/modules/cjs/loader.js:1176:30)?[39m
> >     ?[90m    at Object.Module._extensions..js
> (internal/modules/cjs/loader.js:1196:1
> >     0)?[39m
> >     ?[90m    at Module.load (internal/modules/cjs/loader.js:1040:32)?[39m
> >     ?[90m    at Function.Module._load
> (internal/modules/cjs/loader.js:929:14)?[39m
> >     ?[90m    at Function.executeUserEntryPoint [as runMain]
> (internal/modules/run_ma
> >     in.js:71:12)?[39m
> >     ?[90m    at internal/main/run_main_module.js:17:47?[39m
> >
>
> all the best, Don
> --
> Don Brutzman  Naval Postgraduate School, Code USW/Br
> brutzman at nps.edu
> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
> X3D graphics, virtual worlds, navy robotics
> http://faculty.nps.edu/brutzman
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20200530/afd1ffb0/attachment.html>


More information about the x3d-public mailing list