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