Salome HOME
Merge branch 'master' into rnc/t_shape_plugin
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI.cxx
1 // Copyright (C) 2007-2015  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, or (at your option) any later version.
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   : GEOMBase_Tools.cxx
25 // Author : Damien COQUERET, Open CASCADE S.A.S.
26
27 #include "GEOMToolsGUI.h"
28 #include "GEOMToolsGUI_DeleteDlg.h"
29
30 #include <GeometryGUI.h>
31 #include "GeometryGUI_Operations.h"
32 #include <GEOMBase.h>
33 #include <GEOM_Operation.h>
34 #include <GEOM_Displayer.h>
35
36 #include <SUIT_Session.h>
37 #include <SUIT_OverrideCursor.h>
38 #include <SUIT_MessageBox.h>
39 #include <SUIT_Tools.h>
40 #include <SUIT_FileDlg.h>
41 #include <SUIT_Desktop.h>
42 #include <SUIT_ViewModel.h>
43 #include <SUIT_ViewManager.h>
44
45 #include <SalomeApp_Application.h>
46 #include <SalomeApp_Study.h>
47 #include <LightApp_SelectionMgr.h>
48 #include <GEOMImpl_Types.hxx>
49
50 #include <SALOME_ListIO.hxx>
51 #include <SALOME_Prs.h>
52
53 // QT Includes
54 #include <QApplication>
55 #include <QMap>
56 #include <QRegExp>
57
58 // OCCT Includes
59 #include <TCollection_AsciiString.hxx>
60
61 typedef QMap<QString, QString> FilterMap;
62 static QString lastUsedFilter;
63
64 //=======================================================================
65 // function : getParentComponent
66 // purpose  : Get object's parent component entry
67 //=======================================================================
68 static QString getParentComponent( _PTR( SObject ) obj )
69 {
70   if ( obj ) {
71     _PTR(SComponent) comp = obj->GetFatherComponent();
72     if ( comp )
73       return QString( comp->GetID().c_str() );
74   }
75   return QString();
76 }
77
78 //=====================================================================================
79 // function : inUse
80 // purpose  : check if the object(s) passed as the the second arguments are used
81 //            by the other objects in the study
82 //=====================================================================================
83 static bool inUse( _PTR(Study) study, const QString& component, const QMap<QString,QString>& objects )
84 {
85   _PTR(SObject) comp = study->FindObjectID( component.toLatin1().data() );
86   if ( !comp )
87     return false;
88
89   // collect all GEOM objects being deleted
90   QMap<QString, GEOM::GEOM_BaseObject_var> gobjects;
91   QMap<QString, QString>::ConstIterator oit;
92   std::list<_PTR(SObject)> aSelectedSO;
93   for ( oit = objects.begin(); oit != objects.end(); ++oit ) {
94     _PTR(SObject) so = study->FindObjectID( oit.key().toLatin1().data() );
95     if ( !so )
96       continue;
97     aSelectedSO.push_back(so);
98     CORBA::Object_var corbaObj_rem = GeometryGUI::ClientSObjectToObject( so );
99     GEOM::GEOM_BaseObject_var geomObj_rem = GEOM::GEOM_BaseObject::_narrow( corbaObj_rem );
100     if( CORBA::is_nil( geomObj_rem ) )
101       continue;
102     gobjects.insert( oit.key(), geomObj_rem );
103   }
104
105   // Search References with other Modules
106   std::list< _PTR(SObject) >::iterator itSO = aSelectedSO.begin();
107   for ( ; itSO != aSelectedSO.end(); ++itSO ) {
108     std::vector<_PTR(SObject)> aReferences = study->FindDependances( *itSO  );
109     int aRefLength = aReferences.size();
110     if (aRefLength) {
111       for (int i = 0; i < aRefLength; i++) {
112         _PTR(SObject) firstSO( aReferences[i] );
113         _PTR(SComponent) aComponent = firstSO->GetFatherComponent();
114         QString type = aComponent->ComponentDataType().c_str();
115         if ( type == "SMESH" )
116           return true;
117       }
118     }
119   }
120
121   // browse through all GEOM data tree
122   _PTR(ChildIterator) it ( study->NewChildIterator( comp ) );
123   for ( it->InitEx( true ); it->More(); it->Next() ) {
124     _PTR(SObject) child( it->Value() );
125     CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( child );
126     GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
127     if( CORBA::is_nil( geomObj ) )
128       continue;
129
130     GEOM::ListOfGBO_var list = geomObj->GetDependency();
131     if( list->length() == 0 )
132       continue;
133
134     for( int i = 0; i < list->length(); i++ ) {
135       bool depends = false;
136       bool deleted = false;
137       QMap<QString, GEOM::GEOM_BaseObject_var>::Iterator git;
138       for ( git = gobjects.begin(); git != gobjects.end() && ( !depends || !deleted ); ++git ) {
139         depends = depends || list[i]->_is_equivalent( *git );
140         deleted = deleted || git.key() == child->GetID().c_str() ;//geomObj->_is_equivalent( *git );
141       }
142       if ( depends && !deleted )
143         return true;
144     }
145   }
146   return false;
147 }
148
149 //=======================================================================
150 // function : getGeomChildrenAndFolders
151 // purpose  : Get direct (1-level) GEOM objects under each folder, sub-folder, etc. and these folders itself
152 //=======================================================================
153 static void getGeomChildrenAndFolders( _PTR(SObject) theSO, 
154                                        QMap<QString,QString>& geomObjList, 
155                                        QMap<QString,QString>& folderList ) {
156   if ( !theSO ) return;
157   _PTR(Study) aStudy = theSO->GetStudy();
158   if ( !aStudy ) return;
159   _PTR(UseCaseBuilder) aUseCaseBuilder = aStudy->GetUseCaseBuilder();
160
161   bool isFolder = false;
162   _PTR(GenericAttribute) anAttr;
163   if ( theSO->FindAttribute(anAttr, "AttributeLocalID") ) {
164     _PTR(AttributeLocalID) aLocalID( anAttr );
165     isFolder = aLocalID->Value() == 999;
166   }
167   QString anEntry = theSO->GetID().c_str();
168   QString aName = theSO->GetName().c_str();
169   if ( isFolder ) {
170     folderList.insert( anEntry, aName );
171     _PTR(UseCaseIterator) ucit ( aUseCaseBuilder->GetUseCaseIterator( theSO ) );
172     for ( ucit->Init( false ); ucit->More(); ucit->Next() ) {
173       getGeomChildrenAndFolders( ucit->Value(), geomObjList, folderList );
174     }
175   } else {
176     geomObjList.insert( anEntry, aName );
177   }
178 }
179
180 //=======================================================================
181 // function : GEOMToolsGUI()
182 // purpose  : Constructor
183 //=======================================================================
184 GEOMToolsGUI::GEOMToolsGUI( GeometryGUI* parent )
185 : GEOMGUI( parent )
186 {
187 }
188
189 //=======================================================================
190 // function : ~GEOMToolsGUI()
191 // purpose  : Destructor
192 //=======================================================================
193 GEOMToolsGUI::~GEOMToolsGUI()
194 {
195 }
196
197 //=======================================================================
198 // function : OnGUIEvent()
199 // purpose  :
200 //=======================================================================
201 bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
202 {
203   getGeometryGUI()->EmitSignalDeactivateDialog();
204
205   switch ( theCommandID ) {
206   case GEOMOp::OpDelete:         // EDIT - DELETE
207     OnEditDelete();
208     break;
209 #ifndef DISABLE_PYCONSOLE
210   case GEOMOp::OpCheckGeom:      // TOOLS - CHECK GEOMETRY
211     OnCheckGeometry();
212     break;
213 #endif
214   case GEOMOp::OpSelectVertex:   // POPUP - SELECT ONLY - VERTEX
215     OnSelectOnly( GEOM_POINT );
216     break;
217   case GEOMOp::OpSelectEdge:     // POPUP - SELECT ONLY - EDGE
218     OnSelectOnly( GEOM_EDGE );
219     break;
220   case GEOMOp::OpSelectWire:     // POPUP - SELECT ONLY - WIRE
221     OnSelectOnly( GEOM_WIRE );
222     break;
223   case GEOMOp::OpSelectFace:     // POPUP - SELECT ONLY - FACE
224     OnSelectOnly( GEOM_FACE );
225     break;
226   case GEOMOp::OpSelectShell:    // POPUP - SELECT ONLY - SHELL
227     OnSelectOnly( GEOM_SHELL );
228     break;
229   case GEOMOp::OpSelectSolid:    // POPUP - SELECT ONLY - SOLID
230     OnSelectOnly( GEOM_SOLID );
231     break;
232   case GEOMOp::OpSelectCompound: // POPUP - SELECT ONLY - COMPOUND
233     OnSelectOnly( GEOM_COMPOUND );
234     break;
235   case GEOMOp::OpSelectAll:      // POPUP - SELECT ONLY - SELECT ALL
236     OnSelectOnly( GEOM_ALLOBJECTS );
237     break;
238   case GEOMOp::OpDeflection:     // POPUP - DEFLECTION ANGLE
239     OnDeflection();
240     break;
241   case GEOMOp::OpColor:          // POPUP - COLOR
242     OnColor();
243     break;
244   case GEOMOp::OpSetTexture:     // POPUP - TEXTURE
245     OnTexture();
246     break;
247   case GEOMOp::OpTransparency:   // POPUP - TRANSPARENCY
248     OnTransparency();
249     break;
250   case GEOMOp::OpIncrTransparency: // SHORTCUT   - INCREASE TRANSPARENCY
251     OnChangeTransparency( true );
252     break;
253   case GEOMOp::OpDecrTransparency: // SHORTCUT   - DECREASE TRANSPARENCY
254     OnChangeTransparency( false );
255     break;
256   case GEOMOp::OpIsos:           // POPUP - ISOS
257     OnNbIsos();
258     break;
259   case GEOMOp::OpIncrNbIsos:     // SHORTCUT   - INCREASE NB ISOLINES
260     OnNbIsos( INCR );
261     break;
262   case GEOMOp::OpDecrNbIsos:     // SHORTCUT   - DECREASE NB ISOLINES
263     OnNbIsos( DECR );
264     break;
265   case GEOMOp::OpMaterialProperties: // POPUP - MATERIAL PROPERTIES
266     OnMaterialProperties();
267     break;
268   case GEOMOp::OpPredefMaterCustom:  // POPUP  - MATERIAL PROPERTIES - CUSTOM...
269     OnMaterialProperties();
270     break;
271   case GEOMOp::OpMaterialsLibrary:    // POPUP MENU - MATERIAL PROPERTIES
272     OnMaterialsLibrary();
273     break;
274   case GEOMOp::OpAutoColor:      // POPUP - AUTO COLOR
275     OnAutoColor();
276     break;
277   case GEOMOp::OpNoAutoColor:    // POPUP - DISABLE AUTO COLOR
278     OnDisableAutoColor();
279     break;
280   case GEOMOp::OpDiscloseChildren:   // POPUP - SHOW CHILDREN
281   case GEOMOp::OpConcealChildren:   // POPUP - HIDE CHILDREN
282     OnDiscloseConcealChildren( theCommandID == GEOMOp::OpDiscloseChildren );
283     break;
284   case GEOMOp::OpPointMarker:    // POPUP - POINT MARKER
285     OnPointMarker();
286     break;
287   case GEOMOp::OpUnpublishObject:// POPUP - UNPUBLISH
288     OnUnpublishObject();
289     break;
290   case GEOMOp::OpPublishObject:// GEOM ROOT OBJECT - POPUP - PUBLISH
291     OnPublishObject();
292     break;
293   case GEOMOp::OpEdgeWidth:
294     OnEdgeWidth();
295     break;
296   case GEOMOp::OpIsosWidth:
297     OnIsosWidth();
298     break;
299   case GEOMOp::OpBringToFront:
300     OnBringToFront();
301     break;
302   case GEOMOp::OpClsBringToFront:
303     OnClsBringToFront();
304      break;
305   case GEOMOp::OpCreateFolder:
306     OnCreateFolder();
307      break;
308   case GEOMOp::OpSortChildren:
309     OnSortChildren();
310     break;
311 #ifndef DISABLE_GRAPHICSVIEW
312   case GEOMOp::OpShowDependencyTree:
313     OnShowDependencyTree();
314      break;
315 #endif
316   case GEOMOp::OpReduceStudy:
317     OnReduceStudy();
318     break;
319   default:
320     SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
321     break;
322   }
323   return true;
324 }
325
326 //=======================================================================
327 // function : OnGUIEvent()
328 // purpose  :
329 //=======================================================================
330 bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent, const QVariant& theParam )
331 {
332   getGeometryGUI()->EmitSignalDeactivateDialog();
333
334   switch ( theCommandID ) {
335   case GEOMOp::OpPredefMaterial:         // POPUP MENU - MATERIAL PROPERTIES - <SOME MATERIAL>
336     OnSetMaterial( theParam );
337     break;
338   default:
339     SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
340     break;
341   }
342   return true;
343 }
344
345 //===============================================================================
346 // function : OnEditDelete()
347 // purpose  :
348 //===============================================================================
349 void GEOMToolsGUI::OnEditDelete()
350 {
351   SALOME_ListIO selected;
352   SalomeApp_Application* app =
353     dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
354   if ( !app )
355     return;
356
357   LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
358   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
359   if ( !aSelMgr || !appStudy )
360     return;
361
362   // get selection
363   aSelMgr->selectedObjects( selected, "ObjectBrowser", false );
364   if ( selected.IsEmpty() )
365     return;
366
367   _PTR(Study) aStudy = appStudy->studyDS();
368   _PTR(UseCaseBuilder) aUseCaseBuilder = aStudy->GetUseCaseBuilder();
369
370   // check if study is locked
371   if ( _PTR(AttributeStudyProperties)( aStudy->GetProperties() )->IsLocked() ) {
372     SUIT_MessageBox::warning( app->desktop(),
373                               tr("WRN_WARNING"),
374                               tr("WRN_STUDY_LOCKED") );
375     return; // study is locked
376   }
377
378   // get GEOM component
379   CORBA::String_var geomIOR = app->orb()->object_to_string( GeometryGUI::GetGeomGen() );
380   QString geomComp = getParentComponent( aStudy->FindObjectIOR( geomIOR.in() ) );
381
382   // check each selected object: if belongs to GEOM, if not reference...
383   QMap<QString,QString> toBeDeleted;
384   QMap<QString,QString> allDeleted;
385   QMap<QString,QString> toBeDelFolders;
386   bool isComponentSelected = false;
387
388   for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
389     Handle(SALOME_InteractiveObject) anIObject = It.Value();
390     if ( !anIObject->hasEntry() )
391       continue; // invalid object
392     // ...
393     QString entry = anIObject->getEntry();
394     _PTR(SObject) obj = aStudy->FindObjectID( entry.toLatin1().data() );
395     // check parent component
396     QString parentComp = getParentComponent( obj );
397     if ( parentComp != geomComp )  {
398       SUIT_MessageBox::warning( app->desktop(),
399                                 QObject::tr("ERR_ERROR"),
400                                 QObject::tr("NON_GEOM_OBJECTS_SELECTED").arg( getGeometryGUI()->moduleName() ) );
401       return; // not GEOM object selected
402     }
403
404     ///////////////////////////////////////////////////////
405     // if GEOM component is selected, so skip other checks
406     if ( isComponentSelected ) continue;
407     ///////////////////////////////////////////////////////
408
409     // check if object is reference
410     _PTR(SObject) refobj;
411     if ( obj && obj->ReferencedObject( refobj ) ) {
412       // get the main object by reference IPAL 21354
413       obj = refobj;
414       entry = obj->GetID().c_str();
415     }
416     // ...
417     QString aName = obj->GetName().c_str();
418     if ( entry == geomComp ) {
419       // GEOM component is selected, skip other checks
420       isComponentSelected = true;
421       continue;
422     }
423     // all sub-objects of folder have to be deleted
424     getGeomChildrenAndFolders( obj, toBeDeleted, toBeDelFolders );
425     allDeleted.insert( entry, aName ); // skip GEOM component
426     // browse through all children recursively
427     _PTR(UseCaseIterator) it ( aUseCaseBuilder->GetUseCaseIterator( obj ) );
428     for ( it->Init( true ); it->More(); it->Next() ) {
429       _PTR(SObject) child( it->Value() );
430       if ( child && child->ReferencedObject( refobj ) )
431         continue; // skip references
432       aName = child->GetName().c_str();
433       if ( !aName.isEmpty() )
434         allDeleted.insert( child->GetID().c_str(), aName );
435     }
436   }
437
438   // is there is anything to delete?
439   if ( !isComponentSelected && allDeleted.count() <= 0 )
440     return; // nothing to delete
441
442   // show confirmation dialog box
443   GEOMToolsGUI_DeleteDlg dlg( app->desktop(), allDeleted, isComponentSelected );
444   if ( !dlg.exec() )
445     return; // operation is cancelled by user
446
447   // get currently opened views
448   QList<SALOME_View*> views;
449   SALOME_View* view;
450   ViewManagerList vmans = app->viewManagers();
451   SUIT_ViewManager* vman;
452   foreach ( vman, vmans ) {
453     SUIT_ViewModel* vmod = vman->getViewModel();
454     view = dynamic_cast<SALOME_View*> ( vmod ); // must work for OCC and VTK views
455     if ( view )
456       views.append( view );
457   }
458
459   _PTR(StudyBuilder) aStudyBuilder (aStudy->NewBuilder());
460   GEOM_Displayer* disp = new GEOM_Displayer( appStudy );
461
462   if ( isComponentSelected ) {
463     // GEOM component is selected: delete all objects recursively
464     _PTR(SObject) comp = aStudy->FindObjectID( geomComp.toLatin1().data() );
465     if ( !comp )
466       return;
467     _PTR(ChildIterator) it ( aStudy->NewChildIterator( comp ) );
468     // remove top-level objects only
469     for ( it->InitEx( false ); it->More(); it->Next() ) {
470       _PTR(SObject) child( it->Value() );
471       // remove object from GEOM engine
472       removeObjectWithChildren( child, aStudy, views, disp );
473       // remove object from study
474       aStudyBuilder->RemoveObjectWithChildren( child );
475       // remove object from use case tree
476       aUseCaseBuilder->Remove( child );
477     }
478   }
479   else {
480     // GEOM component is not selected: check if selected objects are in use
481     if ( inUse( aStudy, geomComp, allDeleted ) && 
482          SUIT_MessageBox::question( app->desktop(),
483                                     QObject::tr("WRN_WARNING"),
484                                     QObject::tr("DEP_OBJECT"),
485                                     SUIT_MessageBox::Yes | SUIT_MessageBox::No,
486                                     SUIT_MessageBox::No ) != SUIT_MessageBox::Yes ) {
487       return; // object(s) in use
488     }
489     // ... and then delete all objects
490     QMap<QString, QString>::Iterator it;
491     for ( it = toBeDeleted.begin(); it != toBeDeleted.end(); ++it ) {
492       _PTR(SObject) obj ( aStudy->FindObjectID( it.key().toLatin1().data() ) );
493       // remove object from GEOM engine
494       removeObjectWithChildren( obj, aStudy, views, disp );
495       // remove objects from study
496       aStudyBuilder->RemoveObjectWithChildren( obj );
497       // remove object from use case tree
498       aUseCaseBuilder->Remove( obj );
499     }
500     // ... and then delete all folders
501     for ( it = toBeDelFolders.begin(); it != toBeDelFolders.end(); ++it ) {
502       _PTR(SObject) obj ( aStudy->FindObjectID( it.key().toLatin1().data() ) );
503       // remove object from GEOM engine
504       removeObjectWithChildren( obj, aStudy, views, disp );
505       // remove objects from study
506       aStudyBuilder->RemoveObjectWithChildren( obj );
507       // remove object from use case tree
508       aUseCaseBuilder->Remove( obj );
509     }
510   }
511
512   selected.Clear();
513   aSelMgr->setSelectedObjects( selected );
514   getGeometryGUI()->updateObjBrowser();
515   app->updateActions(); //SRN: To update a Save button in the toolbar
516 }
517
518 //=====================================================================================
519 // function : RemoveObjectWithChildren
520 // purpose  : used by OnEditDelete() method
521 //=====================================================================================
522 void GEOMToolsGUI::removeObjectWithChildren(_PTR(SObject) obj,
523                                             _PTR(Study) aStudy,
524                                             QList<SALOME_View*> views,
525                                             GEOM_Displayer* disp)
526 {
527   // iterate through all children of obj
528   for (_PTR(ChildIterator) it (aStudy->NewChildIterator(obj)); it->More(); it->Next()) {
529   // for (_PTR(UseCaseIterator) it (aStudy->GetUseCaseBuilder()->GetUseCaseIterator(obj)); it->More(); it->Next()) {
530     _PTR(SObject) child (it->Value());
531     removeObjectWithChildren(child, aStudy, views, disp);
532   }
533
534   // erase object and remove it from engine
535   _PTR(GenericAttribute) anAttr;
536   if (obj->FindAttribute(anAttr, "AttributeIOR")) {
537     _PTR(AttributeIOR) anIOR (anAttr);
538
539     SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
540
541     // Delete shape in Client
542     const TCollection_AsciiString ASCIor ((char*)anIOR->Value().c_str());
543     getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer(ASCIor);
544
545     CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(obj);
546     GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
547     if (!CORBA::is_nil(geomObj)) {
548
549       //Remove visual properties of the object
550       appStudy->removeObjectProperties(obj->GetID().c_str());
551
552       // Erase graphical object
553       QListIterator<SALOME_View*> it( views );
554       while ( it.hasNext() )
555         if ( SALOME_View* view = it.next() )
556           disp->Erase(geomObj, true, true, view);
557
558       // Remove object from Engine
559       // We can't directly remove object from engine. All we can do is to unpublish the object
560       // from the study. Another client could be using the object.
561       // Unpublishing is done just after in aStudyBuilder->RemoveObjectWithChildren( child );
562       //GeometryGUI::GetGeomGen()->RemoveObject( geomObj );
563     }
564   }
565 }
566
567 //=================================================================================
568 // function : deactivate()
569 // purpose  : Called when GEOM component is deactivated
570 //=================================================================================
571 void GEOMToolsGUI::deactivate()
572 {
573   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
574   if ( app ) {
575     SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
576     GEOM_Displayer aDisp (appStudy);
577     aDisp.GlobalSelection();
578     getGeometryGUI()->setLocalSelectionMode(GEOM_ALLOBJECTS);
579   }
580 }
581
582 //=====================================================================================
583 // EXPORTED METHODS
584 //=====================================================================================
585 extern "C"
586 {
587 #ifdef WIN32
588   __declspec( dllexport )
589 #endif
590   GEOMGUI* GetLibGUI( GeometryGUI* parent )
591   {
592     return new GEOMToolsGUI( parent );
593   }
594 }