Salome HOME
bos #20430 [CEA 20428] FIELDS : improvement of simplified visualisations
[modules/med.git] / src / MEDCalc / cmp / MEDPresentation.txx
index 8fcca7999f3d85e1348865cf7dd015ef3980a5a6..79172f408ba7245e6bd0967bc28b246ba166c8fa 100644 (file)
@@ -122,24 +122,90 @@ MEDPresentation::updateColorMap(MEDCALC::ColorMapType colorMap)
 
 template<typename PresentationType, typename PresentationParameters>
 void
-MEDPresentation::updateScalarBarRange(MEDCALC::ScalarBarRangeType sbRange)
+MEDPresentation::updateScalarBarRange(MEDCALC::ScalarBarRangeType sbRange, 
+                                      bool hideDataOutsideCustomRange,
+                                      double minValue, double maxValue)
 {
   PresentationType * p = static_cast<PresentationType*>(this);
-
   PresentationParameters params;
   p->getParameters(params);
+  bool prevHideDataoutsideCustomRange = params.hideDataOutsideCustomRange;
+
   params.scalarBarRange = sbRange;
+  params.scalarBarRangeArray[0] = minValue;
+  params.scalarBarRangeArray[1] = maxValue;
+  params.hideDataOutsideCustomRange = hideDataOutsideCustomRange;
   p->setParameters(params);
 
   p->_sbRange = sbRange;
+  p->_scalarBarRangeArray[0] = minValue;
+  p->_scalarBarRangeArray[1] = maxValue;
+  p->_hideDataOutsideCustomRange = hideDataOutsideCustomRange;
 
   // GUI helper:
   setIntProperty(MEDPresentation::PROP_SCALAR_BAR_RANGE, sbRange);
+  setDoubleProperty(MEDPresentation::PROP_SCALAR_BAR_MIN_VALUE, minValue);
+  setDoubleProperty(MEDPresentation::PROP_SCALAR_BAR_MAX_VALUE, maxValue);
+  setIntProperty(MEDPresentation::PROP_HIDE_DATA_OUTSIDE_CUSTOM_RANGE, static_cast<int>(hideDataOutsideCustomRange));
+  // Update the pipeline:
+    if (hideDataOutsideCustomRange || hideDataOutsideCustomRange != prevHideDataoutsideCustomRange) {
+      MEDPyLockWrapper lock;
+      threshold(); //Swith on/off threshould or update threshould range
+      pushAndExecPyLine("pvs.Render();");      
+    }
+    else
+    {
+      MEDPyLockWrapper lock;
+      rescaleTransferFunction();
+      pushAndExecPyLine("pvs.Render();");
+    }
+}
+
+template<typename PresentationType, typename PresentationParameters>
+void 
+MEDPresentation::updateVisibility(const bool theVisibility)
+{
+  PresentationType * p = static_cast<PresentationType*>(this);
+
+  PresentationParameters params;
+  p->getParameters(params);
+  params.visibility = theVisibility;
+  p->setParameters(params);
+
+  p->_presentationVisibility = theVisibility;
+
+  // GUI helper:
+  setIntProperty(MEDPresentation::PROP_VISIBILITY, theVisibility);
 
   // Update the pipeline:
   {
     MEDPyLockWrapper lock;
-    rescaleTransferFunction();
+    visibility();
+    pushAndExecPyLine("pvs.Render();");
+  }
+}
+
+template<typename PresentationType, typename PresentationParameters>
+void 
+MEDPresentation::updateScalarBarVisibility(const bool theVisibility)
+{
+  PresentationType * p = static_cast<PresentationType*>(this);
+
+  PresentationParameters params;
+  p->getParameters(params);
+  params.scalarBarVisibility = theVisibility;
+  p->setParameters(params);
+
+  p->_scalarBarVisibility = theVisibility;
+
+  // GUI helper:
+  setIntProperty(MEDPresentation::PROP_SCALAR_BAR_VISIBILITY, theVisibility);
+
+  // Update the pipeline:
+  {
+    MEDPyLockWrapper lock;
+    scalarBarVisibility();
     pushAndExecPyLine("pvs.Render();");
   }
 }