public class SceneGraphFileReader extends Object
Constructor and Description |
---|
SceneGraphFileReader(File file)
Creates new SceneGraphFileReader.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the file and cleanup internal data structures
|
void |
dereferenceBranchGraph(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(BranchGroup graph)
Given a BranchGraph that has been loaded return the index of the
graph in the file.
|
ClassLoader |
getClassLoader()
Get the ClassLoader used to load the scene graph objects and
deserialize user data
|
SceneGraphObject |
getNamedObject(String name)
Return the named object.
|
String[] |
getNames()
Return the names of all the named objects
|
BranchGroup[] |
readAllBranchGraphs()
Read and return all the branchgraphs in the file
|
BranchGroup[] |
readBranchGraph(int index)
Read the BranchGraph at index in the file.
|
Object |
readBranchGraphUserData(int index)
Read the userdata for the branchgraph at 'index' in the file
|
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,
Canvas3D canvas)
Create and return a ConfiguredUniverse with the PlatformGeometry, ViewerAvatar,
and Locales saved in the file.
|
Object |
readUserData()
Get the UserData in the File header
|
void |
setClassLoader(ClassLoader classLoader)
Set the ClassLoader used to load the scene graph objects and
deserialize user data
|
public SceneGraphFileReader(File file) throws IOException
IOException
public ConfiguredUniverse readUniverse(boolean attachBranchGraphs) throws IOException
ConfiguredUniverse.getConfigURL()
.If the file does not contain universe information, null is returned.
attachBranchGraphs
- load and attach all the branchgraphs
to the universe.IOException
ConfiguredUniverse.getConfigURL()
public void setClassLoader(ClassLoader classLoader)
public ClassLoader getClassLoader()
public ConfiguredUniverse readUniverse(boolean attachBranchGraphs, Canvas3D canvas) throws 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.IOException
public Object readUserData() throws IOException
IOException
public String readDescription() throws IOException
IOException
public int getBranchGraphCount()
public BranchGroup[] readBranchGraph(int index) throws 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 0IOException
getBranchGraphPosition( BranchGroup graph )
public BranchGroup[] readAllBranchGraphs() throws IOException
IOException
public void dereferenceBranchGraph(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(BranchGroup graph)
public Object readBranchGraphUserData(int index) throws IOException
index
- the index of the graph in the fileIOException
public String[] getNames()
public SceneGraphObject getNamedObject(String name) throws NamedObjectException, ObjectNotLoadedException
name
- The name of the objectNamedObjectException
- is thrown if the name is not known to the systemObjectNotLoadedException
- is thrown if the named object has not been loaded yetpublic void close() throws IOException
IOException
Copyright © 2016–2022 SciJava. All rights reserved.