From: vsr Date: Tue, 2 Oct 2012 08:17:28 +0000 (+0000) Subject: Add function to erase an actor in current viewer or in all viewers where it is displa... X-Git-Tag: V6_6_0a1~68 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b398c3a304c7bbf20ca406e0a8cd3e6fd9ef7e36;p=modules%2Fsmesh.git Add function to erase an actor in current viewer or in all viewers where it is displayed (patch from vsv - PPGP dev) --- diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx index eca22e91e..679a8d853 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx @@ -37,6 +37,9 @@ // SALOME GUI includes #include +#include +#include +#include #include #include #include @@ -575,6 +578,44 @@ void SMESH_Swig::CreateAndDisplayActor( const char* Mesh_Entry ) ProcessVoidEvent(new TEvent(Mesh_Entry)); } +void SMESH_Swig::EraseActor( const char* Mesh_Entry, const bool allViewers ) +{ + class TEvent: public SALOME_Event + { + private: + const char* _entry; + bool _allViewers; + public: + TEvent(const char* Mesh_Entry, const bool allViewers ) { + _entry = Mesh_Entry; + _allViewers = allViewers; + } + virtual void Execute() { + SUIT_Session* aSession = SUIT_Session::session(); + SUIT_Application* anApplication = aSession->activeApplication(); + SalomeApp_Application* anApp = dynamic_cast(anApplication); + SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp); + ViewManagerList aManagers; + if ( !_allViewers ) { + aManagers << anApp->activeViewManager(); + } + else { + aManagers = anApp->viewManagers(); + } + foreach( SUIT_ViewManager* aMgr, aManagers ) { + if ( aMgr && aMgr->getType() == VTKViewer_Viewer::Type() ) { + SALOME_View* aSalomeView = dynamic_cast(aMgr->getViewModel()); + if (aSalomeView) { + aDisp->Erase(_entry,true, true, aSalomeView); + } + } + } + } + }; + + ProcessVoidEvent(new TEvent(Mesh_Entry, allViewers)); +} + void SMESH_Swig::SetName(const char* theEntry, const char* theName) { diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h index 4a7b8e719..504eba845 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h @@ -65,6 +65,8 @@ public: void SetName( const char*, const char* ); + void EraseActor( const char*, const bool allViewers = false ); + /*! * \brief Set mesh icon according to compute status * \param Mesh_Entry - entry of a mesh diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i index 52d2bb87f..db8ef31aa 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i @@ -75,4 +75,5 @@ class SMESH_Swig void SetMeshIcon(const char* Mesh_Entry, const bool isComputed, const bool isEmpty); void CreateAndDisplayActor( const char* Mesh_Entry ); + void EraseActor( const char* Mesh_Entry, const bool allViewers = false ); };