From: pkv Date: Tue, 4 Oct 2005 06:23:30 +0000 (+0000) Subject: update interaction between viewer and scalar bar control X-Git-Tag: BR-D5-38-2003_D2005-12-10~77 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a9875f4e6cfc9fa89f827eba834351b197a194e9;p=modules%2Fvisu.git update interaction between viewer and scalar bar control --- diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index b70b8ec5..3b1e226c 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -637,6 +637,11 @@ VISU_GaussPtsAct if(myPointPicker->GetActor() != this) { myTextActor->SetVisibility(aTextVisibility); mySphereActor->SetVisibility(aSphereVisibility); + // + if (GetScalarBarCtrl()->GetIsMarked()) { + GetScalarBarCtrl()->SetIsMarked(false); + GetScalarBarCtrl()->Update(); + } return bRet; } // @@ -650,8 +655,9 @@ VISU_GaussPtsAct if(theSelector->IsSelected(myIO)) theSelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift); else{ - if(!theSelectionEvent->myIsShift) + if(!theSelectionEvent->myIsShift){ theSelector->ClearIObjects(); + } theSelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift); theSelector->AddIObject(this); } @@ -673,20 +679,28 @@ VISU_GaussPtsAct vtkDataSet* aDataSet = GetInput(); vtkCellData* aCellData = aDataSet->GetCellData(); if(vtkDataArray* aScalarArray = aCellData->GetScalars()){ + float aVal = aScalarArray->GetTuple1(aVtkId); float aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray); mySphereSourceSelected->SetRadius(aRadius); + // if(theSelector->HasIndex(myIO)){ mySphereActorSelected->SetVisibility(1); - }else{ + GetScalarBarCtrl()->SetIsMarked(true); + GetScalarBarCtrl()->SetMarkValue(aVal); + } + else{ mySphereActorSelected->SetVisibility(0); mySphereActor->SetVisibility(1); + GetScalarBarCtrl()->SetIsMarked(false); } + GetScalarBarCtrl()->Update(); myTextActor->SetVisibility(1); } if(aSelectionMode == CellSelection){ // Hilighting an element from the parent Mesh if(theSelector->HasIndex(myIO)){ - const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper = myGaussPointsPL->GetGaussPtsIDMapper(); + const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper = + myGaussPointsPL->GetGaussPtsIDMapper(); VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent(); myCellSource->Reset(); @@ -701,11 +715,14 @@ VISU_GaussPtsAct myCellActor->SetVisibility(1); } } - return bRet; // }// if( anObjId >= 0 ) { }//if( aVtkId >= 0 && theSelector->IsValid( this, aVtkId, true ) && hasIO()) + if (GetScalarBarCtrl()->GetIsMarked()) { + GetScalarBarCtrl()->SetIsMarked(false); + GetScalarBarCtrl()->Update(); + } }// if( !isRectangle ) // else { @@ -805,6 +822,7 @@ VISU_GaussPtsAct // shoe sphere myTextActor->SetVisibility(1); mySphereActor->SetVisibility(1); + // return bRet; }// if (bIsAdded){ }// if( anObjId >= 0 ) diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.cxx b/src/PIPELINE/VISU_ScalarBarCtrl.cxx index cbd61e7b..4d9c3f00 100644 --- a/src/PIPELINE/VISU_ScalarBarCtrl.cxx +++ b/src/PIPELINE/VISU_ScalarBarCtrl.cxx @@ -346,21 +346,36 @@ int VISU_ScalarBarCtrl::GetMaximumNumberOfColors()const return myMaximumNumberOfColors; } //================================================================== -// function : MarkValue +// function : SetMarkValue // purpose : //================================================================== -void VISU_ScalarBarCtrl::MarkValue(const float theValue) +void VISU_ScalarBarCtrl::SetMarkValue(const float theValue) { - myMarked=true; myMarkedValue=theValue; } //================================================================== -// function : UnmarkValue +// function : GetMarkValue // purpose : //================================================================== -void VISU_ScalarBarCtrl::UnmarkValue() +float VISU_ScalarBarCtrl::GetMarkValue()const { - myMarked=false; + return myMarkedValue; +} +//================================================================== +// function : SetIsMarked +// purpose : +//================================================================== +void VISU_ScalarBarCtrl::SetIsMarked(const bool theFlag) +{ + myMarked=theFlag; +} +//================================================================== +// function : GetIsMarked +// purpose : +//================================================================== +bool VISU_ScalarBarCtrl::GetIsMarked()const +{ + return myMarked; } //================================================================== // function : Update diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.hxx b/src/PIPELINE/VISU_ScalarBarCtrl.hxx index 7436b22f..c5f3e50d 100644 --- a/src/PIPELINE/VISU_ScalarBarCtrl.hxx +++ b/src/PIPELINE/VISU_ScalarBarCtrl.hxx @@ -102,8 +102,10 @@ public: int GetMaximumNumberOfColors ()const; // // Misc - void MarkValue (const float theValue); - void UnmarkValue(); + void SetMarkValue (const float theValue); + float GetMarkValue ()const; + void SetIsMarked(const bool theFlag); + bool GetIsMarked()const; // protected: VISU_ScalarBarCtrl(); diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index aa9f70e9..02381e3b 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -515,11 +515,13 @@ VISU::GaussPoints_i int aScalarBarMode; if(myIsActiveLocalScalarBar){ - aScalarBarMode = 1; - }else{ + aScalarBarMode = 2; + } + else{ if(myIsDispGlobalScalarBar){ - aScalarBarMode = 2; - }else{ + aScalarBarMode = 1; + } + else{ aScalarBarMode = 0; aScalarBarCtrl->SetRangeGlobal(aRange); }