]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
[bos #32736][CEA] Threshold of criteria. Added initial state of Threshold checkbox...
authorkosta <kleontev@Debian11.kleontev.virtualbox.org>
Tue, 28 Mar 2023 15:44:33 +0000 (17:44 +0200)
committerkosta <kleontev@Debian11.kleontev.virtualbox.org>
Tue, 28 Mar 2023 15:44:33 +0000 (17:44 +0200)
src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx
src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h

index 06ae7c44243b50d2485cafa1c95d4f613bd0ed8f..27870e218629824d699cf56da8255ba5777167f8 100644 (file)
@@ -663,6 +663,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
           //myLogarithmicCheck->setEnabled(range[0] > 1e-07 && range[1] > 1e-07);
           myLogarithmicCheck->setEnabled(range[0] != range[1]);
 
+          setThresholdFromTable(aLookupTable);
           applyThreshold(aLookupTable);
         }
 
@@ -882,6 +883,29 @@ void SMESHGUI_Preferences_ScalarBarDlg::initScalarBarFromResources()
   }
 }
 
+//=================================================================================================
+/*!
+ *  SMESHGUI_Preferences_ScalarBarDlg::setThresholdFromTable()
+ *
+ *  Checks if the table uses special color for values beyond the min-max range,
+ *  and this color is completely transparent - RGBA(0,0,0,0).
+ */
+//=================================================================================================
+void SMESHGUI_Preferences_ScalarBarDlg::setThresholdFromTable(vtkLookupTable* aLookupTable)
+{
+  bool isUseBeyondRangeColor = aLookupTable->GetUseAboveRangeColor() && aLookupTable->GetUseBelowRangeColor();
+
+  if (isUseBeyondRangeColor)
+  {
+    const double* aboveRangeColor = aLookupTable->GetAboveRangeColor();
+    const double* belowRangeColor = aLookupTable->GetBelowRangeColor();
+
+    isUseBeyondRangeColor = aboveRangeColor[3] == 0.0 && belowRangeColor[3] == 0.0;
+  }
+
+  myThresholdCheck->setChecked(isUseBeyondRangeColor);
+}
+
 //=================================================================================================
 /*!
  *  SMESHGUI_Preferences_ScalarBarDlg::applyThreshold()
index 166646f1c50250a5863c1a7b475fd253c8af1594..11c916ada57e3040966866ceac54fc57c6ddcb47 100644 (file)
@@ -73,6 +73,7 @@ public:
   void                     initScalarBarFromResources();
 
 protected:
+  void                     setThresholdFromTable(vtkLookupTable* aLookupTable);
   void                     applyThreshold(vtkLookupTable* aLookupTable);
 
 protected slots: