Salome HOME
[MEDCalc] add presentations and view mode
[modules/med.git] / src / MEDCalc / cmp / MEDPresentation.cxx
index 222a439b3875eed356c6a972a3f923d0a0f11a40..4ae979910bedb179ffda55514cc88cd5be935621 100644 (file)
@@ -104,3 +104,23 @@ std::string MEDPresentation::getFieldTypeString(MEDCoupling::TypeOfField fieldTy
       return "";
   }
 }
+
+std::string
+MEDPresentation::getRenderViewCommand(MEDCALC::MEDPresentationViewMode viewMode)
+{
+  std::string cmd = std::string("pvs._DisableFirstRenderCameraReset();");
+  if (viewMode == MEDCALC::VIEW_MODE_OVERLAP) {
+    cmd += std::string("__view1 = pvs.GetActiveViewOrCreate('RenderView');");
+  } else if (viewMode == MEDCALC::VIEW_MODE_REPLACE) {
+    cmd += std::string("__view1 = pvs.GetActiveViewOrCreate('RenderView');");
+    cmd += std::string("pvs.active_objects.source and pvs.Hide(view=__view1);");
+    cmd += std::string("pvs.Render();");
+  } else if (viewMode == MEDCALC::VIEW_MODE_NEW_LAYOUT) {
+    cmd += std::string("__layout1 = pvs.servermanager.misc.ViewLayout(registrationGroup='layouts');");
+    cmd += std::string("__view1 = pvs.CreateView('RenderView');");
+  } else if (viewMode == MEDCALC::VIEW_MODE_SPLIT_VIEW) {
+    cmd += std::string("__view1 = pvs.CreateView('RenderView');");
+  }
+  cmd += std::string("__view1.ResetCamera();");
+  return cmd;
+}