public class ViewerProxy extends java.lang.Object implements SimpleObserver, ProxyInterface
ViewerProxy proxy = new ViewerProxy();
// Set the path to the visit launch script
proxy.SetBinPath("/usr/local/apps/visit/bin");
// Add arguments before we launch the viewer.
proxy.AddArgument("-debug");
proxy.AddArgument("5");
// Launch the viewer, listening on port 5600
if(proxy.Create(5600))
{
// Now that the viewer is running, do stuff.
proxy.GetViewerMethods().OpenDatabase(proxy.GetDataPath()+"globe.silo");
proxy.AddPlots("Pseudocolor", "speed");
proxy.DrawPlots();
proxy.SaveWindow();
// We're done so close the viewer.
proxy.Close();
}
Constructor and Description |
---|
ViewerProxy()
Contructor for the ViewerProxy class.
|
Modifier and Type | Method and Description |
---|---|
void |
AddArgument(java.lang.String arg)
Adds extra arguments to the viewer's command line so you can
launch VisIt with arguments that you provide.
|
boolean |
Close()
Tells the ViewerProxy to close the viewer.
|
boolean |
Create(int port)
Launches VisIt's viewer and performs the rest of the initialization
of the ViewerProxy class, including loading plugins, starting a listener
thread to read from the viewer.
|
protected void |
finalize()
Closes VisIt's viewer when the object is garbage collected.
|
java.lang.String |
GetDataPath()
Gets the data path directory, which is often a "data" directory
peer to the "bin" directory provided via SetBinPath.
|
EventLoop |
GetEventLoop()
Get the event loop object.
|
java.lang.String |
GetLastError()
Gets the last error message that was encountered.
|
int |
GetNumOperatorPlugins()
Returns the number of operator plugins that were loaded.
|
int |
GetNumPlotPlugins()
Returns the number of plot plugins that were loaded.
|
Plugin |
GetOperatorAttributes(int index)
Convenience method that returns the state object for the operator plugin.
|
Plugin |
GetOperatorAttributes(java.lang.String operatorName)
Convenience method that returns the state object for the operator plugin.
|
int |
GetOperatorIndex(java.lang.String operatorName)
Convenience method that looks up the index of the named operator plugin
in the operator plugin manager.
|
java.lang.String |
GetOperatorName(int index)
Convenience methods that looks up the name of the operator plugin
in the operator plugin manager, given an index.
|
java.lang.String |
GetOperatorVersion(int index)
Convenience methods that returns the Operator plugin version for the
specified plugin index.
|
Plugin |
GetPlotAttributes(int index)
Convenience method that returns the state object for the plot plugin.
|
Plugin |
GetPlotAttributes(java.lang.String plotName)
Convenience method that returns the state object for the plot plugin.
|
int |
GetPlotIndex(java.lang.String plotName)
Convenience method that looks up the index of the named plot plugin
in the plot plugin manager.
|
java.lang.String |
GetPlotName(int index)
Convenience method that looks up the name of the plot plugin
in the plot plugin manager, given an index.
|
java.lang.String |
GetPlotVersion(int index)
Convenience method that returns the plot plugin version for the
specified plugin index.
|
boolean |
GetSynchronous()
Return whether the proxy is running with synchronization.
|
boolean |
GetUpdate()
This method implements the SimpleObserver interface and is called when
we want to determine whether updates to a state object should cause this
object's Update method to be called.
|
ViewerMethods |
GetViewerMethods()
Returns the ViewerMethods object, which is the container object that
maps all method calls through it into ViewerRPC calls to the viewer.
|
ViewerState |
GetViewerState()
Returns the ViewerState object, which is the container object that
holds all of the state objects that can be observed or manipulated
in VisIt.
|
boolean |
PluginsLoaded()
Returns whether plugins have been loaded.
|
void |
PrintMessage(java.lang.String msg)
Prints a message to the console if the ViewerProxy object is
in verbose mode.
|
void |
SendInterruption()
Sends an interruption message to the viewer, which can be used to
interrupt processing of multiple domain datasets in the compute engine.
|
void |
SetBinPath(java.lang.String path)
Sets the location of the visit binary that Java will launch.
|
void |
SetDataPath(java.lang.String path)
Sets the data path directory.
|
void |
SetSynchronous(boolean val)
Sets whether the ViewerProxy will force synchronization with the
viewer after calling methods from the ViewerMethods object.
|
void |
SetUpdate(boolean val)
This method implements the SimpleObserver interface and is called when
we want to prevent updates from an observed state object to have an effect
on this observer.
|
void |
SetVerbose(boolean val)
Sets a flag that determines if messages from the viewer are printed to
the console.
|
boolean |
Synchronize()
Sends a synchronization message to the viewer and blocks until the
viewer's reply to that message is read on the listener thread.
|
void |
Update(AttributeSubject s)
This method implements the SimpleObserver interface and is called when
an observed state object changes, in this case, the plugin manager
attributes state object.
|
public ViewerProxy()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void SetBinPath(java.lang.String path)
path
- An absolute path to the "bin" directory containing
the "visit" script.public java.lang.String GetDataPath()
public void SetDataPath(java.lang.String path)
path
- An absolute path to the "data" directory.public void AddArgument(java.lang.String arg)
arg
- A command line option to be added to the viewer command
line. Note that once the viewer is launched, this method
has no effect.public void PrintMessage(java.lang.String msg)
PrintMessage
in interface ProxyInterface
msg
- The message to print.public boolean Create(int port)
port
- The default port that will be used to listen for the
viewer when it wants to connect back to the ViewerProxy.
VisIt usually defaults to port 5600.public void SetSynchronous(boolean val)
SetSynchronous
in interface ProxyInterface
val
- true for synchronous processing; false for asynchronous.public boolean GetSynchronous()
GetSynchronous
in interface ProxyInterface
public void SetVerbose(boolean val)
val
- True to make the ViewerProxy print verbose output.public boolean Close()
public void SendInterruption()
SendInterruption
in interface ProxyInterface
public boolean Synchronize()
Synchronize
in interface ProxyInterface
public EventLoop GetEventLoop()
public java.lang.String GetLastError()
public ViewerState GetViewerState()
GetViewerState
in interface ProxyInterface
ViewerState
public ViewerMethods GetViewerMethods()
public int GetPlotIndex(java.lang.String plotName)
GetPlotIndex
in interface ProxyInterface
plotName
- The name of the plot to look for.public java.lang.String GetPlotName(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- The index of the plot.java.lang.ArrayIndexOutOfBoundsException
public java.lang.String GetPlotVersion(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- The index of the plot.java.lang.ArrayIndexOutOfBoundsException
public Plugin GetPlotAttributes(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- The index of the plot.java.lang.ArrayIndexOutOfBoundsException
public Plugin GetPlotAttributes(java.lang.String plotName) throws java.lang.ArrayIndexOutOfBoundsException
plotName
- The name of the plot.java.lang.ArrayIndexOutOfBoundsException
public int GetNumPlotPlugins()
public int GetOperatorIndex(java.lang.String operatorName)
GetOperatorIndex
in interface ProxyInterface
operatorName
- The name of the plot to look for.public java.lang.String GetOperatorName(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- The index of the operator.java.lang.ArrayIndexOutOfBoundsException
public java.lang.String GetOperatorVersion(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- The index of the Operator.java.lang.ArrayIndexOutOfBoundsException
public Plugin GetOperatorAttributes(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- The index of the operator.java.lang.ArrayIndexOutOfBoundsException
public Plugin GetOperatorAttributes(java.lang.String operatorName) throws java.lang.ArrayIndexOutOfBoundsException
operatorName
- The name of the plot.java.lang.ArrayIndexOutOfBoundsException
public int GetNumOperatorPlugins()
public void Update(AttributeSubject s)
Update
in interface SimpleObserver
s
- The state object that was modified - in this case the plugin
manager attributes.public void SetUpdate(boolean val)
SetUpdate
in interface SimpleObserver
val
- True to make the update have an effect; false otherwise.public boolean GetUpdate()
GetUpdate
in interface SimpleObserver
public boolean PluginsLoaded()