What is the full JavaScript API

From KitwarePublic
Jump to navigationJump to search

ParaViewWeb


Introduction

ParaViewWeb rely on the Python API of ParaView to do it's processing. Therefore, all the method that are available through Python are available through JavaScript. To learn more about what can be achieved from that API, you can look at the ParaView Python tutorial or simply look at the ParaView Python API defined inside the ParaView-src/Utilities/VTKPythonWrapping/paraview/simple.py and inside the ParaViewWeb-src/ParaViewAdapter/pwsimple.py.

Trick and Tips

To figure out how to do things in JavaScript you can use ParaView with the Python trace on, so you will only need to translate the generated trace to a JavaScript code. But other than that it should be pretty straight forward.

Translation

Create a Proxy

Python:

cone = Cone(resolution=12)
cone = Cone()

JavaScript:

 var cone = paraview.Cone({resolution:12});
 cone = paraview.Cone();

Set a Property

Python:

 cone.Resolution = 24
 cone.Center = [1,2,3]

JavaScript:

 cone.setResolution(24);
 cone.setCenter(1,2,3);
 cone.setCenter([1,2,3]);

Get a Property

Python:

 cone.Resolution
 cone.Center

JavaScript:

 cone.getResolution();
 cone.getCenter();