Xj3D VRML/X3D Code API

org.web3d.vrml.renderer
Class CRVRMLScene

java.lang.Object
  extended byorg.web3d.vrml.lang.AbstractScene
      extended byorg.web3d.vrml.renderer.CRVRMLScene
All Implemented Interfaces:
BasicScene, VRMLScene

public class CRVRMLScene
extends AbstractScene
implements VRMLScene

A representation of a complete scene in VRML.

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.14 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.web3d.vrml.lang.AbstractScene
allNodes, loadedURI, majorVersion, metaData, minorVersion, nodeFactory, routeList, templateList, templateMap, worldURL
 
Constructor Summary
CRVRMLScene(int major, int minor)
          Construct a new default instance of this class.
 
Method Summary
 void addExportedNode(java.lang.String name, java.lang.String def)
          Add a new export name to the map.
 void addExternProto(VRMLExternProtoDeclare node)
          Add a new EXTERNPROTO instance to the internal list.
 void addProto(VRMLProtoDeclare node)
          Add a new proto instance to the internal list.
 void addRoute(ROUTE node)
          Add a new ROUTE instance to the internal list.
 void addRoute(VRMLNodeType fromNode, int fromField, VRMLNodeType toNode, int toField)
          Add a new ROUTE to the internal list.
 void addTemplate(VRMLNodeTemplate template)
          Add a new template to this scene.
 java.util.Map getExports()
          Get the list of exports from this file.
 java.util.Map getExternProtos()
          Get the list of EXTERNPROTOs declared in this scene.
 VRMLProtoDeclare getFirstProto()
          Get the first PROTO declared in this scene.
 java.util.Map getProtos()
          Get the list of ordinary PROTO's declared in this scene.
 void removeExportedNode(java.lang.String name)
          Remove a export name from the map.
 void removeExternProto(VRMLExternProtoDeclare node)
          Remove an EXTERNPROTO instance from the internal list.
 void removeProto(VRMLProtoDeclare node)
          Remove a proto instance from the internal list.
 void removeRoute(ROUTE node)
          Remove a route instance from the internal list.
 void removeTemplate(VRMLNodeTemplate template)
          Remove a template from this scene.
 void setMetaData(SceneMetaData data)
          Set the meta data to be associated with this scene.
 
Methods inherited from class org.web3d.vrml.lang.AbstractScene
addDEFNode, addImportedNode, addNode, getByPrimaryType, getBySecondaryType, getDEFNodes, getImports, getLoadedURI, getMetaData, getNodeFactory, getNodeTemplate, getNodeTemplates, getRootNode, getRoutes, getSpecificationMajorVersion, getSpecificationMinorVersion, getWorldRootURL, removeDEFNode, removeImportedNode, removeNode, setLoadedURI, setNodeFactory, setRootNode, setWorldRootURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.web3d.vrml.lang.BasicScene
addNode, getByPrimaryType, getBySecondaryType, getDEFNodes, getImports, getLoadedURI, getMetaData, getNodeFactory, getNodeTemplate, getNodeTemplates, getRootNode, getRoutes, getSpecificationMajorVersion, getSpecificationMinorVersion, getWorldRootURL, removeNode, setNodeFactory
 

Constructor Detail

CRVRMLScene

public CRVRMLScene(int major,
                   int minor)
Construct a new default instance of this class.

Parameters:
major - The major version number of this scene
minor - The minor version number of this scene
Method Detail

setMetaData

public void setMetaData(SceneMetaData data)
Set the meta data to be associated with this scene. Will automatically


addRoute

public void addRoute(ROUTE node)
Add a new ROUTE instance to the internal list.

Parameters:
node - The new ROUTE instance to be added

addRoute

public void addRoute(VRMLNodeType fromNode,
                     int fromField,
                     VRMLNodeType toNode,
                     int toField)
Add a new ROUTE to the internal list.

Parameters:
fromNode - The source node
fromField - The source field index
toNode - The destination node
toField - The destination field index

removeRoute

public void removeRoute(ROUTE node)
Remove a route instance from the internal list. If the list doesn't know about this instance, it is quietly ignored.

Parameters:
node - The ROUTE to remove

addTemplate

public void addTemplate(VRMLNodeTemplate template)
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.

Specified by:
addTemplate in interface BasicScene
Overrides:
addTemplate in class AbstractScene
Parameters:
template - The new template instance to use

removeTemplate

public void removeTemplate(VRMLNodeTemplate template)
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.

Specified by:
removeTemplate in interface BasicScene
Overrides:
removeTemplate in class AbstractScene
Parameters:
template - The template instance to remove

addProto

public void addProto(VRMLProtoDeclare node)
Add a new proto instance to the internal list.

Parameters:
node - The new proto instance to be added

removeProto

public void removeProto(VRMLProtoDeclare node)
Remove a proto instance from the internal list.

Parameters:
node - The new proto instance to be removed

getFirstProto

public VRMLProtoDeclare getFirstProto()
Get the first PROTO declared in this scene. EXTERNPROTO's are not included in this list. If no protos are declared it will return null. If the proto is later removed then this will return null;

Specified by:
getFirstProto in interface VRMLScene
Returns:
The first proto declared or null

getProtos

public java.util.Map getProtos()
Get the list of ordinary PROTO's declared in this scene. EXTERNPROTOs are not included in this list.

Specified by:
getProtos in interface VRMLScene
Returns:
The list of proto instances in this scene

addExternProto

public void addExternProto(VRMLExternProtoDeclare node)
Add a new EXTERNPROTO instance to the internal list.

Parameters:
node - The new EXTERNPROTO instance to be added

removeExternProto

public void removeExternProto(VRMLExternProtoDeclare node)
Remove an EXTERNPROTO instance from the internal list.

Parameters:
node - The EXTERNPROTO instance to be removed

getExternProtos

public java.util.Map getExternProtos()
Get the list of EXTERNPROTOs declared in this scene. The instances may or may not have been loaded at this point. Check with the interface declaration to see if this is the case.

Specified by:
getExternProtos in interface VRMLScene
Returns:
The list of EXTERNPROTO instances in this scene

addExportedNode

public void addExportedNode(java.lang.String name,
                            java.lang.String def)
Add a new export name to the map. If there is a Exported name of this type already registered, it is replace with the incoming instance (as per VRML specification.

Parameters:
name - The name of the node to be replaced
def - The DEF name of the local node, may be null

removeExportedNode

public void removeExportedNode(java.lang.String name)
Remove a export name from the map.

Parameters:
name - The name of the node to be removed

getExports

public java.util.Map getExports()
Get the list of exports from this file. The map is the exported name to the node instance. If there are no nodes exported, the map will be empty. Note that exported nodes is not a valid concept for VRML97. It only exists for X3D V3.0 and above.

Specified by:
getExports in interface VRMLScene
Returns:
A map of the exported nodes

Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium