Salome HOME
Additional fix for issue 0020593: EDF 885 VISU: Unchecking Filter by Scalar does...
authorouv <ouv@opencascade.com>
Thu, 4 Feb 2010 12:27:27 +0000 (12:27 +0000)
committerouv <ouv@opencascade.com>
Thu, 4 Feb 2010 12:27:27 +0000 (12:27 +0000)
src/VISUGUI/VisuGUI_FilterScalarsDlg.cxx
src/VISU_I/VISU_Prs3d_i.cc
src/VISU_I/VISU_Prs3d_i.hh

index ed42002ccb40fbc213ee6cfe95725165db723954..f94d05abc66e1723ce8cef75d822574066350ae1 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
 
 #include <SalomeApp_Application.h>
 #include <LightApp_SelectionMgr.h>
@@ -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<SVTK_ViewWindow>( myVisuGUI ) )
+      if( isToUpdate = VISU::PublishInView( myVisuGUI, myColoredPrs3d, aViewWindow, true ) )
+        myColoredPrs3d->SetForcedHidden( false );
+
+  if( isToUpdate )
+    myColoredPrs3d->UpdateActors();
+
   QDialog::accept();
 }
 
index 08e4644c4ab986b95a3a4b36686272cb4981ddf6..17468de966fc0c5e2384614cecb7901f5d3a7fbc 100644 (file)
@@ -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 = "<<this);
   myOffset[0] = myOffset[1] = myOffset[2] = 0;
@@ -71,6 +72,8 @@ VISU::Prs3d_i
 
     GetPipeLine()->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<VISU_Actor*>( 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;
+}
index d720ccf3b32164c471b3a114d1d56e8b9891f1ff..6f54053ccfdbd1d2c715a54c38fca958b70a2bf8 100644 (file)
@@ -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;
   };
 
   //----------------------------------------------------------------------------