<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">John,</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">I guess I am not sure what setUSE is
      suppose to do. I my world of 3D graphics (note that this is not
      X3D), a node may only have a single parent. If the intent of
      setUse is to duplicate the content tree starting with another
      node, I would need to decide if that is better done as a deep copy
      (independent content) or the DEF node is to be sub-classed. Also
      note that for me, SAI === DOM + some 3D interfaces.<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">A deep copy would need to copy the node
      and attribute structure and content starting with the identified
      node. I would need to modify the ID attribute values so there were
      no duplicates, probably defining a unique suffix at the start of
      the copy operation and appending that to each ID value from the
      original tree. Note that the copy operation needs to avoid copying
      any non-DOM-tree objects. I would likely first consider converting
      the DOM-tree from the source ID to an HTML string, then parse that
      into a DOM-tree not connected (yet) to the document. At that
      point, updating the IDs is easier. Once the copying is complete
      and the DOM updated, there is no relationship between the original
      source nodes and the new nodes. There are situations where this
      works well, and there are times when it doesn't really work at
      all.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">The other choice is more programmatic
      in nature. It would create 3D objects/structure, but not directly
      include those objects in the DOM-tree. It would probably be easier
      to established the original nodes as a (non-X3D) prototype that is
      not directly instantiated. "USE" references references would
      sub-class the prototype and instantiate the sub-class, potentially
      overriding some "methods" or "data". Changes to the prototype
      would be propagated to all of the sub-classes. This method is more
      complex, and I have not thought it out as well (and deeply).</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">I am not sure if this answers your
      question/request.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Leonard Daly<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <blockquote type="cite"
      cite="mid:5cd0ac87.1c69fb81.5b4e4.1467@mx.google.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
      <div class="WordSection1">
        <p class="MsoNormal">Leonard, can you explain for us how we can
          write an SAI program avoiding setUSE()?  Apparently, my
          explanations aren’t getting through.</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">John</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Sent from <a
            href="https://go.microsoft.com/fwlink/?LinkId=550986"
            moz-do-not-send="true">Mail</a> for Windows 10</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div
          style="mso-element:para-border-div;border:none;border-top:solid
          #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
          <p class="MsoNormal" style="border:none;padding:0in"><b>From:
            </b><a href="mailto:brutzman@nps.edu" moz-do-not-send="true">Brutzman,
              Donald (Don) (CIV)</a><br>
            <b>Sent: </b>Monday, May 6, 2019 2:18 AM<br>
            <b>To: </b><a href="mailto:yottzumm@gmail.com"
              moz-do-not-send="true">John Carlson</a>; <a
              href="mailto:aono@tut.jp" moz-do-not-send="true">aono@tut.jp</a><br>
            <b>Cc: </b><a href="mailto:x3d-public@web3d.org"
              moz-do-not-send="true">X3D Graphics public mailing list</a><br>
            <b>Subject: </b>Re: questions on X3DJSAIL usage.</p>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">On 5/4/2019 4:15 PM, John Carlson wrote:</p>
        <p class="MsoNormal">> I’m waiting for a response on whether
          I should stop using setUSE() (except in cases where > 1
          fields are used in a node) in programs using X3DJSAIL.</p>
        <p class="MsoNormal">> </p>
        <p class="MsoNormal">> Thanks!</p>
        <p class="MsoNormal">> </p>
        <p class="MsoNormal">> John</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Hmmm, perhaps I'm not understanding your
          question... but here is an attempt at a simple answer.  Plus
          some additional syntactic sugar.</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">1. I think a programmer utilizes setUSE()
          whenever you need to set a USE value on a node.</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Example excerpts:</p>
        <p class="MsoNormal"><a class="moz-txt-link-freetext" href="http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview">http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview</a></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">HelloWorld.x3d</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">       <Transform translation='0 -2
          0'></p>
        <p class="MsoNormal">         <Shape></p>
        <p class="MsoNormal">           <Text DEF='TextMessage'
          string='"Hello" "world!"'></p>
        <p class="MsoNormal">             <FontStyle
          justify='"MIDDLE" "MIDDLE"'/></p>
        <p class="MsoNormal">           </Text></p>
        <p class="MsoNormal">           <Appearance></p>
        <p class="MsoNormal">             <Material
          USE='MaterialLightBlue'/></p>
        <p class="MsoNormal">           </Appearance></p>
        <p class="MsoNormal">         </Shape></p>
        <p class="MsoNormal">       </Transform></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">HelloWorld.java</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">       .addChild(new
          TransformObject().setTranslation(0.0f,-2.0f,0.0f)</p>
        <p class="MsoNormal">         .addChild(new ShapeObject()</p>
        <p class="MsoNormal">           .setGeometry(new
          TextObject("TextMessage").setString(new
          MFStringObject("\"Hello\" \"world!\""))</p>
        <p class="MsoNormal">             .setFontStyle(new
          FontStyleObject().setJustify(FontStyleObject.JUSTIFY_MIDDLE_MIDDLE)))</p>
        <p class="MsoNormal">           .setAppearance(new
          AppearanceObject()</p>
        <p class="MsoNormal">             .setMaterial(new
          MaterialObject().setUSE("MaterialLightBlue")))))));</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">HelloWorld.py</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">      .addChild(Transform() \</p>
        <p class="MsoNormal">       .setTranslation(SFVec3f([0,-2,0])) \</p>
        <p class="MsoNormal">       .addChild(Shape() \</p>
        <p class="MsoNormal">        .setGeometry(Text() \</p>
        <p class="MsoNormal">         .setDEF(SFString("TextMessage")) \</p>
        <p class="MsoNormal">        
          .setString(MFString(["Hello","world!"])) \</p>
        <p class="MsoNormal">         .setFontStyle(FontStyle() \</p>
        <p class="MsoNormal">         
          .setJustify(MFString(["MIDDLE","MIDDLE"])) \</p>
        <p class="MsoNormal">         ) \</p>
        <p class="MsoNormal">        ) \</p>
        <p class="MsoNormal">        .setAppearance(Appearance() \</p>
        <p class="MsoNormal">         .setMaterial(Material() \</p>
        <p class="MsoNormal">         
          .setUSE(SFString("MaterialLightBlue")) \</p>
        <p class="MsoNormal">         ) \</p>
        <p class="MsoNormal">        ) \</p>
        <p class="MsoNormal">       ) \</p>
        <p class="MsoNormal">      )</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">2. Note that if we start putting field
          adjustments on the same line, the structure for .java and .py
          are nearly identical.</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Other syntax tightening is further possible
          in .py version:</p>
        <p class="MsoNormal">- no apparent need to wrap SFString() in
          python syntax</p>
        <p class="MsoNormal">- I suspect that MFString() wrapping is
          also superfluous, hopefully we can just use ["Hello","world!"]</p>
        <p class="MsoNormal">- Similarly might try replacing
          SFVec3f([0,-2,0]) with [0,-2,0] - we're getting more Pythonic
          now!</p>
        <p class="MsoNormal">- indenting with two space characters makes
          scene-graph structure more evident.</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">3. Spent the day refactoring the X3D
          Examples Archive projects from Netbeans plain-old freeform
          projects to Netbeans Java freeform projects.  This doesn't
          limit any functionality but it does make Java experimentation
          much simpler... menu items now include Compile/Run/Debug
          options.</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">4. Am further noticing from above that the
          following single-string .java construct</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">                .setString(new
          MFStringObject("\"Hello\" \"world!\""))</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">is more readable as a String array instead:</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">                .setString(new
          MFStringObject(new String[] {"Hello","world!"}))</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">or even more simply as:</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">                .setString(new String[]
          {"Hello","world!"})</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Have improved X3dToJava.xslt conversions to
          simplify accordingly.  Will rerun all java conversions tonight
          and hopefully redeploy Web3D example archives tomorrow.  Then
          retest python build tomorrow night.</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Also will redeploy X3DJSAIL with this
          improvement tonight.  Have also added initial PointProperties
          validation for X3Dv4, included source in full.jar for IDE
          javadoc/debugging, and fixed a number of X3DLoaderDOM
          geospatial errors.</p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">all the best, Don</p>
        <p class="MsoNormal">-- </p>
        <p class="MsoNormal">Don Brutzman  Naval Postgraduate School,
          Code USW/Br       <a class="moz-txt-link-abbreviated" href="mailto:brutzman@nps.edu">brutzman@nps.edu</a></p>
        <p class="MsoNormal">Watkins 270,  MOVES Institute, Monterey CA
          93943-5000 USA   +1.831.656.2149</p>
        <p class="MsoNormal">X3D graphics, virtual worlds, navy robotics
          <a class="moz-txt-link-freetext" href="http://faculty.nps.edu/brutzman">http://faculty.nps.edu/brutzman</a></p>
        <p class="MsoNormal"><o:p> </o:p></p>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
x3d-public mailing list
<a class="moz-txt-link-abbreviated" href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a>
<a class="moz-txt-link-freetext" href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a>
</pre>
    </blockquote>
    <p><br>
    </p>
    <div class="moz-signature">-- <br>
      <font class="tahoma,arial,helvetica san serif" color="#333366">
        <font size="+1"><b>Leonard Daly</b></font><br>
        3D Systems & Cloud Consultant<br>
        LA ACM SIGGRAPH Past Chair<br>
        President, Daly Realism - <i>Creating the Future</i>
      </font></div>
  </body>
</html>