1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // GEOM GEOMGUI : GUI for Geometry component
24 // File : libGEOM_Swig.cxx
25 // Author : Nicolas REJNERI, Paul RASCLE
27 #include "libGEOM_Swig.h"
29 #include "GeometryGUI.h"
30 #include "GEOMToolsGUI.h"
32 #include "SUIT_Desktop.h"
33 #include "SUIT_Session.h"
34 #include "SalomeApp_Application.h"
35 #include "SalomeApp_Study.h"
37 #include "OB_Browser.h"
39 #include "OCCViewer_ViewWindow.h"
40 #include "OCCViewer_ViewManager.h"
41 #include "SOCC_ViewModel.h"
44 #include "SVTK_ViewModel.h"
45 #include "SVTK_ViewWindow.h"
46 #include "SVTK_View.h"
47 #include "SVTK_Renderer.h"
50 #include "GEOM_Actor.h"
51 #include "GEOM_Client.hxx"
52 #include "GEOM_AISShape.hxx"
53 #include "GEOM_InteractiveObject.hxx"
54 #include "GEOM_Displayer.h"
55 #include "GEOM_Constants.h"
57 #include "SALOME_Event.h"
61 #include <TopoDS_Shape.hxx>
62 #include <AIS_ListOfInteractive.hxx>
63 #include <AIS_ListIteratorOfListOfInteractive.hxx>
64 #include <AIS_Drawer.hxx>
65 #include <Prs3d_IsoAspect.hxx>
66 #include <BRepTools.hxx>
69 #include <SALOMEconfig.h>
70 #include CORBA_SERVER_HEADER(GEOM_Gen)
72 #include <vtkRenderer.h>
74 static SHAPE_READER(ShapeReader);
76 inline OCCViewer_Viewer* GetOCCViewer(SUIT_Application* theApp){
77 SUIT_ViewWindow* window = theApp->desktop()->activeWindow();
78 if(window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()){
79 OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( window );
81 OCCViewer_ViewManager* vm = dynamic_cast<OCCViewer_ViewManager*>( vw->getViewManager() );
83 return vm->getOCCViewer();
90 inline SVTK_ViewWindow* GetSVTKViewWindow(SUIT_Application* theApp){
91 SUIT_ViewWindow* window = theApp->desktop()->activeWindow();
92 if(window && window->getViewManager()->getType() == SVTK_Viewer::Type())
93 return dynamic_cast<SVTK_ViewWindow*>( window );
98 GEOM_Swig::GEOM_Swig()
100 // MESSAGE("Constructeur");
103 GEOM_Swig::~GEOM_Swig()
105 // MESSAGE("Destructeur");
108 void GEOM_Swig::createAndDisplayGO (const char* Entry, bool isUpdated)
110 class TEvent: public SALOME_Event
115 TEvent(const char* theEntry, bool toUpdateViewer):
117 myUpdateViewer(toUpdateViewer)
119 virtual void Execute()
121 SUIT_Application* app = SUIT_Session::session()->activeApplication();
124 SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
125 if (!ActiveStudy) return;
127 _PTR(Study) aStudy(ActiveStudy->studyDS());
128 _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
130 GEOM::GEOM_Gen_var Geom = GeometryGUI::GetGeomGen();
131 if (CORBA::is_nil(Geom)) {
132 GeometryGUI::InitGeomGen();
133 Geom = GeometryGUI::GetGeomGen();
135 if (CORBA::is_nil(Geom))
138 std::string aFatherIOR;
139 _PTR(SComponent) father = aStudy->FindComponent("GEOM");
142 if (!father->ComponentIOR(aFatherIOR)) {
143 CORBA::String_var objStr = SalomeApp_Application::orb()->object_to_string(Geom);
144 aStudyBuilder->LoadWith(father, objStr.in());
145 father->ComponentIOR(aFatherIOR);
148 _PTR(SObject) obj = aStudy->FindObjectID(myEntry);
153 _PTR(GenericAttribute) anAttr;
154 if (!obj->FindAttribute(anAttr, "AttributeIOR"))
156 _PTR(AttributeIOR) anIOR(anAttr);
157 std::string anIORValue = anIOR->Value();
159 GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(anIORValue.c_str());
160 TopoDS_Shape Shape = ShapeReader.GetShape(Geom,aShape);
161 if (!Shape.IsNull()) {
162 if (obj->FindAttribute(anAttr, "AttributeName")) {
163 _PTR(AttributeName) aName (anAttr);
164 std::string aNameValue = aName->Value();
166 /*SUIT_Operation* op = new SalomeApp_ImportOperation (app);
169 _PTR(SObject) newObj1 = aStudyBuilder->NewObject(father);
170 aStudyBuilder->Addreference(newObj1, obj);
171 // commit transaction
173 Handle(GEOM_InteractiveObject) anIO =
174 new GEOM_InteractiveObject (const_cast<char*>(anIORValue.c_str()),
175 const_cast<char*>(aFatherIOR.c_str()),
177 const_cast<char*>( obj->GetID().c_str()));
179 GEOM_Displayer(ActiveStudy).Display(anIO, myUpdateViewer);
180 /*if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) {
181 SVTK_View* aView = aViewWindow->getView();
182 int aMode = aView->GetDisplayMode();
184 vtkActorCollection* theActors =
185 GEOM_AssemblyBuilder::BuildActors(Shape,0,aMode,true);
186 theActors->InitTraversal();
187 while (vtkActor* anActor = theActors->GetNextActor()) {
188 GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor);
189 GActor->setName(const_cast<char*>(aNameValue.c_str()));
191 aView->Display(GActor);
194 } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app)) {
195 Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
196 Handle(GEOM_AISShape) aSh =
197 new GEOM_AISShape (Shape,const_cast<char*>(aNameValue.c_str()));
198 aSh->setName(const_cast<char*>(aNameValue.c_str()));
201 ic->AddOrRemoveCurrentObject(aSh,true);
203 // update object browser
204 SalomeApp_Application* app = NULL; //dynamic_cast<SalomeApp_Application*>(app);
206 CAM_Module* module = app->module("Geometry");
207 SalomeApp_Module* appMod = dynamic_cast<SalomeApp_Module*>(module);
209 appMod->updateObjBrowser(true);
216 // MESSAGE("createAndDisplayGO");
217 ProcessVoidEvent(new TEvent (Entry, isUpdated));
219 class TEventUpdateBrowser: public SALOME_Event
222 TEventUpdateBrowser() {}
223 virtual void Execute() {
224 SalomeApp_Application* app =
225 dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
227 CAM_Module* module = app->module("Geometry");
228 SalomeApp_Module* appMod = dynamic_cast<SalomeApp_Module*>(module);
229 if (appMod) appMod->updateObjBrowser(true);
235 ProcessVoidEvent(new TEventUpdateBrowser ());
238 void GEOM_Swig::createAndDisplayFitAllGO (const char* Entry)
240 class TEventFitAll: public SALOME_Event
244 virtual void Execute() {
245 SUIT_Application* app = SUIT_Session::session()->activeApplication();
248 if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app))
250 SVTK_View* aView = aViewWindow->getView();
251 aView->GetRenderer()->OnFitAll();
253 else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app))
255 Handle(V3d_Viewer) aViewer3d = occViewer->getViewer3d();
256 aViewer3d->InitActiveViews();
258 if (aViewer3d->MoreActiveViews())
259 aViewer3d->ActiveView()->FitAll();
264 createAndDisplayGO(Entry);
265 ProcessVoidEvent(new TEventFitAll());
268 void GEOM_Swig::UpdateViewer()
270 class TEventUpdateViewer: public SALOME_Event
273 TEventUpdateViewer() {}
274 virtual void Execute() {
275 SUIT_Application* app = SUIT_Session::session()->activeApplication();
277 SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
278 if (!ActiveStudy) return;
280 GEOM_Displayer(ActiveStudy).UpdateViewer();
284 ProcessVoidEvent(new TEventUpdateViewer());
287 int GEOM_Swig::getIndexTopology(const char* SubIOR, const char* IOR)
289 GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
290 if (CORBA::is_nil(aGeomGen))
293 GEOM::GEOM_Object_var aMainShape = aGeomGen->GetIORFromString(IOR);
294 GEOM::GEOM_Object_var aSubShape = aGeomGen->GetIORFromString(SubIOR);
295 if (CORBA::is_nil(aMainShape) || CORBA::is_nil(aSubShape))
298 GEOM::GEOM_IShapesOperations_var anIShapesOperations =
299 aGeomGen->GetIShapesOperations(aMainShape->GetStudyID());
300 if (CORBA::is_nil(anIShapesOperations))
303 return anIShapesOperations->GetTopologyIndex(aMainShape, aSubShape);
306 const char* GEOM_Swig::getShapeTypeString(const char* IOR)
308 TCollection_AsciiString aTypeName ("Shape of unknown type");
310 GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
311 if (!CORBA::is_nil(aGeomGen))
313 GEOM::GEOM_Object_var aShape = aGeomGen->GetIORFromString(IOR);
314 if (!CORBA::is_nil(aShape))
316 GEOM::GEOM_IShapesOperations_var anIShapesOperations =
317 aGeomGen->GetIShapesOperations(aShape->GetStudyID());
318 if (!CORBA::is_nil(anIShapesOperations))
320 aTypeName = anIShapesOperations->GetShapeTypeString(aShape);
325 return CORBA::string_dup(aTypeName.ToCString());
329 const char* GEOM_Swig::getShapeTypeIcon(const char* IOR)
331 GEOM::GEOM_Gen_var Geom = GeometryGUI::GetGeomGen();
332 if ( CORBA::is_nil( Geom ) )
335 GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(IOR);
336 TopoDS_Shape shape = ShapeReader.GetShape(Geom, aShape);
338 if( shape.IsNull() ) {
342 switch (shape.ShapeType() )
344 case TopAbs_COMPOUND:
345 { return "ICON_OBJBROWSER_COMPOUND" ;}
346 case TopAbs_COMPSOLID:
347 { return "ICON_OBJBROWSER_COMPSOLID" ;}
349 { return "ICON_OBJBROWSER_SOLID" ;}
351 { return "ICON_OBJBROWSER_SHELL" ;}
353 { return "ICON_OBJBROWSER_FACE" ;}
355 { return "ICON_OBJBROWSER_WIRE" ;}
357 { return "ICON_OBJBROWSER_EDGE" ;}
359 { return "ICON_OBJBROWSER_VERTEX" ;}
365 void GEOM_Swig::setDisplayMode(const char* theEntry, int theMode, bool isUpdated)
367 class TEvent: public SALOME_Event {
372 TEvent(const char* theEntryArg, int theModeArg, bool theUpdated):
373 myEntry(theEntryArg), myMode(theModeArg), myUpdateViewer(theUpdated)
375 virtual void Execute() {
376 SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
379 Handle(SALOME_InteractiveObject) anIO =
380 new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
382 if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
383 SVTK_View* aView = aViewWindow->getView();
384 aView->SetDisplayMode(anIO, myMode);
388 else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
389 SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
391 soccViewer->switchRepresentation(anIO, myMode, myUpdateViewer);
396 ProcessVoidEvent(new TEvent (theEntry, theMode, isUpdated));
399 void GEOM_Swig::setVectorsMode(const char* theEntry, bool isOn, bool isUpdated)
401 class TEvent: public SALOME_Event {
406 TEvent(const char* theEntryArg, bool theOn, bool theUpdated):
407 myEntry(theEntryArg), myOn(theOn), myUpdateViewer(theUpdated)
409 virtual void Execute() {
410 SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
413 Handle(SALOME_InteractiveObject) anIO =
414 new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
416 if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
417 SVTK_View* aView = aViewWindow->getView();
418 SVTK_Viewer* stvkViewer = dynamic_cast<SVTK_Viewer*>(aViewWindow->getViewManager()->getViewModel());
419 SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( stvkViewer->CreatePrs( myEntry.c_str() ) );
420 vtkActorCollection* anActors = vtkPrs->GetObjects();
421 anActors->InitTraversal();
422 while (vtkActor* anAct = anActors->GetNextActor()) {
423 GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(anAct);
424 aGeomActor->SetVectorMode(!aGeomActor->GetVectorMode());
429 else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
430 Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
431 SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
433 SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( soccViewer->CreatePrs( myEntry.c_str() ) );
434 if ( occPrs && !occPrs->IsNull() ) {
435 AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes );
436 AIS_ListIteratorOfListOfInteractive interIter( shapes );
437 for ( ; interIter.More(); interIter.Next() ) {
438 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() );
439 aSh->SetDisplayVectors(myOn);
440 ic->RecomputePrsOnly(interIter.Value());
448 ProcessVoidEvent(new TEvent (theEntry, isOn, isUpdated));
451 void GEOM_Swig::setColor(const char* theEntry, int red, int green, int blue, bool isUpdated)
453 class TEvent: public SALOME_Event {
460 TEvent(const char* theEntryArg, int theR, int theG, int theB, bool theUpdated):
461 myEntry(theEntryArg), myRed(theR), myGreen(theG), myBlue(theB), myUpdateViewer(theUpdated)
463 virtual void Execute() {
464 SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
466 GEOMToolsGUI::SetColor( myEntry, QColor( myRed, myGreen, myBlue), myUpdateViewer );
469 ProcessVoidEvent(new TEvent(theEntry, red, green, blue, isUpdated));
472 void GEOM_Swig::setIsos(const char* Entry, int nbU, int nbV, bool isUpdated )
474 class TEvent: public SALOME_Event {
479 TEvent(const char* theEntry, int theNbU, int theNbV, bool theUpdated):
480 myEntry(theEntry), myNbU(theNbU), myNbV(theNbV), myUpdateViewer(theUpdated)
482 virtual void Execute() {
483 SUIT_Application* app = SUIT_Session::session()->activeApplication();
485 SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
488 Handle(SALOME_InteractiveObject) anIO =
489 new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
491 if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) {
492 SVTK_Viewer* aView = dynamic_cast<SVTK_Viewer*>(aViewWindow->getViewManager()->getViewModel());
493 SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( aView->CreatePrs( myEntry.c_str() ) );
495 vtkActorCollection* anActors = vtkPrs->GetObjects();
496 anActors->InitTraversal();
497 GEOM_Actor* anActor = GEOM_Actor::SafeDownCast( anActors->GetNextActor() );
499 int aIsos[2]={myNbU,myNbV};
500 anActor->SetNbIsos(aIsos);
501 anActor->StoreIsoNumbers();
502 QString anIsos = QString("%1%2%3").arg(myNbU).arg(DIGIT_SEPARATOR).arg(myNbV);
503 int aMgrId = aView->getViewManager()->getGlobalId();
504 study->setObjectProperty(aMgrId, myEntry.c_str(), ISOS_PROP, anIsos);
511 else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app)) {
512 Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
513 SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
515 int aMgrId = soccViewer->getViewManager()->getGlobalId();
516 SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( soccViewer->CreatePrs( myEntry.c_str() ) );
517 if ( occPrs && !occPrs->IsNull() ) {
518 AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes );
519 AIS_ListIteratorOfListOfInteractive interIter( shapes );
520 for ( ; interIter.More(); interIter.Next() ) {
521 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() );
522 if ( !aSh.IsNull() ) {
523 Handle(AIS_Drawer) drawer = aSh->Attributes();
524 QVariant v = study->getObjectProperty( aMgrId, myEntry.c_str(), EDGE_WIDTH_PROP, QVariant() );
525 int width = v.isValid() ? v.toInt() : 1;
526 drawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width, myNbU) );
527 drawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width, myNbV) );
528 aSh->storeIsoNumbers();
529 ic->SetLocalAttributes(aSh, drawer);
531 QString anIsos = QString("%1%2%3").arg(myNbU).arg(DIGIT_SEPARATOR).arg(myNbV);
532 study->setObjectProperty(aMgrId, myEntry.c_str(), ISOS_PROP, anIsos);
541 ProcessVoidEvent(new TEvent (Entry, nbU, nbV, isUpdated));
544 void GEOM_Swig::setTransparency(const char* theEntry, float transp, bool isUpdated)
546 class TEvent: public SALOME_Event {
551 TEvent(const char* theEntryArg, float theParam, bool theUpdated):
552 myEntry(theEntryArg), myParam(theParam), myUpdateViewer(theUpdated)
554 virtual void Execute() {
555 SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
558 Handle(SALOME_InteractiveObject) anIO =
559 new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
561 if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
562 SVTK_View* aView = aViewWindow->getView();
563 aView->SetTransparency(anIO, myParam);
566 } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
567 SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
569 soccViewer->setTransparency(anIO, myParam, myUpdateViewer);
574 ProcessVoidEvent(new TEvent (theEntry, transp, isUpdated));
578 class TInitGeomGenEvent: public SALOME_Event {
580 typedef bool TResult;
582 TInitGeomGenEvent() : myResult(false) {}
583 virtual void Execute() {
584 myResult = GeometryGUI::InitGeomGen();
587 bool GEOM_Swig::initGeomGen()
589 return ProcessEvent(new TInitGeomGenEvent());
594 void GEOM_Swig::eraseGO (const char* Entry, bool allWindows)
596 class TEvent: public SALOME_Event
599 bool myFromAllWindows;
601 TEvent(const char* theEntry, bool fromAllWindows):
602 myEntry(theEntry), myFromAllWindows(fromAllWindows)
604 virtual void Execute()
606 SUIT_Application* app = SUIT_Session::session()->activeApplication();
608 SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
609 if (!ActiveStudy) return;
611 Handle (SALOME_InteractiveObject) aIO = new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
613 GEOM_Displayer(ActiveStudy).Erase(aIO, true);
614 /* if (myFromAllWindows) {
615 QPtrList<SUIT_ViewWindow> aWindows = app->desktop()->windows();
616 SUIT_ViewWindow* aWin = 0;
617 for (aWin = aWindows.first(); aWin; aWin = aWindows.next()) {
618 EraseObject(aWin, aIO);
621 SUIT_ViewWindow* aWin = app->desktop()->activeWindow();
623 EraseObject(aWin, aIO);
628 void EraseObject(SUIT_ViewWindow* theWin, Handle (SALOME_InteractiveObject) theIO)
630 if (theWin->getViewManager()->getType() == OCCViewer_Viewer::Type()){
631 OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( theWin );
633 OCCViewer_ViewManager* vm = dynamic_cast<OCCViewer_ViewManager*>( vw->getViewManager() );
635 SOCC_Viewer* aViewer = dynamic_cast<SOCC_Viewer*>(vm->getOCCViewer());
637 SALOME_Prs* aPrs = aViewer->CreatePrs(myEntry.c_str());
639 SALOME_OCCPrs* aOccPrs = dynamic_cast<SALOME_OCCPrs*>(aPrs);
641 aViewer->Erase(aOccPrs);
648 } else if (theWin->getViewManager()->getType() == SVTK_Viewer::Type()){
649 SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>( theWin );
651 aViewWindow->Erase(theIO);
657 ProcessVoidEvent(new TEvent(Entry, allWindows));
662 void GEOM_Swig::setDeflection(const char* theEntry, float theDeflect)
664 class TEvent: public SALOME_Event {
668 TEvent(const char* theEntryArg, float theParam):
669 myEntry(theEntryArg), myParam(theParam)
671 virtual void Execute() {
672 SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
675 Handle(SALOME_InteractiveObject) anIO =
676 new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
678 if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
679 vtkActorCollection* aActors = aViewWindow->getRenderer()->GetActors();
680 aActors->InitTraversal();
681 while (vtkActor* aAct = aActors->GetNextActor()) {
682 if (GEOM_Actor* aGeomActor = dynamic_cast<GEOM_Actor*>(aAct)) {
683 if (aGeomActor->hasIO()) {
684 Handle(SALOME_InteractiveObject) aNextIO = aGeomActor->getIO();
685 if (aNextIO->isSame(anIO)) {
686 aGeomActor->setDeflection(myParam);
687 aViewWindow->Repaint();
693 // aView->SetTransparency(anIO, myParam);
695 } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
696 Handle(AIS_InteractiveContext) aContext = occViewer->getAISContext();
697 AIS_ListOfInteractive aAISList;
698 aContext->DisplayedObjects(aAISList);
699 AIS_ListIteratorOfListOfInteractive it(aAISList);
700 for (; it.More(); it.Next()) {
701 Handle(SALOME_InteractiveObject) aObj =
702 Handle(SALOME_InteractiveObject)::DownCast(it.Value()->GetOwner());
703 if ((!aObj.IsNull()) && aObj->hasEntry() && aObj->isSame(anIO)) {
704 Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(it.Value());
705 if (!aShape.IsNull()) {
706 TopoDS_Shape aSh = aShape->Shape();
708 BRepTools::Clean(aSh);
710 aShape->SetOwnDeviationCoefficient( myParam );
711 aShape->SetOwnHLRDeviationAngle( 1.57 );
712 aContext->Redisplay(aShape);
721 ProcessVoidEvent(new TEvent (theEntry, theDeflect));