+
+std::string
+MEDPresentation::getRenderViewCommand(MEDCALC::MEDPresentationViewMode viewMode) const
+{
+ std::ostringstream oss, oss2;
+ oss << "__view" << _renderViewPyId;
+ std::string view(oss.str());
+ oss2 << "pvs._DisableFirstRenderCameraReset();";
+ if (viewMode == MEDCALC::VIEW_MODE_OVERLAP) {
+ oss2 << view << " = pvs.GetActiveViewOrCreate('RenderView');";
+ } else if (viewMode == MEDCALC::VIEW_MODE_REPLACE) {
+ oss2 << view << " = pvs.GetActiveViewOrCreate('RenderView');";
+ oss2 << "pvs.active_objects.source and pvs.Hide(view=" << view << ");";
+ oss2 << "pvs.Render();";
+ } else if (viewMode == MEDCALC::VIEW_MODE_NEW_LAYOUT) {
+ oss2 << "__layout1 = pvs.servermanager.misc.ViewLayout(registrationGroup='layouts');";
+ oss2 << view << " = pvs.CreateView('RenderView');";
+ } else if (viewMode == MEDCALC::VIEW_MODE_SPLIT_VIEW) {
+ oss2 << view << " = pvs.CreateView('RenderView');";
+ }
+ return oss2.str();
+}
+
+std::string
+MEDPresentation::getResetCameraCommand() const
+{
+ std::ostringstream oss;
+ oss << "__view" << _renderViewPyId << ".ResetCamera();";
+ return oss.str();
+}
+
+std::string
+MEDPresentation::getColorMapCommand(MEDCALC::MEDPresentationColorMap colorMap) const
+{
+ switch (colorMap) {
+ case MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW: return "Blue to Red Rainbow";
+ case MEDCALC::COLOR_MAP_COOL_TO_WARM: return "Cool to Warm";
+ }
+}
+
+int
+MEDPresentation::GeneratePythonId()
+{
+ static int INIT_ID = 0;
+ return INIT_ID++;
+}
+
+void
+MEDPresentation::activateView() const
+{
+ PyLockWrapper lock;
+ std::ostringstream oss;
+ oss << "pvs.SetActiveView(__view" << _renderViewPyId << ");";
+ std::cerr << oss.str() << std::endl;
+ PyRun_SimpleString(oss.str().c_str());
+}