Package org.web3d.vrml.lang
Interface BasicScene
- All Known Subinterfaces:
VRMLScene
- All Known Implementing Classes:
AbstractScene
,CRVRMLScene
,ProtoScene
,SAIVRMLScene
public interface BasicScene
Abstract representation of a contained scene graph.
The scene returns lists of nodes of the given type. This list contains all of the nodes of that type in the order that they are declared in the incoming stream. As the scene changes due to scripting and external interactions, it will add new instances of these nodes to the end of the list. If there is none of the given node types, the methods shall return empty lists.
- Version:
- $Revision: 1.19 $
- Author:
- Justin Couch
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a node to this scene.void
addTemplate
(VRMLNodeTemplate template) Add a new template to this scene.getByPrimaryType
(int type) Get the list of nodes of the given primary type declared in this scene.getBySecondaryType
(int type) Get the list of nodes of the given secondary type declared in this scene.Get a list of the nodes that have been named with DEF in this scene.Get the IMPORT declaration information from this scene.int
Get the layer ID of this scene.Get the URI of the world that this scene represents.Get the meta data associated with this scene.Get the node factory that represents the setup of this scene.getNodeTemplate
(String name) Get the proto defined by the name.Get the list of top-level node templates declared in this scene.Get the profile name for this sceneGet the node that forms the root of this proto body.Get the list of ROUTEs declared in this scene.int
Get the specification major version that this scene belongs to.int
Get the specification minor version that this scene belongs to.Get the Root URL of the world that this scene represents.void
removeNode
(VRMLNode node) Remove a node from this scene.void
removeTemplate
(VRMLNodeTemplate template) Remove a template from this scene.void
setLayerId
(int id) Set the layer ID of this scene.void
Set the node factory instance to be used with this scene.
-
Method Details
-
getLayerId
int getLayerId()Get the layer ID of this scene. This method is only useful when the scene is not the root scene, such as being buried in an Inline.- Returns:
- id A non-negative layer identifier
-
setLayerId
void setLayerId(int id) Set the layer ID of this scene. This method is only called when the scene is not the root scene, such as being buried in an Inline. This passes down the layer ID that the inline is kept in. The scene should make sure that this is passed down to the children nodes of this scene, but making sure to ignore any contained layers.- Parameters:
id
- A non-negative layer identifier
-
getMetaData
SceneMetaData getMetaData()Get the meta data associated with this scene. A scene should always have some amount of metadata.- Returns:
- The current meta data
-
getRootNode
VRMLNode getRootNode()Get the node that forms the root of this proto body. The body will contain the renderable scene graph as the first item of the node and all other children as the non-renderable parts, as per the VRML spec.- Returns:
- A reference to the root node of the scene
-
getWorldRootURL
String getWorldRootURL()Get the Root URL of the world that this scene represents. This is the URL minus the file name, but including any directory information.- Returns:
- The full URL of the world's location
-
getLoadedURI
String getLoadedURI()Get the URI of the world that this scene represents. Returns null for dynamically created worlds.- Returns:
- The full URI of the world's location
-
getNodeFactory
VRMLNodeFactory getNodeFactory()Get the node factory that represents the setup of this scene. Provided so that a caller can make use of the factory to create nodes that are only valid as part of the initial setup of this scene.- Returns:
- The VRMLNodeFactory instance configured to represent this scene
-
setNodeFactory
Set the node factory instance to be used with this scene. This is a one-shot call. After it has been set, it cannot be changed. An exception will be thrown.- Parameters:
fac
- The factory instance to use- Throws:
IllegalArgumentException
- The factory instance provided was nullIllegalStateException
- A factory has already been set
-
getSpecificationMajorVersion
int getSpecificationMajorVersion()Get the specification major version that this scene belongs to.- Returns:
- The major version number
-
getSpecificationMinorVersion
int getSpecificationMinorVersion()Get the specification minor version that this scene belongs to.- Returns:
- The minor version number
-
addNode
Add a node to this scene. This is a single node instance and the implementation is not required to traverse this node for all its children and sort them as well. It is expected external code shall be handling the tree traversal. The code will make sure that this node instance is only inserted into the internal structures exactly once, even if this is a duplicate call.- Parameters:
node
- The node to add
-
removeNode
Remove a node from this scene. The implementation shall silently ignore a request to remove a node that does not exist in this scene.- Parameters:
node
- The node to add
-
addTemplate
Add a new template to this scene. Each template is assumed to be independent of the others. If a template contains further templates, the nested instances should not be added to this scene.- Parameters:
template
- The new template instance to use
-
removeTemplate
Remove a template from this scene. The implementation shall silently ignore a request to remove a template that does not exist in this scene. If instances of this template already exist, they shall remain in the scene.- Parameters:
template
- The template instance to remove
-
getRoutes
-
getNodeTemplates
List<VRMLNodeTemplate> getNodeTemplates()Get the list of top-level node templates declared in this scene. The list will not be sorted into separate sets of PROTO and EXTERNPROTO instances.- Returns:
- The list of VRMLNodeTemplate instances in this scene
-
getByPrimaryType
-
getBySecondaryType
-
getNodeTemplate
Get the proto defined by the name. If no proto is known by that name then return null.- Parameters:
name
- The name of the proto to fetch.- Returns:
- The proto known by that name or null
-
getDEFNodes
-
getImports
Get the IMPORT declaration information from this scene. There is no validity checking of these statements. The map is the inline's DEF name as the key to the value being a String[] that contains the inlined file's exported name and the AS rename portion.- Returns:
- A map of the imported nodes
-
getProfileName
-