Salome HOME
[MEDCalc] add presentations and view mode
[modules/med.git] / src / MEDCalc / cmp / MEDPresentationContour.cxx
1 #include "MEDPresentationContour.hxx"
2
3 void
4 MEDPresentationContour::internalGeneratePipeline()
5 {
6   PyGILState_STATE _gil_state = PyGILState_Ensure();
7
8   std::string cmd = std::string("import pvsimple as pvs;");
9   cmd += getRenderViewCommand(_params.viewMode); // define __view1
10
11   cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');");
12   cmd += std::string("__isovolume1 = pvs.IsoVolume(Input=__obj1);");
13   cmd += std::string("__disp1 = pvs.Show(__isovolume1, __view1);");
14   cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
15   cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);");
16   cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
17   cmd += std::string("pvs.Render();");
18
19   //std::cerr << "Python command:" << std::endl;
20   //std::cerr << cmd << std::endl;
21   PyRun_SimpleString(cmd.c_str());
22   // Retrieve Python object for internal storage:
23   PyObject* obj = getPythonObjectFromMain("__isovolume1");
24   PyObject* disp = getPythonObjectFromMain("__disp1");
25   pushInternal(obj, disp);
26
27   PyGILState_Release(_gil_state);
28 }