From: ptv Date: Wed, 17 Nov 2010 08:42:17 +0000 (+0000) Subject: 0020830: EDF 1357 GUI : Hide/Show Icon X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f672cb9dd87f7c8a2e92bd1324d89a4f5734a72e;p=modules%2Fgui.git 0020830: EDF 1357 GUI : Hide/Show Icon --- diff --git a/src/SUIT/resources/SUIT_msg_en.ts b/src/SUIT/resources/SUIT_msg_en.ts index c9465cf2c..157d390a3 100644 --- a/src/SUIT/resources/SUIT_msg_en.ts +++ b/src/SUIT/resources/SUIT_msg_en.ts @@ -113,6 +113,10 @@ Do you want to overwrite it? NAME_COLUMN Name + + VISIBILITY_COLUMN + Visibility + SUIT_Study diff --git a/src/SUIT/resources/SUIT_msg_fr.ts b/src/SUIT/resources/SUIT_msg_fr.ts index cf287361a..b3d984926 100755 --- a/src/SUIT/resources/SUIT_msg_fr.ts +++ b/src/SUIT/resources/SUIT_msg_fr.ts @@ -112,6 +112,10 @@ Faut-il le réécrire? NAME_COLUMN Nom + + VISIBILITY_COLUMN + Visibilité + SUIT_Study diff --git a/src/SVTK/SVTK_Functor.h b/src/SVTK/SVTK_Functor.h index fdb5def83..1715863c6 100644 --- a/src/SVTK/SVTK_Functor.h +++ b/src/SVTK/SVTK_Functor.h @@ -29,7 +29,8 @@ #include -#include "SALOME_InteractiveObject.hxx" +#include +#include /*! \file SVTK_Functor.h @@ -107,6 +108,24 @@ namespace SVTK } }; + //---------------------------------------------------------------- + /*! + This collect visible IO in list + */ + template + 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() ); + } + }; } diff --git a/src/SVTK/SVTK_View.cxx b/src/SVTK/SVTK_View.cxx index 1e70b3ab4..b949511a5 100644 --- a/src/SVTK/SVTK_View.cxx +++ b/src/SVTK/SVTK_View.cxx @@ -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(aCopy.GetActors(), + TCollectIfVisible(theList)); +} diff --git a/src/SVTK/SVTK_View.h b/src/SVTK/SVTK_View.h index 1baab2823..ac943026b 100644 --- a/src/SVTK/SVTK_View.h +++ b/src/SVTK/SVTK_View.h @@ -28,7 +28,9 @@ #endif #include "SVTK.h" -#include "SALOME_InteractiveObject.hxx" + +#include +#include #include @@ -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 diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx index 58d4e47d8..6b5d0cfa6 100644 --- a/src/SVTK/SVTK_ViewModel.cxx +++ b/src/SVTK/SVTK_ViewModel.cxx @@ -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 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(aViewWindow)) + if(SVTK_View* aView = aViewWnd->getView()) + aView->GetVisible( theList ); +} + /*! Updates current viewer */ diff --git a/src/SVTK/SVTK_ViewModel.h b/src/SVTK/SVTK_ViewModel.h index 5e038d2c7..4cc7aaa17 100644 --- a/src/SVTK/SVTK_ViewModel.h +++ b/src/SVTK/SVTK_ViewModel.h @@ -26,8 +26,9 @@ #include "SVTK.h" #include "SVTK_ViewModelBase.h" -#include "SALOME_Prs.h" -#include "SALOME_InteractiveObject.hxx" +#include +#include +#include #include #include @@ -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 );