Salome HOME
Update copyright information
[modules/geom.git] / src / DisplayGUI / DisplayGUI.cxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  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 // GEOM GEOMGUI : GUI for Geometry component
24 // File   : DisplayGUI.cxx
25 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
26 //
27 #include "DisplayGUI.h"
28 #include <GeometryGUI.h>
29 #include "GeometryGUI_Operations.h"
30 #include <GEOM_Constants.h>
31 #include <GEOM_Displayer.h>
32 #include <GEOM_AISShape.hxx>
33 #include <GEOM_Actor.h>
34
35 #include <SUIT_Desktop.h>
36 #include <SUIT_ViewWindow.h>
37 #include <SUIT_OverrideCursor.h>
38
39 #include <OCCViewer_ViewManager.h>
40 #include <OCCViewer_ViewModel.h>
41
42 #include <SALOME_ListIO.hxx>
43 #include <SALOME_ListIteratorOfListIO.hxx>
44
45 #include <SVTK_ViewWindow.h>
46 #include <SVTK_View.h>
47 #include <SVTK_ViewModel.h>
48 #include <SOCC_ViewModel.h>
49 #include <SVTK_Prs.h>
50 #include <SOCC_Prs.h>
51
52 #include <QtxActionMenuMgr.h>
53
54 #include <SalomeApp_Application.h>
55 #include <LightApp_SelectionMgr.h>
56 #include <SalomeApp_Study.h>
57
58 #include <AIS_ListIteratorOfListOfInteractive.hxx>
59
60 #include <vtkActorCollection.h>
61 #include <vtkRenderer.h>
62
63 #include <QAction>
64
65 //=======================================================================
66 // function : DisplayGUI::DisplayGUI()
67 // purpose  : Constructor
68 //=======================================================================
69 DisplayGUI::DisplayGUI( GeometryGUI* parent ) : GEOMGUI( parent )
70 {
71 }
72
73 //=======================================================================
74 // function : DisplayGUI::~DisplayGUI()
75 // purpose  : Destructor
76 //=======================================================================
77 DisplayGUI::~DisplayGUI()
78 {
79 }
80
81
82 //=======================================================================
83 // function : DisplayGUI::OnGUIEvent()
84 // purpose  : Dispatch menu command
85 //=======================================================================
86 bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
87 {
88   SalomeApp_Application* app = getGeometryGUI()->getApp();
89   if (!app) return false;
90
91   LightApp_SelectionMgr *Sel = app->selectionMgr();
92   SALOME_ListIO selected;
93   Sel->selectedObjects( selected );
94
95   QString aDispModeName;
96   int aDispMode;
97   if ( theCommandID == GEOMOp::OpDisplayMode )
98     aDispMode = GetDisplayMode();
99
100   switch ( theCommandID ) {
101   case GEOMOp::OpDisplayMode:    // MENU VIEW - DISPLAY MODE - WIREFRAME/SHADING/SHADING WITH EDGES
102     //InvertDisplayMode();
103     switch ( aDispMode) {
104     case 0:
105       aDispModeName = tr( "GEOM_MEN_WIREFRAME" );
106       break;
107     case 1:
108       aDispModeName = tr("GEOM_MEN_SHADING");
109       break;
110     case 2:
111       aDispModeName = tr("GEOM_MEN_SHADING_WITH_EDGES");
112       break;
113     default:
114       break;
115     }
116     getGeometryGUI()->action( GEOMOp::OpDisplayMode )->setText( aDispModeName );
117     getGeometryGUI()->menuMgr()->update();
118     break;
119   case GEOMOp::OpShowAll:        // MENU VIEW - SHOW ALL
120     getGeometryGUI()->EmitSignalDeactivateDialog();
121     DisplayAll();
122     break;
123   case GEOMOp::OpShowOnly:       // POPUP MENU - SHOW ONLY
124     getGeometryGUI()->EmitSignalDeactivateDialog();
125     DisplayOnly();
126     break;
127   case GEOMOp::OpHideAll:        // MENU VIEW - HIDE ALL
128     EraseAll();
129     break;
130   case GEOMOp::OpHide:           // POPUP MENU - HIDE
131     Erase();
132     break;
133   case GEOMOp::OpShow:           // POPUP MENU - SHOW
134     getGeometryGUI()->EmitSignalDeactivateDialog();
135     Display();
136     break;
137   case GEOMOp::OpSwitchVectors:  // MENU VIEW - DISPLAY MODE - SHOW EDGE DIRECTION
138     SetVectorMode(!GetVectorMode());
139     getGeometryGUI()->action( GEOMOp::OpSwitchVectors )->setText
140       ( GetVectorMode() ? tr("MEN_VECTOR_MODE_ON") : tr( "MEN_VECTOR_MODE_OFF" ) );
141     getGeometryGUI()->menuMgr()->update();
142     break;
143   case GEOMOp::OpWireframe:      // POPUP MENU - DISPLAY MODE - WIREFRAME
144     ChangeDisplayMode( 0 );
145     break;
146   case GEOMOp::OpShading:        // POPUP MENU - DISPLAY MODE - SHADING
147     ChangeDisplayMode( 1 );
148     break;
149   case GEOMOp::OpShadingWithEdges: // POPUP MENU - DISPLAY MODE - SHADING WITH EDGES
150     ChangeDisplayMode( 2 );
151     break;
152   case GEOMOp::OpTexture:        // POPUP MENU - DISPLAY MODE - TEXTURE
153     ChangeDisplayMode( 3 );
154     break;
155     case GEOMOp::OpVectors:        // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION
156     ChangeDisplayMode( 4 );
157     break;
158   default:
159     app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
160     break;
161   }
162   Sel->setSelectedObjects( selected );
163   return true;
164 }
165
166 //=====================================================================================
167 // function : DisplayGUI::DisplayAll()
168 // purpose  : Display all GEOM objects
169 //=====================================================================================
170 void DisplayGUI::DisplayAll()
171 {
172   SalomeApp_Application* app = getGeometryGUI()->getApp();
173   if ( !app ) return;
174
175   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
176   if ( !appStudy ) return;
177   _PTR(Study) aStudy = appStudy->studyDS();
178   if ( !aStudy ) return;
179   _PTR(SComponent) SC ( aStudy->FindComponent( "GEOM" ) );
180   if ( !SC )
181     return;
182
183   SALOME_ListIO listIO;
184   _PTR(ChildIterator) anIter ( aStudy->NewChildIterator( SC ) );
185   anIter->InitEx( true );
186
187   SUIT_OverrideCursor();
188
189   while( anIter->More() ) {
190     _PTR(SObject) valSO ( anIter->Value() );
191     _PTR(SObject) refSO;
192     if ( !valSO->ReferencedObject( refSO ) ) {
193       listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(),
194                                                   SC->ComponentDataType().c_str(),
195                                                   valSO->GetName().c_str()) );
196     } 
197     anIter->Next();
198   }
199   GEOM_Displayer( appStudy ).Display( listIO, true );
200 }
201
202 //=====================================================================================
203 // function : DisplayGUI::EraseAll()
204 // purpose  : Erase all GEOM objects
205 //=====================================================================================
206 void DisplayGUI::EraseAll()
207 {
208   SUIT_OverrideCursor();
209
210   SUIT_Application* app = getGeometryGUI()->getApp();
211   if ( app ) {
212     SUIT_ViewWindow* vw = app->desktop()->activeWindow();
213     if ( vw ) {
214       SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
215       SUIT_ViewManager* vman = vw->getViewManager();
216       if ( vman->getType() == OCCViewer_Viewer::Type() || 
217            vman->getType() == SVTK_Viewer::Type() ) {
218         GEOM_Displayer( appStudy ).EraseAll();
219       }
220     }
221   }
222 }
223
224 //=====================================================================================
225 // function : DisplayGUI::DisplayOnly()
226 // purpose  : Display selected GEOM objects and erase other
227 //=====================================================================================
228 void DisplayGUI::DisplayOnly()
229 {
230   EraseAll();
231   Display();
232 }
233
234 //=====================================================================================
235 // function : DisplayGUI::Display()
236 // purpose  : Display selected GEOM objects
237 //=====================================================================================
238 void DisplayGUI::Display()
239 {
240   SALOME_ListIO listIO;
241
242   SalomeApp_Application* app = getGeometryGUI()->getApp();
243   if ( !app ) return;
244
245   SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
246   if ( !anActiveStudy ) return;
247
248   //get SalomeApp selection manager
249   LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
250   if ( !aSelMgr ) return;
251
252   SALOME_ListIO aList;
253   aSelMgr->selectedObjects( aList );
254   SALOME_ListIteratorOfListIO It( aList );
255
256   SUIT_OverrideCursor();
257
258   for( ;It.More();It.Next() ) {
259     Handle(SALOME_InteractiveObject) anIObject = It.Value();
260     if ( anIObject->hasEntry() ) {
261       _PTR(SObject) SO ( anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ) );
262       if ( SO && QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str()) ) {
263         _PTR(SComponent) SC ( SO->GetFatherComponent() );
264         // if component is selected
265         listIO.Clear();
266         _PTR(ChildIterator) anIter ( anActiveStudy->studyDS()->NewChildIterator( SO ) );
267         anIter->InitEx( true );
268         while( anIter->More() ) {
269           _PTR(SObject) valSO ( anIter->Value() );
270           _PTR(SObject) refSO;
271           if ( !valSO->ReferencedObject( refSO ) ) {
272             listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(),
273                                                         SC->ComponentDataType().c_str(),
274                                                         valSO->GetName().c_str()) );
275           }
276           anIter->Next();
277         }
278         break;
279       }
280       else {
281         listIO.Append( anIObject );
282       }
283     }
284     else {
285       listIO.Append( anIObject );
286     }
287   }
288   GEOM_Displayer( anActiveStudy ).Display( listIO, true );
289 }
290
291
292 //=====================================================================================
293 // function : DisplayGUI::Erase()
294 // purpose  : Erase selected GEOM objects
295 //=====================================================================================
296 void DisplayGUI::Erase()
297 {
298   SALOME_ListIO listIO;
299
300   SalomeApp_Application* app = getGeometryGUI()->getApp();
301   if ( !app ) return;
302
303   SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
304   if ( !anActiveStudy ) return;
305
306   //get SalomeApp selection manager
307   LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
308   if ( !aSelMgr ) return;
309
310   SALOME_ListIO aList;
311   aSelMgr->selectedObjects( aList );
312   SALOME_ListIteratorOfListIO It( aList );
313
314   SUIT_OverrideCursor();
315
316   for( ; It.More(); It.Next() ) {
317     Handle(SALOME_InteractiveObject) anIObject = It.Value();
318     if ( anIObject->hasEntry() ) {
319       _PTR(SObject) SO ( anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ) );
320       if ( SO && QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str()) ) {
321         _PTR(SComponent) SC ( SO->GetFatherComponent() );
322         // if component is selected
323         listIO.Clear();
324         _PTR(ChildIterator) anIter ( anActiveStudy->studyDS()->NewChildIterator( SO ) );
325         anIter->InitEx( true );
326         while( anIter->More() ) {
327           _PTR(SObject) valSO ( anIter->Value() );
328           _PTR(SObject) refSO;
329           if ( !valSO->ReferencedObject( refSO ) ) {
330             listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(),
331                                                         SC->ComponentDataType().c_str(),
332                                                         valSO->GetName().c_str()) );
333           }
334           anIter->Next();
335         }
336         break;
337       }
338       else {
339         listIO.Append( anIObject );
340       }
341     }
342     else {
343       listIO.Append( anIObject );
344     }
345   }
346
347   SUIT_ViewWindow* viewWindow = app->desktop()->activeWindow();
348   bool aIsForced = true;
349   if(viewWindow->getViewManager()->getType() == SVTK_Viewer::Type())
350     aIsForced = false;
351
352   GEOM_Displayer(anActiveStudy).Erase( listIO, aIsForced);
353   getGeometryGUI()->getApp()->selectionMgr()->clearSelected();
354 }
355
356 //=====================================================================================
357 // function : DisplayGUI::SetDisplayMode()
358 // purpose  : Set display mode for the viewer (current viewer if <viewWindow> - 0 )
359 //=====================================================================================
360 void DisplayGUI::SetDisplayMode( const int mode, SUIT_ViewWindow* viewWindow )
361 {
362   SUIT_OverrideCursor();
363
364   if ( !viewWindow ) 
365     viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
366   if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
367     SVTK_View* aView = ((SVTK_ViewWindow*)viewWindow)->getView();
368     aView->SetDisplayMode( mode );
369     GeometryGUI::Modified();
370   } 
371   else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
372     OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer();
373     Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
374
375     AIS_DisplayMode newmode;
376     switch (mode) {
377     case 0:
378       newmode = AIS_WireFrame;
379       break;
380     case 1:
381       newmode = AIS_Shaded;
382       break;
383     case 2:
384       newmode = AIS_DisplayMode( GEOM_AISShape::ShadingWithEdges );
385       break;
386     case 3:
387       newmode = AIS_DisplayMode( GEOM_AISShape::TexturedShape );
388       break;
389     default:
390       break;
391     }
392
393     AIS_ListOfInteractive List;
394     ic->DisplayedObjects( List );
395     AIS_ListOfInteractive List1;
396     ic->ObjectsInCollector( List1 );
397     List.Append( List1 );
398     
399     AIS_ListIteratorOfListOfInteractive ite( List );
400     while( ite.More() ) {
401       if( ite.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) {
402         Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( ite.Value() );
403         ic->SetDisplayMode( aSh, Standard_Integer( newmode ),true );
404       }
405       ite.Next();
406     }
407       
408     ic->SetDisplayMode( newmode, Standard_False );
409
410     GeometryGUI::Modified();
411   }
412 }
413
414 //=====================================================================================
415 // function : DisplayGUI::GetDisplayMode()
416 // purpose  : Get display mode of the viewer (current viewer if <viewWindow> - 0 )
417 //=====================================================================================
418 int DisplayGUI::GetDisplayMode( SUIT_ViewWindow* viewWindow )
419 {
420   int dispMode = 0;
421   if ( !viewWindow ) 
422     viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
423   if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
424     SVTK_View* aView = ((SVTK_ViewWindow*)viewWindow)->getView();
425     dispMode = aView->GetDisplayMode();
426   } 
427   else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
428     OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer();
429     Handle(AIS_InteractiveContext) ic = v3d->getAISContext();    
430     dispMode = ic->DisplayMode();
431   }
432   return dispMode;
433 }
434
435 //=====================================================================================
436 // function : DisplayGUI::SetVectorsMode()
437 // purpose  : Set vector mode for the viewer
438 //=====================================================================================
439 void DisplayGUI::SetVectorMode( const bool mode, SUIT_ViewWindow* viewWindow )
440 {
441   SUIT_OverrideCursor();
442
443   if ( !viewWindow ) 
444     viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
445   if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
446     viewWindow->setProperty( "VectorsMode", mode );
447     SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( viewWindow );
448     vtkActorCollection* allActors = vw->getRenderer()->GetActors();
449     allActors->InitTraversal();
450     while (vtkActor* actor = allActors->GetNextActor()) {
451       if (actor->GetVisibility()) { // only for visible actors
452         GEOM_Actor* aGeomActor = 0;
453         if ( actor->IsA( "GEOM_Actor" ) ) {
454           aGeomActor = GEOM_Actor::SafeDownCast( actor );
455           if ( aGeomActor )
456             aGeomActor->SetVectorMode( mode );
457         }
458       }
459     }
460     GeometryGUI::Modified();
461   }
462   else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
463     viewWindow->setProperty( "VectorsMode", mode );
464     OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer();
465     Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
466     AIS_ListOfInteractive List;
467     ic->DisplayedObjects( List );
468     AIS_ListOfInteractive List1;
469     ic->ObjectsInCollector( List1 );
470     List.Append( List1 );
471
472     AIS_ListIteratorOfListOfInteractive ite( List );
473     while( ite.More() ) {
474       if( ite.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) {
475         Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( ite.Value() );
476         aSh->SetDisplayVectors(mode);
477         ic->RecomputePrsOnly(ite.Value());
478       }
479       ite.Next();
480     }
481     GeometryGUI::Modified();
482   }
483 }
484
485 //=====================================================================================
486 // function : DisplayGUI::GetVectorMode()
487 // purpose  : Get the "show edge direction" mode of the viewer
488 //=====================================================================================
489 int DisplayGUI::GetVectorMode( SUIT_ViewWindow* viewWindow )
490 {
491   if ( !viewWindow ) 
492     viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
493   return viewWindow->property( "VectorsMode" ).toBool();
494 }
495
496 //=====================================================================================
497 // function : DisplayGUI::InvertDisplayMode()
498 // purpose  : Invert display mode ( shading <-> wireframe ) for the viewer 
499 //            (current viewer if <viewWindow> = 0 )
500 //=====================================================================================
501 void DisplayGUI::InvertDisplayMode( SUIT_ViewWindow* viewWindow )
502 {
503   SetDisplayMode( 1 - GetDisplayMode( viewWindow ) );
504 }
505
506 //=====================================================================================
507 // function : DisplayGUI::ChangeDisplayMode()
508 // purpose  : Set display mode for selected objects in the viewer given
509 //            (current viewer if <viewWindow> = 0 )
510 //=====================================================================================
511 void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow )
512 {
513   SalomeApp_Application* app = getGeometryGUI()->getApp();
514   if ( !app ) return;
515
516   if ( !viewWindow ) 
517     viewWindow = app->desktop()->activeWindow();
518
519   LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
520   if ( !aSelMgr ) return;
521
522   SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
523   
524   if(!aStudy)
525     return;
526
527   SUIT_OverrideCursor();
528
529   SALOME_ListIO aList;
530
531   if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
532     SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( viewWindow );
533     SVTK_View* aView = vw->getView();
534     int mgrId = viewWindow->getViewManager()->getGlobalId();
535     bool vectorMode = false;
536
537     aSelMgr->selectedObjects( aList );
538     SALOME_ListIteratorOfListIO It( aList );
539
540     for( ;It.More(); It.Next() ) {
541       SVTK_Viewer* stvkViewer = dynamic_cast<SVTK_Viewer*>(vw->getViewManager()->getViewModel());
542       SVTK_Prs* vtkPrs =
543         stvkViewer ? dynamic_cast<SVTK_Prs*>( stvkViewer->CreatePrs( It.Value()->getEntry() ) ) : 0;
544       if ( vtkPrs && !vtkPrs->IsNull() ) {
545         if (mode == 0 )
546           aView->ChangeRepresentationToWireframe( vtkPrs->GetObjects() );
547         else if ( mode == 1 )
548           aView->ChangeRepresentationToSurface( vtkPrs->GetObjects() );
549         else if ( mode == 2 )
550           aView->ChangeRepresentationToSurfaceWithEdges( vtkPrs->GetObjects() );
551         else if ( mode == 4 ) {
552           vtkActorCollection* anActors = vtkPrs->GetObjects();
553           anActors->InitTraversal();
554           while (vtkActor* anAct = anActors->GetNextActor()) {
555             GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(anAct);
556             vectorMode = !aGeomActor->GetVectorMode();
557             aGeomActor->SetVectorMode(vectorMode);
558           }
559         }
560         if(mode == 0 || mode == 1 || mode == 2) {
561           aStudy->setObjectProperty(mgrId,It.Value()->getEntry(),DISPLAY_MODE_PROP, mode);
562         }
563         else if (mode == 4) {
564           aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),VECTOR_MODE_PROP, vectorMode);        
565         }
566       }
567     }
568     aView->Repaint();
569     GeometryGUI::Modified();
570   }
571   else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
572     OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer();
573     Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
574
575     aSelMgr->selectedObjects( aList );
576     SALOME_ListIteratorOfListIO It( aList );
577     int mgrId = viewWindow->getViewManager()->getGlobalId();
578     bool vectorMode = 0;
579
580     for( ;It.More(); It.Next() ) {
581       SOCC_Viewer* soccViewer = (SOCC_Viewer*)(viewWindow->getViewManager()->getViewModel());
582       SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( soccViewer->CreatePrs( It.Value()->getEntry() ) );
583       if ( occPrs && !occPrs->IsNull() ) {
584         AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes );
585         AIS_ListIteratorOfListOfInteractive interIter( shapes );
586         for ( ; interIter.More(); interIter.Next() ) {
587           if ( mode == 0 )
588             ic->SetDisplayMode( interIter.Value(), AIS_WireFrame, false );
589           else if ( mode == 1 )
590             ic->SetDisplayMode( interIter.Value(), AIS_Shaded, false );
591           else if ( mode == 2 )
592             ic->SetDisplayMode( interIter.Value(), GEOM_AISShape::ShadingWithEdges, false );
593           else if ( mode == 3 )
594             ic->SetDisplayMode( interIter.Value(), AIS_ExactHLR, false );
595           else if (mode == 4 ) {
596             Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() );
597             if ( !aSh.IsNull() ) {
598               vectorMode = !aSh->isShowVectors();      
599               aSh->SetDisplayVectors(vectorMode);
600               ic->RecomputePrsOnly(interIter.Value());
601             }
602           }
603         }
604         if(mode == 0 || mode == 1 || mode == 2 || mode == 3) {
605           aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),DISPLAY_MODE_PROP, mode);
606         }
607         else if (mode == 4) {
608           aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),VECTOR_MODE_PROP, vectorMode);
609         }
610       }
611     }
612     ic->UpdateCurrentViewer();
613     GeometryGUI::Modified();
614   }
615 }
616
617 //=====================================================================================
618 // EXPORTED METHODS
619 //=====================================================================================
620 extern "C"
621 {
622 #ifdef WIN32
623   __declspec( dllexport )
624 #endif
625   GEOMGUI* GetLibGUI( GeometryGUI* parent )
626   {
627     return new DisplayGUI( parent );
628   }
629 }