[x3d-public] X3DJSAIL: Exceeding Java String limits on setValue? What do wedo?

Don Brutzman brutzman at nps.edu
Thu Mar 30 00:42:10 PDT 2017


corrected attachment: this version has a smaller splitTupleSize to illustrate the multiple append methods.  See lines 101-105 after the comment /* splitting up long array to improve compilability */

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 --------------
package X3dForAdvancedModeling.Animation;

/*
Copyright (c) 1995-2017 held by the author(s).  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer
      in the documentation and/or other materials provided with the
      distribution.
    * Neither the name of the Web3D Consortium (http://www.web3D.org)
      nor the names of its contributors may be used to endorse or
      promote products derived from this software without specific
      prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import org.web3d.x3d.jsail.Core.*;
import org.web3d.x3d.jsail.EnvironmentalEffects.*;
import org.web3d.x3d.jsail.EventUtilities.*;
import org.web3d.x3d.jsail.fields.*;
import org.web3d.x3d.jsail.Geometry3D.*;
import org.web3d.x3d.jsail.Grouping.*;
import org.web3d.x3d.jsail.Interpolation.*;
import org.web3d.x3d.jsail.Navigation.*;
import org.web3d.x3d.jsail.Shape.*;
import org.web3d.x3d.jsail.Texturing.*;
import org.web3d.x3d.jsail.Time.*;

/*
   <meta name="generator" content="X3dToJava.xslt stylesheet to create X3DJSAIL Java program from X3D source." />
   <meta name="url"       content="http://www.web3d.org/x3d/stylesheets/X3dToJava.xslt" />
   <meta name="reference" content="X3DJSAIL, http://www.web3d.org/specifications/java/X3DJSAIL.html" />
*/
 
