Skip navigation links

Package org.scijava.java3d.utils.scenegraph.io

This package provides a Java3D SceneGraph IO capability.

See: Description

Package org.scijava.java3d.utils.scenegraph.io Description

This package provides a Java3D SceneGraph IO capability. The API supports IO of a scenegraph to and from a Java Stream and/or RandomAccessFile. The features offered for these two io systems are somewhat different.

The SceneGraphFileReader and SceneGraphFileWriter classes provide IO to and from a RandomAccessFile. They allow a universe and/or multiple BranchGraphs to be written to the file with Node's and NodeComponent's shared between the separate graphs. The graphs can be read in any order.

SceneGraphStreamReader and SceneGraphStreamWriter classes provide IO to and from a Stream. These classes allow a universe and/or multiple BranchGraphs to be passed over stream. In contrast to the FileReader/Writer sharing of Node's is NOT supported between graphs by the API. Sharing of node components is supported. If your application requires references to Nodes in other graphs (such as SharedGroups) the application must handle the references using the namedObjects constructs.

Note : If you use SceneGraphStreamWriter class to write to a FileOutputStream the resulting file cannot be read using the SceneGraphFileReader, the converse is also true, you can not use a FileInputStream to load a file written by SceneGraphFileWriter.

The package supports the IO of all the Java3D 1.3 core classes and many of the utilities. It also includes interfaces which can be implemented to allow user defined subclasses of SceneGraphObjects to be stored. Information on the extensibility can be found here

The package has a number of properties which can be used to control the IO behavior

j3d.io.UseSuperClassIfNoChildClass when this property is present the load operation will attempt to avoid failure if Scene Graph nodes are not present in the classpath. For example if a developer has subclassed BranchGroup with a class called MyBG but has not implemented the SceneGraphIO interface when the API saves the graph the superclass (ie BranchGroup) data will be stored. When the scene is loaded normally MyBG must be in the classpath otherwise the load will fail. If this property is set then the superclass node (ie BranchGroup) will be instantiated when MyBG is missing. Obviously, if MyBG contained any state information then this will be lost.

j3d.io.ImageCompression this can be set to None, GZIP, JPEG and tells the IO system to compress images in the .j3f file using the prescribed technique. In the future this will be extended to support all the formats available in javax.imageio in JDK 1.4.

Skip navigation links

Copyright © 2016–2022 SciJava. All rights reserved.