+ SUIT_Application* app = SUIT_Session::session()->activeApplication();
+ if (!app) return;
+ SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
+ if (!ActiveStudy) return;
+
+ Handle (SALOME_InteractiveObject) aIO = new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
+
+ GEOM_Displayer(ActiveStudy).Erase(aIO, true);
+ /* 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));
+}
+
+
+
+void GEOM_Swig::setDeflection(const char* theEntry, float theDeflect)
+{
+ class TEvent: public SALOME_Event {
+ std::string myEntry;
+ float myParam;
+ public:
+ TEvent(const char* theEntryArg, float theParam):
+ myEntry(theEntryArg), myParam(theParam)
+ {}
+ virtual void Execute() {
+ SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
+ if (!anApp) return;
+
+ Handle(SALOME_InteractiveObject) anIO =
+ new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
+
+ if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
+ vtkActorCollection* aActors = aViewWindow->getRenderer()->GetActors();
+ aActors->InitTraversal();
+ while (vtkActor* aAct = aActors->GetNextActor()) {
+ if (GEOM_Actor* aGeomActor = dynamic_cast<GEOM_Actor*>(aAct)) {
+ if (aGeomActor->hasIO()) {
+ Handle(SALOME_InteractiveObject) aNextIO = aGeomActor->getIO();
+ if (aNextIO->isSame(anIO)) {
+ aGeomActor->setDeflection(myParam);
+ aViewWindow->Repaint();
+ return;
+ }
+ }
+ }
+ }
+ // aView->SetTransparency(anIO, myParam);
+ //aView->Repaint();
+ } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
+ Handle(AIS_InteractiveContext) aContext = occViewer->getAISContext();
+ AIS_ListOfInteractive aAISList;
+ aContext->DisplayedObjects(aAISList);
+ AIS_ListIteratorOfListOfInteractive it(aAISList);
+ for (; it.More(); it.Next()) {
+ Handle(SALOME_InteractiveObject) aObj =
+ Handle(SALOME_InteractiveObject)::DownCast(it.Value()->GetOwner());
+ if ((!aObj.IsNull()) && aObj->hasEntry() && aObj->isSame(anIO)) {
+ Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(it.Value());
+ if (!aShape.IsNull()) {
+ TopoDS_Shape aSh = aShape->Shape();
+ if (!aSh.IsNull())
+ BRepTools::Clean(aSh);
+
+ aShape->SetOwnDeviationCoefficient( myParam );
+ aShape->SetOwnHLRDeviationAngle( 1.57 );
+ aContext->Redisplay(aShape);
+ return;
+ }
+ }
+ }
+ }