From: kosta Date: Tue, 28 Mar 2023 14:33:41 +0000 (+0200) Subject: [bos #32736][CEA] Threshold of criteria. Added using completely transparent above... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=822058a1f0c1eb59fb065574fdbfd5f2eb03a182;p=modules%2Fsmesh.git [bos #32736][CEA] Threshold of criteria. Added using completely transparent above and below range colors for vtkLookupTable if Threshold is checked. --- diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx index 25480624d..06ae7c442 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx @@ -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); + } +} diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h index 3345ad1f3..166646f1c 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h @@ -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();