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