[bos #32736][CEA] Threshold of criteria. Added using completely transparent above and below range colors for vtkLookupTable if Threshold is checked.

This commit is contained in:
kosta 2023-03-28 16:33:41 +02:00
parent 326bd24286
commit 822058a1f0
2 changed files with 32 additions and 0 deletions

View File

@ -569,6 +569,7 @@ bool SMESHGUI_Preferences_ScalarBarDlg::onApply()
myLookupTable->SetRange( aMin, aMax );
myLookupTable->SetNumberOfTableValues(myColorsSpin->value());
applyThreshold(myLookupTable);
bool scaleChanged = (myLogarithmicCheck->isChecked() != (myLookupTable->GetScale() == VTK_SCALE_LOG10));
if (scaleChanged)
@ -661,6 +662,8 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
myLogarithmicCheck->setChecked(aLookupTable->GetScale() == VTK_SCALE_LOG10);
//myLogarithmicCheck->setEnabled(range[0] > 1e-07 && range[1] > 1e-07);
myLogarithmicCheck->setEnabled(range[0] != range[1]);
applyThreshold(aLookupTable);
}
vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty();
@ -878,3 +881,27 @@ void SMESHGUI_Preferences_ScalarBarDlg::initScalarBarFromResources()
DEF_VER_H = mgr->doubleValue("SMESH", name.arg( "height" ));
}
}
//=================================================================================================
/*!
* SMESHGUI_Preferences_ScalarBarDlg::applyThreshold()
*
* Switch on and off using of special color for values beyond the min-max range.
* Now this color is completely transparent - RGBA(0,0,0,0).
*/
//=================================================================================================
void SMESHGUI_Preferences_ScalarBarDlg::applyThreshold(vtkLookupTable* aLookupTable)
{
const bool isChecked = myThresholdCheck->isChecked();
aLookupTable->SetUseAboveRangeColor(isChecked);
aLookupTable->SetUseBelowRangeColor(isChecked);
if (isChecked)
{
const double beyondRangeColor[4] = {};
aLookupTable->SetAboveRangeColor(beyondRangeColor);
aLookupTable->SetBelowRangeColor(beyondRangeColor);
}
}

View File

@ -50,6 +50,8 @@ class SalomeApp_IntSpinBox;
class QtxColorButton;
class LightApp_SelectionMgr;
class vtkLookupTable;
class SMESHGUI_EXPORT SMESHGUI_Preferences_ScalarBarDlg : public QDialog
{
Q_OBJECT
@ -70,6 +72,9 @@ public:
const double );
void initScalarBarFromResources();
protected:
void applyThreshold(vtkLookupTable* aLookupTable);
protected slots:
virtual void reject();