Salome HOME
[MEDCalc] Add presentation parameters
authorCédric Aguerre <cedric.aguerre@edf.fr>
Fri, 19 Feb 2016 13:55:19 +0000 (14:55 +0100)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Fri, 19 Feb 2016 13:55:19 +0000 (14:55 +0100)
idl/MEDPresentationManager.idl
src/MEDCalc/tui/medpresentation.py

index e7eac75f4112803312dca7466e534c07db0c282e..d108a917e7c87c91dd4f8985056d062e627fdfa4 100644 (file)
@@ -25,6 +25,8 @@
 
 module MEDCALC
 {
+  /* Enumerations and constants */
+
   enum MEDPresentationViewMode {
     VIEW_MODE_OVERLAP,
     VIEW_MODE_REPLACE,
@@ -32,15 +34,62 @@ module MEDCALC
     VIEW_MODE_SPLIT_VIEW
   };
 
+  enum MEDPresentationColorMap {
+    COLOR_MAP_BLUE_TO_RED_RAINBOW,
+    COLOR_MAP_COOL_TO_WARM
+  };
+
+  struct ScalarBarRange {
+    // (valMin,valMax) defines the scalar bar range from:
+    //      (-1,timetep): the field values at the chosen timestep
+    //      (-1,-1):      the field values across all timesteps
+    //      (start,end):  a user-input range of values
+    long valMin;
+    long valMax;
+  };
+
+  const string DISPLAY_EUCLIDEAN_NORM = "Euclidean norm";
+
+  enum SliceOrientation {
+    SLICE_NORMAL_TO_X,
+    SLICE_NORMAL_TO_Y,
+    SLICE_NORMAL_TO_Z,
+    SLICE_NORMAL_TO_XY,
+    SLICE_NORMAL_TO_XZ,
+    SLICE_NORMAL_TO_YZ,
+    SLICE_NORMAL_TO_XYZ
+  };
+
+  /* Default values */
+
+  const MEDPresentationViewMode VIEW_MODE_DEFAULT = VIEW_MODE_REPLACE;
+  const MEDPresentationColorMap COLOR_MAP_DEFAULT = COLOR_MAP_BLUE_TO_RED_RAINBOW;
+  //const ScalarBarRange SCALAR_BAR_RANGE_DEFAULT = ;
+  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 long NB_CONTOURS_DEFAULT = 10;
+  const long NB_SLICES_DEFAULT = 1;
+
+  /* Structs */
+
   struct ScalarMapParameters {
     long fieldHandlerId;
     MEDPresentationViewMode viewMode;
+    string displayedInfo; // DISPLAY_EUCLIDEAN_NORM or any field name
+    ScalarBarRange sbRange;
+    MEDPresentationColorMap colorMap;
   };
 
   // A contour is an isoline in 2D and an isosurface in 3D
   struct ContourParameters {
     long fieldHandlerId;
     MEDPresentationViewMode viewMode;
+    string displayedInfo; // DISPLAY_EUCLIDEAN_NORM or any field name
+    ScalarBarRange sbRange;
+    MEDPresentationColorMap colorMap;
+    long nbContours;
   };
 
   struct VectorFieldParameters {
@@ -51,6 +100,8 @@ module MEDCALC
   struct SlicesParameters {
     long fieldHandlerId;
     MEDPresentationViewMode viewMode;
+    SliceOrientation orientation;
+    long nbSlices;
   };
 
   struct DeflectionShapeParameters {
@@ -61,8 +112,13 @@ module MEDCALC
   struct PointSpriteParameters {
     long fieldHandlerId;
     MEDPresentationViewMode viewMode;
+    string displayedInfo; // DISPLAY_EUCLIDEAN_NORM or any field name
+    ScalarBarRange sbRange;
+    MEDPresentationColorMap colorMap;
   };
 
+  /* Functions */
+
   interface MEDPresentationManager : SALOME::GenericObj
   {
 
index 7dd0fe9463a5f89fe1e18b27542bb88fa98d3b0b..fd1100627f61c7e55ea099ec3023c95110d7480d 100644 (file)
@@ -23,40 +23,67 @@ from medcalc.medevents import notifyGui_addPresentation
 
 __manager = medcalc.medcorba.factory.getPresentationManager()
 
-def MakeScalarMap(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
+def MakeScalarMap(proxy,
+                  viewMode=MEDCALC.VIEW_MODE_DEFAULT,
+                  displayedInfo=MEDCALC.DISPLAY_DEFAULT,
+                  scalarBarRange=MEDCALC.ScalarBarRange(MEDCALC.SCALAR_BAR_RANGE_VAL_MIN_DEFAULT,
+                                                        MEDCALC.SCALAR_BAR_RANGE_VAL_MAX_DEFAULT),
+                  colorMap=MEDCALC.COLOR_MAP_DEFAULT
+                  ):
   # Create the presentation instance in CORBA engine
   # The engine in turn creates the ParaView pipeline elements
-  params = MEDCALC.ScalarMapParameters(proxy.id, viewMode)
+  params = MEDCALC.ScalarMapParameters(proxy.id, viewMode, displayedInfo, scalarBarRange, colorMap)
   presentation_id = __manager.makeScalarMap(params)
   notifyGui_addPresentation(proxy.id, presentation_id)
 #
 
-def MakeContour(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
-  params = MEDCALC.ContourParameters(proxy.id, viewMode)
+def MakeContour(proxy,
+                viewMode=MEDCALC.VIEW_MODE_DEFAULT,
+                displayedInfo=MEDCALC.DISPLAY_DEFAULT,
+                scalarBarRange=MEDCALC.ScalarBarRange(MEDCALC.SCALAR_BAR_RANGE_VAL_MIN_DEFAULT,
+                                                      MEDCALC.SCALAR_BAR_RANGE_VAL_MAX_DEFAULT),
+                colorMap=MEDCALC.COLOR_MAP_DEFAULT,
+                nbContours=MEDCALC.NB_CONTOURS_DEFAULT
+                ):
+  params = MEDCALC.ContourParameters(proxy.id, viewMode, displayedInfo, scalarBarRange, colorMap, nbContours)
   presentation_id = __manager.makeContour(params)
   notifyGui_addPresentation(proxy.id, presentation_id)
 #
 
-def MakeVectorField(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
+def MakeVectorField(proxy,
+                    viewMode=MEDCALC.VIEW_MODE_DEFAULT
+                    ):
   params = MEDCALC.VectorFieldParameters(proxy.id, viewMode)
   presentation_id = __manager.makeVectorField(params)
   notifyGui_addPresentation(proxy.id, presentation_id)
 #
 
-def MakeSlices(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
-  params = MEDCALC.SlicesParameters(proxy.id, viewMode)
+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)
 #
 
-def MakeDeflectionShape(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
+def MakeDeflectionShape(proxy,
+                        viewMode=MEDCALC.VIEW_MODE_DEFAULT
+                        ):
   params = MEDCALC.DeflectionShapeParameters(proxy.id, viewMode)
   presentation_id = __manager.makeDeflectionShape(params)
   notifyGui_addPresentation(proxy.id, presentation_id)
 #
 
-def MakePointSprite(proxy, viewMode=MEDCALC.VIEW_MODE_REPLACE):
-  params = MEDCALC.PointSpriteParameters(proxy.id, viewMode)
+def MakePointSprite(proxy,
+                    viewMode=MEDCALC.VIEW_MODE_DEFAULT,
+                    displayedInfo=MEDCALC.DISPLAY_DEFAULT,
+                    scalarBarRange=MEDCALC.ScalarBarRange(MEDCALC.SCALAR_BAR_RANGE_VAL_MIN_DEFAULT,
+                                                          MEDCALC.SCALAR_BAR_RANGE_VAL_MAX_DEFAULT),
+                    colorMap=MEDCALC.COLOR_MAP_DEFAULT,
+                    ):
+  params = MEDCALC.PointSpriteParameters(proxy.id, viewMode, displayedInfo, scalarBarRange, colorMap)
   presentation_id = __manager.makePointSprite(params)
   notifyGui_addPresentation(proxy.id, presentation_id)
 #