[bos #32736][CEA] Threshold of criteria. Added initial state of Threshold checkbox by checking if vtkLookupTable uses above and below range colors.

This commit is contained in:
kosta 2023-03-28 17:44:33 +02:00
parent 822058a1f0
commit 19b74c9f65
2 changed files with 25 additions and 0 deletions

View 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()

View File

@ -73,6 +73,7 @@ public:
void initScalarBarFromResources();
protected:
void setThresholdFromTable(vtkLookupTable* aLookupTable);
void applyThreshold(vtkLookupTable* aLookupTable);
protected slots: