|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.j3d.utils.scenegraph.io.SceneGraphFileReader
public class SceneGraphFileReader
Read Java3D BranchGraphs and/or Universe from a file. Individual branchgraphs or an entire Universe can be read and references (shared nodes and components) between the graphs are handled correctly.
Constructor Summary | |
---|---|
SceneGraphFileReader(java.io.File file)
Creates new SceneGraphFileReader. |
Method Summary | |
---|---|
void |
close()
Close the file and cleanup internal data structures |
void |
dereferenceBranchGraph(javax.media.j3d.BranchGroup graph)
Remove the IO system's reference to this branchgraph and all its nodes. |
int |
getBranchGraphCount()
Return the number of BranchGraphs in the file |
int |
getBranchGraphPosition(javax.media.j3d.BranchGroup graph)
Given a BranchGraph that has been loaded return the index of the graph in the file. |
java.lang.ClassLoader |
getClassLoader()
Get the ClassLoader used to load the scene graph objects and deserialize user data |
javax.media.j3d.SceneGraphObject |
getNamedObject(java.lang.String name)
Return the named object. |
java.lang.String[] |
getNames()
Return the names of all the named objects |
javax.media.j3d.BranchGroup[] |
readAllBranchGraphs()
Read and return all the branchgraphs in the file |
javax.media.j3d.BranchGroup[] |
readBranchGraph(int index)
Read the BranchGraph at index in the file. |
java.lang.Object |
readBranchGraphUserData(int index)
Read the userdata for the branchgraph at 'index' in the file |
java.lang.String |
readDescription()
Get the Description of this file's contents |
ConfiguredUniverse |
readUniverse(boolean attachBranchGraphs)
Create and return a ConfiguredUniverse with the PlatformGeometry, ViewerAvatar, and Locales saved in the file. |
ConfiguredUniverse |
readUniverse(boolean attachBranchGraphs,
javax.media.j3d.Canvas3D canvas)
Create and return a ConfiguredUniverse with the PlatformGeometry, ViewerAvatar, and Locales saved in the file. |
java.lang.Object |
readUserData()
Get the UserData in the File header |
void |
setClassLoader(java.lang.ClassLoader classLoader)
Set the ClassLoader used to load the scene graph objects and deserialize user data |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SceneGraphFileReader(java.io.File file) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public ConfiguredUniverse readUniverse(boolean attachBranchGraphs) throws java.io.IOException
ConfiguredUniverse.getConfigURL()
.If the file does not contain universe information, null is returned.
attachBranchGraphs
- load and attach all the branchgraphs
to the universe.
java.io.IOException
ConfiguredUniverse.getConfigURL()
public void setClassLoader(java.lang.ClassLoader classLoader)
public java.lang.ClassLoader getClassLoader()
public ConfiguredUniverse readUniverse(boolean attachBranchGraphs, javax.media.j3d.Canvas3D canvas) throws java.io.IOException
If the file does not contain universe information, null is returned.
attachBranchGraphs
- load and attach all the branchgraphs
to the universe.canvas
- The canvas to be associated with the Universe.
java.io.IOException
public java.lang.Object readUserData() throws java.io.IOException
java.io.IOException
public java.lang.String readDescription() throws java.io.IOException
java.io.IOException
public int getBranchGraphCount()
public javax.media.j3d.BranchGroup[] readBranchGraph(int index) throws java.io.IOException
The requested graph will always be the first element in the array.
The file index of all the Graphs can be discovered using getBranchGraphPosition
.
index
- The index of the Graph in the file. First graph is at index 0
java.io.IOException
getBranchGraphPosition( BranchGroup graph )
public javax.media.j3d.BranchGroup[] readAllBranchGraphs() throws java.io.IOException
java.io.IOException
public void dereferenceBranchGraph(javax.media.j3d.BranchGroup graph)
References to all loaded graphs are maintained by the IO system in order to facilitate node and component sharing between the graphs.
This call removes the references to graph index
NOT CURRENTLY IMPLEMENTED
public int getBranchGraphPosition(javax.media.j3d.BranchGroup graph)
public java.lang.Object readBranchGraphUserData(int index) throws java.io.IOException
index
- the index of the graph in the file
java.io.IOException
public java.lang.String[] getNames()
public javax.media.j3d.SceneGraphObject getNamedObject(java.lang.String name) throws NamedObjectException, ObjectNotLoadedException
name
- The name of the object
NamedObjectException
- is thrown if the name is not known to the system
ObjectNotLoadedException
- is thrown if the named object has not been loaded yetpublic void close() throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |