Salome HOME
[MEDCalc] Mesh view and slice presentation.
authorabn <adrien.bruneton@cea.fr>
Mon, 1 Aug 2016 15:07:45 +0000 (17:07 +0200)
committerabn <adrien.bruneton@cea.fr>
Mon, 1 Aug 2016 15:07:45 +0000 (17:07 +0200)
38 files changed:
idl/MEDPresentationManager.idl
src/MEDCalc/cmp/CMakeLists.txt
src/MEDCalc/cmp/MEDPresentation.hxx
src/MEDCalc/cmp/MEDPresentation.txx
src/MEDCalc/cmp/MEDPresentationContour.hxx
src/MEDCalc/cmp/MEDPresentationManager_i.cxx
src/MEDCalc/cmp/MEDPresentationManager_i.hxx
src/MEDCalc/cmp/MEDPresentationMeshView.cxx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationMeshView.hxx [new file with mode: 0644]
src/MEDCalc/cmp/MEDPresentationScalarMap.cxx
src/MEDCalc/cmp/MEDPresentationSlices.cxx
src/MEDCalc/cmp/MEDPresentationSlices.hxx
src/MEDCalc/gui/CMakeLists.txt
src/MEDCalc/gui/MEDWidgetHelperMeshView.cxx [new file with mode: 0644]
src/MEDCalc/gui/MEDWidgetHelperMeshView.hxx [new file with mode: 0644]
src/MEDCalc/gui/MEDWidgetHelperSlices.cxx [new file with mode: 0644]
src/MEDCalc/gui/MEDWidgetHelperSlices.hxx [new file with mode: 0644]
src/MEDCalc/gui/MED_images.ts
src/MEDCalc/gui/MED_msg_en.ts
src/MEDCalc/gui/PresentationController.cxx
src/MEDCalc/gui/PresentationController.hxx
src/MEDCalc/gui/PresentationEvent.hxx
src/MEDCalc/gui/dialogs/WidgetPresentationParameters.cxx
src/MEDCalc/gui/dialogs/WidgetPresentationParameters.hxx
src/MEDCalc/gui/dialogs/WidgetPresentationParameters.ui
src/MEDCalc/res/presentations/classic/visu_mesh16.png [new file with mode: 0644]
src/MEDCalc/res/presentations/classic/visu_mesh24.png [new file with mode: 0644]
src/MEDCalc/res/presentations/modern/mesh16.png [new file with mode: 0644]
src/MEDCalc/res/presentations/modern/mesh24.png [new file with mode: 0644]
src/MEDCalc/res/presentations/modern/mesh24_1.png [new file with mode: 0644]
src/MEDCalc/test/tui/CMakeLists.txt
src/MEDCalc/test/tui/contour.py
src/MEDCalc/test/tui/mesh_view.py [new file with mode: 0644]
src/MEDCalc/test/tui/scalar_map.py
src/MEDCalc/test/tui/slices.py [new file with mode: 0644]
src/MEDCalc/test/tui/tests.set
src/MEDCalc/tui/__init__.py
src/MEDCalc/tui/medpresentation.py

index d95aca9bc028b471bc8b53ea1e1d3a9d50b7f84b..f66f62721929a09aa1f7811300cb6f535ac60e5c 100644 (file)
@@ -44,6 +44,13 @@ module MEDCALC
     SCALAR_BAR_CURRENT_TIMESTEP
   };
 
+  enum MEDPresentationMeshMode {
+    MESH_MODE_WIREFRAME,
+    MESH_MODE_SURFACE_EDGES,
+    MESH_MODE_SURFACE
+  };
+  
+  
 
 //  struct ScalarBarRange {
 //    // (valMin,valMax) defines the scalar bar range from:
@@ -57,7 +64,7 @@ module MEDCALC
 
   const string DISPLAY_EUCLIDEAN_NORM = "";  // Void string to avoid clash with a real component name -- never used actually?
 
-  enum SliceOrientation {
+  enum MEDPresentationSliceOrientation {
     SLICE_NORMAL_TO_X,
     SLICE_NORMAL_TO_Y,
     SLICE_NORMAL_TO_Z,
@@ -72,15 +79,23 @@ module MEDCALC
   const MEDPresentationViewMode VIEW_MODE_DEFAULT = VIEW_MODE_REPLACE;
   const MEDPresentationColorMap COLOR_MAP_DEFAULT = COLOR_MAP_BLUE_TO_RED_RAINBOW;
   const MEDPresentationScalarBarRange SCALAR_BAR_RANGE_DEFAULT = SCALAR_BAR_ALL_TIMESTEPS;
-  const long SCALAR_BAR_RANGE_VAL_MIN_DEFAULT = -1;
-  const long SCALAR_BAR_RANGE_VAL_MAX_DEFAULT = -1;
+  const MEDPresentationMeshMode MESH_MODE_DEFAULT = MESH_MODE_WIREFRAME;
+//  const long SCALAR_BAR_RANGE_VAL_MIN_DEFAULT = -1;
+//  const long SCALAR_BAR_RANGE_VAL_MAX_DEFAULT = -1;
   const string DISPLAY_DEFAULT = DISPLAY_EUCLIDEAN_NORM;
-  const SliceOrientation SLICE_ORIENTATION_DEFAULT = SLICE_NORMAL_TO_Z;
+  const MEDPresentationSliceOrientation SLICE_ORIENTATION_DEFAULT = SLICE_NORMAL_TO_X;
   const long NB_CONTOURS_DEFAULT = 10;
   const long NB_SLICES_DEFAULT = 1;
 
   /* Structs */
 
+  // Just showing the mesh 
+  struct MeshViewParameters {
+    long fieldHandlerId;   // TODO should be a meshHandlerId really ...
+    MEDPresentationMeshMode mode;
+  };
+
+  // A simple scalar map
   struct ScalarMapParameters {
     long fieldHandlerId;
     string displayedComponent; // DISPLAY_EUCLIDEAN_NORM or any component name
@@ -103,14 +118,14 @@ module MEDCALC
 //    MEDPresentationColorMap colorMap;
 //  };
 //
-//  struct SlicesParameters {
-//    long fieldHandlerId;
-//    string displayedComponent; // DISPLAY_EUCLIDEAN_NORM or any component name
-//    MEDPresentationScalarBarRange scalarBarRange;
-//    MEDPresentationColorMap colorMap;
-//    SliceOrientation orientation;
-//    long nbSlices;
-//  };
+  struct SlicesParameters {
+    long fieldHandlerId;
+    string displayedComponent; // DISPLAY_EUCLIDEAN_NORM or any component name
+    MEDPresentationScalarBarRange scalarBarRange;
+    MEDPresentationColorMap colorMap;
+    MEDPresentationSliceOrientation orientation;
+    long nbSlices;
+  };
 //
 //  struct DeflectionShapeParameters {
 //    long fieldHandlerId;
@@ -129,11 +144,12 @@ module MEDCALC
 
   interface MEDPresentationManager : SALOME::GenericObj
   {
+    long makeMeshView(in MeshViewParameters params, in MEDPresentationViewMode viewMode);
     long makeScalarMap(in ScalarMapParameters params, in MEDPresentationViewMode viewMode);
     long makeContour(in ContourParameters params, in MEDPresentationViewMode viewMode)
       raises (SALOME::SALOME_Exception);
 //    long makeVectorField(in VectorFieldParameters params, in MEDPresentationViewMode viewMode);
-//    long makeSlices(in SlicesParameters params, in MEDPresentationViewMode viewMode);
+    long makeSlices(in SlicesParameters params, in MEDPresentationViewMode viewMode);
 //    long makeDeflectionShape(in DeflectionShapeParameters params, in MEDPresentationViewMode viewMode);
 //    long makePointSprite(in PointSpriteParameters params, in MEDPresentationViewMode viewMode);
 
@@ -142,13 +158,16 @@ module MEDCALC
     void setPresentationIntProperty(in long presId, in string propName, in long propValue);
     long getPresentationIntProperty(in long presId, in string propName);
 
+    MeshViewParameters  getMeshViewParameters(in long presId);
     ScalarMapParameters getScalarMapParameters(in long presId);
-    ContourParameters getContourParameters(in long presId);
+    ContourParameters   getContourParameters(in long presId);
+    SlicesParameters     getSlicesParameters(in long presId);
 
+    void updateMeshView(in long presId, in MeshViewParameters params);
     void updateScalarMap(in long presId, in ScalarMapParameters params);
     void updateContour(in long presId, in ContourParameters params);
 //    void updateVectorField(in long presId, in VectorFieldParameters params);
-//    void updateSlices(in long presId, in SlicesParameters params);
+    void updateSlices(in long presId, in SlicesParameters params);
 //    void updateDeflectionShape(in long presId, in DeflectionShapeParameters params);
 //    void updatePointSprite(in long presId, in PointSpriteParameters params);
 
index edad94b6116f3de25f7485108000a6d20f0eef0c..3a443934c72719b3f0c38829c9b343846d70f4ce 100644 (file)
@@ -39,10 +39,11 @@ SET(COMMON_SOURCES
   MEDPresentationManager_i.cxx
   MEDPresentation.cxx
   # presentations
+  MEDPresentationMeshView.cxx
   MEDPresentationScalarMap.cxx
   MEDPresentationContour.cxx
 #  MEDPresentationVectorField.cxx
-#  MEDPresentationSlices.cxx
+  MEDPresentationSlices.cxx
 #  MEDPresentationDeflectionShape.cxx
 #  MEDPresentationPointSprite.cxx
 )
index 4b75c4f48659d1672647d316eb92c2207cb834cc..a47d1b2ff0648bfc74abff834eb5ef5a8fe0f3b7 100644 (file)
@@ -46,7 +46,6 @@ public:
   static const std::string PROP_NB_COMPONENTS;        // number of field components
   static const std::string PROP_SELECTED_COMPONENT;   // index of the selected component - 0 means Euclidean norm
   static const std::string PROP_COMPONENT;            // string prefix for all properties storing component names
-
   static const std::string PROP_COLOR_MAP;            // color map - TODO: arch fix - should be in params only
   static const std::string PROP_SCALAR_BAR_RANGE;     // scalar bar range - TODO: arch fix - should be in params only
 
index 0e061fc20d17990b9d9a9484c6fe99cca053db38..8d6fa6f0716454290c9304b4676d9e3e6aedcf47 100644 (file)
@@ -47,7 +47,6 @@ MEDPresentation::setParameters(const PresentationParameters& params)
   p->setParameters(params);
 }
 
-
 /**
  * Update the ParaVis pipeline so that the given component appears on screen.
  * Blank means "Euclidean norm"
@@ -64,8 +63,6 @@ MEDPresentation::updateComponent(const std::string& newCompo)
   params.displayedComponent = newCompo.c_str();
   p->setParameters(params);
 
-
-
   int nbCompo = getIntProperty(MEDPresentation::PROP_NB_COMPONENTS);
   int idx = -1;
   for (int i=0; i < nbCompo; i++)
index 4fb42ab2885224fc07a7784a77793d41b0eff135..7a61ce020ac781994d0f2f3cd19672cbc91aabd2 100644 (file)
@@ -33,7 +33,6 @@ public:
   virtual ~MEDPresentationContour() {}
 
   void updatePipeline(const MEDCALC::ContourParameters& params);
-//  MEDCALC::MEDPresentationViewMode getViewMode() { return _params.viewMode; }
 
   void getParameters(MEDCALC::ContourParameters & params) const { params = _params; } ;
   void setParameters(const MEDCALC::ContourParameters & params) { _params = params; } ;
index fc758a1616c3bc42e53133185c7eab7e901a2344..ad763cb6728f9b470c7363b1272d15825c76b994 100644 (file)
 #include "Basics_Utils.hxx"
 
 // presentations
+#include "MEDPresentationMeshView.hxx"
 #include "MEDPresentationScalarMap.hxx"
 #include "MEDPresentationContour.hxx"
-//#include "MEDPresentationSlices.hxx"
+#include "MEDPresentationSlices.hxx"
 //#include "MEDPresentationVectorField.hxx"
 //#include "MEDPresentationDeflectionShape.hxx"
 //#include "MEDPresentationPointSprite.hxx"
@@ -122,6 +123,12 @@ MEDPresentationManager_i::getPresentationIntProperty(MEDPresentation::TypeID pre
 
 }
 
+MEDPresentation::TypeID
+MEDPresentationManager_i::makeMeshView(const MEDCALC::MeshViewParameters& params, const MEDCALC::MEDPresentationViewMode viewMode)
+{
+  return _makePresentation<MEDPresentationMeshView>(params, viewMode);
+}
+
 MEDPresentation::TypeID
 MEDPresentationManager_i::makeScalarMap(const MEDCALC::ScalarMapParameters& params, const MEDCALC::MEDPresentationViewMode viewMode)
 {
@@ -140,11 +147,11 @@ MEDPresentationManager_i::makeContour(const MEDCALC::ContourParameters& params,
 //  return _makePresentation<MEDPresentationVectorField>(params);
 //}
 //
-//MEDPresentation::TypeID
-//MEDPresentationManager_i::makeSlices(const MEDCALC::SlicesParameters& params)
-//{
-//  return _makePresentation<MEDPresentationSlices>(params);
-//}
+MEDPresentation::TypeID
+MEDPresentationManager_i::makeSlices(const MEDCALC::SlicesParameters& params, const MEDCALC::MEDPresentationViewMode viewMode)
+{
+  return _makePresentation<MEDPresentationSlices>(params, viewMode);
+}
 //
 //MEDPresentation::TypeID
 //MEDPresentationManager_i::makeDeflectionShape(const MEDCALC::DeflectionShapeParameters& params)
@@ -158,6 +165,15 @@ MEDPresentationManager_i::makeContour(const MEDCALC::ContourParameters& params,
 //  return _makePresentation<MEDPresentationPointSprite>(params);
 //}
 
+MEDCALC::MeshViewParameters
+MEDPresentationManager_i::getMeshViewParameters(MEDPresentation::TypeID presentationID)
+{
+  MEDCALC::MeshViewParameters p;
+  _getParameters<MEDPresentationMeshView>(presentationID, p);
+  return p;
+}
+
+
 MEDCALC::ScalarMapParameters*
 MEDPresentationManager_i::getScalarMapParameters(MEDPresentation::TypeID presentationID)
 {
@@ -175,6 +191,22 @@ MEDPresentationManager_i::getContourParameters(MEDPresentation::TypeID presentat
   return p;
 }
 
+MEDCALC::SlicesParameters*
+MEDPresentationManager_i::getSlicesParameters(MEDPresentation::TypeID presentationID)
+{
+  MEDCALC::SlicesParameters* p = new MEDCALC::SlicesParameters();
+  _getParameters<MEDPresentationSlices>(presentationID, *p);
+  MEDCALC::SlicesParameters_var tmp(p);
+  return tmp._retn();
+}
+
+
+void
+MEDPresentationManager_i::updateMeshView(MEDPresentation::TypeID presentationID, const MEDCALC::MeshViewParameters& params)
+{
+  return _updatePresentation<MEDPresentationMeshView>(presentationID, params);
+}
+
 void
 MEDPresentationManager_i::updateScalarMap(MEDPresentation::TypeID presentationID, const MEDCALC::ScalarMapParameters& params)
 {
@@ -193,11 +225,11 @@ MEDPresentationManager_i::updateContour(MEDPresentation::TypeID presentationID,
 //  return _updatePresentation<MEDPresentationVectorField>(presentationID, params);
 //}
 //
-//void
-//MEDPresentationManager_i::updateSlices(MEDPresentation::TypeID presentationID, const MEDCALC::SlicesParameters& params)
-//{
-//  return _updatePresentation<MEDPresentationSlices>(presentationID, params);
-//}
+void
+MEDPresentationManager_i::updateSlices(MEDPresentation::TypeID presentationID, const MEDCALC::SlicesParameters& params)
+{
+  return _updatePresentation<MEDPresentationSlices>(presentationID, params);
+}
 //
 //void
 //MEDPresentationManager_i::updateDeflectionShape(MEDPresentation::TypeID presentationID, const MEDCALC::DeflectionShapeParameters& params)
index 1016968e8e8f4dd0177b6eaa93b951fb537ac61a..7c0cb19a04f2a371a96e75c2884a142e23d6690a 100644 (file)
@@ -39,12 +39,13 @@ class MEDPresentationManager_i: public POA_MEDCALC::MEDPresentationManager,
 
   static MEDPresentationManager_i* getInstance();
 
+  MEDCALC_EXPORT MEDPresentation::TypeID makeMeshView(const MEDCALC::MeshViewParameters&, const MEDCALC::MEDPresentationViewMode);
   MEDCALC_EXPORT MEDPresentation::TypeID makeScalarMap(const MEDCALC::ScalarMapParameters&, const MEDCALC::MEDPresentationViewMode);
   MEDCALC_EXPORT MEDPresentation::TypeID makeContour(const MEDCALC::ContourParameters&, const MEDCALC::MEDPresentationViewMode);
-//  MEDCALC_EXPORT MEDPresentation::TypeID makeVectorField(const MEDCALC::VectorFieldParameters&);
-//  MEDCALC_EXPORT MEDPresentation::TypeID makeSlices(const MEDCALC::SlicesParameters&);
-//  MEDCALC_EXPORT MEDPresentation::TypeID makeDeflectionShape(const MEDCALC::DeflectionShapeParameters&);
-//  MEDCALC_EXPORT MEDPresentation::TypeID makePointSprite(const MEDCALC::PointSpriteParameters&);
+//  MEDCALC_EXPORT MEDPresentation::TypeID makeVectorField(const MEDCALC::VectorFieldParameters&, const MEDCALC::MEDPresentationViewMode);
+  MEDCALC_EXPORT MEDPresentation::TypeID makeSlices(const MEDCALC::SlicesParameters&, const MEDCALC::MEDPresentationViewMode);
+//  MEDCALC_EXPORT MEDPresentation::TypeID makeDeflectionShape(const MEDCALC::DeflectionShapeParameters&, const MEDCALC::MEDPresentationViewMode);
+//  MEDCALC_EXPORT MEDPresentation::TypeID makePointSprite(const MEDCALC::PointSpriteParameters&, const MEDCALC::MEDPresentationViewMode);
 
   MEDCALC_EXPORT void setPresentationStringProperty(MEDPresentation::TypeID presentationID, const char* propName, const char* propValue);
   MEDCALC_EXPORT char* getPresentationStringProperty(MEDPresentation::TypeID presentationID, const char* propName);
@@ -52,13 +53,16 @@ class MEDPresentationManager_i: public POA_MEDCALC::MEDPresentationManager,
   MEDCALC_EXPORT void setPresentationIntProperty(MEDPresentation::TypeID presentationID, const char* propName, const CORBA::Long propValue);
   MEDCALC_EXPORT CORBA::Long getPresentationIntProperty(MEDPresentation::TypeID presentationID, const char* propName);
 
+  MEDCALC_EXPORT MEDCALC::MeshViewParameters   getMeshViewParameters(MEDPresentation::TypeID presentationID);
   MEDCALC_EXPORT MEDCALC::ScalarMapParameters* getScalarMapParameters(MEDPresentation::TypeID presentationID);
   MEDCALC_EXPORT MEDCALC::ContourParameters    getContourParameters(MEDPresentation::TypeID presentationID);
+  MEDCALC_EXPORT MEDCALC::SlicesParameters*    getSlicesParameters(MEDPresentation::TypeID presentationID);
 
+  MEDCALC_EXPORT void updateMeshView(MEDPresentation::TypeID, const MEDCALC::MeshViewParameters&);
   MEDCALC_EXPORT void updateScalarMap(MEDPresentation::TypeID, const MEDCALC::ScalarMapParameters&);
   MEDCALC_EXPORT void updateContour(MEDPresentation::TypeID, const MEDCALC::ContourParameters&);
 //  MEDCALC_EXPORT void updateVectorField(MEDPresentation::TypeID, const MEDCALC::VectorFieldParameters&);
-//  MEDCALC_EXPORT void updateSlices(MEDPresentation::TypeID, const MEDCALC::SlicesParameters&);
+  MEDCALC_EXPORT void updateSlices(MEDPresentation::TypeID, const MEDCALC::SlicesParameters&);
 //  MEDCALC_EXPORT void updateDeflectionShape(MEDPresentation::TypeID, const MEDCALC::DeflectionShapeParameters&);
 //  MEDCALC_EXPORT void updatePointSprite(MEDPresentation::TypeID, const MEDCALC::PointSpriteParameters&);
 
diff --git a/src/MEDCalc/cmp/MEDPresentationMeshView.cxx b/src/MEDCalc/cmp/MEDPresentationMeshView.cxx
new file mode 100644 (file)
index 0000000..ff23a68
--- /dev/null
@@ -0,0 +1,113 @@
+// Copyright (C) 2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "MEDPresentationMeshView.hxx"
+
+#include <SALOME_KernelServices.hxx>
+#undef LOG  // should be fixed in KERNEL - double definition
+#include <Basics_Utils.hxx>
+
+#include <sstream>
+
+const std::string MEDPresentationMeshView::TYPE_NAME = "MEDPresentationMeshView";
+const std::string MEDPresentationMeshView::PROP_MESH_MODE = "meshMode";
+
+MEDPresentationMeshView::MEDPresentationMeshView(const MEDCALC::MeshViewParameters& params,
+                                               const MEDCALC::MEDPresentationViewMode viewMode) :
+        // Cheating a bit here - a mesh view doesn't need a color map or a range:
+        MEDPresentation(params.fieldHandlerId, TYPE_NAME, viewMode, MEDCALC::COLOR_MAP_DEFAULT,
+                        MEDCALC::SCALAR_BAR_RANGE_DEFAULT),
+        _params(params)
+{
+  setIntProperty(MEDPresentationMeshView::PROP_MESH_MODE, params.mode);
+}
+
+std::string
+MEDPresentationMeshView::getMeshViewCommand() const
+{
+  std::ostringstream oss1;
+
+  switch (_params.mode)
+  {
+    case MEDCALC::MESH_MODE_WIREFRAME:
+      oss1 << _dispVar << ".SetRepresentationType('Wireframe');";
+      break;
+    case MEDCALC::MESH_MODE_SURFACE_EDGES:
+      oss1 << _dispVar << ".SetRepresentationType('Surface With Edges');";
+      break;
+    case MEDCALC::MESH_MODE_SURFACE:
+      oss1 << _dispVar << ".SetRepresentationType('Surface');";
+      break;
+    default:
+      const char * mes = "Unexpected getMeshViewCommand error!";
+      STDLOG(mes);
+      throw KERNEL::createSalomeException(mes);
+  }
+
+  return oss1.str();
+}
+
+void
+MEDPresentationMeshView::internalGeneratePipeline()
+{
+  MEDPresentation::internalGeneratePipeline();
+
+  MEDPyLockWrapper lock;
+
+  std::ostringstream oss;
+  std::string view(getRenderViewVar());
+
+  oss << _srcObjVar << " = pvs.MEDReader(FileName='" << _fileName << "');";
+  pushAndExecPyLine(oss.str()); oss.str("");
+  pushAndExecPyLine( getRenderViewCommand() ); // instanciate __viewXXX
+  oss << _objVar << " = " << _srcObjVar << ";";
+  pushAndExecPyLine(oss.str()); oss.str("");
+  oss << _dispVar << " = pvs.Show(" << _objVar << ", " << view << ");";
+  pushAndExecPyLine(oss.str()); oss.str("");
+  pushAndExecPyLine(getMeshViewCommand());
+  pushAndExecPyLine(getResetCameraCommand());
+  pushAndExecPyLine("pvs.Render();");
+}
+
+void
+MEDPresentationMeshView::updatePipeline(const MEDCALC::MeshViewParameters& params)
+{
+  if (params.fieldHandlerId != _params.fieldHandlerId)
+    throw KERNEL::createSalomeException("Unexpected updatePipeline error! Mismatching fieldHandlerId!");
+
+  if (params.mode != _params.mode)
+    updateMeshMode(params.mode);
+}
+
+void
+MEDPresentationMeshView::updateMeshMode(const MEDCALC::MEDPresentationMeshMode mode)
+{
+  _params.mode = mode;
+
+  // GUI helper:
+  setIntProperty(MEDPresentationMeshView::PROP_MESH_MODE, mode);
+
+  // Update the pipeline:
+  {
+    MEDPyLockWrapper lock;
+    std::string cmd = getMeshViewCommand();
+    pushAndExecPyLine(cmd);
+    pushAndExecPyLine("pvs.Render();");
+  }
+}
diff --git a/src/MEDCalc/cmp/MEDPresentationMeshView.hxx b/src/MEDCalc/cmp/MEDPresentationMeshView.hxx
new file mode 100644 (file)
index 0000000..06c43fa
--- /dev/null
@@ -0,0 +1,50 @@
+// Copyright (C) 2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef SRC_MEDCALC_CMP_MEDPRESENTATION_MESHVIEW_HXX_
+#define SRC_MEDCALC_CMP_MEDPRESENTATION_MESHVIEW_HXX_
+
+#include "MEDCALC.hxx"
+#include "MEDPresentation.hxx"
+
+class MEDCALC_EXPORT MEDPresentationMeshView : public MEDPresentation
+{
+public:
+  static const std::string TYPE_NAME;
+  static const std::string PROP_MESH_MODE;
+
+  MEDPresentationMeshView(const MEDCALC::MeshViewParameters& params, const MEDCALC::MEDPresentationViewMode viewMode);
+  virtual ~MEDPresentationMeshView() {}
+
+  void updatePipeline(const MEDCALC::MeshViewParameters& params);
+
+  void getParameters(MEDCALC::MeshViewParameters & params) const { params = _params; } ;
+  void setParameters(const MEDCALC::MeshViewParameters & params) { _params = params; } ;
+
+protected:
+  void updateMeshMode(const MEDCALC::MEDPresentationMeshMode mode);
+  virtual void internalGeneratePipeline();
+
+  std::string getMeshViewCommand() const;
+
+private:
+  MEDCALC::MeshViewParameters _params;
+};
+
+#endif
index 50d6ebbdcfc6f400a6fde263764d5742931830fd..3f603db7bd231cc9f5e4d74f962ab8b8a1081a35 100644 (file)
@@ -85,12 +85,7 @@ MEDPresentationScalarMap::updatePipeline(const MEDCALC::ScalarMapParameters& par
     throw KERNEL::createSalomeException("Unexpected updatePipeline error! Mismatching fieldHandlerId!");
 
   if (std::string(params.displayedComponent) != std::string(_params.displayedComponent))
-    {
-      STDLOG("about to updateCompo in scalar map");
-      STDLOG("from param " << params.displayedComponent);
-      STDLOG("from intern " << _params.displayedComponent);
-      updateComponent<MEDPresentationScalarMap, MEDCALC::ScalarMapParameters>(std::string(params.displayedComponent));
-    }
+    updateComponent<MEDPresentationScalarMap, MEDCALC::ScalarMapParameters>(std::string(params.displayedComponent));
   if (params.scalarBarRange != _params.scalarBarRange)
     updateScalarBarRange<MEDPresentationScalarMap, MEDCALC::ScalarMapParameters>(params.scalarBarRange);
   if (params.colorMap != _params.colorMap)
index 243468f0b36ea97498df4564480426d07f588d1c..a71284f03e641c3e4ade2a64daab696bbb68a51b 100644 (file)
 
 #include "MEDPresentationSlices.hxx"
 
+#include <SALOME_KernelServices.hxx>
+#undef LOG  // should be fixed in KERNEL - double definition
+#include <Basics_Utils.hxx>
+
+#include <sstream>
+
+const std::string MEDPresentationSlices::TYPE_NAME = "MEDPresentationSlices";
+const std::string MEDPresentationSlices::PROP_NB_SLICES = "nbSlices";
+const std::string MEDPresentationSlices::PROP_SLICE_ORIENTATION = "slicesOrientation";
+
+MEDPresentationSlices::MEDPresentationSlices(const MEDCALC::SlicesParameters& params,
+                                               const MEDCALC::MEDPresentationViewMode viewMode) :
+        MEDPresentation(params.fieldHandlerId, TYPE_NAME, viewMode, params.colorMap, params.scalarBarRange),
+        _params(params)
+{
+  setIntProperty(MEDPresentationSlices::PROP_NB_SLICES, params.nbSlices);
+  setIntProperty(MEDPresentationSlices::PROP_SLICE_ORIENTATION, params.orientation);
+}
+
+std::string
+MEDPresentationSlices::getNbSlicesCommand() const
+{
+  std::ostringstream oss1;
+  // TODO
+//  oss1 << _objVar << ".SliceType.Normal = " << norm << ";";
+  return oss1.str();
+}
+
+std::string
+MEDPresentationSlices::getOrientationCommand() const
+{
+  std::ostringstream oss1;
+  std::string norm;
+
+  switch(_params.orientation)
+  {
+    case MEDCALC::SLICE_NORMAL_TO_X:
+      norm = "[1.0, 0.0, 0.0]";
+      break;
+    case MEDCALC::SLICE_NORMAL_TO_Y:
+      norm = "[0.0, 1.0, 0.0]";
+      break;
+    case MEDCALC::SLICE_NORMAL_TO_Z:
+      norm = "[0.0, 0.0, 1.0]";
+      break;
+    case MEDCALC::SLICE_NORMAL_TO_XY:
+      norm = "[1.0, 1.0, 0.0]";
+      break;
+    case MEDCALC::SLICE_NORMAL_TO_XZ:
+      norm = "[1.0, 0.0, 1.0]";
+      break;
+    case MEDCALC::SLICE_NORMAL_TO_YZ:
+      norm = "[0.0, 1.0, 1.0]";
+      break;
+    case MEDCALC::SLICE_NORMAL_TO_XYZ:
+      norm = "[1.0, 1.0, 1.0]";
+      break;
+    default:
+      const char * mes = "Unexpected getSliceOrientationCommand() error!";
+      STDLOG(mes);
+      throw KERNEL::createSalomeException(mes);
+  }
+
+  oss1 << _objVar << ".SliceType.Normal = " << norm << ";";
+  return oss1.str();
+}
+
+
 void
 MEDPresentationSlices::internalGeneratePipeline()
 {
-//  PyGILState_STATE _gil_state = PyGILState_Ensure();
-//
-//  std::string cmd = std::string("import pvsimple as pvs;");
-//  cmd += getRenderViewCommand(_params.viewMode); // define __view1
-//
-//  cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');");
-//  cmd += std::string("__slice1 = pvs.Slice(Input=__obj1);");
-//  cmd += std::string("__disp1 = pvs.Show(__slice1, __view1);");
-//  cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
-//  cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);");
-//  cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
-//  cmd += std::string("pvs.Render();");
-//
-//  cmd += getResetCameraCommand();
-//
-//  //std::cerr << "Python command:" << std::endl;
-//  //std::cerr << cmd << std::endl;
-//  PyRun_SimpleString(cmd.c_str());
-//  // Retrieve Python object for internal storage:
-//  PyObject* obj = getPythonObjectFromMain("__slice1");
-//  PyObject* disp = getPythonObjectFromMain("__disp1");
-//  pushInternal(obj, disp);
-//
-//  PyGILState_Release(_gil_state);
+  MEDPresentation::internalGeneratePipeline();
+
+  MEDPyLockWrapper lock;
+
+  std::ostringstream oss_o, oss;
+  std::string view(getRenderViewVar());
+
+  oss << _srcObjVar << " = pvs.MEDReader(FileName='" << _fileName << "');";
+  pushAndExecPyLine(oss.str()); oss.str("");
+
+  // Populate internal array of available components:
+  fillAvailableFieldComponents();
+  pushAndExecPyLine( getRenderViewCommand() ); // instanciate __viewXXX
+  oss << _objVar << " = pvs.Slice(Input=" << _srcObjVar << ");";
+  pushAndExecPyLine(oss.str()); oss.str("");
+  oss << _objVar << ".SliceType = 'Plane';";
+  pushAndExecPyLine(oss.str()); oss.str("");
+
+  // Set slice orientation
+  pushAndExecPyLine(getOrientationCommand());
+
+  oss << _dispVar << " = pvs.Show(" << _objVar << ", " << view << ");";
+  pushAndExecPyLine(oss.str()); oss.str("");
+  oss << "pvs.ColorBy(" << _dispVar << ", ('" << _fieldType << "', '" << _fieldName << "'));";
+  pushAndExecPyLine(oss.str()); oss.str("");
+  oss << _dispVar <<  ".SetScalarBarVisibility(" << view << ", True);";
+  pushAndExecPyLine(oss.str()); oss.str("");
+  oss << getRescaleCommand();
+  pushAndExecPyLine(oss.str()); oss.str("");
+  oss << _lutVar << " = pvs.GetColorTransferFunction('" << _fieldName << "');";
+  pushAndExecPyLine(oss.str()); oss.str("");
+  pushAndExecPyLine(getColorMapCommand()); oss.str("");
+  pushAndExecPyLine(getResetCameraCommand());
+  pushAndExecPyLine("pvs.Render();");
 }
 
 void
 MEDPresentationSlices::updatePipeline(const MEDCALC::SlicesParameters& params)
 {
-  // :TODO:
+  if (params.fieldHandlerId != _params.fieldHandlerId)
+    throw KERNEL::createSalomeException("Unexpected updatePipeline error! Mismatching fieldHandlerId!");
+
+  if (std::string(params.displayedComponent) != std::string(_params.displayedComponent))
+    updateComponent<MEDPresentationSlices, MEDCALC::SlicesParameters>(std::string(params.displayedComponent));
+  if (params.scalarBarRange != _params.scalarBarRange)
+    updateScalarBarRange<MEDPresentationSlices, MEDCALC::SlicesParameters>(params.scalarBarRange);
+  if (params.colorMap != _params.colorMap)
+    updateColorMap<MEDPresentationSlices, MEDCALC::SlicesParameters>(params.colorMap);
+
+  if (params.orientation != _params.orientation)
+    updateOrientation(params.orientation);
+  if (params.nbSlices != _params.nbSlices)
+    updateNbSlices(params.nbSlices);
+}
+
+void
+MEDPresentationSlices::updateNbSlices(const int nbSlices)
+{
+  _params.nbSlices = nbSlices;
+
+  // GUI helper:
+  setIntProperty(MEDPresentationSlices::PROP_NB_SLICES, nbSlices);
+
+  // Update the pipeline:
+  {
+    MEDPyLockWrapper lock;
+    std::string cmd = getNbSlicesCommand();
+    pushAndExecPyLine(cmd);
+    pushAndExecPyLine("pvs.Render();");
+  }
+}
+
+void
+MEDPresentationSlices::updateOrientation(const MEDCALC::MEDPresentationSliceOrientation orientation)
+{
+  _params.orientation = orientation;
+
+  // GUI helper:
+  setIntProperty(MEDPresentationSlices::PROP_SLICE_ORIENTATION, orientation);
+
+  // Update the pipeline:
+  {
+    MEDPyLockWrapper lock;
+    std::string cmd = getOrientationCommand();
+    pushAndExecPyLine(cmd);
+    pushAndExecPyLine("pvs.Render();");
+  }
 }
+
index 7166a92bdb5baafe88e6bbba1727257ce74ad308..bc55bbcfdd98c860dbc75e4ea287c2602ee5d9d4 100644 (file)
 class MEDCALC_EXPORT MEDPresentationSlices : public MEDPresentation
 {
 public:
-  MEDPresentationSlices(const MEDCALC::SlicesParameters& params) :
-    MEDPresentation(params.fieldHandlerId, "MEDPresentationSlices"), _params(params)
-  {}
+  static const std::string TYPE_NAME;
+  static const std::string PROP_NB_SLICES;
+  static const std::string PROP_SLICE_ORIENTATION;
+
+  MEDPresentationSlices(const MEDCALC::SlicesParameters& params, const MEDCALC::MEDPresentationViewMode viewMode);
   virtual ~MEDPresentationSlices() {}
 
   void updatePipeline(const MEDCALC::SlicesParameters& params);
-  MEDCALC::MEDPresentationViewMode getViewMode() { return _params.viewMode; }
+
+  void getParameters(MEDCALC::SlicesParameters & params) const { params = _params; } ;
+  void setParameters(const MEDCALC::SlicesParameters & params) { _params = params; } ;
 
 protected:
+  void updateNbSlices(const int nbSlices);
+  void updateOrientation(const MEDCALC::MEDPresentationSliceOrientation orientation);
   virtual void internalGeneratePipeline();
 
+  std::string getNbSlicesCommand() const;
+  std::string getOrientationCommand() const;
+
 private:
   MEDCALC::SlicesParameters _params;
 };
index f0398bb01bd5b86c07c06e58aad48839723d83ec..0ff4b8f455e80f4fc46480cf507814e002a42fc9 100644 (file)
@@ -38,8 +38,10 @@ SET(MEDCALCGUI_SOURCES
     XmedConsoleDriver.cxx
     XmedDataModel.cxx
     MEDWidgetHelper.cxx
+    MEDWidgetHelperMeshView.cxx
     MEDWidgetHelperScalarMap.cxx
     MEDWidgetHelperContour.cxx
+    MEDWidgetHelperSlices.cxx
 )
 
 IF(SALOME_MED_WITH_QTTESTING)
@@ -54,8 +56,10 @@ SET(MEDCALCGUI_HEADERS
   PresentationController.hxx
   ProcessingController.hxx
   MEDWidgetHelper.hxx
+  MEDWidgetHelperMeshView.hxx
   MEDWidgetHelperScalarMap.hxx
   MEDWidgetHelperContour.hxx
+  MEDWidgetHelperSlices.hxx
   )
  
 IF(SALOME_MED_WITH_QTTESTING)
diff --git a/src/MEDCalc/gui/MEDWidgetHelperMeshView.cxx b/src/MEDCalc/gui/MEDWidgetHelperMeshView.cxx
new file mode 100644 (file)
index 0000000..d927164
--- /dev/null
@@ -0,0 +1,82 @@
+// Copyright (C) 2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "MEDWidgetHelperMeshView.hxx"
+#include "MEDPresentationMeshView.hxx"  // from component side.
+#include "PresentationController.hxx"
+
+#include <Basics_Utils.hxx>
+
+#include <sstream>
+
+MEDWidgetHelperMeshView::MEDWidgetHelperMeshView(const PresentationController * presController,
+                                               MEDCALC::MEDPresentationManager_ptr presManager, int presId,
+                                               const std::string & presName, WidgetPresentationParameters * paramW):
+  MEDWidgetHelper(presController, presManager, presId, presName, paramW)
+{
+}
+
+MEDWidgetHelperMeshView::~MEDWidgetHelperMeshView()
+{}
+
+void MEDWidgetHelperMeshView::loadParametersFromEngine()
+{
+  MEDWidgetHelper::loadParametersFromEngine();
+  _meshMode = static_cast<MEDCALC::MEDPresentationMeshMode>(
+          _presManager->getPresentationIntProperty(_presId, MEDPresentationMeshView::PROP_MESH_MODE.c_str()));
+}
+
+void MEDWidgetHelperMeshView::udpateWidget()
+{
+  MEDWidgetHelper::udpateWidget();
+
+  // MeshView presentation needs the mesh mode that's all.
+  _paramWidget->setMeshMode(_meshMode);
+  // Hide color map and scalar bar range
+  _paramWidget->toggleCommonFieldWidget(false);
+
+  // Connect combo box changes
+  QObject::connect( this, SIGNAL(presentationUpdateSignal(const PresentationEvent *)),
+                    _presController, SIGNAL(presentationSignal(const PresentationEvent *)) );
+  QObject::connect( _paramWidget, SIGNAL(comboMeshIndexChanged(int)), this, SLOT(onMeshModeChanged(int)) );
+}
+
+void MEDWidgetHelperMeshView::releaseWidget()
+{
+  MEDWidgetHelper::releaseWidget();
+
+  // Show color map and scalar bar range
+  _paramWidget->toggleCommonFieldWidget(true);
+
+  QObject::disconnect( this, SIGNAL(presentationUpdateSignal(const PresentationEvent *)),
+                       _presController, SIGNAL(presentationSignal(const PresentationEvent *)) );
+  QObject::disconnect( _paramWidget, SIGNAL(comboMeshIndexChanged(int)), this, SLOT(onMeshModeChanged(int)) );
+}
+
+void MEDWidgetHelperMeshView::onMeshModeChanged(int meshMode)
+{
+  STDLOG("MEDWidgetHelperMeshView::onMeshModeChanged");
+  PresentationEvent* event = new PresentationEvent();
+  event->eventtype = PresentationEvent::EVENT_CHANGE_MESH_MODE;
+  event->presentationId = _presId;
+  event->anInteger = static_cast<int>(_paramWidget->getMeshMode());
+
+  emit presentationUpdateSignal(event); // --> PresentationController::processPresentationEvent
+}
+
diff --git a/src/MEDCalc/gui/MEDWidgetHelperMeshView.hxx b/src/MEDCalc/gui/MEDWidgetHelperMeshView.hxx
new file mode 100644 (file)
index 0000000..4a04c56
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright (C) 2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef SRC_MEDCALC_GUI_MEDWIDGETHELPERMESHVIEW_HXX_
+#define SRC_MEDCALC_GUI_MEDWIDGETHELPERMESHVIEW_HXX_
+
+#include "MEDWidgetHelper.hxx"
+
+class PresentationController;
+
+class MEDWidgetHelperMeshView: public MEDWidgetHelper
+{
+  Q_OBJECT
+
+public:
+  MEDWidgetHelperMeshView(const PresentationController* presController,
+                           MEDCALC::MEDPresentationManager_ptr presManager, int presId, const std::string & presName,
+                           WidgetPresentationParameters * paramW);
+  virtual ~MEDWidgetHelperMeshView();
+
+  virtual void udpateWidget();
+  virtual void releaseWidget();
+
+  virtual std::string getPythonTag() const { return "MeshView"; }
+
+protected slots:
+  void onMeshModeChanged(int index);
+
+protected:
+  virtual void loadParametersFromEngine();
+
+private:
+  MEDCALC::MEDPresentationMeshMode _meshMode;
+};
+
+#endif /* SRC_MEDCALC_GUI_MEDWIDGETHELPERMESHVIEW_HXX_ */
diff --git a/src/MEDCalc/gui/MEDWidgetHelperSlices.cxx b/src/MEDCalc/gui/MEDWidgetHelperSlices.cxx
new file mode 100644 (file)
index 0000000..f9cb1b7
--- /dev/null
@@ -0,0 +1,93 @@
+// Copyright (C) 2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "MEDWidgetHelperSlices.hxx"
+#include "MEDPresentationSlices.hxx"  // from component side.
+#include "PresentationController.hxx"
+
+#include <Basics_Utils.hxx>
+
+#include <sstream>
+
+MEDWidgetHelperSlices::MEDWidgetHelperSlices(const PresentationController * presController,
+                                               MEDCALC::MEDPresentationManager_ptr presManager, int presId,
+                                               const std::string & presName, WidgetPresentationParameters * paramW):
+  MEDWidgetHelper(presController, presManager, presId, presName, paramW),
+  _nbSlices(-1),
+  _sliceOrientation(MEDCALC::SLICE_ORIENTATION_DEFAULT)
+{}
+
+MEDWidgetHelperSlices::~MEDWidgetHelperSlices()
+{}
+
+void MEDWidgetHelperSlices::loadParametersFromEngine()
+{
+  MEDWidgetHelper::loadParametersFromEngine();
+  _nbSlices = _presManager->getPresentationIntProperty(_presId, MEDPresentationSlices::PROP_NB_SLICES.c_str());
+  _sliceOrientation = static_cast<MEDCALC::MEDPresentationSliceOrientation>(
+      _presManager->getPresentationIntProperty(_presId, MEDPresentationSlices::PROP_SLICE_ORIENTATION.c_str()));
+}
+
+void MEDWidgetHelperSlices::udpateWidget()
+{
+  MEDWidgetHelper::udpateWidget();
+  STDLOG("MEDWidgetHelperSlices::udpateWidget() nbSlices is " << _nbSlices);
+
+//  _paramWidget->setNbSlices(_nbSlices);        // TODO: uncomment when ready to deal with slice number
+  _paramWidget->setSliceOrientation(_sliceOrientation);
+
+  // Connect combo box changes
+  QObject::connect( this, SIGNAL(presentationUpdateSignal(const PresentationEvent *)),
+                    _presController, SIGNAL(presentationSignal(const PresentationEvent *)) );
+  QObject::connect( _paramWidget, SIGNAL(spinBoxValueChanged(int)), this, SLOT(onNbSlicesChanged(int)) );
+  QObject::connect( _paramWidget, SIGNAL(comboOrientIndexChanged(int)), this, SLOT(onSliceOrientationChanged(int)) );
+}
+
+void MEDWidgetHelperSlices::releaseWidget()
+{
+  MEDWidgetHelper::releaseWidget();
+
+  QObject::disconnect( this, SIGNAL(presentationUpdateSignal(const PresentationEvent *)),
+                       _presController, SIGNAL(presentationSignal(const PresentationEvent *)) );
+  QObject::disconnect( _paramWidget, SIGNAL(spinBoxValueChanged(int)), this, SLOT(onNbSlicesChanged(int)) );
+  QObject::disconnect( _paramWidget, SIGNAL(comboOrientIndexChanged(int)), this, SLOT(onSliceOrientationChanged(int)) );
+}
+
+void MEDWidgetHelperSlices::onNbSlicesChanged(int nbSlices)
+{
+  STDLOG("MEDWidgetHelperSlices::onNbSlicesChanged");
+  PresentationEvent* event = new PresentationEvent();
+  event->eventtype = PresentationEvent::EVENT_CHANGE_NB_SLICES;
+  event->presentationId = _presId;
+  event->anInteger = nbSlices;
+
+  emit presentationUpdateSignal(event); // --> PresentationController::processPresentationEvent
+}
+
+
+void MEDWidgetHelperSlices::onSliceOrientationChanged(int sliceOrient)
+{
+  STDLOG("MEDWidgetHelperSlices::onNbSlicesChanged");
+  PresentationEvent* event = new PresentationEvent();
+  event->eventtype = PresentationEvent::EVENT_CHANGE_SLICE_ORIENTATION;
+  event->presentationId = _presId;
+  event->anInteger = static_cast<int>(_paramWidget->getSliceOrientation());
+
+  emit presentationUpdateSignal(event); // --> PresentationController::processPresentationEvent
+}
diff --git a/src/MEDCalc/gui/MEDWidgetHelperSlices.hxx b/src/MEDCalc/gui/MEDWidgetHelperSlices.hxx
new file mode 100644 (file)
index 0000000..aace3b7
--- /dev/null
@@ -0,0 +1,54 @@
+// Copyright (C) 2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef SRC_MEDCALC_GUI_MEDWIDGETHELPERSLICES_HXX_
+#define SRC_MEDCALC_GUI_MEDWIDGETHELPERSLICES_HXX_
+
+#include "MEDWidgetHelper.hxx"
+
+class PresentationController;
+
+class MEDWidgetHelperSlices: public MEDWidgetHelper
+{
+  Q_OBJECT
+
+public:
+  MEDWidgetHelperSlices(const PresentationController* presController,
+                           MEDCALC::MEDPresentationManager_ptr presManager, int presId, const std::string & presName,
+                           WidgetPresentationParameters * paramW);
+  virtual ~MEDWidgetHelperSlices();
+
+  virtual void udpateWidget();
+  virtual void releaseWidget();
+
+  virtual std::string getPythonTag() const { return "Slices"; }
+
+protected slots:
+  void onSliceOrientationChanged(int idx);
+  void onNbSlicesChanged(int nbSlices);
+
+protected:
+  virtual void loadParametersFromEngine();
+
+private:
+  int _nbSlices;
+  MEDCALC::MEDPresentationSliceOrientation _sliceOrientation;
+};
+
+#endif /* SRC_MEDCALC_GUI_MEDWIDGETHELPERSLICES_HXX_ */
index cd650e7434ab4ed11459443b89a688eb0954d370..5bc3ee90be13982df43c97f1aa7256b923a01c62 100644 (file)
       <translation>workspace_save.png</translation>
     </message>
     <!-- Presentation toolbar icons (default theme)-->
+    <message>
+      <source>ICO_PRESENTATION_MESH_VIEW_DEFAULT</source>
+      <translation>mesh24.png</translation>
+    </message>    
     <message>
       <source>ICO_PRESENTATION_SCALAR_MAP_DEFAULT</source>
       <translation>scalarmap24.png</translation>
       <translation>pqNodeMapData24.png</translation>
     </message>
     <!-- Presentation tree icons (default theme)-->
+    <message>
+      <source>ICO_MEDPresentationMeshView_DEFAULT</source>
+      <translation>mesh16.png</translation>
+    </message>    
     <message>
       <source>ICO_MEDPresentationScalarMap_DEFAULT</source>
       <translation>scalarmap16.png</translation>
       <translation>pqNodeMapData16.png</translation>
     </message>
     <!-- Presentation toolbar icons (modern theme)-->
+    <message>
+      <source>ICO_PRESENTATION_MESH_VIEW_MODERN</source>
+      <translation>mesh24.png</translation>
+    </message>    
     <message>
       <source>ICO_PRESENTATION_SCALAR_MAP_MODERN</source>
       <translation>scalarmap24.png</translation>
       <translation>pqNodeMapData24.png</translation>
     </message>
     <!-- Presentation tree icons (modern theme)-->
+    <message>
+      <source>ICO_MEDPresentationMeshView_MODERN</source>
+      <translation>mesh16.png</translation>
+    </message>    
     <message>
       <source>ICO_MEDPresentationScalarMap_MODERN</source>
       <translation>scalarmap16.png</translation>
       <translation>pqNodeMapData16.png</translation>
     </message>
     <!-- Presentation toolbar icons (classic theme)-->
+    <message>
+      <source>ICO_PRESENTATION_MESH_VIEW_CLASSIC</source>
+      <translation>visu_mesh24.png</translation>
+    </message>    
     <message>
       <source>ICO_PRESENTATION_SCALAR_MAP_CLASSIC</source>
       <translation>visu_scalars24.png</translation>
       <translation>visu_points24.png</translation>
     </message>
     <!-- Presentation tree icons (classic theme)-->
+    <message>
+      <source>ICO_MEDPresentationMeshView_CLASSIC</source>
+      <translation>visu_mesh16.png</translation>
+    </message>
     <message>
       <source>ICO_MEDPresentationScalarMap_CLASSIC</source>
       <translation>visu_scalars16.png</translation>
index 73d655dfe9c3d47d69fbd56de4c5a57b49bc017c..a3564ddd2eb0b2ad097ee7b82e4b7abede2d04b3 100644 (file)
@@ -7,6 +7,14 @@
       <source>TITLE_PRESENTATION_PARAMETERS</source>
       <translation>Presentation parameters</translation>
     </message>
+    <message>
+      <source>LAB_PRESENTATION_MESH_VIEW</source>
+      <translation>Mesh</translation>
+    </message>
+    <message>
+      <source>TIP_PRESENTATION_MESH_VIEW</source>
+      <translation>Mesh</translation>
+    </message>
     <message>
       <source>LAB_PRESENTATION_SCALAR_MAP</source>
       <translation>Scalar map</translation>
       <source>MENU_PRESENTATIONS</source>
       <translation>Presentations</translation>
     </message>
+    <message>
+      <source>MEDPresentationMeshView</source>
+      <translation>Mesh view</translation>
+    </message>
     <message>
       <source>MEDPresentationScalarMap</source>
       <translation>Scalar map</translation>
       <source>LAB_COLOR_MAP</source>
       <translation>Color map:</translation>
     </message>
+
+    <message>
+      <source>LAB_MESH_WIREFRAME</source>
+      <translation>Wireframe</translation>
+    </message>
+    <message>
+      <source>LAB_MESH_SURFACE</source>
+      <translation>Surface</translation>
+    </message>
+    <message>
+      <source>LAB_MESH_SURF_EDGES</source>
+      <translation>Surface With Edges</translation>
+    </message>
+    <message>
+      <source>LAB_DISP_MESH_MODE</source>
+      <translation>Mesh display:</translation>
+    </message>
+    <message>
+      <source>LAB_NB_CONTOURS</source>
+      <translation>Number of contours:</translation>
+    </message>
+    <message>
+      <source>LAB_NB_SLICES</source>
+      <translation>Number of slices:</translation>
+    </message>
+    <message>
+      <source>LAB_SLICE_ORIENT</source>
+      <translation>Slice orientation:</translation>
+    </message>
+
+    <message>
+      <source>LAB_SLICE_NORMAL_TO_X</source>
+      <translation>Normal to X</translation>
+    </message>
+    <message>
+      <source>LAB_SLICE_NORMAL_TO_Y</source>
+      <translation>Normal to Y</translation>
+    </message>
+    <message>
+      <source>LAB_SLICE_NORMAL_TO_Z</source>
+      <translation>Normal to Z</translation>
+    </message>
+    <message>
+      <source>LAB_SLICE_NORMAL_TO_XY</source>
+      <translation>Normal to XY</translation>
+    </message>
+    <message>
+      <source>LAB_SLICE_NORMAL_TO_XZ</source>
+      <translation>Normal to XZ</translation>
+    </message>
+    <message>
+      <source>LAB_SLICE_NORMAL_TO_YZ</source>
+      <translation>Normal to YZ</translation>
+    </message>
+    <message>
+      <source>LAB_SLICE_NORMAL_TO_XYZ</source>
+      <translation>Normal to XYZ</translation>
+    </message>
+    
   </context>
   <context>
     <name>DlgAlias</name>
index 9d9b7c0ba64e11fb1ca4f469746156ff6170f201..d9ea2b2b9d508b151b6cf97b6bcfeab7f993ad9b 100644 (file)
 #include "MEDPresentationManager_i.hxx"
 #include "XmedConsoleDriver.hxx"
 
+#include "MEDPresentationMeshView.hxx"
 #include "MEDPresentationScalarMap.hxx"
 #include "MEDPresentationContour.hxx"
+#include "MEDPresentationSlices.hxx"
 
+#include "MEDWidgetHelperMeshView.hxx"
 #include "MEDWidgetHelperScalarMap.hxx"
 #include "MEDWidgetHelperContour.hxx"
+#include "MEDWidgetHelperSlices.hxx"
 
 #include <SalomeApp_Application.h>
 #include <SalomeApp_Study.h>
@@ -170,10 +174,18 @@ PresentationController::createActions()
   int presentationToolbarId = _salomeModule->createTool("Presentations", "PresentationToolbar");
   int presentationMenuId = _salomeModule->createMenu(tr("MENU_PRESENTATIONS"), -1, 1);
 
+  label   = tr("LAB_PRESENTATION_MESH_VIEW");
+  tooltip = tr("TIP_PRESENTATION_MESH_VIEW");
+  QString icon = tr(_getIconName("ICO_PRESENTATION_MESH_VIEW").c_str());
+  int actionId;
+  actionId = _salomeModule->createStandardAction(label,this, SLOT(onVisualizeMeshView()),icon,tooltip);
+  _salomeModule->createTool(actionId, presentationToolbarId);
+  _salomeModule->action(actionId)->setIconVisibleInMenu(true);
+  _salomeModule->createMenu(actionId, presentationMenuId);
+
   label   = tr("LAB_PRESENTATION_SCALAR_MAP");
   tooltip = tr("TIP_PRESENTATION_SCALAR_MAP");
-  QString icon = tr(_getIconName("ICO_PRESENTATION_SCALAR_MAP").c_str());
-  int actionId;
+  icon = tr(_getIconName("ICO_PRESENTATION_SCALAR_MAP").c_str());
   actionId = _salomeModule->createStandardAction(label,this, SLOT(onVisualizeScalarMap()),icon,tooltip);
   _salomeModule->createTool(actionId, presentationToolbarId);
   _salomeModule->action(actionId)->setIconVisibleInMenu(true);
@@ -319,6 +331,12 @@ PresentationController::visualize(PresentationEvent::EventType eventType)
   }
 }
 
+void
+PresentationController::onVisualizeMeshView()
+{
+  this->visualize(PresentationEvent::EVENT_VIEW_OBJECT_MESH_VIEW);
+}
+
 void
 PresentationController::onVisualizeScalarMap()
 {
@@ -415,6 +433,34 @@ PresentationController::getScalarBarRangePython() const
   return QString();
 }
 
+QString
+PresentationController::getMeshModePython(const int mode) const
+{
+  MEDCALC::MEDPresentationMeshMode mod = static_cast<MEDCALC::MEDPresentationMeshMode>(mode);
+  switch(mod) {
+    case MEDCALC::MESH_MODE_WIREFRAME:     return "MEDCALC.MESH_MODE_WIREFRAME";
+    case MEDCALC::MESH_MODE_SURFACE:       return "MEDCALC.MESH_MODE_SURFACE";
+    case MEDCALC::MESH_MODE_SURFACE_EDGES: return "MEDCALC.MESH_MODE_SURFACE_EDGES";
+  }
+  return QString();
+}
+
+QString
+PresentationController::getSliceOrientationPython(const int orientation) const
+{
+  MEDCALC::MEDPresentationSliceOrientation orient = static_cast<MEDCALC::MEDPresentationSliceOrientation>(orientation);
+  switch(orient) {
+    case MEDCALC::SLICE_NORMAL_TO_X:   return "MEDCALC.SLICE_NORMAL_TO_X";
+    case MEDCALC::SLICE_NORMAL_TO_Y:   return "MEDCALC.SLICE_NORMAL_TO_Y";
+    case MEDCALC::SLICE_NORMAL_TO_Z:   return "MEDCALC.SLICE_NORMAL_TO_Z";
+    case MEDCALC::SLICE_NORMAL_TO_XY:  return "MEDCALC.SLICE_NORMAL_TO_XY";
+    case MEDCALC::SLICE_NORMAL_TO_XZ:  return "MEDCALC.SLICE_NORMAL_TO_XZ";
+    case MEDCALC::SLICE_NORMAL_TO_YZ:  return "MEDCALC.SLICE_NORMAL_TO_YZ";
+    case MEDCALC::SLICE_NORMAL_TO_XYZ: return "MEDCALC.SLICE_NORMAL_TO_XYZ";
+  }
+  return QString();
+}
+
 std::string
 PresentationController::getPresTypeFromWidgetHelper(int presId) const
 {
@@ -432,7 +478,11 @@ PresentationController::processPresentationEvent(const PresentationEvent* event)
   QString scalarBarRange = getScalarBarRangePython();
   MEDCALC::FieldHandler* fieldHandler = event->fieldHandler;
   QStringList commands;
-  if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_SCALAR_MAP ) {
+  if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_MESH_VIEW ) {
+        commands += QString("presentation_id = medcalc.MakeMeshView(accessField(%1), viewMode=%2)").arg(fieldHandler->id).arg(viewMode);
+        commands += QString("presentation_id");
+    }
+  else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_SCALAR_MAP ) {
       commands += QString("presentation_id = medcalc.MakeScalarMap(accessField(%1), viewMode=%2, scalarBarRange=%3, colorMap=%4)")
           .arg(fieldHandler->id).arg(viewMode).arg(scalarBarRange).arg(colorMap);
       commands += QString("presentation_id");
@@ -446,10 +496,11 @@ PresentationController::processPresentationEvent(const PresentationEvent* event)
   //    commands += QString("presentation_id = medcalc.MakeVectorField(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
   //    commands += QString("presentation_id");
   //  }
-  //  else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_SLICES ) {
-  //    commands += QString("presentation_id = medcalc.MakeSlices(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
-  //    commands += QString("presentation_id");
-  //  }
+    else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_SLICES ) {
+      commands += QString("presentation_id = medcalc.MakeSlices(accessField(%1), viewMode=%2, scalarBarRange=%3, colorMap=%4)")
+        .arg(fieldHandler->id).arg(viewMode).arg(scalarBarRange).arg(colorMap);
+      commands += QString("presentation_id");
+    }
   //  else if ( event->eventtype == PresentationEvent::EVENT_VIEW_OBJECT_DEFLECTION_SHAPE ) {
   //    commands += QString("presentation_id = medcalc.MakeDeflectionShape(accessField(%1), %2)").arg(fieldHandler->id).arg(viewMode);
   //    commands += QString("presentation_id");
@@ -485,6 +536,25 @@ PresentationController::processPresentationEvent(const PresentationEvent* event)
       commands += QString("params.nbContours = %1").arg(event->anInteger);
       commands += QString("medcalc.UpdateContour(%1, params)").arg(event->presentationId);
   }
+  else if ( event->eventtype == PresentationEvent::EVENT_CHANGE_MESH_MODE ) {
+      std::string typ = getPresTypeFromWidgetHelper(event->presentationId);
+      commands += QString("params = medcalc.GetMeshViewParameters(%2)").arg(event->presentationId);
+      commands += QString("params.mode = %1").arg(getMeshModePython(event->anInteger));
+      commands += QString("medcalc.UpdateMeshView(%1, params)").arg(event->presentationId);
+  }
+  else if ( event->eventtype == PresentationEvent::EVENT_CHANGE_NB_SLICES ) {
+      std::string typ = getPresTypeFromWidgetHelper(event->presentationId);
+      commands += QString("params = medcalc.GetSlicesParameters(%2)").arg(event->presentationId);
+      commands += QString("params.nbSlices = %1").arg(event->anInteger);
+      commands += QString("medcalc.UpdateSlices(%1, params)").arg(event->presentationId);
+  }
+  else if ( event->eventtype == PresentationEvent::EVENT_CHANGE_SLICE_ORIENTATION ) {
+      std::string typ = getPresTypeFromWidgetHelper(event->presentationId);
+      commands += QString("params = medcalc.GetSlicesParameters(%2)").arg(event->presentationId);
+      commands += QString("params.orientation = %1").arg(getSliceOrientationPython(event->anInteger));
+      commands += QString("medcalc.UpdateSlices(%1, params)").arg(event->presentationId);
+  }
+
   else if ( event->eventtype == PresentationEvent::EVENT_DELETE_PRESENTATION ) {
       commands += QString("medcalc.RemovePresentation(%1)").arg(event->presentationId);
   }
