From 0b4adba6a7abb9477fdfc53f60200568bed4af1c Mon Sep 17 00:00:00 2001 From: kosta Date: Mon, 17 Apr 2023 17:03:01 +0100 Subject: [PATCH] [bos #32736][CEA] Threshold of criteria. Added Wireframe Off checkbox to hide edges' lines. --- src/OBJECT/SMESH_Actor.cxx | 11 ++++++++ src/OBJECT/SMESH_Actor.h | 2 ++ src/OBJECT/SMESH_ActorDef.h | 3 +++ .../SMESHGUI_Preferences_ScalarBarDlg.cxx | 27 ++++++++++++++++--- .../SMESHGUI_Preferences_ScalarBarDlg.h | 2 ++ src/SMESHGUI/SMESH_msg_en.ts | 4 +++ src/SMESHGUI/SMESH_msg_fr.ts | 4 +++ src/SMESHGUI/SMESH_msg_ja.ts | 4 +++ 8 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index c1c6cdc3f..d9e47586c 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -842,6 +842,7 @@ void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode ) myBallActor->GetMapper()->SetScalarVisibility(false); myScalarBarActor->SetVisibility(false); ClipThreshold(false); + SetWireframeOff(false); bool anIsScalarVisible = theMode > eNone; @@ -1825,6 +1826,8 @@ void SMESH_ActorDef::UpdateHighlight() case SMESH_DeviceActor::eSurface: case SMESH_DeviceActor::eWireframe: { + anIsVisible = !IsWireframeOff(); + if(myIsHighlighted) { myHighlitableActor->SetProperty(myHighlightProp); }else if(myIsPreselected){ @@ -2526,6 +2529,14 @@ void SMESH_ActorDef::ClipThreshold(bool isThresholdOn, double min /*= 0.0*/, dou } } +// Hides the wireframe if isWireframeOff == true. +void SMESH_ActorDef::SetWireframeOff(bool isWireframeOff) +{ + myIsWireframeOff = isWireframeOff; + + UpdateHighlight(); +} + void SMESH_ActorDef::UpdateDistribution() { if(SMESH::Controls::NumericalFunctor* fun = diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h index b7e83ad7b..aa1c67625 100644 --- a/src/OBJECT/SMESH_Actor.h +++ b/src/OBJECT/SMESH_Actor.h @@ -168,6 +168,8 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor virtual void UpdateDistribution() = 0; virtual void ClipThreshold(bool isThresholdOn, double min = 0.0, double max = 0.0) = 0; virtual bool IsClipThresholdOn() const = 0; + virtual void SetWireframeOff(bool isWireframeOff) = 0; + virtual bool IsWireframeOff() const = 0; virtual void SetPointsFontProperties( SMESH::LabelFont family, int size, bool bold, bool italic, bool shadow, diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index 2cca9bfc8..98c229d85 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -228,6 +228,8 @@ class SMESH_ActorDef : public SMESH_Actor virtual void UpdateDistribution(); virtual void ClipThreshold(bool isThresholdOn, double min = 0.0, double max = 0.0); virtual bool IsClipThresholdOn() const { return myIsClipThresholdOn; } + virtual void SetWireframeOff(bool isWireframeOff); + virtual bool IsWireframeOff() const { return myIsWireframeOff; } #ifndef DISABLE_PLOT2DVIEWER virtual SPlot2d_Histogram* GetPlot2Histogram() { return my2dHistogram; } @@ -303,6 +305,7 @@ class SMESH_ActorDef : public SMESH_Actor bool myIsEntityModeCache; bool myIsPointsVisible; bool myIsClipThresholdOn = false; + bool myIsWireframeOff = false; bool myIsShrinkable; bool myIsShrunk; diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx index 744646966..76752d62d 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx @@ -152,12 +152,17 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* myThresholdCheck->setText(tr("SMESH_TRESHOLD_SCALARBAR")); myThresholdCheck->setChecked(false); + myWireframeOffCheck = new QCheckBox (myRangeGrp); + myWireframeOffCheck->setText(tr("SMESH_WIREFRAME_OFF_SCALARBAR")); + myWireframeOffCheck->setChecked(false); + myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MIN" ), myRangeGrp ), 0, 0, 1, 1 ); myRangeGrpLayout->addWidget( myMinEdit, 0, 1, 1, 1 ); myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MAX" ), myRangeGrp ), 0, 2, 1, 1 ); myRangeGrpLayout->addWidget( myMaxEdit, 0, 3, 1, 1 ); myRangeGrpLayout->addWidget( myLogarithmicCheck, 1, 0, 1, 1 ); myRangeGrpLayout->addWidget( myThresholdCheck, 1, 1, 1, 1 ); + myRangeGrpLayout->addWidget( myWireframeOffCheck, 1, 2, 1, 1 ); aTopLayout->addWidget( myRangeGrp ); @@ -573,6 +578,8 @@ bool SMESHGUI_Preferences_ScalarBarDlg::onApply() myLookupTable->SetNumberOfTableValues(myColorsSpin->value()); applyThreshold(aMin, aMax); + applyWireframeOff(); + bool scaleChanged = (myLogarithmicCheck->isChecked() != (myLookupTable->GetScale() == VTK_SCALE_LOG10)); if (scaleChanged) myLookupTable->SetScale(myLogarithmicCheck->isChecked() ? VTK_SCALE_LOG10 : VTK_SCALE_LINEAR); @@ -667,8 +674,12 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged() myThresholdCheck->setChecked(myActor->IsClipThresholdOn()); applyThreshold(range[0], range[1]); + + myWireframeOffCheck->setChecked(myActor->IsWireframeOff()); } + applyWireframeOff(); + vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty(); double aTColor[3]; aTitleTextPrp->GetColor( aTColor ); @@ -897,12 +908,22 @@ void SMESHGUI_Preferences_ScalarBarDlg::initScalarBarFromResources() /*! * 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). + * Hides and shows elements beyond the given min - max range by threshold filter inside the actor. */ //================================================================================================= -//void SMESHGUI_Preferences_ScalarBarDlg::applyThreshold(vtkLookupTable* aLookupTable) void SMESHGUI_Preferences_ScalarBarDlg::applyThreshold(double min, double max) { myActor->ClipThreshold(myThresholdCheck->isChecked(), min, max); } + +//================================================================================================= +/*! + * SMESHGUI_Preferences_ScalarBarDlg::applyWireframeOff() + * + * Hides and shows edges' lines. + */ +//================================================================================================= +void SMESHGUI_Preferences_ScalarBarDlg::applyWireframeOff() +{ + myActor->SetWireframeOff(myWireframeOffCheck->isChecked()); +} diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h index 204601772..08b600cb6 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h @@ -74,6 +74,7 @@ public: protected: void applyThreshold(double min, double max); + void applyWireframeOff(); protected slots: virtual void reject(); @@ -103,6 +104,7 @@ private: QLineEdit* myMaxEdit; QCheckBox* myLogarithmicCheck; QCheckBox* myThresholdCheck; + QCheckBox* myWireframeOffCheck; QGroupBox* myFontGrp; QtxColorButton* myTitleColorBtn; diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 0a0f69bc6..fb04b585c 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -2228,6 +2228,10 @@ Check algorithm documentation for supported geometry SMESH_TRESHOLD_SCALARBAR Threshold + + SMESH_WIREFRAME_OFF_SCALARBAR + Wireframe Off + SMESH_MAKE_GROUPS Generate groups diff --git a/src/SMESHGUI/SMESH_msg_fr.ts b/src/SMESHGUI/SMESH_msg_fr.ts index af8541f2d..7fe5b7096 100644 --- a/src/SMESHGUI/SMESH_msg_fr.ts +++ b/src/SMESHGUI/SMESH_msg_fr.ts @@ -2226,6 +2226,10 @@ Référez-vous à la documentation sur l'algorithme et la géométrie supportée SMESH_TRESHOLD_SCALARBAR Seuil + + SMESH_WIREFRAME_OFF_SCALARBAR + Filaire désactivé + SMESH_MAKE_GROUPS Générer les groupes diff --git a/src/SMESHGUI/SMESH_msg_ja.ts b/src/SMESHGUI/SMESH_msg_ja.ts index ba16e96d6..01277cbd8 100644 --- a/src/SMESHGUI/SMESH_msg_ja.ts +++ b/src/SMESHGUI/SMESH_msg_ja.ts @@ -1983,6 +1983,10 @@ SMESH_TRESHOLD_SCALARBAR しきい値 + + SMESH_WIREFRAME_OFF_SCALARBAR + ワイヤーフレーム オフ + SMESH_MAKE_GROUPS グループを生成します。 -- 2.39.2