]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
SMESH_Swig::EraseActor() method added to erase VTK actors for deleted PPGP meshes...
authorsan <san@opencascade.com>
Mon, 18 Mar 2013 13:04:45 +0000 (13:04 +0000)
committersan <san@opencascade.com>
Mon, 18 Mar 2013 13:04:45 +0000 (13:04 +0000)
src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx
src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h
src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i

index eca22e91e77323f0d982a7df4b755de0010658b3..e4d3b7a98ecbaa5a24f01d0eee4c395880f5040b 100644 (file)
@@ -37,6 +37,9 @@
 
 // SALOME GUI includes
 #include <SUIT_Session.h>
+#include <SUIT_ViewManager.h>
+#include <SALOME_Prs.h>
+#include <SUIT_ViewWindow.h>
 #include <VTKViewer_ViewModel.h>
 #include <SALOME_Event.h>
 #include <SalomeApp_Application.h>
@@ -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<SalomeApp_Application*>(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<SALOME_View*>(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)
 {
index 4a7b8e719a8e2e949c5a4bcfff223fdd9ec3febd..9efe2dcd6b11f787fa6caf8ac63838abfee11086 100644 (file)
@@ -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
index 52d2bb87fa4aab38309d362f30de565b0ed4f809..64234317e5a6f308973455671491bb4b086c571c 100644 (file)
@@ -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 );
 };