@@ -502,25 +572,17 @@ PresentationController::findOrCreateWidgetHelper(MEDCALC::MEDPresentationManager
   if (it != _presHelperMap.end())
     return (*it).second;
   MEDWidgetHelper * wh;
-  if (type == MEDPresentationScalarMap::TYPE_NAME)
+  if (type == MEDPresentationMeshView::TYPE_NAME)
+    wh = new MEDWidgetHelperMeshView(this, _presManager, presId, name, _widgetPresentationParameters);
+  else if (type == MEDPresentationScalarMap::TYPE_NAME)
     wh = new MEDWidgetHelperScalarMap(this, _presManager, presId, name, _widgetPresentationParameters);
   else if (type == MEDPresentationContour::TYPE_NAME)
     wh = new MEDWidgetHelperContour(this, _presManager, presId, name, _widgetPresentationParameters);
+  else if (type == MEDPresentationSlices::TYPE_NAME)
+      wh = new MEDWidgetHelperSlices(this, _presManager, presId, name, _widgetPresentationParameters);
   else
     {
-      //    case PRES_CONTOUR:
-      //// break;
-      //    case PRES_DEFLECTION:
-      ////          break;
-      //    case PRES_VECTOR_FIELD:
-      //  //        break;
-      //    case PRES_POINT_SPRITE:
-      //    //      break;
-      //    case PRES_POINT_SPRITE:
-      //      //    break;
-      //    default:
       STDLOG("findOrCreateWidgetHelper(): NOT IMPLEMENTED !!!");
-
     }
   _presHelperMap[presId] = wh;
   return wh;
index 98fc9ffb63e35907e08cf6393054b855bfaca3ba..9d92c1b0a9fc4f3d9271de428db4ab26775efabe 100644 (file)
@@ -62,6 +62,7 @@ signals:
   void presentationSignal(const PresentationEvent*);
 
 protected slots:
+  void onVisualizeMeshView();
   void onVisualizeScalarMap();
   void onVisualizeContour();
   void onVisualizeVectorField();
@@ -90,6 +91,8 @@ private:
   QString getViewModePython() const;
   QString getColorMapPython() const;
   QString getScalarBarRangePython() const;
+  QString getMeshModePython(const int mode) const;
+  QString getSliceOrientationPython(const int orient) const;
 
 private:
   MEDModule* _salomeModule;
index 784fbb314ec4916228c2884968d0e93603284f60..648ebf102144c7553a6b88cfd1d10e3976abbc46 100644 (file)
@@ -5,6 +5,7 @@
 
 typedef struct {
   enum EventType {
+    EVENT_VIEW_OBJECT_MESH_VIEW,
     EVENT_VIEW_OBJECT_CONTOUR,
     EVENT_VIEW_OBJECT_DEFLECTION_SHAPE,
     EVENT_VIEW_OBJECT_POINT_SPRITE,
@@ -17,7 +18,10 @@ typedef struct {
     EVENT_CHANGE_COLORMAP,
     EVENT_CHANGE_TIME_RANGE,
 
-    EVENT_CHANGE_NB_CONTOUR
+    EVENT_CHANGE_MESH_MODE,
+    EVENT_CHANGE_NB_CONTOUR,
+    EVENT_CHANGE_SLICE_ORIENTATION,
+    EVENT_CHANGE_NB_SLICES
   };
 
   EventType eventtype;
index 4e7231b114f1a76d5227c91dccf3c4f04430eec1..65238551de469229fd90bce4c6692e2303341d5e 100644 (file)
@@ -30,10 +30,14 @@ WidgetPresentationParameters::WidgetPresentationParameters(QWidget* parent)
   toggleWidget(false);
   QObject::connect(_ui.comboBoxCompo,          SIGNAL(currentIndexChanged(int)),
                    this,                       SLOT(onComboCompoIndexChanged(int)) );
+  QObject::connect(_ui.comboBoxMesh,          SIGNAL(currentIndexChanged(int)),
+                     this,                       SLOT(onComboMeshIndexChanged(int)) );
   QObject::connect(_ui.comboBoxScalarBarRange, SIGNAL(currentIndexChanged(int)),
                    this,                       SLOT(onComboScalarBarRangeIndexChanged(int)) );
   QObject::connect(_ui.comboBoxColorMap,       SIGNAL(currentIndexChanged(int)),
                    this,                       SLOT(onComboColorMapIndexChanged(int)) );
+  QObject::connect(_ui.comboBoxSliceOrient,       SIGNAL(currentIndexChanged(int)),
+                   this,                       SLOT(onComboOrientIndexChanged(int)) );
   QObject::connect(_ui.spinBox,                SIGNAL(valueChanged(int)),
                      this,                     SLOT(onSpinBoxValueChanged(int)) );
 }
@@ -44,6 +48,19 @@ WidgetPresentationParameters::onComboCompoIndexChanged(int idx)
   if (!_blockSig) emit comboCompoIndexChanged(idx);
 }
 
+void
+WidgetPresentationParameters::onComboOrientIndexChanged(int idx)
+{
+  if (!_blockSig) emit comboOrientIndexChanged(idx);
+}
+
+
+void
+WidgetPresentationParameters::onComboMeshIndexChanged(int idx)
+{
+  if (!_blockSig) emit comboMeshIndexChanged(idx);
+}
+
 void
 WidgetPresentationParameters::onComboColorMapIndexChanged(int idx)
 {
@@ -62,11 +79,21 @@ WidgetPresentationParameters::onSpinBoxValueChanged(int val)
   if (!_blockSig) emit spinBoxValueChanged(val);
 }
 
+void
+WidgetPresentationParameters::toggleCommonFieldWidget(bool show)
+{
+  _blockSig = true;
+  _ui.commonWidget->setEnabled(show);
+  _blockSig = false;
+}
+
 void
 WidgetPresentationParameters::toggleWidget(bool show)
 {
   if (!show)
     {
+      toggleCommonFieldWidget(true);
+
       _blockSig = true;
       _ui.widgetDynamic->hide();
       setPresName("Choose a presentation");
@@ -80,6 +107,8 @@ WidgetPresentationParameters::toggleWidget(bool show)
       // It is the WidgetHelper responsability to re-show the widgets it needs
       _ui.labelCompo->hide();
       _ui.comboBoxCompo->hide();
+      _ui.labelMeshMode->hide();
+      _ui.comboBoxMesh->hide();
       _ui.labelSpinBox->hide();
       _ui.spinBox->hide();
       _ui.labelSliceOrient->hide();
@@ -129,7 +158,7 @@ WidgetPresentationParameters::setNbContour(int nbContour)
     }
 
   // Show the widget:
-  _ui.labelSpinBox->setText(tr("LAB_NB_CONTOUR"));
+  _ui.labelSpinBox->setText(tr("LAB_NB_CONTOURS"));
   _ui.labelSpinBox->show();
   _ui.spinBox->show();
 
@@ -138,11 +167,36 @@ WidgetPresentationParameters::setNbContour(int nbContour)
   _blockSig = false;
 }
 
+void
+WidgetPresentationParameters::setNbSlices(int nbSlices)
+{
+  if (nbSlices <= 0)
+    {
+      //TODO throw?
+      STDLOG("WidgetPresentationParameters::setNbSlices(): invalid number of slices!");
+    }
+
+  // Show the widget:
+  _ui.labelSpinBox->setText(tr("LAB_NB_SLICES"));
+  _ui.labelSpinBox->show();
+  _ui.spinBox->show();
+
+  _blockSig = true;
+  _ui.spinBox->setValue(nbSlices);
+  _blockSig = false;
+}
+
 int WidgetPresentationParameters::getNbContour() const
 {
   return _ui.spinBox->value();
 }
 
+int WidgetPresentationParameters::getNbSlices() const
+{
+  return _ui.spinBox->value();
+}
+
+
 void
 WidgetPresentationParameters::setScalarBarRange(MEDCALC::MEDPresentationScalarBarRange sbrange)
 {
@@ -165,7 +219,7 @@ WidgetPresentationParameters::setScalarBarRange(MEDCALC::MEDPresentationScalarBa
 void
 WidgetPresentationParameters::setColorMap(MEDCALC::MEDPresentationColorMap colorMap)
 {
-  int idx;
+  int idx = -1;
   if (colorMap == MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW)
     idx = _ui.comboBoxColorMap->findText(tr("LAB_BLUE_TO_RED"));
   else if (colorMap == MEDCALC::COLOR_MAP_COOL_TO_WARM)
@@ -182,6 +236,131 @@ WidgetPresentationParameters::setColorMap(MEDCALC::MEDPresentationColorMap color
     STDLOG("Strange!! No matching found - unable to set color map in GUI.");
 }
 
+void
+WidgetPresentationParameters::setMeshMode(MEDCALC::MEDPresentationMeshMode mode)
+{
+  // Show the widget:
+  _ui.labelMeshMode->show();
+  _ui.comboBoxMesh->show();
+
+  int idx;
+  switch(mode)
+  {
+    case MEDCALC::MESH_MODE_WIREFRAME:
+      idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_WIREFRAME"));
+      break;
+    case MEDCALC::MESH_MODE_SURFACE:
+      idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_SURFACE"));
+      break;
+    case MEDCALC::MESH_MODE_SURFACE_EDGES:
+      idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_SURF_EDGES"));
+      break;
+    default:
+      idx = -1;
+  }
+  if (idx >= 0)
+    {
+      _blockSig = true;
+      _ui.comboBoxMesh->setCurrentIndex(idx);
+      _blockSig = false;
+    }
+  else
+    STDLOG("Strange!! No matching found - unable to set mesh mode in GUI.");
+}
+
+void
+WidgetPresentationParameters::setSliceOrientation(MEDCALC::MEDPresentationSliceOrientation orient)
+{
+  // Show the widget:
+  _ui.labelSliceOrient->show();
+  _ui.comboBoxSliceOrient->show();
+
+  int idx;
+  switch(orient)
+  {
+    case MEDCALC::SLICE_NORMAL_TO_X:
+      idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_X"));
+      break;
+    case MEDCALC::SLICE_NORMAL_TO_Y:
+      idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_Y"));
+      break;
+    case MEDCALC::SLICE_NORMAL_TO_Z:
+      idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_Z"));
+      break;
+    case MEDCALC::SLICE_NORMAL_TO_XY:
+      idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XY"));
+      break;
+    case MEDCALC::SLICE_NORMAL_TO_XZ:
+      idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XZ"));
+      break;
+    case MEDCALC::SLICE_NORMAL_TO_YZ:
+      idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_YZ"));
+      break;
+    case MEDCALC::SLICE_NORMAL_TO_XYZ:
+      idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XYZ"));
+      break;
+    default:
+      idx = -1;
+  }
+  if (idx >= 0)
+    {
+      _blockSig = true;
+      _ui.comboBoxSliceOrient->setCurrentIndex(idx);
+      _blockSig = false;
+    }
+  else
+    STDLOG("Strange!! No matching found - unable to set slice orientation in GUI.");
+}
+
+
+MEDCALC::MEDPresentationSliceOrientation
+WidgetPresentationParameters::getSliceOrientation() const
+{
+  QString sbrange = _ui.comboBoxSliceOrient->currentText();
+  if (sbrange == tr("LAB_SLICE_NORMAL_TO_X")) {
+      return MEDCALC::SLICE_NORMAL_TO_X;
+  }
+  else if (sbrange == tr("LAB_SLICE_NORMAL_TO_Y")) {
+      return MEDCALC::SLICE_NORMAL_TO_Y;
+  }
+  else if (sbrange == tr("LAB_SLICE_NORMAL_TO_Z")) {
+      return MEDCALC::SLICE_NORMAL_TO_Z;
+  }
+  else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XY")) {
+      return MEDCALC::SLICE_NORMAL_TO_XY;
+  }
+  else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XZ")) {
+      return MEDCALC::SLICE_NORMAL_TO_XZ;
+  }
+  else if (sbrange == tr("LAB_SLICE_NORMAL_TO_YZ")) {
+      return MEDCALC::SLICE_NORMAL_TO_YZ;
+  }
+  else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XYZ")) {
+      return MEDCALC::SLICE_NORMAL_TO_XYZ;
+  }
+  // Should not happen
+  STDLOG("Strange!! No matching found - returning SLICE_NORMAL_TO_X.");
+  return MEDCALC::SLICE_NORMAL_TO_X;
+}
+
+MEDCALC::MEDPresentationMeshMode
+WidgetPresentationParameters::getMeshMode() const
+{
+  QString mesm = _ui.comboBoxMesh->currentText();
+  if (mesm == tr("LAB_MESH_WIREFRAME")) {
+      return MEDCALC::MESH_MODE_WIREFRAME;
+  }
+  else if (mesm == tr("LAB_MESH_SURFACE")) {
+      return MEDCALC::MESH_MODE_SURFACE;
+  }
+  else if (mesm == tr("LAB_MESH_SURF_EDGES")) {
+      return MEDCALC::MESH_MODE_SURFACE_EDGES;
+  }
+  // Should not happen
+  STDLOG("Strange!! No matching found - returning MESH_MODE_WIREFRAME.");
+  return MEDCALC::MESH_MODE_WIREFRAME;
+}
+
 
 MEDCALC::MEDPresentationScalarBarRange
 WidgetPresentationParameters::getScalarBarRange() const
@@ -231,12 +410,6 @@ WidgetPresentationParameters::getColorMap() const
   return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW;
 }
 
