From: kosta Date: Tue, 28 Mar 2023 15:44:33 +0000 (+0200) Subject: [bos #32736][CEA] Threshold of criteria. Added initial state of Threshold checkbox... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=19b74c9f652c504f3581804ae0fd6d9580d06a7f;p=modules%2Fsmesh.git [bos #32736][CEA] Threshold of criteria. Added initial state of Threshold checkbox by checking if vtkLookupTable uses above and below range colors. --- diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx index 06ae7c442..27870e218 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx @@ -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() diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h index 166646f1c..11c916ada 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h @@ -73,6 +73,7 @@ public: void initScalarBarFromResources(); protected: + void setThresholdFromTable(vtkLookupTable* aLookupTable); void applyThreshold(vtkLookupTable* aLookupTable); protected slots: