|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Basic browser interface to the X3D browser from any application. Individual X3D browser must implement this interface.
A number of the methods in this application can take strings representing URLs. Relative URL strings contained in URL fields of nodes or these method arguments are interpreted as follows:
Relative URLs are treated as per clause B.3.5 of the EAI Java Bindings
Field Summary | |
static java.lang.String |
PROPERTY_BOUNDBACKGROUND
Properties: the currently bound Viewpoint (returns node handle) |
static java.lang.String |
PROPERTY_BOUNDNAVIGATIONINFO
Properties: the currently bound Viewpoint (returns node handle) |
static java.lang.String |
PROPERTY_BOUNDVIEWPOINT
Properties: the currently bound Viewpoint (returns node handle) |
static java.lang.String |
PROPERTY_HEADLIGHT
Properties: headlight on/off (returns Boolean true/false) |
static java.lang.String |
PROPERTY_NAME
Properties: name of the browser |
static java.lang.String |
PROPERTY_PROFILE
Properties: supported profile of the browser The browser should return the profile and if available all additional profile components that it supports for example "coreX3D navigation=VRML97,scripting=Java" |
static java.lang.String |
PROPERTY_VERSION
Properties: version of the browser |
Method Summary | |
void |
addAWTObserver(EventObserver observer)
Add an observer for AWT events. |
void |
addBrowserObserver(EventObserver observer)
Add an observer for browser events. |
void |
addBrowserScriptObserver(java.lang.String scriptmethod)
Add a javascript observer for browser events. |
void |
addFieldScriptObserver(java.lang.String node,
java.lang.String field,
java.lang.String scriptmethod)
Add a javascript observer for a field with read capability (EventOut or ExposedField) the observer object will be notified of any changes to this field The javascript method should be done this way: function javascriptmethod(type,nodename,fieldname) where type - the event type nodename - the name of the node that launched this event (in case of a browser event it's null) fieldname - the name of the field that launched this event (in case of a browser event it's null) |
void |
addRoute(Node fromNode,
java.lang.String fromEventOut,
Node toNode,
java.lang.String toEventIn)
Add a route between two nodes |
void |
beginUpdate()
Lock the output from the external interface to the browser as the code is about to begin a series of updates. |
Node[] |
createX3DFromString(java.lang.String x3dString)
Parse the given string and turn this into a list of X3D nodes. |
void |
createX3DFromURL(java.lang.String url,
EventObserver observer,
java.lang.Object userData)
Create and load X3D from the given URL. |
void |
deleteRoute(Node fromNode,
java.lang.String fromEventOut,
Node toNode,
java.lang.String toEventIn)
Delete a route between two nodes |
void |
endUpdate()
Release the output of events from the external interface into the X3D browser. |
float[] |
getCamera()
Get the current position and orientation of the camera |
Node |
getNode(java.lang.String name)
Get a DEF node by name. |
java.lang.String |
getNodeField(java.lang.String node,
java.lang.String event)
get node eventout by string, usable from script |
java.lang.Object |
getProperty(java.lang.String name)
Get a browser property. |
Node[] |
getWorld()
Get the current root nodes. |
java.lang.String |
getWorldURL()
Get the fully qualified URL of the currently loaded world. |
void |
loadURL(java.lang.String url)
Load the URL as the new root of the scene. |
PickInfo |
pick(int info,
float[] from,
float[] direction)
Send a ray and get information about the geometry that was hit by the ray specified by start point and direction. |
PickInfo |
pick(int info,
int mousex,
int mousey)
Send a ray and get information about the geometry that was hit by the ray specified by a mouse position. |
void |
removeAWTObserver(EventObserver observer)
Remove an observer for AWT browser events. |
void |
removeBrowserObserver(EventObserver observer)
Remove an observer for browser events. |
void |
removeBrowserScriptObserver(java.lang.String scriptmethod)
Remove a javascript observer for browser events. |
void |
removeFieldScriptObserver(java.lang.String node,
java.lang.String field,
java.lang.String scriptmethod)
Remove a javascript observer for changes in this field. the observer has been added before with addObserver |
void |
replaceWorld(Node[] nodes)
Replace the current world with the given nodes. |
boolean |
setNodeField(java.lang.String node,
java.lang.String event,
java.lang.String value)
set node eventin from string, usable from script |
Field Detail |
public static final java.lang.String PROPERTY_NAME
public static final java.lang.String PROPERTY_VERSION
public static final java.lang.String PROPERTY_PROFILE
public static final java.lang.String PROPERTY_HEADLIGHT
public static final java.lang.String PROPERTY_BOUNDVIEWPOINT
public static final java.lang.String PROPERTY_BOUNDBACKGROUND
public static final java.lang.String PROPERTY_BOUNDNAVIGATIONINFO
Method Detail |
public java.lang.Object getProperty(java.lang.String name)
name
- the name of the propertypublic float[] getCamera() throws X3DException
public java.lang.String getWorldURL() throws X3DException
loadURL
then the string will reflect the new URL. If
replaceWorld
is called then the URL still represents the
original world.loadURL(java.lang.String)
,
replaceWorld(x3d.Node[])
public void replaceWorld(Node[] nodes) throws java.lang.IllegalArgumentException, X3DException
Calling this method causes a SHUTDOWN event followed by an INITIALIZED event to be generated.
nodes
- The list of nodes to use as the new root of the worldpublic Node[] getWorld() throws X3DException
public void loadURL(java.lang.String url) throws java.lang.IllegalArgumentException, X3DException
Generates an immediate SHUTDOWN event and then when the new contents are ready to be loaded, sends an INITIALIZED event.
url
- The url of a X3D file.public Node[] createX3DFromString(java.lang.String x3dString) throws java.lang.IllegalArgumentException, X3DException
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 X3D syntax. The X3D header line is not required to be present in the string.
x3dString
- The string containing X3D string syntaxpublic void createX3DFromURL(java.lang.String url, EventObserver observer, java.lang.Object userData) throws java.lang.IllegalArgumentException, X3DException
url
- The url of the X3D file.observer
- The observer that gets the notification.userData
- Additional userData that will be passed to the onEvent method,
might be null.public void addRoute(Node fromNode, java.lang.String fromEventOut, Node toNode, java.lang.String toEventIn) throws java.lang.IllegalArgumentException
fromNode
- start node of the routefromField
- field name of the start nodetoNode
- end node of the routetoField
- field name of the end nodepublic void deleteRoute(Node fromNode, java.lang.String fromEventOut, Node toNode, java.lang.String toEventIn) throws java.lang.IllegalArgumentException
fromNode
- start node of the routefromField
- field name of the start nodetoNode
- end node of the routetoField
- field name of the end nodepublic Node getNode(java.lang.String name) throws java.lang.IllegalArgumentException, X3DException
name
- The name of the DEF node to retrievepublic boolean setNodeField(java.lang.String node, java.lang.String event, java.lang.String value)
String
- name of nodeString
- name of eventInString
- value for eventInpublic java.lang.String getNodeField(java.lang.String node, java.lang.String event)
String
- name of nodeString
- name of eventOutpublic void beginUpdate() throws X3DException
This call is not nested. Additional beginUpdate calls have no effect. The first endUpdate call will release the X3D browser again.
public void endUpdate() throws X3DException
The call is not nested. This means one call to endUpdate ends all beginUpdate calls.
If no beginUpdate has been called before calling this method, it has no effect.
public PickInfo pick(int info, float[] from, float[] direction) throws java.lang.IllegalArgumentException
info
- flagword that specifies which information should be retrieved
The flags are defined in PickInfo.from
- the start point of the raydirection
- the direction of the pointpublic PickInfo pick(int info, int mousex, int mousey) throws java.lang.IllegalArgumentException
info
- flagword that specifies which information should be retrieved
The flags are defined in PickInfo.mousex
- the x coordinate of the mousemousey
- the y coordinate of the mousepublic void addBrowserObserver(EventObserver observer) throws X3DException
observer
- The observer to add.public void addBrowserScriptObserver(java.lang.String scriptmethod)
scriptmethod
- The javascript method to add.public void removeBrowserObserver(EventObserver observer) throws X3DException
observer
- The observer to removepublic void removeBrowserScriptObserver(java.lang.String scriptmethod)
scriptmethod
- The javascript method to removepublic void addFieldScriptObserver(java.lang.String node, java.lang.String field, java.lang.String scriptmethod)
the observer object will be notified of any changes to this field The javascript method should be done this way: function javascriptmethod(type,nodename,fieldname) where type - the event type nodename - the name of the node that launched this event (in case of a browser event it's null) fieldname - the name of the field that launched this event (in case of a browser event it's null)
node
- the name of the node to register tofield
- the name of the field of the node to register toscriptmethod
- The javascript method to addpublic void removeFieldScriptObserver(java.lang.String node, java.lang.String field, java.lang.String scriptmethod)
the observer has been added before with addObserver
node
- the name of the node to register tofield
- the name of the field of the node to register toscriptmethod
- The javascript method to removepublic void addAWTObserver(EventObserver observer) throws X3DException
observer
- The observer to add.public void removeAWTObserver(EventObserver observer) throws X3DException
observer
- The observer to remove
|
Questions or comments. Copyright 1999, Bitmanagement Software, Inc. |
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |