Salome HOME
0021543: EDF 1978 SMESH: Viscous layer for 2D meshes
[modules/smesh.git] / src / SMESH_SWIG_WITHIHM / libSMESH_Swig.cxx
index 463d1fd2735af2667724c78f8a81831223056313..679a8d8532f5d04f6c26bc661b19270cff099aba 100644 (file)
@@ -1,24 +1,22 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 // SMESH SMESH : GUI for SMESH component
 // File   : libSMESH_Swig.cxx
 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
@@ -39,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>
@@ -577,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<SalomeApp_Application*>(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<SALOME_View*>(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)
 {