[x3d-public] Wish list for X3DJSAIL (clean up hierachy)

John Carlson yottzumm at gmail.com
Wed Mar 20 18:38:18 PDT 2024


Dear all,

This may already be possible, but I’d like to see a utility where you could
traverse the whole scene graph and remove Transforms with defaulted field
values (besides children) and remove them and parent children nodes to
grandparents.  I am working on a scenegraph visitor pattern (will take some
time, working with X3DEOM — Extended Object Model), and I’ll provide that
and a new GTransform class for those wanting to subclass Transform to test
“defaultness” and patches to X3Dautoclass.js.

I am thinking there should be an “X3DDefaultedValues” abstract node or type
with a method “hasDefaultedValues” which will test a node or statement to
see if the non-node fields are defaulted, and ensure that it’s parent can
accept the children nodes.  The parent will be passed to the method, and a
flags will allow removal of the original node from the scene, and
reparenting any children nodes to the parent parameter.

I will prototype the visitor and method (with GTransform) over the next few
weeks and hope to report success.

Any existing codebase to support this effort is welcome!

John

On Wed, Mar 20, 2024 at 7:17 PM John Carlson <yottzumm at gmail.com> wrote:

> I am realizing I can override the HAnimHumanoid class in my
> X3Dautoclass.js files, but I don’t know how that might affect X3DJSAIL.
> Worth a shot!
>
> Note that this will not affect DOM or XML parsing in X3DJSAIL.  Ideally,
> I’d have a new node type (ugh!) or be able to do dependency injection/class
> replacement, like I can for JavaScript or Python.
>
> Another reason why putting a language on top of X3DJSAIL has benefits!  Go
> node-java/GraalJS/Pyjnius!
>
> This is obviously very experimental right now, and a maintenance headache
> for most people.
>
> John
>
> On Wed, Mar 20, 2024 at 6:02 PM John Carlson <yottzumm at gmail.com> wrote:
>
>> Okay, I am seeing that the stylesheet to use is configurable in the
>> X3DJSAIL.properties file.  Great.  That applies to output.
>>
>> Can I have an X3DJSAIL property for overriding the HAnimHumanoid class?
>> Suggestions?  Or just override one output method through dependency
>> injection?  Can I do dependency injection from the command line?
>>
>> I'm guessing alternate stylesheets is the correct approach, but it may
>> not affect XML output?  comments?  Is there a way to set the stylesheets in
>> CommandLine.java command line options?  If I can do that, then I can get
>> rid of my RunSaxon.java  Except RunSaxon.java handles batch requests.
>> Another thing to do would be to send translated file names to standard
>> output, which I can then process successful conversions through a
>> json2all.js script.
>>
>> Should I donate RunSaxon.java to the cause?
>>
>> Here it is:
>>
>> X3DJSONLD/src/main/java/net/coderextreme/RunSaxon.java at master ·
>> coderextreme/X3DJSONLD (github.com)
>> <https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/java/net/coderextreme/RunSaxon.java>
>>
>> Probably some modifications would be required to pair input with output.
>> I compute stuff like file names automatically.
>>
>> What I'm concerned most about is maintaining both a scene graph and a
>> String in memory as the Strings can get quite large (8GB).  It looks like
>> there may already be streaming input, so the question might be, how is
>> streaming to/from standard input/standard output from a scene graph
>> accomplished?  Similar to tovrml.exe.  Say I want to put CommandLine in a
>> shell or Bun JavaScript pipeline?
>>
>> I'll read the X3DJSAIL wish list in a bit.
>>
>> Thanks!
>>
>> John
>>
>> On Wed, Mar 20, 2024 at 4:53 PM John Carlson <yottzumm at gmail.com> wrote:
>>
>>> Support:
>>>
>>> toWriterXML(Writer w)
>>> toOutputStreamXML(OutputStream os)
>>> fromReaderXML(Reader r)
>>> fromInputStreamXML(InputStream is)
>>>
>>> methods in I/O classes or buffering/channel classes (java.nio).  I’ve
>>> not used java.nio much.    One can also consider Jackson XML.
>>>
>>> Or otherwise support XML Source and Result interfaces, namely:
>>>
>>> javax.xml.transform.Source
>>> javax.xml.transform.Result
>>>
>>> and implementers (preferred over above, I think), Sources can return a
>>> Node.
>>>
>>> I may do this myself.  Let me know if this is already done.
>>>
>>> Comments?
>>>
>>> It would be good to do this for Classic VRML and VRML97 as well.
>>>
>>> The benefit is that the developer can bring any I/O object classes and
>>> any XML i/o they want.  I believe that this can provide for
>>> formatting/pretty printing as well, and the user should be able to specify
>>> what pretty printing they want, so indenting is not necessary, or can be
>>> customized.
>>>
>>> What I’m ultimately aiming for is flexibility in field output ordering.
>>>   I realize this may not do it, can I bring my own stylesheets to
>>> X3DJSAIL?  Suggestions on how to override current methods recommended?  I
>>> just want to override the HAnimHumanoid class.  I don’t want to touch
>>> X3DJSAIL if I can help it.
>>>
>>> Another advantage might be that one doesn’t have to hold the whole
>>> document in a String on output.
>>>
>>> Breathe Java!
>>>
>>> John
>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20240320/9f467312/attachment-0001.html>


More information about the x3d-public mailing list