-QComboBox *
-WidgetPresentationParameters::getComboBoxCompo()
-{
-  return _ui.comboBoxCompo;
-}
-
 void
 WidgetPresentationParameters::setPresName(const std::string& name)
 {
index 42888a65a0a15cc9d97825916eb84c3231cbbb7f..530ca64786dcf160a1b71f9c6605fee8ebb638fc 100644 (file)
@@ -42,6 +42,9 @@ public:
   std::string getComponent() const;
   void setComponents(std::vector<std::string> compos, int selecIndex);
 
+  MEDCALC::MEDPresentationMeshMode getMeshMode() const;
+  void setMeshMode(MEDCALC::MEDPresentationMeshMode mode);
+
   MEDCALC::MEDPresentationScalarBarRange getScalarBarRange() const;
   void setScalarBarRange(MEDCALC::MEDPresentationScalarBarRange);
 
@@ -56,20 +59,31 @@ public:
   int getNbContour() const;
   void setNbContour(int nbContour);
 
+  int getNbSlices() const;
+  void setNbSlices(int nbSlices);
+
+  MEDCALC::MEDPresentationSliceOrientation getSliceOrientation() const;
+  void setSliceOrientation(MEDCALC::MEDPresentationSliceOrientation orient);
+
   void toggleWidget(bool show);
   bool isShown() const;
-  QComboBox * getComboBoxCompo();
+
+  void toggleCommonFieldWidget(bool show);
 
 signals:
   void comboScalarBarRangeIndexChanged(int);
   void comboColorMapIndexChanged(int);
   void comboCompoIndexChanged(int);
+  void comboOrientIndexChanged(int);
+  void comboMeshIndexChanged(int);
   void spinBoxValueChanged(int);
 
 private slots:
   void onComboScalarBarRangeIndexChanged(int);
   void onComboColorMapIndexChanged(int);
   void onComboCompoIndexChanged(int);
+  void onComboOrientIndexChanged(int);
+  void onComboMeshIndexChanged(int);
   void onSpinBoxValueChanged(int);
 
 private:
index 85279d3695eed19689425962b79117c128fd0dcc..d1c47f0c2bfcfb6367ac184fc5109bf226d0406d 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>439</width>
-    <height>359</height>
+    <width>784</width>
+    <height>584</height>
    </rect>
   </property>
   <property name="minimumSize">
@@ -28,7 +28,7 @@
     </widget>
    </item>
    <item>
-    <widget class="QWidget" name="widget" native="true">
+    <widget class="QWidget" name="commonWidget" native="true">
      <layout class="QGridLayout" name="gridLayout_2">
       <item row="0" column="1">
        <widget class="QComboBox" name="comboBoxScalarBarRange">
         </property>
        </widget>
       </item>
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_4">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>LAB_RANGE</string>
+        </property>
+       </widget>
+      </item>
       <item row="2" column="1">
        <widget class="QComboBox" name="comboBoxColorMap">
+        <property name="enabled">
+         <bool>true</bool>
+        </property>
         <item>
          <property name="text">
           <string>LAB_BLUE_TO_RED</string>
         </item>
        </widget>
       </item>
-      <item row="0" column="0">
-       <widget class="QLabel" name="label_4">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="text">
-         <string>LAB_RANGE</string>
-        </property>
-       </widget>
-      </item>
      </layout>
     </widget>
    </item>
     <widget class="QWidget" name="widgetDynamic" native="true">
      <layout class="QGridLayout" name="gridLayout">
       <item row="0" column="0">
+       <widget class="QLabel" name="labelMeshMode">
+        <property name="text">
+         <string>LAB_DISP_MESH_MODE</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QComboBox" name="comboBoxMesh">
+        <item>
+         <property name="text">
+          <string>LAB_MESH_WIREFRAME</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>LAB_MESH_SURFACE</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>LAB_MESH_SURF_EDGES</string>
+         </property>
+        </item>
+       </widget>
+      </item>
+      <item row="1" column="0">
        <widget class="QLabel" name="labelCompo">
         <property name="text">
          <string>LAB_DISP_COMP</string>
         </property>
        </widget>
       </item>
-      <item row="0" column="1" colspan="2">
+      <item row="1" column="1">
        <widget class="QComboBox" name="comboBoxCompo">
         <item>
          <property name="text">
         </item>
        </widget>
       </item>
-      <item row="1" column="0">
+      <item row="2" column="0">
        <widget class="QLabel" name="labelSpinBox">
         <property name="text">
          <string>LAB_SPIN_BOX</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="1">
+      <item row="2" column="1">
        <widget class="QSpinBox" name="spinBox"/>
       </item>
-      <item row="1" column="2">
+      <item row="2" column="2">
        <spacer name="horizontalSpacer">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
        </spacer>
       </item>
-      <item row="2" column="0">
+      <item row="3" column="0">
        <widget class="QLabel" name="labelSliceOrient">
         <property name="text">
          <string>LAB_SLICE_ORIENT</string>
         </property>
        </widget>
       </item>
-      <item row="2" column="1" colspan="2">
+      <item row="3" column="1">
        <widget class="QComboBox" name="comboBoxSliceOrient">
         <item>
          <property name="text">
           <string>LAB_SLICE_NORMAL_TO_Z</string>
          </property>
         </item>
+        <item>
+         <property name="text">
+          <string>LAB_SLICE_NORMAL_TO_XY</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>LAB_SLICE_NORMAL_TO_XZ</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>LAB_SLICE_NORMAL_TO_YZ</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>LAB_SLICE_NORMAL_TO_XYZ</string>
+         </property>
+        </item>
        </widget>
       </item>
      </layout>
diff --git a/src/MEDCalc/res/presentations/classic/visu_mesh16.png b/src/MEDCalc/res/presentations/classic/visu_mesh16.png
new file mode 100644 (file)
index 0000000..1105b37
Binary files /dev/null and b/src/MEDCalc/res/presentations/classic/visu_mesh16.png differ
diff --git a/src/MEDCalc/res/presentations/classic/visu_mesh24.png b/src/MEDCalc/res/presentations/classic/visu_mesh24.png
new file mode 100644 (file)
index 0000000..3b3de8b
Binary files /dev/null and b/src/MEDCalc/res/presentations/classic/visu_mesh24.png differ
diff --git a/src/MEDCalc/res/presentations/modern/mesh16.png b/src/MEDCalc/res/presentations/modern/mesh16.png
new file mode 100644 (file)
index 0000000..1105b37
Binary files /dev/null and b/src/MEDCalc/res/presentations/modern/mesh16.png differ
diff --git a/src/MEDCalc/res/presentations/modern/mesh24.png b/src/MEDCalc/res/presentations/modern/mesh24.png
new file mode 100644 (file)
index 0000000..3b3de8b
Binary files /dev/null and b/src/MEDCalc/res/presentations/modern/mesh24.png differ
diff --git a/src/MEDCalc/res/presentations/modern/mesh24_1.png b/src/MEDCalc/res/presentations/modern/mesh24_1.png
new file mode 100644 (file)
index 0000000..2c82203
Binary files /dev/null and b/src/MEDCalc/res/presentations/modern/mesh24_1.png differ
index 5bbaec13484947d2739487dcdca0346b764ccdd4..862434a7e76a0d39bf9857ce2378119c00f68974 100644 (file)
@@ -21,6 +21,7 @@ INCLUDE(tests.set)
 
 SET(_test_files
     medfiles/smooth_surface_and_field.med
+    medfiles/agitateur.med
 )
 
 SET(TEST_INSTALL_DIRECTORY ${SALOME_MED_INSTALL_TEST}/MEDCalc/tui)
index b1e47e4c13cc856c3ac9f785f0b445e05ec2ae02..b4643fe2879188d424324fad36351950d4676f5e 100644 (file)
@@ -32,9 +32,9 @@ source_id = medcalc.LoadDataSource(datafile)
 
 # Field 0 = CONCENTRATION_ELEM_DOM (ON_CELLS) -> scalar
 presentation_id = medcalc.MakeContour(accessField(0), MEDCALC.VIEW_MODE_REPLACE, colorMap=MEDCALC.COLOR_MAP_BLUE_TO_RED_RAINBOW)
-sleep(2)
+sleep(1)
 medcalc.RemovePresentation(presentation_id)
-sleep(2)
+sleep(1)
 
 # Field 55 = VITESSE_ELEM_DOM (ON_CELLS) -> vector field, contour should fail.
 try:
@@ -42,4 +42,4 @@ try:
   sys.exit(-1);
 except:
   print "Contour failed as expected."
-sleep(2)
+sleep(1)
diff --git a/src/MEDCalc/test/tui/mesh_view.py b/src/MEDCalc/test/tui/mesh_view.py
new file mode 100644 (file)
index 0000000..6f4f7f5
--- /dev/null
@@ -0,0 +1,36 @@
+# Copyright (C) 2016  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import os
+from time import sleep
+
+import medcalc
+medcalc.medconsole.setConsoleGlobals(globals())
+import MEDCALC
+from medcalc.medconsole import accessField
+
+from medcalc_testutils import GetMEDFileDirTUI
+
+datafile = os.path.join(GetMEDFileDirTUI(), "smooth_surface_and_field.med")
+source_id = medcalc.LoadDataSource(datafile)
+
+presentation_id = medcalc.MakeMeshView(accessField(0), MEDCALC.VIEW_MODE_REPLACE)
+sleep(1)
+medcalc.RemovePresentation(presentation_id)
+sleep(1)
index 343aa051d18e217c40bb3081a11e00fce9654d70..004826c0d636bcf13f73185b69f8296f7c6b0a9d 100644 (file)
@@ -31,6 +31,6 @@ datafile = os.path.join(GetMEDFileDirTUI(), "smooth_surface_and_field.med")
 source_id = medcalc.LoadDataSource(datafile)
 
 presentation_id = medcalc.MakeScalarMap(accessField(0), MEDCALC.VIEW_MODE_REPLACE, colorMap=MEDCALC.COLOR_MAP_BLUE_TO_RED_RAINBOW)
-sleep(2)
+sleep(1)
 medcalc.RemovePresentation(presentation_id)
-sleep(2)
+sleep(1)
diff --git a/src/MEDCalc/test/tui/slices.py b/src/MEDCalc/test/tui/slices.py
new file mode 100644 (file)
index 0000000..413a3d1
--- /dev/null
@@ -0,0 +1,36 @@
+# Copyright (C) 2016  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import os
+from time import sleep
+
+import medcalc
+medcalc.medconsole.setConsoleGlobals(globals())
+import MEDCALC
+from medcalc.medconsole import accessField
+
+from medcalc_testutils import GetMEDFileDirTUI
+
+datafile = os.path.join(GetMEDFileDirTUI(), "agitateur.med")
+source_id = medcalc.LoadDataSource(datafile)
+
+presentation_id = medcalc.MakeSlices(accessField(0), MEDCALC.VIEW_MODE_REPLACE, colorMap=MEDCALC.COLOR_MAP_BLUE_TO_RED_RAINBOW)
+sleep(1)
+medcalc.RemovePresentation(presentation_id)
+sleep(1)
index 112519ff02b84fc775416d29b843efb0aa6264c1..e2cad1b1ebb314b092fd81af716cf5bc2667f8b8 100644 (file)
@@ -22,4 +22,7 @@ SET(TEST_NAMES
   load_file
   import_pvsimple
 #  scalar_map
+#  contour
+#  slices
+#  mesh_view
 )
index cf4dd4ea9634de5d0b6ac46998c21af1eaa23d2e..a409f477b50f80ee420c702f8a5e31dbb558562f 100644 (file)
@@ -39,19 +39,24 @@ from medio import LoadDataSource
 from medio import LoadImageAsDataSource
 
 # Presentations
+from medpresentation import MakeMeshView
 from medpresentation import MakeScalarMap
 from medpresentation import MakeContour
 #from medpresentation import MakeVectorField
-#from medpresentation import MakeSlices
+from medpresentation import MakeSlices
 #from medpresentation import MakeDeflectionShape
 #from medpresentation import MakePointSprite
 from medpresentation import RemovePresentation
 
+from medpresentation import GetMeshViewParameters
 from medpresentation import GetScalarMapParameters
 from medpresentation import GetContourParameters
+from medpresentation import GetSlicesParameters
 
+from medpresentation import UpdateMeshView
 from medpresentation import UpdateScalarMap
 from medpresentation import UpdateContour
+from medpresentation import UpdateSlices
 
 # Console commands
 import medconsole
index b59490093a0bfe213589067826999f416b713757..c1da528a41086963d91bab10b69523680ea5a985 100644 (file)
@@ -23,6 +23,21 @@ from medcalc.medevents import notifyGui_addPresentation, notifyGui_removePresent
 
 __manager = medcalc.medcorba.factory.getPresentationManager()
 
+def MakeMeshView(proxy,
+                 viewMode=MEDCALC.VIEW_MODE_DEFAULT,
+                 meshMode=MEDCALC.MESH_MODE_DEFAULT):
+  # Create the presentation instance in CORBA engine
+  # The engine in turn creates the ParaView pipeline elements
+  params = MEDCALC.MeshViewParameters(proxy.id, meshMode)
+  try:
+    presentation_id = __manager.makeMeshView(params, viewMode)
+    notifyGui_addPresentation(proxy.id, presentation_id)
+    return presentation_id
+  except SALOME.SALOME_Exception as e:
+    notifyGui_error("An error occured while creating the mesh view:\n" + e.details.text)
+    raise Exception(e.details.text)
+
+
 def MakeScalarMap(proxy,
                   viewMode=MEDCALC.VIEW_MODE_DEFAULT,
                   displayedComponent=MEDCALC.DISPLAY_DEFAULT,
@@ -42,7 +57,6 @@ def MakeScalarMap(proxy,
 
 def MakeContour(proxy,
                 viewMode=MEDCALC.VIEW_MODE_DEFAULT,
-                displayedComponent=MEDCALC.DISPLAY_DEFAULT,
                 scalarBarRange=MEDCALC.SCALAR_BAR_RANGE_DEFAULT,
                 colorMap=MEDCALC.COLOR_MAP_DEFAULT,
                 nbContours=MEDCALC.NB_CONTOURS_DEFAULT
@@ -67,15 +81,24 @@ def MakeContour(proxy,
 #  return presentation_id
 ##
 #
-#def MakeSlices(proxy,
-#               viewMode=MEDCALC.VIEW_MODE_DEFAULT,
-#               orientation=MEDCALC.SLICE_ORIENTATION_DEFAULT,
-#               nbSlices=MEDCALC.NB_SLICES_DEFAULT
-#               ):
-#  params = MEDCALC.SlicesParameters(proxy.id, viewMode, orientation, nbSlices)
-#  presentation_id = __manager.makeSlices(params)
-#  notifyGui_addPresentation(proxy.id, presentation_id)
-#  return presentation_id
+def MakeSlices(proxy,
+                viewMode=MEDCALC.VIEW_MODE_DEFAULT,
+                displayedComponent=MEDCALC.DISPLAY_DEFAULT,
+                scalarBarRange=MEDCALC.SCALAR_BAR_RANGE_DEFAULT,
+                colorMap=MEDCALC.COLOR_MAP_DEFAULT,
+                sliceOrientation=MEDCALC.SLICE_ORIENTATION_DEFAULT,
+                nbSlices=MEDCALC.NB_SLICES_DEFAULT):
+  # Create the presentation instance in CORBA engine
+  # The engine in turn creates the ParaView pipeline elements
+  params = MEDCALC.SlicesParameters(proxy.id, displayedComponent,scalarBarRange, colorMap, 
+                                    sliceOrientation, nbSlices)
+  try:
+    presentation_id = __manager.makeSlices(params, viewMode)
+    notifyGui_addPresentation(proxy.id, presentation_id)
+    return presentation_id
+  except SALOME.SALOME_Exception as e:
+    notifyGui_error("An error occured while creating the slices:\n" + e.details.text)
+    raise Exception(e.details.text)
 ##
 #
 #def MakeDeflectionShape(proxy,
@@ -105,19 +128,20 @@ def RemovePresentation(presentation_id):
     notifyGui_removePresentation(presentation_id)
 #
 
-def GetScalarMapParameters(presentation_id):
-  # TODO: check that pres id is really a ScalarMap ...
-  params = __manager.getScalarMapParameters(presentation_id)
+def GetGENERICParameters(tag, presentation_id):
+  exec "params = __manager.get%sParameters(presentation_id)" % tag
   return params
 
-def GetContourParameters(presentation_id):
-  # TODO: check that pres id is really a ScalarMap ...
-  params = __manager.getContourParameters(presentation_id)
-  return params
+GetMeshViewParameters = lambda pres_id: GetGENERICParameters("MeshView", pres_id)
+GetScalarMapParameters = lambda pres_id: GetGENERICParameters("ScalarMap", pres_id)
+GetContourParameters = lambda pres_id: GetGENERICParameters("Contour", pres_id)
+GetSlicesParameters = lambda pres_id: GetGENERICParameters("Slices", pres_id)
 
-def UpdateScalarMap(presentation_id, params):
-  __manager.updateScalarMap(presentation_id, params)
 
-def UpdateContour(presentation_id, params):
-  __manager.updateContour(presentation_id, params)
+def UpdateGENERIC(tag, presentation_id, params):
+  exec "__manager.update%s(presentation_id, params)" % tag
 
+UpdateMeshView = lambda pres_id, params: UpdateGENERIC("MeshView", pres_id, params)
+UpdateScalarMap = lambda pres_id, params: UpdateGENERIC("ScalarMap", pres_id, params)
+UpdateContour = lambda pres_id, params: UpdateGENERIC("Contour", pres_id, params)
+UpdateSlices = lambda pres_id, params: UpdateGENERIC("Slices", pres_id, params)