#include <Python.h>#include <vtkPythonUtil.h>#include <vtkVersion.h>#include <vtkRenderer.h>#include <vtkRenderWindow.h>#include <vtkRenderWindowInteractor.h>#include <SALOME_Event.h>#include <SUIT_Session.h>#include <LightApp_Application.h>#include <LightApp_Study.h>#include <SVTK_ViewManager.h>#include <SVTK_ViewWindow.h>
Data Structures | |
| class | TGetRendererEvent |
| class | TGetRenderWindowEvent |
| class | TGetRenderWindowInteractorEvent |
Defines | |
| #define | VTK_XVERSION (VTK_MAJOR_VERSION*10000+VTK_MINOR_VERSION*100+VTK_BUILD_VERSION) |
| #define | PUBLISH_ENUM(i) |
| Python wrappings for VTK viewer of the SALOME desktop. | |
Enumerations | |
| enum | { ViewFront, ViewBack, ViewTop, ViewBottom, ViewRight, ViewLeft } |
View operation type. More... | |
| enum | { __Find, __FindOrCreate, __Create } |
VTK window find/create mode. More... | |
Functions | |
| static PyObject * | GetPyClass (const char *theClassName) |
| Get Python class object by name. | |
| static SVTK_ViewWindow * | GetVTKViewWindow (int toCreate=__FindOrCreate) |
| Find or create VTK window. | |
| PyObject * | libSalomePy_getRenderer (PyObject *self, PyObject *args) |
| PyObject * | libSalomePy_getRenderWindow (PyObject *self, PyObject *args) |
| PyObject * | libSalomePy_getRenderWindowInteractor (PyObject *self, PyObject *args) |
| PyObject * | libSalomePy_showTrihedron (PyObject *self, PyObject *args) |
| PyObject * | libSalomePy_fitAll (PyObject *self, PyObject *args) |
| PyObject * | libSalomePy_setView (PyObject *self, PyObject *args) |
| PyObject * | libSalomePy_resetView (PyObject *self, PyObject *args) |
| void | initlibSalomePy () |
| Python module initialization. | |
Variables | |
| static PyMethodDef | Module_Methods [] |
| #define VTK_XVERSION (VTK_MAJOR_VERSION*10000+VTK_MINOR_VERSION*100+VTK_BUILD_VERSION) |
| #define PUBLISH_ENUM | ( | i | ) |
{ \
PyObject *w; \
int rc; \
if ( ( w = PyInt_FromLong( i ) ) == NULL ) return; \
rc = PyDict_SetItemString( aModuleDict, #i, w ); \
Py_DECREF( w ); \
if ( rc < 0 ) return; \
}
All methods are implemented using Event mechanism. The module provides the following functions:
Usage in Python:
import SalomePy renderer = SalomePy.getRenderer() # get VTK renderer window = SalomePy.getRenderWindow() # get render window
The methods getRenderer(), getRenderWindow() and getRenderWindowInteractor() open new VTK viewer if there is no one opened. In case of any error these methods return None object to the Python.
| anonymous enum |
| static PyObject* GetPyClass | ( | const char * | theClassName | ) | [static] |
| theClassName | Python class name |
| static SVTK_ViewWindow* GetVTKViewWindow | ( | int | toCreate = __FindOrCreate | ) | [static] |
| toCreate | window find/create mode |
References __Create, __FindOrCreate, SUIT_Session.activeApplication(), SUIT_Application.activeStudy(), LightApp_Application.createViewManager(), SUIT_ViewManager.createViewWindow(), SUIT_ViewManager.getActiveView(), LightApp_Application.getViewManager(), SUIT_ViewManager.getViews(), and SUIT_Session.session().
| PyObject* libSalomePy_getRenderer | ( | PyObject * | self, |
| PyObject * | args | ||
| ) |
References ProcessEvent().
| PyObject* libSalomePy_getRenderWindow | ( | PyObject * | self, |
| PyObject * | args | ||
| ) |
References ProcessEvent().
| PyObject* libSalomePy_getRenderWindowInteractor | ( | PyObject * | self, |
| PyObject * | args | ||
| ) |
References ProcessEvent().
| PyObject* libSalomePy_showTrihedron | ( | PyObject * | self, |
| PyObject * | args | ||
| ) |
References __Find, SALOME_Event.Execute(), GetVTKViewWindow(), and ProcessVoidEvent().
| PyObject* libSalomePy_fitAll | ( | PyObject * | self, |
| PyObject * | args | ||
| ) |
References __Find, SALOME_Event.Execute(), GetVTKViewWindow(), and ProcessVoidEvent().
| PyObject* libSalomePy_setView | ( | PyObject * | self, |
| PyObject * | args | ||
| ) |
References __Find, SALOME_Event.Execute(), GetVTKViewWindow(), ProcessVoidEvent(), ViewBack, ViewBottom, ViewFront, ViewLeft, ViewRight, and ViewTop.
| PyObject* libSalomePy_resetView | ( | PyObject * | self, |
| PyObject * | args | ||
| ) |
References __Find, SALOME_Event.Execute(), GetVTKViewWindow(), and ProcessVoidEvent().
| void initlibSalomePy | ( | ) |
References Module_Methods, PUBLISH_ENUM, ViewBack, ViewBottom, ViewFront, ViewLeft, ViewRight, and ViewTop.
PyMethodDef Module_Methods[] [static] |
{
{ "getRenderer", libSalomePy_getRenderer, METH_VARARGS },
{ "getRenderWindow", libSalomePy_getRenderWindow, METH_VARARGS },
{ "getRenderWindowInteractor", libSalomePy_getRenderWindowInteractor, METH_VARARGS },
{ "showTrihedron", libSalomePy_showTrihedron, METH_VARARGS },
{ "fitAll", libSalomePy_fitAll, METH_NOARGS },
{ "setView", libSalomePy_setView, METH_VARARGS },
{ "resetView", libSalomePy_resetView, METH_NOARGS },
{ NULL, NULL }
}