Salome HOME
NPAL16568: Added Approximation parameter in MakeFilling algorithm.
[modules/geom.git] / src / GEOMGUI / GeometryGUI_Swig.cxx
1 //  GEOM GEOMGUI : GUI for Geometry component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : GeometryGUI_Swig.cxx
25 //  Author : Nicolas REJNERI, Paul RASCLE
26 //  Module : GEOM
27 //  $Header$
28
29 #include "GeometryGUI_Swig.hxx"
30 #include "SALOMEGUI_Swig.hxx"
31
32 #include "GeometryGUI.h"
33
34 #include "SUIT_Session.h"
35 #include "SalomeApp_Application.h"
36 #include "SalomeApp_Study.h"
37 #include "SalomeApp_ImportOperation.h"
38
39 #include "OB_Browser.h"
40
41 #include "OCCViewer_ViewWindow.h"
42 #include "OCCViewer_ViewManager.h"
43 #include "SOCC_ViewModel.h"
44
45 #include "SVTK_ViewModel.h"
46 #include "SVTK_ViewWindow.h"
47 #include "SVTK_View.h"
48 #include "SVTK_Renderer.h"
49
50 #include "GEOM_Actor.h"
51 #include "GEOM_Client.hxx"
52 #include "GEOM_AISShape.hxx"
53 #include "GEOM_AssemblyBuilder.h"
54 #include "GEOM_InteractiveObject.hxx"
55 #include "GEOM_Displayer.h"
56
57 #include "SALOME_Event.hxx"
58
59 #include "utilities.h"
60
61 #include "SALOMEDSClient.hxx"
62
63 // OCCT Includes
64 #include <TopAbs.hxx>
65 #include <TopoDS_Shape.hxx>
66 #include <AIS_ListOfInteractive.hxx>
67 #include <AIS_ListIteratorOfListOfInteractive.hxx>
68 #include <AIS_Drawer.hxx>
69 #include <BRepTools.hxx>
70
71 // IDL Headers
72 #include <SALOMEconfig.h>
73 #include CORBA_SERVER_HEADER(GEOM_Gen)
74
75 #include <vtkRenderer.h>
76
77 using namespace std;
78
79
80 static GEOM_Client ShapeReader;
81
82 inline OCCViewer_Viewer* GetOCCViewer(SUIT_Application* theApp){
83   SUIT_ViewWindow* window = theApp->desktop()->activeWindow();
84   if(window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()){
85     OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( window );
86     if ( vw ) {
87       OCCViewer_ViewManager* vm = dynamic_cast<OCCViewer_ViewManager*>( vw->getViewManager() );
88       if ( vm )
89         return vm->getOCCViewer();
90     }
91   }
92
93   return 0;
94 }
95
96 inline SVTK_ViewWindow* GetSVTKViewWindow(SUIT_Application* theApp){
97   SUIT_ViewWindow* window = theApp->desktop()->activeWindow();
98   if(window && window->getViewManager()->getType() == SVTK_Viewer::Type())
99     return dynamic_cast<SVTK_ViewWindow*>( window );
100
101   return 0;
102 }
103
104 GEOM_Swig::GEOM_Swig()
105 {
106   // MESSAGE("Constructeur");
107 }
108
109 GEOM_Swig::~GEOM_Swig()
110 {
111   // MESSAGE("Destructeur");
112 }
113
114 void GEOM_Swig::createAndDisplayGO (const char* Entry, bool isUpdated)
115 {
116   class TEvent: public SALOME_Event
117   {
118     std::string myEntry;
119     bool        myUpdateViewer;
120   public:
121     TEvent(const char* theEntry, bool toUpdateViewer):
122       myEntry(theEntry),
123       myUpdateViewer(toUpdateViewer)
124     {}
125     virtual void Execute()
126     {
127       SUIT_Application* app = SUIT_Session::session()->activeApplication();
128       if (!app) return;
129
130       SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
131       if (!ActiveStudy) return;
132
133       _PTR(Study) aStudy(ActiveStudy->studyDS());
134       _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
135
136       GEOM::GEOM_Gen_var Geom = GeometryGUI::GetGeomGen();
137       if (CORBA::is_nil(Geom)) {
138         GeometryGUI::InitGeomGen();
139         Geom = GeometryGUI::GetGeomGen();
140       }
141       if (CORBA::is_nil(Geom))
142         return;
143
144       string aFatherIOR;
145       _PTR(SComponent) father = aStudy->FindComponent("GEOM");
146       if (!father)
147         return;
148       if (!father->ComponentIOR(aFatherIOR)) {
149         CORBA::String_var objStr = SalomeApp_Application::orb()->object_to_string(Geom);
150         aStudyBuilder->LoadWith(father, objStr.in());
151         father->ComponentIOR(aFatherIOR);
152       }
153
154       _PTR(SObject) obj = aStudy->FindObjectID(myEntry);
155       if (!obj)
156         return;
157
158       // Create new actor
159       _PTR(GenericAttribute) anAttr;
160       if (!obj->FindAttribute(anAttr, "AttributeIOR"))
161         return;
162       _PTR(AttributeIOR) anIOR(anAttr);
163       string anIORValue = anIOR->Value();
164
165       GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(anIORValue.c_str());
166       TopoDS_Shape Shape = ShapeReader.GetShape(Geom,aShape);
167       if (!Shape.IsNull()) {
168         if (obj->FindAttribute(anAttr, "AttributeName")) {
169           _PTR(AttributeName) aName (anAttr);
170           string aNameValue = aName->Value();
171           // open transaction
172           /*SUIT_Operation* op = new SalomeApp_ImportOperation (app);
173           op->start();
174
175           _PTR(SObject) newObj1 = aStudyBuilder->NewObject(father);
176           aStudyBuilder->Addreference(newObj1, obj);
177           // commit transaction
178           op->commit();*/
179           Handle(GEOM_InteractiveObject) anIO =
180             new GEOM_InteractiveObject (const_cast<char*>(anIORValue.c_str()),
181                                         const_cast<char*>(aFatherIOR.c_str()),
182                                         "GEOM",
183                                         const_cast<char*>( obj->GetID().c_str()));
184
185           GEOM_Displayer(ActiveStudy).Display(anIO, myUpdateViewer);
186           /*if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) {
187             SVTK_View* aView = aViewWindow->getView();
188             int aMode = aView->GetDisplayMode();
189
190             vtkActorCollection* theActors =
191               GEOM_AssemblyBuilder::BuildActors(Shape,0,aMode,true);
192             theActors->InitTraversal();
193             while (vtkActor* anActor = theActors->GetNextActor()) {
194               GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor);
195               GActor->setName(const_cast<char*>(aNameValue.c_str()));
196               GActor->setIO(anIO);
197               aView->Display(GActor);
198             }
199             aView->Repaint();
200           } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app)) {
201             Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
202             Handle(GEOM_AISShape) aSh =
203               new GEOM_AISShape (Shape,const_cast<char*>(aNameValue.c_str()));
204             aSh->setName(const_cast<char*>(aNameValue.c_str()));
205             aSh->setIO(anIO);
206             ic->Display(aSh);
207             ic->AddOrRemoveCurrentObject(aSh,true);
208             }*/
209           // update object browser
210           SalomeApp_Application* app = NULL; //dynamic_cast<SalomeApp_Application*>(app);
211           if (app) {
212             CAM_Module* module = app->module("Geometry");
213             SalomeApp_Module* appMod = dynamic_cast<SalomeApp_Module*>(module);
214             if (appMod)
215               appMod->updateObjBrowser(true);
216           }
217         }
218       }
219     }
220   };
221
222   // MESSAGE("createAndDisplayGO");
223   ProcessVoidEvent(new TEvent (Entry, isUpdated));
224
225   class TEventUpdateBrowser: public SALOME_Event
226     {
227       public:
228         TEventUpdateBrowser() {}
229         virtual void Execute() {
230           SalomeApp_Application* app =
231             dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
232           if (app) {
233             CAM_Module* module = app->module("Geometry");
234             SalomeApp_Module* appMod = dynamic_cast<SalomeApp_Module*>(module);
235             if (appMod) appMod->updateObjBrowser(true);
236           }
237         }
238     };
239
240   if (isUpdated)
241     ProcessVoidEvent(new TEventUpdateBrowser ());
242 }
243
244 void GEOM_Swig::createAndDisplayFitAllGO (const char* Entry)
245 {
246   class TEventFitAll: public SALOME_Event
247   {
248     public:
249       TEventFitAll() {}
250       virtual void Execute() {
251         SUIT_Application* app = SUIT_Session::session()->activeApplication();
252         if (!app) return;
253         
254         if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app))
255           {
256             SVTK_View* aView = aViewWindow->getView();
257             aView->GetRenderer()->OnFitAll();
258           }
259         else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app))
260           {  
261             Handle(V3d_Viewer) aViewer3d = occViewer->getViewer3d();
262             aViewer3d->InitActiveViews();
263             
264             if (aViewer3d->MoreActiveViews())
265               aViewer3d->ActiveView()->FitAll();
266           }
267       }
268   };
269
270   createAndDisplayGO(Entry);
271   ProcessVoidEvent(new TEventFitAll());
272 }
273
274 void GEOM_Swig::UpdateViewer()
275 {
276   class TEventUpdateViewer: public SALOME_Event
277   {
278     public:
279       TEventUpdateViewer() {}
280       virtual void Execute() {
281         SUIT_Application* app = SUIT_Session::session()->activeApplication();
282         if (!app) return;
283         SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
284         if (!ActiveStudy) return;
285         
286         GEOM_Displayer(ActiveStudy).UpdateViewer();
287       }
288   };
289   
290   ProcessVoidEvent(new TEventUpdateViewer());
291 }
292
293 int GEOM_Swig::getIndexTopology(const char* SubIOR, const char* IOR)
294 {
295   GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
296   if (CORBA::is_nil(aGeomGen))
297     return -1;
298
299   GEOM::GEOM_Object_var aMainShape = aGeomGen->GetIORFromString(IOR);
300   GEOM::GEOM_Object_var aSubShape  = aGeomGen->GetIORFromString(SubIOR);
301   if (CORBA::is_nil(aMainShape) || CORBA::is_nil(aSubShape))
302     return -1;
303
304   GEOM::GEOM_IShapesOperations_var anIShapesOperations =
305     aGeomGen->GetIShapesOperations(aMainShape->GetStudyID());
306   if (CORBA::is_nil(anIShapesOperations))
307     return -1;
308
309   return anIShapesOperations->GetTopologyIndex(aMainShape, aSubShape);
310 }
311
312 const char* GEOM_Swig::getShapeTypeString(const char* IOR)
313 {
314   TCollection_AsciiString aTypeName ("Shape of unknown type");
315
316   GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
317   if (!CORBA::is_nil(aGeomGen))
318   {
319     GEOM::GEOM_Object_var aShape = aGeomGen->GetIORFromString(IOR);
320     if (!CORBA::is_nil(aShape))
321     {
322       GEOM::GEOM_IShapesOperations_var anIShapesOperations =
323         aGeomGen->GetIShapesOperations(aShape->GetStudyID());
324       if (!CORBA::is_nil(anIShapesOperations))
325       {
326         aTypeName = anIShapesOperations->GetShapeTypeString(aShape);
327       }
328     }
329   }
330
331   return CORBA::string_dup(aTypeName.ToCString());
332 }
333
334
335 const char* GEOM_Swig::getShapeTypeIcon(const char* IOR)
336 {
337   GEOM::GEOM_Gen_var Geom = GeometryGUI::GetGeomGen();
338   if ( CORBA::is_nil( Geom ) )
339     return "None";
340
341   GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(IOR);
342   TopoDS_Shape shape = ShapeReader.GetShape(Geom, aShape);
343
344   if( shape.IsNull() ) {
345     return "None" ;
346   }
347
348   switch (shape.ShapeType() )
349     {
350     case TopAbs_COMPOUND:
351       { return "ICON_OBJBROWSER_COMPOUND" ;}
352     case  TopAbs_COMPSOLID:
353       { return "ICON_OBJBROWSER_COMPSOLID" ;}
354     case TopAbs_SOLID:
355       { return "ICON_OBJBROWSER_SOLID" ;}
356     case TopAbs_SHELL:
357       { return "ICON_OBJBROWSER_SHELL" ;}
358     case TopAbs_FACE:
359       { return "ICON_OBJBROWSER_FACE" ;}
360     case TopAbs_WIRE:
361       { return "ICON_OBJBROWSER_WIRE" ;}
362     case TopAbs_EDGE:
363       { return "ICON_OBJBROWSER_EDGE" ;}
364     case TopAbs_VERTEX:
365       { return "ICON_OBJBROWSER_VERTEX" ;}
366     }
367
368   return "None";
369 }
370
371 void GEOM_Swig::setDisplayMode(const char* theEntry, int theMode, bool isUpdated)
372 {
373   class TEvent: public SALOME_Event {
374     std::string myEntry;
375     int myMode;
376     bool myUpdateViewer;
377   public:
378     TEvent(const char* theEntryArg, int theModeArg, bool theUpdated):
379       myEntry(theEntryArg), myMode(theModeArg), myUpdateViewer(theUpdated)
380     {}
381     virtual void Execute() {
382       SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
383       if (!anApp) return;
384
385       Handle(SALOME_InteractiveObject) anIO =
386         new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
387
388       if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
389         SVTK_View* aView = aViewWindow->getView();
390         aView->SetDisplayMode(anIO, myMode);
391         if (myUpdateViewer)
392           aView->Repaint();
393       }
394       else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
395         SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
396         if (soccViewer)
397           soccViewer->switchRepresentation(anIO, myMode, myUpdateViewer);
398       }
399     }
400   };
401
402   ProcessVoidEvent(new TEvent (theEntry, theMode, isUpdated));
403 }
404
405 void GEOM_Swig::setColor(const char* theEntry, int red, int green, int blue, bool isUpdated)
406 {
407   class TEvent: public SALOME_Event {
408     std::string myEntry;
409     int myRed;
410     int myGreen;
411     int myBlue;
412     bool myUpdateViewer;
413   public:
414     TEvent(const char* theEntryArg, int theR, int theG, int theB, bool theUpdated):
415       myEntry(theEntryArg), myRed(theR), myGreen(theG), myBlue(theB), myUpdateViewer(theUpdated)
416     {}
417     virtual void Execute() {
418       SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
419       if (!anApp) return;
420
421       Handle(SALOME_InteractiveObject) anIO =
422         new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
423
424       if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)){
425         SVTK_View* aView = aViewWindow->getView();
426         QColor aColor (myRed, myGreen, myBlue);
427         aView->SetColor(anIO, aColor);
428         if (myUpdateViewer)
429           aView->Repaint();
430       } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
431         Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
432         AIS_ListOfInteractive List;
433         ic->DisplayedObjects(List);
434         AIS_ListIteratorOfListOfInteractive ite (List);
435         for (; ite.More(); ite.Next()) {
436           Handle(SALOME_InteractiveObject) anObj =
437             Handle(SALOME_InteractiveObject)::DownCast(ite.Value()->GetOwner());
438           if (!anObj.IsNull() && anObj->hasEntry() && anObj->isSame(anIO)) {
439             Quantity_Color CSFColor =
440               Quantity_Color(myRed/255., myGreen/255., myBlue/255., Quantity_TOC_RGB);
441             ite.Value()->SetColor(CSFColor);
442             if (ite.Value()->IsKind(STANDARD_TYPE(GEOM_AISShape)))
443               Handle(GEOM_AISShape)::DownCast(ite.Value())->SetShadingColor(CSFColor);
444             ic->Redisplay(ite.Value(), true, true);
445             if (myUpdateViewer)
446               occViewer->update();
447             break;
448           }
449         }
450       }
451     }
452   };
453   ProcessVoidEvent(new TEvent(theEntry, red, green, blue, isUpdated));
454 }
455
456 void GEOM_Swig::setTransparency(const char* theEntry, float transp, bool isUpdated)
457 {
458   class TEvent: public SALOME_Event {
459     std::string myEntry;
460     float myParam;
461     bool myUpdateViewer;
462   public:
463     TEvent(const char* theEntryArg, float theParam, bool theUpdated):
464       myEntry(theEntryArg), myParam(theParam), myUpdateViewer(theUpdated)
465     {}
466     virtual void Execute() {
467       SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
468       if (!anApp) return;
469
470       Handle(SALOME_InteractiveObject) anIO =
471         new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
472
473       if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
474         SVTK_View* aView = aViewWindow->getView();
475         aView->SetTransparency(anIO, myParam);
476         if (myUpdateViewer)
477           aView->Repaint();
478       } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
479         SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
480         if (soccViewer)
481           soccViewer->setTransparency(anIO, myParam, myUpdateViewer);
482       }
483     }
484   };
485
486   ProcessVoidEvent(new TEvent (theEntry, transp, isUpdated));
487 }
488
489
490 class TInitGeomGenEvent: public SALOME_Event {
491 public:
492   typedef bool TResult;
493   TResult myResult;
494   TInitGeomGenEvent() : myResult(false) {}
495   virtual void Execute() {
496     myResult = GeometryGUI::InitGeomGen();
497   }
498 };
499 bool GEOM_Swig::initGeomGen()
500 {
501   return ProcessEvent(new TInitGeomGenEvent());
502 }
503
504
505
506 void GEOM_Swig::eraseGO (const char* Entry, bool allWindows)
507 {
508   class TEvent: public SALOME_Event
509   {
510     std::string myEntry;
511     bool myFromAllWindows;
512   public:
513     TEvent(const char* theEntry, bool fromAllWindows):
514       myEntry(theEntry), myFromAllWindows(fromAllWindows)
515     {}
516     virtual void Execute()
517     {
518       SUIT_Application* app = SUIT_Session::session()->activeApplication();
519       if (!app) return;
520       SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
521       if (!ActiveStudy) return;
522
523       Handle (SALOME_InteractiveObject) aIO = new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
524
525       GEOM_Displayer(ActiveStudy).Erase(aIO, true);
526       /*      if (myFromAllWindows) {
527         QPtrList<SUIT_ViewWindow> aWindows = app->desktop()->windows();
528         SUIT_ViewWindow* aWin = 0;
529         for (aWin = aWindows.first(); aWin; aWin = aWindows.next()) {
530           EraseObject(aWin, aIO);
531         }
532       } else {
533         SUIT_ViewWindow* aWin = app->desktop()->activeWindow();
534         if (aWin)
535           EraseObject(aWin, aIO);
536           }*/
537     }
538
539     /*  private:
540     void EraseObject(SUIT_ViewWindow* theWin, Handle (SALOME_InteractiveObject) theIO)
541     {
542       if (theWin->getViewManager()->getType() == OCCViewer_Viewer::Type()){
543         OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( theWin );
544         if ( vw ) {
545           OCCViewer_ViewManager* vm = dynamic_cast<OCCViewer_ViewManager*>( vw->getViewManager() );
546           if ( vm ) {
547             SOCC_Viewer* aViewer = dynamic_cast<SOCC_Viewer*>(vm->getOCCViewer());
548             if (aViewer) {
549               SALOME_Prs* aPrs = aViewer->CreatePrs(myEntry.c_str());
550               if (aPrs) {
551                 SALOME_OCCPrs* aOccPrs =  dynamic_cast<SALOME_OCCPrs*>(aPrs);
552                 if (aOccPrs) {
553                   aViewer->Erase(aOccPrs);
554                   aViewer->Repaint();
555                 }
556               }
557             }
558           }
559         }
560       } else if (theWin->getViewManager()->getType() == SVTK_Viewer::Type()){
561         SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>( theWin );
562         if (aViewWindow) {
563           aViewWindow->Erase(theIO);
564         }
565       }
566       }*/
567
568   };
569   ProcessVoidEvent(new TEvent(Entry, allWindows));
570 }
571
572
573
574 void GEOM_Swig::setDeflection(const char* theEntry, float theDeflect)
575 {
576   class TEvent: public SALOME_Event {
577     std::string myEntry;
578     float myParam;
579   public:
580     TEvent(const char* theEntryArg, float theParam):
581       myEntry(theEntryArg), myParam(theParam)
582     {}
583     virtual void Execute() {
584       SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
585       if (!anApp) return;
586
587       Handle(SALOME_InteractiveObject) anIO =
588         new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
589
590       if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
591         vtkActorCollection* aActors = aViewWindow->getRenderer()->GetActors();
592         aActors->InitTraversal();
593         while (vtkActor* aAct = aActors->GetNextActor()) {
594           if (GEOM_Actor* aGeomActor = dynamic_cast<GEOM_Actor*>(aAct)) {
595             if (aGeomActor->hasIO()) {
596               Handle(SALOME_InteractiveObject) aNextIO = aGeomActor->getIO();
597               if (aNextIO->isSame(anIO)) {
598                 aGeomActor->setDeflection(myParam);
599                 aViewWindow->Repaint();
600                 return;
601               }
602             }
603           }
604         }
605         //      aView->SetTransparency(anIO, myParam);
606         //aView->Repaint();
607       } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
608         Handle(AIS_InteractiveContext) aContext = occViewer->getAISContext();
609         AIS_ListOfInteractive aAISList;
610         aContext->DisplayedObjects(aAISList);
611         AIS_ListIteratorOfListOfInteractive it(aAISList);
612         for (; it.More(); it.Next()) {
613           Handle(SALOME_InteractiveObject) aObj = 
614             Handle(SALOME_InteractiveObject)::DownCast(it.Value()->GetOwner());
615           if ((!aObj.IsNull()) && aObj->hasEntry() && aObj->isSame(anIO)) {
616             Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(it.Value());
617             if (!aShape.IsNull()) {
618               TopoDS_Shape aSh = aShape->Shape();
619               if (!aSh.IsNull())
620                 BRepTools::Clean(aSh);
621
622               aShape->SetOwnDeviationCoefficient( myParam );
623               aShape->SetOwnHLRDeviationAngle( 1.57 );
624               aContext->Redisplay(aShape);
625               return;
626             }
627           }
628         }
629       }
630     }
631   };
632
633   ProcessVoidEvent(new TEvent (theEntry, theDeflect));
634 }
635