Difference between revisions of "ParaViewWeb Plugins"

From KitwarePublic
Jump to: navigation, search
(On the client side)
(On the server side)
Line 41: Line 41:
     return view
     return view
   def add(a,b):
   def add(a,b):
Line 54: Line 54:
   def div(a,b):
   def div(a,b):
     return a/b
     return a/b
== On the client side ==
== On the client side ==

Latest revision as of 09:45, 8 April 2012


On the server side

The user can add plugin on the server side in order to ease the work of the web developer. To do that, you can add any number of python file in the plugin directory that you set in your pw-config.properties file with the pw.plugins.default or pw.plugins.???? property.

The following scripts provides some sample code for plugins:


 import pwsimple
 import os
 import threading
 buildDir = 'ParaView-build/bin'
 class StartServerThread ( threading.Thread ):
   def run( self ):
     os.system(buildDir + '/pvserver')
 def startServer():
   Start pvserver
 def connectToServer():
   Connect to pvserver
 def loadManta():
   Load manta plugins
   pwsimple.LoadPlugin(buildDir+"/libMantaView.so", False)# client
   pwsimple.LoadPlugin(buildDir+"/libMantaView.so", True) # server
 def createMantaView():
   Configure the manta view
   view = pwsimple._create_view("MantaIceTDesktopRenderView")
   view.Threads = 8
   view.ViewSize = [1024,1024]
   return view


 def add(a,b):
   return a+b
 def minus(a,b):
   return a-b
 def mul(a,b):
   return a*b
 def div(a,b):
   return a/b

On the client side

 var paraview = new Paraview(serverUrl);
 paraview.createSession("name", "comment");
 calc = paraview.plugins.calc;
 mantaLoader = paraview.plugins.MantaLoader;
 view = mantaLoader.createMantaView();