]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
*** empty log message ***
authorvsv <vsv@opencascade.com>
Fri, 5 May 2006 14:28:13 +0000 (14:28 +0000)
committervsv <vsv@opencascade.com>
Fri, 5 May 2006 14:28:13 +0000 (14:28 +0000)
src/GEOMGUI/GeometryGUI_Swig.cxx
src/GEOMGUI/GeometryGUI_Swig.hxx
src/GEOMGUI/GeometryGUI_Swig.i

index 22e3502b62b3f42834dd12eb45b395bf5bb56d60..57b0f8659fc44692565e2f4673509b900e2725f4 100644 (file)
@@ -231,6 +231,68 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry)
 }
 
 
+void GEOM_Swig::eraseGO (const char* Entry, bool allWindows)
+{
+  class TEvent: public SALOME_Event
+  {
+    std::string myEntry;
+    bool myFromAllWindows;
+  public:
+    TEvent(const char* theEntry, bool fromAllWindows):
+      myEntry(theEntry), myFromAllWindows(fromAllWindows)
+    {}
+    virtual void Execute()
+    {
+      SUIT_Application* app = SUIT_Session::session()->activeApplication();
+      if (!app) return;
+      Handle (SALOME_InteractiveObject) aIO = new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
+
+      if (myFromAllWindows) {
+       QPtrList<SUIT_ViewWindow> aWindows = app->desktop()->windows();
+       SUIT_ViewWindow* aWin = 0;
+       for (aWin = aWindows.first(); aWin; aWin = aWindows.next()) {
+         EraseObject(aWin, aIO);
+       }
+      } else {
+       SUIT_ViewWindow* aWin = app->desktop()->activeWindow();
+       if (aWin)
+         EraseObject(aWin, aIO);
+      }
+    }
+
+  private:
+    void EraseObject(SUIT_ViewWindow* theWin, Handle (SALOME_InteractiveObject) theIO)
+    {
+      if (theWin->getViewManager()->getType() == OCCViewer_Viewer::Type()){
+       OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( theWin );
+       if ( vw ) {
+         OCCViewer_ViewManager* vm = dynamic_cast<OCCViewer_ViewManager*>( vw->getViewManager() );
+         if ( vm ) {
+           SOCC_Viewer* aViewer = dynamic_cast<SOCC_Viewer*>(vm->getOCCViewer());
+           if (aViewer) {
+             SALOME_Prs* aPrs = aViewer->CreatePrs(myEntry.c_str());
+             if (aPrs) {
+               SALOME_OCCPrs* aOccPrs =  dynamic_cast<SALOME_OCCPrs*>(aPrs);
+               if (aOccPrs) {
+                 aViewer->Erase(aOccPrs);
+                 aViewer->Repaint();
+               }
+             }
+           }
+         }
+       }
+      } else if (theWin->getViewManager()->getType() == SVTK_Viewer::Type()){
+       SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>( theWin );
+       if (aViewWindow) {
+         aViewWindow->Erase(theIO);
+       }
+      }
+    }
+
+  };
+  ProcessVoidEvent(new TEvent(Entry, allWindows));
+}
+
 int GEOM_Swig::getIndexTopology(const char* SubIOR, const char* IOR)
 {
   GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
index 02489d402d880f88855ab4908523dca85d7e25a3..04ebb27d9aa9fba2626379eddd194d05214613db 100644 (file)
@@ -50,6 +50,7 @@ public:
   ~GEOM_Swig();
 
   void createAndDisplayGO(const char* Entry);
+  void eraseGO(const char* Entry, bool allWindows);
   void setDisplayMode(const char* Entry, int mode);
   void setColor(const char* Entry, int red, int green, int blue);
   void setTransparency(const char* Entry, float transp);
index d8be6b738b374292ca8a142c63a3d8eec7602966..516ffd4b3f843de521eda7b35d7c0bc63624a1f9 100644 (file)
@@ -37,6 +37,7 @@ class GEOM_Swig
   ~GEOM_Swig();
 
   void createAndDisplayGO(const char* Entry);
+  void eraseGO(const char* Entry, bool allWindows);
   int  getIndexTopology(const char *SubEntry, const char *Entry);
   const char* getShapeTypeString(const char *Entry);