Package org.web3d.vrml.scripting.browser
Class VRML97CommonBrowser
java.lang.Object
org.web3d.vrml.scripting.browser.CommonBrowser
org.web3d.vrml.scripting.browser.VRML97CommonBrowser
The common parts of a browser implementation suitable for VRML97 scripting.
This class is a full implementation because the external and scripting interfaces will use it differently. External use can just subclass and add the EAI Browser interface. For scripting, the need to extend the Browser base class means that this class will need to be delegated to.
The current implementation ignores any parameter values provided by the world.
- Version:
- $Revision: 1.21 $
- Author:
- Justin Couch
-
Field Summary
Fields inherited from class org.web3d.vrml.scripting.browser.CommonBrowser
core, errorReporter, loaderManager, routeManager, stateManager
-
Constructor Summary
ConstructorsConstructorDescriptionVRML97CommonBrowser
(BrowserCore browser, RouteManager rm, FrameStateManager fsm, WorldLoaderManager wlm, VRMLNodeFactory nodeFac) Create a browser instance that represents the given universe details. -
Method Summary
Modifier and TypeMethodDescriptioncreateVrmlFromString
(String vrmlSyntax, VRMLExecutionSpace parentSpace) Parse the given string and turn this into a list of VRML nodes.void
createVrmlFromURL
(String[] url, VRMLNodeType node, String eventIn) Create and load VRML from the given URL and place the returned values as nodes into the given VRML node in the scene.void
replaceWorld
(VRMLNodeType[] nodes) Replace the current world with the given nodes.Methods inherited from class org.web3d.vrml.scripting.browser.CommonBrowser
addRoute, completeUrl, deleteRoute, getCurrentFrameRate, getCurrentSpeed, getDescription, getName, getVersion, getWorldURL, loadURL, setDescription, setErrorReporter
-
Constructor Details
-
VRML97CommonBrowser
public VRML97CommonBrowser(BrowserCore browser, RouteManager rm, FrameStateManager fsm, WorldLoaderManager wlm, VRMLNodeFactory nodeFac) Create a browser instance that represents the given universe details. If the scene builder or factory is null, then it will find one from the global pool defined for the renderer used by the browser core.- Parameters:
browser
- The core representation of the browserrm
- A route manager for users creating/removing routesfsm
- State manager for coordinating inter-frame processingwlm
- Loader manager for doing async callsnodeFac
- Factory to create nodes with for this renderer- Throws:
IllegalArgumentException
- A parameter is null
-
-
Method Details
-
replaceWorld
Replace the current world with the given nodes. Replaces the entire contents of the VRML world with the new nodes. Any node references that belonged to the previous world are still valid but no longer form part of the scene graph (unless it is these nodes passed to this method). The URL of the world still represents the just unloaded world.Calling this method causes a SHUTDOWN event followed by an INITIALIZED event to be generated.
- Parameters:
nodes
- The list of nodes to use as the new root of the world
-
createVrmlFromString
public VRMLNodeType[] createVrmlFromString(String vrmlSyntax, VRMLExecutionSpace parentSpace) throws VRMLException, VRMLParseException, IOException Parse the given string and turn this into a list of VRML nodes. Method is a blocking call that won't return until all of the top level nodes defined in the string have been returned.At the point that this method returns, external files such as textures, sounds and inlines may not have been loaded.
The string may contain all legal VRML syntax. The VRML header line is not required to be present in the string.
- Parameters:
vrmlSyntax
- The string containing VRML string syntaxparentSpace
- The parent space for these nodes or null for top-level- Returns:
- A list of the top level nodes in VRML representation as defined in the parameter
- Throws:
VRMLException
- General error during processingVRMLParseException
- If the string does not contain legal VRML syntax or no node instantiationsIOException
-
createVrmlFromURL
public void createVrmlFromURL(String[] url, VRMLNodeType node, String eventIn) throws InvalidFieldException Create and load VRML from the given URL and place the returned values as nodes into the given VRML node in the scene. The difference between this and loadURL is that this method does not replace the entire scene with the contents from the URL. Instead, it places the return values as events in the nominated node and MFNode eventIn.- Parameters:
url
- The list of URLs in decreasing order of preference as defined in the VRML97 specification.node
- The destination node for the VRML code to be sent to.eventIn
- The name of the MFNode eventIn to send the nodes to.- Throws:
InvalidFieldException
- the eventIn or node is not a valid destination for the URL information
-