From: san Date: Mon, 18 Mar 2013 13:04:45 +0000 (+0000) Subject: SMESH_Swig::EraseActor() method added to erase VTK actors for deleted PPGP meshes... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=93dd4f94d88687d2a7cac1401879216ea0eb6cce;p=modules%2Fsmesh.git SMESH_Swig::EraseActor() method added to erase VTK actors for deleted PPGP meshes automatically. --- diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx index eca22e91e..e4d3b7a98 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,36 @@ void SMESH_Swig::CreateAndDisplayActor( const char* Mesh_Entry ) ProcessVoidEvent(new TEvent(Mesh_Entry)); } +void SMESH_Swig::EraseActor( const char* Mesh_Entry ) +{ + class TEvent: public SALOME_Event + { + private: + const char* _entry; + public: + TEvent(const char* Mesh_Entry) { + _entry = Mesh_Entry; + } + 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 = anApp->viewManagers(); + foreach(SUIT_ViewManager* aMgr, aManagers) { + if (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)); +} + 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..9efe2dcd6 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* ); + /*! * \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..64234317e 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 ); };