]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
0020830: EDF 1357 GUI : Hide/Show Icon
authorptv <ptv@opencascade.com>
Wed, 17 Nov 2010 08:42:17 +0000 (08:42 +0000)
committerptv <ptv@opencascade.com>
Wed, 17 Nov 2010 08:42:17 +0000 (08:42 +0000)
src/SUIT/resources/SUIT_msg_en.ts
src/SUIT/resources/SUIT_msg_fr.ts
src/SVTK/SVTK_Functor.h
src/SVTK/SVTK_View.cxx
src/SVTK/SVTK_View.h
src/SVTK/SVTK_ViewModel.cxx
src/SVTK/SVTK_ViewModel.h

index c9465cf2c008a25a42723c454b40f16907fe13d4..157d390a325dad139ff4e7afbd795b93682b4c58 100644 (file)
@@ -113,6 +113,10 @@ Do you want to overwrite it?</translation>
         <source>NAME_COLUMN</source>
         <translation>Name</translation>
     </message>
+    <message>
+        <source>VISIBILITY_COLUMN</source>
+        <translation>Visibility</translation>
+    </message>
 </context>
 <context>
     <name>SUIT_Study</name>
index cf287361a6c61ab1b4303c994a4ed98484179cc3..b3d984926240121cbc63858c96309aebae7e872c 100755 (executable)
@@ -112,6 +112,10 @@ Faut-il le réécrire?</translation>
         <source>NAME_COLUMN</source>
         <translation>Nom</translation>
     </message>
+    <message>
+        <source>VISIBILITY_COLUMN</source>
+        <translation>Visibilité</translation>
+    </message>
 </context>
 <context>
     <name>SUIT_Study</name>
index fdb5def833de16b06b6d779f436f4298497f81f1..1715863c6ae1628e7f69e28b7cea6d55e86e8e19 100644 (file)
@@ -29,7 +29,8 @@
 
 #include <VTKViewer_Functor.h>
 
-#include "SALOME_InteractiveObject.hxx"
+#include <SALOME_InteractiveObject.hxx>
+#include <SALOME_ListIO.hxx>
 
 /*!
   \file SVTK_Functor.h
@@ -107,6 +108,24 @@ namespace SVTK
     }
   };
 
+  //----------------------------------------------------------------
+  /*!
+    This collect visible IO in list
+  */
+  template<class TActor> 
+  struct TCollectIfVisible
+  {
+    SALOME_ListIO& myList;
+    //! To construct the functor
+    TCollectIfVisible (SALOME_ListIO& theList) : myList(theList)
+    {}
+    //! To calculate the functor
+    void operator()(TActor* theActor) 
+    {
+      if(theActor->GetVisibility() && theActor->hasIO())
+        myList.Append( theActor->getIO() );
+    }
+  };
 }
 
 
index 1e70b3ab43b71cc9dc777c2c7c9fb08a68ffd791..b949511a56f618fa7a5362b0954cff70ce4db5fb 100644 (file)
@@ -714,3 +714,14 @@ SVTK_View
   return QColor(0,0,0);
 }
 
+/*!
+  \Collect objects visible in viewer
+  \param theList - visible objects collection
+*/
+void SVTK_View::GetVisible( SALOME_ListIO& theList )
+{
+  using namespace SVTK;
+  VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
+  ForEach<SALOME_Actor>(aCopy.GetActors(),
+                        TCollectIfVisible<SALOME_Actor>(theList));
+}
index 1baab282342a9e8b35b65524c24a66e1ad5066c2..ac943026b36cbf3fd24100cc4c07c513951cb60f 100644 (file)
@@ -28,7 +28,9 @@
 #endif
 
 #include "SVTK.h"
-#include "SALOME_InteractiveObject.hxx"
+
+#include <SALOME_InteractiveObject.hxx>
+#include <SALOME_ListIO.hxx>
 
 #include <QObject>
 
@@ -244,6 +246,10 @@ public:
   Remove(SALOME_Actor* SActor, 
          bool updateViewer = true);
 
+  //! Collect objects visible in viewer
+  void
+  GetVisible( SALOME_ListIO& theList );
+
   //----------------------------------------------------------------------------
   //! Redirect the request to #SVTK_Renderer::SetPreselectionProp
   void
index 58d4e47d86df71669c2c964cad2d23c3aa8d01af..6b5d0cfa6e0f53b257792779d54eedf331936804 100644 (file)
@@ -653,6 +653,21 @@ bool SVTK_Viewer::isVisible( const Handle(SALOME_InteractiveObject)& io )
   return true;
 }
 
+/*!
+  \Collect objects visible in viewer
+  \param theList - visible objects collection
+*/
+void SVTK_Viewer::GetVisible( SALOME_ListIO& theList )
+{
+  // here we collect object if it is disaplaed even one view
+  QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
+    if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
+      if(TViewWindow* aViewWnd = dynamic_cast<TViewWindow*>(aViewWindow))
+        if(SVTK_View* aView = aViewWnd->getView())
+          aView->GetVisible( theList );
+}
+
 /*!
   Updates current viewer
 */
index 5e038d2c79d3f92d4531c729ed71044b243c6b7a..4cc7aaa17eaed5221ad4ff7660287c82397424dc 100644 (file)
@@ -26,8 +26,9 @@
 #include "SVTK.h"
 #include "SVTK_ViewModelBase.h"
 
-#include "SALOME_Prs.h"
-#include "SALOME_InteractiveObject.hxx"
+#include <SALOME_Prs.h>
+#include <SALOME_InteractiveObject.hxx>
+#include <SALOME_ListIO.hxx>
 
 #include <QColor>
 #include <QMap>
@@ -137,6 +138,9 @@ public:
   //! See #SALOME_View::EraseAll( const bool = false )
   void EraseAll( const bool = false );
 
+  //! See #SALOME_View::getVisible( SALOME_ListIO& )
+  virtual void GetVisible( SALOME_ListIO& );
+
   //! See #SALOME_View::CreatePrs( const char* entry = 0 )
   SALOME_Prs* CreatePrs( const char* entry = 0 );