Package org.web3d.vrml.renderer
Class CRVRMLScene
java.lang.Object
org.web3d.vrml.lang.AbstractScene
org.web3d.vrml.renderer.CRVRMLScene
- All Implemented Interfaces:
BasicScene
,VRMLScene
A representation of a complete scene in VRML and X3D.
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.15 $
- Author:
- Justin Couch
-
Field Summary
Fields inherited from class org.web3d.vrml.lang.AbstractScene
allNodes, loadedURI, majorVersion, metaData, minorVersion, nodeFactory, rootNode, routeList, templateList, templateMap, worldURL
-
Constructor Summary
ConstructorsConstructorDescriptionCRVRMLScene
(int major, int minor) Construct a new default instance of this class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addExportedNode
(String name, String def) Add a new export name to the map.void
Add a new EXTERNPROTO instance to the internal list.void
Add a node to this scene.void
addProto
(VRMLProtoDeclare node) Add a new proto instance to the internal list.void
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.Get the list of exports from this file.Get the list of EXTERNPROTOs declared in this scene.Get the first LayerSet declared in this scene.Get the first PROTO declared in this scene.Utility method to get the profile name for this sceneGet the list of ordinary PROTO's declared in this scene.void
removeExportedNode
(String name) Remove a export name from the map.void
Remove an EXTERNPROTO instance from the internal list.void
removeNode
(VRMLNode node) Remove a node from this scene.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, getByPrimaryType, getBySecondaryType, getDEFNodes, getImports, getLayerId, getLoadedURI, getMetaData, getNodeFactory, getNodeTemplate, getNodeTemplates, getRootNode, getRoutes, getSpecificationMajorVersion, getSpecificationMinorVersion, getWorldRootURL, removeDEFNode, removeImportedNode, setLayerId, 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
getByPrimaryType, getBySecondaryType, getDEFNodes, getImports, getLayerId, getLoadedURI, getMetaData, getNodeFactory, getNodeTemplate, getNodeTemplates, getRootNode, getRoutes, getSpecificationMajorVersion, getSpecificationMinorVersion, getWorldRootURL, setLayerId, setNodeFactory
-
Constructor Details
-
CRVRMLScene
public CRVRMLScene(int major, int minor) Construct a new default instance of this class.- Parameters:
major
- The major version number of this sceneminor
- The minor version number of this scene
-
-
Method Details
-
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 interfaceVRMLScene
- Returns:
- The first proto declared or null
-
getFirstLayerSet
Get the first LayerSet declared in this scene. If there is no LayerSet defined, return null.- Specified by:
getFirstLayerSet
in interfaceVRMLScene
- Returns:
- The first proto declared or null
-
getProtos
Get the list of ordinary PROTO's declared in this scene. EXTERNPROTOs are not included in this list. -
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 interfaceVRMLScene
- Returns:
- The list of EXTERNPROTO instances in this scene
-
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 interfaceVRMLScene
- Returns:
- A map of the exported nodes
-
addNode
Add a node to this scene. Override the base class method so that we can track the first added layer set to this scene.- Specified by:
addNode
in interfaceBasicScene
- Overrides:
addNode
in classAbstractScene
- Parameters:
node
- The node to add
-
removeNode
Remove a node from this scene. Override the base class method so that we can track the first layer set to this scene.- Specified by:
removeNode
in interfaceBasicScene
- Overrides:
removeNode
in classAbstractScene
- Parameters:
node
- The node to add
-
setMetaData
Set the meta data to be associated with this scene. Will automatically- Parameters:
data
-
-
addRoute
Add a new ROUTE instance to the internal list.- Parameters:
node
- The new ROUTE instance to be added
-
addRoute
Add a new ROUTE to the internal list.- Parameters:
fromNode
- The source nodefromField
- The source field indextoNode
- The destination nodetoField
- The destination field index
-
removeRoute
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
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 interfaceBasicScene
- Overrides:
addTemplate
in classAbstractScene
- 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.- Specified by:
removeTemplate
in interfaceBasicScene
- Overrides:
removeTemplate
in classAbstractScene
- Parameters:
template
- The template instance to remove
-
addProto
Add a new proto instance to the internal list.- Parameters:
node
- The new proto instance to be added
-
removeProto
Remove a proto instance from the internal list.- Parameters:
node
- The new proto instance to be removed
-
addExternProto
Add a new EXTERNPROTO instance to the internal list.- Parameters:
node
- The new EXTERNPROTO instance to be added
-
removeExternProto
Remove an EXTERNPROTO instance from the internal list.- Parameters:
node
- The EXTERNPROTO instance to be removed
-
addExportedNode
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 replaceddef
- The DEF name of the local node, may be null
-
removeExportedNode
Remove a export name from the map.- Parameters:
name
- The name of the node to be removed
-
getProfileName
Utility method to get the profile name for this scene- Specified by:
getProfileName
in interfaceBasicScene
- Returns:
- Profile name
-