From 913ff1550f9161319f46a08009cacbc7eb8063b9 Mon Sep 17 00:00:00 2001 From: pkv Date: Tue, 18 Oct 2005 10:27:37 +0000 Subject: [PATCH] fix for Bug GVIEW10318 --- src/OBJECT/VISU_GaussPtsAct.cxx | 4 +-- src/PIPELINE/VISU_ScalarBarCtrl.cxx | 43 +++++++++++++++++++++-------- src/PIPELINE/VISU_ScalarBarCtrl.hxx | 10 +++++-- 3 files changed, 40 insertions(+), 17 deletions(-) diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index 0155c28f..cb5470a1 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -360,7 +360,7 @@ VISU_GaussPtsAct ::SetVisibility(int theMode) { Superclass::SetVisibility(theMode); - myScalarBarCtrl->SetBarVisibility(theMode && myBarVisibility); + myScalarBarCtrl->SetVisibility(theMode); } //---------------------------------------------------------------------------- @@ -369,7 +369,7 @@ VISU_GaussPtsAct ::SetBarVisibility(bool theMode) { myBarVisibility = theMode; - myScalarBarCtrl->SetBarVisibility(theMode); + myScalarBarCtrl->SetCtrlVisibility((int)theMode); } bool diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.cxx b/src/PIPELINE/VISU_ScalarBarCtrl.cxx index 4d9c3f00..e200b2ea 100644 --- a/src/PIPELINE/VISU_ScalarBarCtrl.cxx +++ b/src/PIPELINE/VISU_ScalarBarCtrl.cxx @@ -48,7 +48,6 @@ vtkStandardNewMacro(VISU_ScalarBarCtrl); //================================================================== VISU_ScalarBarCtrl::VISU_ScalarBarCtrl() { - myBarVisibility=true; myDistance=0.02; myL=0.8; myB=0.15; @@ -88,6 +87,9 @@ VISU_ScalarBarCtrl::VISU_ScalarBarCtrl() myBlack[i]=0; myGrey[i]=192; } + // + myCtrlVisibility=1; + SetVisibility(1); } //================================================================== // function : ~ @@ -117,20 +119,40 @@ int VISU_ScalarBarCtrl::GetMode()const return myMode; } //================================================================== -// function : SetBarVisibility +// function : SetVisibility +// purpose : +//================================================================== +void VISU_ScalarBarCtrl::SetVisibility(const int theFlag) +{ + int iVisibility=(myCtrlVisibility && theFlag); + for (int i=0; i<2; ++i){ + mySBA[i]->SetVisibility(iVisibility); + } +} +//================================================================== +// function : GetVisibility // purpose : //================================================================== -void VISU_ScalarBarCtrl::SetBarVisibility(const bool theFlag) +int VISU_ScalarBarCtrl::GetVisibility()const { - myBarVisibility=theFlag; + return mySBA[0]->GetVisibility(); } //================================================================== -// function : GetBarVisibility +// function : SetCtrlVisibility // purpose : //================================================================== -bool VISU_ScalarBarCtrl::GetBarVisibility()const +void VISU_ScalarBarCtrl::SetCtrlVisibility(const int theFlag) { - return myBarVisibility; + myCtrlVisibility=theFlag; + SetVisibility(1); +} +//================================================================== +// function : GetCtrlVisibility +// purpose : +//================================================================== +int VISU_ScalarBarCtrl::GetCtrlVisibility()const +{ + return myCtrlVisibility; } //================================================================== // function : SetRangeLocal @@ -383,10 +405,8 @@ bool VISU_ScalarBarCtrl::GetIsMarked()const //================================================================== void VISU_ScalarBarCtrl::Update() { - if (!myBarVisibility) { - for (int i=0; iSetVisibility(myBarVisibility); - } + if (!myCtrlVisibility) { + SetVisibility(0); return; } // @@ -452,7 +472,6 @@ void VISU_ScalarBarCtrl::PrepareTables() // mySBA[i]->SetMaximumNumberOfColors(myMaximumNumberOfColors); mySBA[i]->SetLookupTable(myXLT[i]); - mySBA[i]->SetVisibility(myBarVisibility); mySBA[i]->Modified(); } } diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.hxx b/src/PIPELINE/VISU_ScalarBarCtrl.hxx index c5f3e50d..dab82503 100644 --- a/src/PIPELINE/VISU_ScalarBarCtrl.hxx +++ b/src/PIPELINE/VISU_ScalarBarCtrl.hxx @@ -65,8 +65,12 @@ public: void RemoveFromRender(vtkRenderer* theRenderer); // // Visibility - void SetBarVisibility(const bool theFlag); - bool GetBarVisibility()const; + void SetVisibility(const int theFlag); + int GetVisibility()const; + // + // Visibility + void SetCtrlVisibility(const int theFlag); + int GetCtrlVisibility()const; // // Build void Update(); @@ -125,7 +129,7 @@ protected: float myRangeLocal[2]; float myRangeGlobal[2]; bool myBicolor; - bool myBarVisibility; + int myCtrlVisibility; int myMaximumNumberOfColors; unsigned char myBlack[4]; unsigned char myGrey[4]; -- 2.39.2