Jeospace API

org.jeospace.simulation
Class X3DSimManager

java.lang.Object
  extended byorg.jeospace.simulation.X3DSimManager
All Implemented Interfaces:
org.web3d.x3d.sai.BrowserListener, java.util.EventListener, java.lang.Runnable, SimManager, org.web3d.x3d.sai.X3DFieldEventListener

public class X3DSimManager
extends java.lang.Object
implements SimManager, org.web3d.x3d.sai.BrowserListener, org.web3d.x3d.sai.X3DFieldEventListener

Executes the algorithms for the position and orientation of simulation components as scheduled by the ChronManager. Handles the initial and ongoing construction and deconstruction of the X3D scene. Manages the interactions of simulation components with the X3D browser.

Version:
$Revision: 1.2 $
Author:
Rex Melton
See Also:
Profile, ExternalBrowser, ChronManager

Method Summary
 void addIdentificationListener(IdentificationListener il)
          Add a listener for IdentificationEvents
 void addPlatformComponent(org.w3c.dom.Element component)
          Add a visual component to the X3D browser
 void addSimListener(SimListener sl)
          Add a listener for SimEvents
 void addSystemComponent(org.w3c.dom.Element component)
          Add a visual component to the X3D browser
 void browserChanged(org.web3d.x3d.sai.BrowserEvent be)
          The Browser Listener.
protected  void fireIdentificationEvent(int type, Identification ident)
          Send an IdentificationEvent to all registered listeners
protected  void fireSimEvent(SimEvent se)
          Send a SimEvent to all registered listeners
 float getBrowserFrameRate()
          Return the X3D browser frame rate.
 boolean getEnabled()
          Return the enable state.
 NavManager getNavManager()
          Return the active NavManager
 Length getScale()
          Return the scale at which the simulation is displayed.
 void readableFieldChanged(org.web3d.x3d.sai.X3DFieldEvent xfe)
          Field events handler.
 void removeIdentificationListener(IdentificationListener il)
          Remove a listener for IdentificationEvents
 void removePlatformComponent(org.w3c.dom.Element component)
          Remove a visual component from the X3D browser
 void removeSimListener(SimListener sl)
          Remove a listener for SimEvents
 void removeSystemComponent(org.w3c.dom.Element component)
          Remove a visual component from the X3D browser
 void run()
          The per-simulation-frame task, updates the simulation object's properties.
 void setBrowser(org.web3d.x3d.sai.ExternalBrowser newBrowser)
          Initialize the sim manager's visualization capabilities utilizing the argument X3D Browser object.
 void setChronometer(Chronometer chronometer)
          Set the active Chronometer.
 void setEnabled(boolean enabled)
          Set the enable state.
 void setRootNode(RootNode newRootNode)
          Set the root node of the simulation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

run

public void run()
The per-simulation-frame task, updates the simulation object's properties. Typically this is scheduled to execute periodically by a ChronManager.

Specified by:
run in interface SimManager

setChronometer

public void setChronometer(Chronometer chronometer)
Set the active Chronometer.

Specified by:
setChronometer in interface SimManager
Parameters:
chronometer - The Chronometer.

setEnabled

public void setEnabled(boolean enabled)
Set the enable state.

Specified by:
setEnabled in interface SimManager
Parameters:
enabled - The state flag.

getEnabled

public boolean getEnabled()
Return the enable state.

Specified by:
getEnabled in interface SimManager
Returns:
the enable state.

addSimListener

public void addSimListener(SimListener sl)
Add a listener for SimEvents

Specified by:
addSimListener in interface SimManager
Parameters:
sl - The listener

removeSimListener

public void removeSimListener(SimListener sl)
Remove a listener for SimEvents

Specified by:
removeSimListener in interface SimManager
Parameters:
sl - the listener

browserChanged

public void browserChanged(org.web3d.x3d.sai.BrowserEvent be)
The Browser Listener.

Specified by:
browserChanged in interface org.web3d.x3d.sai.BrowserListener

readableFieldChanged

public void readableFieldChanged(org.web3d.x3d.sai.X3DFieldEvent xfe)
Field events handler.

Specified by:
readableFieldChanged in interface org.web3d.x3d.sai.X3DFieldEventListener

getNavManager

public NavManager getNavManager()
Return the active NavManager

Returns:
the active NavManager

setBrowser

public void setBrowser(org.web3d.x3d.sai.ExternalBrowser newBrowser)
Initialize the sim manager's visualization capabilities utilizing the argument X3D Browser object.

Parameters:
newBrowser - The X3D browser object for displaying the visualization of the simulation. A null value will stop any currently running visualization.

setRootNode

public void setRootNode(RootNode newRootNode)
Set the root node of the simulation. If the scene object exists when this method is called, the hierarchy will be walked and X3D structures created for the members of the existing hierarchy.

Note: This method should only be called once upon simulation initialization. Logic has not yet been implemented to reset the root system once it has been established.

Parameters:
newRootNode - The RootNode of the simulation.

getScale

public Length getScale()
Return the scale at which the simulation is displayed.

Returns:
the scale at which the simulation is displayed.

getBrowserFrameRate

public float getBrowserFrameRate()
Return the X3D browser frame rate.

Returns:
the X3D browser frame rate.

addSystemComponent

public void addSystemComponent(org.w3c.dom.Element component)
Add a visual component to the X3D browser

Parameters:
component - the Element descriptor of the visual component

removeSystemComponent

public void removeSystemComponent(org.w3c.dom.Element component)
Remove a visual component from the X3D browser

Parameters:
component - the Element descriptor of the visual component

addPlatformComponent

public void addPlatformComponent(org.w3c.dom.Element component)
Add a visual component to the X3D browser

Parameters:
component - the Element descriptor of the visual component

removePlatformComponent

public void removePlatformComponent(org.w3c.dom.Element component)
Remove a visual component from the X3D browser

Parameters:
component - the Element descriptor of the visual component

addIdentificationListener

public void addIdentificationListener(IdentificationListener il)
Add a listener for IdentificationEvents

Parameters:
il - The listener

removeIdentificationListener

public void removeIdentificationListener(IdentificationListener il)
Remove a listener for IdentificationEvents

Parameters:
il - The listener

fireIdentificationEvent

protected void fireIdentificationEvent(int type,
                                       Identification ident)
Send an IdentificationEvent to all registered listeners

Parameters:
type - The action which caused the event
ident - The Identification object.

fireSimEvent

protected void fireSimEvent(SimEvent se)
Send a SimEvent to all registered listeners

Parameters:
se - The SimEvent to send

Jeospace API

Copyright © 2006 - jeospace.org