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