From: ouv Date: Thu, 4 Feb 2010 12:27:27 +0000 (+0000) Subject: Additional fix for issue 0020593: EDF 885 VISU: Unchecking Filter by Scalar does... X-Git-Tag: V5_1_main_20100210~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=38a80f0c727f7f3a95c465c892578e6b8209fc63;p=modules%2Fvisu.git Additional fix for issue 0020593: EDF 885 VISU: Unchecking Filter by Scalar does not remove white marks on the scalar bar --- diff --git a/src/VISUGUI/VisuGUI_FilterScalarsDlg.cxx b/src/VISUGUI/VisuGUI_FilterScalarsDlg.cxx index ed42002c..f94d05ab 100644 --- a/src/VISUGUI/VisuGUI_FilterScalarsDlg.cxx +++ b/src/VISUGUI/VisuGUI_FilterScalarsDlg.cxx @@ -25,6 +25,7 @@ #include "VisuGUI.h" #include "VisuGUI_Tools.h" +#include "VisuGUI_ViewTools.h" #include #include @@ -136,7 +137,16 @@ void VisuGUI_FilterScalarsDlg::accept() { myColoredPrs3d->SetScalarFilterRange( myMinEdit->text().toDouble(), myMaxEdit->text().toDouble() ); myColoredPrs3d->UseScalarFiltering( myRangeBox->isChecked() ); - myColoredPrs3d->UpdateActors(); + + bool isToUpdate = true; + if( myColoredPrs3d->IsForcedHidden() ) + if( SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow( myVisuGUI ) ) + if( isToUpdate = VISU::PublishInView( myVisuGUI, myColoredPrs3d, aViewWindow, true ) ) + myColoredPrs3d->SetForcedHidden( false ); + + if( isToUpdate ) + myColoredPrs3d->UpdateActors(); + QDialog::accept(); } diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 08e4644c..17468de9 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -53,7 +53,8 @@ static int MYDEBUG = 0; VISU::Prs3d_i::Prs3d_i() : PrsObject_i(SALOMEDS::Study::_nil()), myActorCollection(vtkActorCollection::New()), - myIsActiveSatate(true) + myIsActiveSatate(true), + myIsForcedHidden(false) { if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<SameAs(anOrigin->GetPipeLine()); anOrigin->GetOffset(myOffset); + + SetForcedHidden(anOrigin->IsForcedHidden()); } } @@ -557,11 +560,15 @@ VISU::Prs3d_i try { CheckDataSet(); } catch( std::exception& ex ) { - SUIT_MessageBox::warning( 0, - QObject::tr("WRN_VISU"), - QString( ex.what() ), - QObject::tr("BUT_OK") ); - RemoveActors(); + if( !IsForcedHidden() ) { + if( HasVisibleActors() ) + SetForcedHidden( true ); + RemoveActors(); + SUIT_MessageBox::warning( 0, + QObject::tr("WRN_VISU"), + QString( ex.what() ), + QObject::tr("BUT_OK") ); + } return; } ProcessVoidEvent(new TInvokeSignalEvent(myUpdateActorsSignal)); @@ -701,3 +708,29 @@ VISU::Prs3d_i { return myActorCollection->GetNumberOfItems(); } + +bool +VISU::Prs3d_i +::HasVisibleActors() +{ + myActorCollection->InitTraversal(); + while( vtkActor* anActor = myActorCollection->GetNextActor() ) + if( VISU_Actor* aVISUActor = dynamic_cast( anActor ) ) + if( aVISUActor->GetVisibility() ) + return true; + return false; +} + +bool +VISU::Prs3d_i +::IsForcedHidden() const +{ + return myIsForcedHidden; +} + +void +VISU::Prs3d_i +::SetForcedHidden( bool theFlag ) +{ + myIsForcedHidden = theFlag; +} diff --git a/src/VISU_I/VISU_Prs3d_i.hh b/src/VISU_I/VISU_Prs3d_i.hh index d720ccf3..6f54053c 100644 --- a/src/VISU_I/VISU_Prs3d_i.hh +++ b/src/VISU_I/VISU_Prs3d_i.hh @@ -235,7 +235,10 @@ namespace VISU GetBounds(vtkFloatingPointType aBounds[6]); int - GetNumberOfActors (); + GetNumberOfActors(); + + bool + HasVisibleActors(); //! Move the 3D presentation according to the given offset parameters void @@ -288,6 +291,14 @@ namespace VISU std::string GetActorEntry(); + //---------------------------------------------------------------------------- + //! Managing "forced hidden" flag + bool + IsForcedHidden() const; + + void + SetForcedHidden( bool ); + protected: /*! Used in Apply method to get know whether it is possible to create presentation @@ -357,6 +368,8 @@ namespace VISU SetActiveState(bool theState); bool myIsActiveSatate; + + bool myIsForcedHidden; }; //----------------------------------------------------------------------------