From: vsv Date: Fri, 5 May 2006 14:28:13 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=918efd9524d0ca9f33e484e236c9eb607c175c4f;p=modules%2Fgeom.git *** empty log message *** --- diff --git a/src/GEOMGUI/GeometryGUI_Swig.cxx b/src/GEOMGUI/GeometryGUI_Swig.cxx index 22e3502b6..57b0f8659 100644 --- a/src/GEOMGUI/GeometryGUI_Swig.cxx +++ b/src/GEOMGUI/GeometryGUI_Swig.cxx @@ -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 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( theWin ); + if ( vw ) { + OCCViewer_ViewManager* vm = dynamic_cast( vw->getViewManager() ); + if ( vm ) { + SOCC_Viewer* aViewer = dynamic_cast(vm->getOCCViewer()); + if (aViewer) { + SALOME_Prs* aPrs = aViewer->CreatePrs(myEntry.c_str()); + if (aPrs) { + SALOME_OCCPrs* aOccPrs = dynamic_cast(aPrs); + if (aOccPrs) { + aViewer->Erase(aOccPrs); + aViewer->Repaint(); + } + } + } + } + } + } else if (theWin->getViewManager()->getType() == SVTK_Viewer::Type()){ + SVTK_ViewWindow* aViewWindow = dynamic_cast( 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(); diff --git a/src/GEOMGUI/GeometryGUI_Swig.hxx b/src/GEOMGUI/GeometryGUI_Swig.hxx index 02489d402..04ebb27d9 100644 --- a/src/GEOMGUI/GeometryGUI_Swig.hxx +++ b/src/GEOMGUI/GeometryGUI_Swig.hxx @@ -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); diff --git a/src/GEOMGUI/GeometryGUI_Swig.i b/src/GEOMGUI/GeometryGUI_Swig.i index d8be6b738..516ffd4b3 100644 --- a/src/GEOMGUI/GeometryGUI_Swig.i +++ b/src/GEOMGUI/GeometryGUI_Swig.i @@ -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);