[x3d-public] The following changes (last) to X3DJSAIL (HelloWorldProgramOutput.java) output XML will make the JSON and Java easier to generate from X3DJSONLD.

John Carlson yottzumm at gmail.com
Mon Dec 18 03:43:03 PST 2017


This is what I mean by setting the containerField when setMaterial is called.  I need containerField in the XML, unless X3dToJson.xslt can handle creating the containerField, and there are several options for containerField here, I need is specified in X3DJSAIL thus:


      newProtoInstanceNode.setContainerFieldOverride("material");

In this below method.

I am not entirely sure what I need, just that I need the containerField in XML.

Thanks,

John

Jsail/Shape/Appearance.java:

        /**
         * Assign ProtoInstance to <i>material</i> field;

         * <i>Warning:</i> ProtoInstance must match acceptable node type X3DMaterialNode.
         * @param newProtoInstanceNode is the new ProtoInstance node for the material field
         * @see #setMaterial(X3DMaterialNode)
         * @return {@link AppearanceObject} - namely <i>this</i> same object to allow sequential method pipelining (i.e. consecutive
setAttribute method invocations).
         */
        public AppearanceObject setMaterial(ProtoInstanceObject newProtoInstanceNode)
        {
                if (material != null)
                {
                        ((X3DConcreteElement) material).setParentObject(null); // housekeeping, clear prior object
                        material = null;
                }
                materialProtoInstance = newProtoInstanceNode;
                if (newProtoInstanceNode != null)
                {
                        newProtoInstanceNode.setParentObject(this);
//////////////////////// HERE /////////////////////////////
                }
                return this;
        }
}


$ diff HelloWorldProgramOutputOutput.x3d ~/X3DJSONLD/src/main/data
76c76
<                         <MetadataString name='escapedQuotesTest1' containerField='value' value='"escaped quotation marks example 1: He said, \\"Immel did it!\\""'/>
---
>                         <MetadataString name='escapedQuotesTest1' containerField='value' value='"escaped quotation marks example 1: He said, \"Immel did it!\""'/>
88c88
<                     <Text string='"One, Two, Three" "" "He said, \\"Immel did it!\\""'/>
---
>                     <Text string='"One, Two, Three" "" "He said, \"Immel did it!\""'/>
152c152
<                 <ProtoInstance name='ArtDeco01Material'>
---
>                 <ProtoInstance name='ArtDeco01Material' containerField="material">
162c162
<                 <ProtoInstance DEF='ArtDeco02MaterialDEF' name='ArtDeco02Material'>
---
>                 <ProtoInstance DEF='ArtDeco02MaterialDEF' name='ArtDeco02Material' containerField="material">
172c172
<                 <ProtoInstance USE='ArtDeco02MaterialDEF'/>
---
>                 <ProtoInstance USE='ArtDeco02MaterialDEF' containerField="material"/>
247c247
<                     <ProtoInstance DEF='MyMaterialModulator' name='MaterialModulator'/>
---
>                     <ProtoInstance DEF='MyMaterialModulator' name='MaterialModulator' containerField="material"/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20171218/4c40832d/attachment.html>


More information about the x3d-public mailing list