public class BoxSwitch
{
  X3DObject x3dModelObjectTree = new X3DObject().setProfile("Immersive").setVersion("3.3")
  .setHead(new headObject()
    .setMeta(new metaObject().setName("title").setContent("BoxSwitch.x3d"))
    .setMeta(new metaObject().setName("creator").setContent("Don Brutzman"))
    .setMeta(new metaObject().setName("created").setContent("30 December 2015"))
    .setMeta(new metaObject().setName("modified").setContent("4 March 2017"))
    .setMeta(new metaObject().setName("description").setContent("Show animation by switching Box nodes that are each covered by a different ImageTexture."))
    .setMeta(new metaObject().setName("reference").setContent("../GeometricShapes/CubeWithLabeledSides.x3d"))
    .setMeta(new metaObject().setName("drawing").setContent("../GeometricShapes/images/CubeSideImages.vsd"))
    .setMeta(new metaObject().setName("identifier").setContent("http://x3dGraphics.com/examples/X3dForAdvancedModeling/Animation/BoxSwitch.x3d"))
    .setMeta(new metaObject().setName("generator").setContent("X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"))
    .setMeta(new metaObject().setName("license").setContent("../license.html")))
  .setScene(new SceneObject()
    .addChild(new BackgroundObject().setSkyColor(new MFColorObject(new float[] {0.8f,0.8f,0.9f})))
    .addChild(new NavigationInfoObject())
    .addChild(new SwitchObject("BoxSwitcher").setWhichChoice(-1)
      .addChild(new ShapeObject()
        .setGeometry(new BoxObject("UnitBox"))
        .setAppearance(new AppearanceObject()
          .setTexture(new ImageTextureObject().setUrl(new MFStringObject("\"../GeometricShapes/images/RedImage.png\" \"http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/RedImage.png\"")))))
      .addChild(new ShapeObject()
        .setGeometry(new BoxObject().setUSE("UnitBox"))
        .setAppearance(new AppearanceObject()
          .setTexture(new ImageTextureObject().setUrl(new MFStringObject("\"../GeometricShapes/images/GreenImage.png\" \"http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/GreenImage.png\"")))))
      .addChild(new ShapeObject()
        .setGeometry(new BoxObject().setUSE("UnitBox"))
        .setAppearance(new AppearanceObject()
          .setTexture(new ImageTextureObject().setUrl(new MFStringObject("\"../GeometricShapes/images/TurquoiseImage.png\" \"http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/TurquoiseImage.png\"")))))
      .addChild(new ShapeObject()
        .setGeometry(new BoxObject().setUSE("UnitBox"))
        .setAppearance(new AppearanceObject()
          .setTexture(new ImageTextureObject().setUrl(new MFStringObject("\"../GeometricShapes/images/YellowImage.png\" \"http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/YellowImage.png\"")))))
      .addChild(new ShapeObject()
        .setGeometry(new BoxObject().setUSE("UnitBox"))
        .setAppearance(new AppearanceObject()
          .setTexture(new ImageTextureObject().setUrl(new MFStringObject("\"../GeometricShapes/images/WhiteImage.png\" \"http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/WhiteImage.png\"")))))
      .addChild(new ShapeObject()
        .setGeometry(new BoxObject().setUSE("UnitBox"))
        .setAppearance(new AppearanceObject()
          .setTexture(new ImageTextureObject().setUrl(new MFStringObject("\"../GeometricShapes/images/GreyImage.png\" \"http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/GreyImage.png\""))))))
    .addComments("Animated Box")
    .addChild(new TimeSensorObject("Clock").setCycleInterval(12).setLoop(true))
    .addChild(new IntegerSequencerObject("Sequencer").setKey(new float[] {0.0f,0.1667f,0.3333f,0.5f,0.6667f,0.8333f,1.0f}).setKeyValue(new int[] {0,1,2,3,4,5,0}))
    .addChild(new ROUTEObject().setFromField("fraction_changed").setFromNode("Clock").setToField("set_fraction").setToNode("Sequencer"))
    .addChild(new ROUTEObject().setFromField("value_changed").setFromNode("Sequencer").setToField("whichChoice").setToNode("BoxSwitcher"))
    .addChild(new ViewpointObject("OrbitingView").setPosition(-8.0f,0.0f,0.0f).setOrientation(0.0f,1.0f,0.0f,-1.57f).setDescription("Orbiting view"))
    .addComments("Animated Viewpoint, orbiting about the origin")
    .addChild(new PositionInterpolatorObject("CircularPathPositionInterpolator").setKeyValue(new MFVec3fObject() /* splitting up long array to improve compilability */
.append(new MFVec3fObject(new float[] {0.0f,0.0f,8.0f,1.389f,0.0f,7.878f,2.736f,0.0f,7.518f,4.0f,0.0f,6.928f,5.142f,0.0f,6.128f,6.128f,0.0f,5.142f,6.928f,0.0f,4.0f,7.518f,0.0f,2.736f,7.878f,0.0f,1.389f,8.0f,0.0f,0.0f}))
.append(new MFVec3fObject(new float[] {7.878f,0.0f,-1.389f,7.518f,0.0f,-2.736f,6.928f,0.0f,-4.0f,6.128f,0.0f,-5.142f,5.142f,0.0f,-6.128f,4.0f,0.0f,-6.928f,2.736f,0.0f,-7.518f,1.389f,0.0f,-7.878f,0.0f,0.0f,-8.0f,-1.389f,0.0f,-7.878f}))
.append(new MFVec3fObject(new float[] {-2.736f,0.0f,-7.518f,-4.0f,0.0f,-6.928f,-5.142f,0.0f,-6.128f,-6.128f,0.0f,-5.142f,-6.928f,0.0f,-4.0f,-7.518f,0.0f,-2.736f,-7.878f,0.0f,-1.389f,-8.0f,0.0f,-0.0f,-7.878f,0.0f,1.389f,-7.518f,0.0f,2.736f}))
.append(new MFVec3fObject(new float[] {-6.928f,0.0f,4.0f,-6.128f,0.0f,5.142f,-5.142f,0.0f,6.128f,-4.0f,0.0f,6.928f,-2.736f,0.0f,7.518f,-1.389f,0.0f,7.878f,0.0f,0.0f,8.0f}))).setKey(new float[] {0.0f,0.02778f,0.05556f,0.08333f,0.11111f,0.13889f,0.16667f,0.19444f,0.22222f,0.25f,0.27778f,0.30556f,0.33333f,0.36111f,0.38889f,0.41667f,0.44444f,0.47222f,0.5f,0.52778f,0.55556f,0.58333f,0.61111f,0.63889f,0.66667f,0.69444f,0.72222f,0.75f,0.77778f,0.80556f,0.83333f,0.86111f,0.88889f,0.91667f,0.94444f,0.97222f,1.0f}))
    .addChild(new ROUTEObject().setFromField("fraction_changed").setFromNode("Clock").setToField("set_fraction").setToNode("CircularPathPositionInterpolator"))
    .addChild(new ROUTEObject().setFromField("value_changed").setFromNode("CircularPathPositionInterpolator").setToField("position").setToNode("OrbitingView"))
    .addChild(new OrientationInterpolatorObject("CenterFacingOrientationInterpolator").setKey(new float[] {0.0f,0.3333f,0.6667f,1.0f}).setKeyValue(new MFRotationObject(new float[] {0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,2.094395f,0.0f,1.0f,0.0f,4.18879f,0.0f,1.0f,0.0f,0.0f})))
    .addChild(new ROUTEObject().setFromField("fraction_changed").setFromNode("Clock").setToField("set_fraction").setToNode("CenterFacingOrientationInterpolator"))
    .addChild(new ROUTEObject().setFromField("value_changed").setFromNode("CenterFacingOrientationInterpolator").setToField("orientation").setToNode("OrbitingView"))
    .addComments("Additional Viewpoints")
    .addChild(new ViewpointObject().setOrientation(0.0f,1.0f,0.0f,1.57f).setPosition(8.0f,0.0f,0.0f).setDescription("Front view"))
    .addChild(new ViewpointObject().setPosition(-8.0f,0.0f,0.0f).setOrientation(0.0f,1.0f,0.0f,-1.57f).setDescription("Back view"))
    .addChild(new ViewpointObject().setPosition(0.0f,0.0f,8.0f).setDescription("Left view"))
    .addChild(new ViewpointObject().setPosition(0.0f,0.0f,-8.0f).setOrientation(0.0f,1.0f,0.0f,3.1416f).setDescription("Right view"))
    .addChild(new ViewpointObject().setPosition(0.0f,8.0f,0.0f).setOrientation(1.0f,0.0f,0.0f,-1.57f).setDescription("Top view"))
    .addChild(new ViewpointObject().setPosition(0.0f,-8.0f,0.0f).setOrientation(1.0f,0.0f,0.0f,1.57f).setDescription("Bottom view")));
}


More information about the x3d-public mailing list