Salome HOME
Issue 0019855 (Cannot delete objects with dependencies) : improve 'Delete objects...
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI_1.cxx
1 // GEOM GEOMGUI : GUI for Geometry component
2 //
3 // Copyright (C) 2004  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 // File   : GEOMToolsGUI_1.cxx
23 // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
24 //
25
26 #include <PyConsole_Console.h>
27
28 #include "GEOMToolsGUI.h"
29 #include "GEOMToolsGUI_TransparencyDlg.h"
30 #include "GEOMToolsGUI_NbIsosDlg.h"
31
32 #include <GeometryGUI.h>
33 #include <GEOM_Displayer.h>
34
35 #include <GEOMBase.h>
36 #include <GEOM_Actor.h>
37
38 #include <SALOME_ListIO.hxx>
39 #include <SALOME_ListIteratorOfListIO.hxx>
40
41 #include <SOCC_Prs.h>
42
43 #include <SVTK_Prs.h>
44 #include <SVTK_ViewModel.h>
45 #include <SVTK_ViewWindow.h>
46 #include <SVTK_View.h>
47
48 #include <OCCViewer_ViewModel.h>
49
50 #include <SUIT_ViewManager.h>
51 #include <SUIT_Desktop.h>
52 #include <SUIT_ResourceMgr.h>
53 #include <SUIT_Session.h>
54 #include <SUIT_OverrideCursor.h>
55 #include <SUIT_MessageBox.h>
56
57 #include <SalomeApp_Application.h>
58 #include <SalomeApp_Study.h>
59 #include <SalomeApp_Module.h>
60
61 #include <LightApp_SelectionMgr.h>
62 #include <LightApp_NameDlg.h>
63
64 #include <GEOMImpl_Types.hxx>
65
66 #include "utilities.h"
67
68 // OCCT Includes
69 #include <AIS_Drawer.hxx>
70 #include <Prs3d_IsoAspect.hxx>
71 #include <Prs3d_PointAspect.hxx>
72 #include <Graphic3d_AspectMarker3d.hxx>
73
74 // QT Includes
75 #include <QColorDialog>
76 #include <QList>
77
78 // VTK includes
79 #include <vtkRenderer.h>
80
81 void GEOMToolsGUI::OnSettingsColor()
82 {
83   SUIT_Session* sess = SUIT_Session::session();
84   SUIT_ResourceMgr* resMgr = sess->resourceMgr();
85   SUIT_Desktop* desk = sess->activeApplication()->desktop();
86
87   QColor anInitColor = resMgr->colorValue( "Geometry", "SettingsShadingColor", QColor( "yellow" ) );
88
89   QColor aDialogColor = QColorDialog::getColor(anInitColor, desk );
90   if( aDialogColor.isValid() )
91   {
92     QString type = desk->activeWindow()->getViewManager()->getType();
93     if( type != OCCViewer_Viewer::Type() && type != SVTK_Viewer::Type() )
94       MESSAGE("Settings Color is not supported for current Viewer");
95
96     resMgr->setValue( "Geometry", "SettingsShadingColor", aDialogColor );
97   }
98 }
99
100 void GEOMToolsGUI::OnRename()
101 {
102   SALOME_ListIO selected;
103   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
104   if ( app ) {
105     LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
106     SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
107     if ( aSelMgr && appStudy ) {
108       aSelMgr->selectedObjects( selected );
109       if ( !selected.IsEmpty() ) {
110         _PTR(Study) aStudy = appStudy->studyDS();
111
112         bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
113         if ( aLocked ) {
114           SUIT_MessageBox::warning ( app->desktop(),
115                                      QObject::tr("WRN_WARNING"),
116                                      QObject::tr("WRN_STUDY_LOCKED"),
117                                      QObject::tr("BUT_OK") );
118           return;
119         }
120
121         for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
122           Handle(SALOME_InteractiveObject) IObject = It.Value();
123
124           _PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) );
125           _PTR(GenericAttribute) anAttr;
126           if ( obj ) {
127             if( obj->FindAttribute(anAttr, "AttributeName") ) {
128               _PTR(AttributeName) aName (anAttr);
129
130               QString newName = LightApp_NameDlg::getName( app->desktop(), aName->Value().c_str() );
131               if ( !newName.isEmpty() ) {
132                 aName->SetValue( newName.toLatin1().constData() ); // rename the SObject
133                 IObject->setName( newName.toLatin1() );// rename the InteractiveObject
134                 // Rename the corresponding GEOM_Object
135                 GEOM::GEOM_Object_var anObj =  GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj));
136                 if (!CORBA::is_nil( anObj ))
137                   anObj->SetName( newName.toLatin1() );
138                 (dynamic_cast<SalomeApp_Module*>(app->activeModule()))->updateObjBrowser( false );
139               }
140             } // if ( name attribute )
141           } // if ( obj )
142         } // iterator
143       }
144     }
145   }
146   
147   app->updateActions(); //SRN: To update a Save button in the toolbar
148 }
149
150 void GEOMToolsGUI::OnCheckGeometry()
151 {
152   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
153   PyConsole_Console* pyConsole = app->pythonConsole();
154
155   if(pyConsole)
156     pyConsole->exec("from GEOM_usinggeom import *");
157 }
158
159 void GEOMToolsGUI::OnAutoColor()
160 {
161   QList<SALOME_Prs> aListOfGroups;
162
163   SALOME_ListIO selected;
164   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
165   if( !app )
166     return;
167
168   LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
169   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
170   if( !aSelMgr || !appStudy )
171     return;
172
173   aSelMgr->selectedObjects( selected );
174   if( selected.IsEmpty() )
175     return;
176
177   Handle(SALOME_InteractiveObject) anIObject = selected.First();
178
179   _PTR(Study) aStudy = appStudy->studyDS();
180   _PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) );
181   GEOM::GEOM_Object_var aMainObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aMainSObject));
182   if( CORBA::is_nil( aMainObject ) )
183     return;
184
185   aMainObject->SetAutoColor( true );
186
187   QList<SALOMEDS::Color> aReservedColors;
188
189   GEOM_Displayer aDisp (appStudy);
190
191   SALOME_View* vf = aDisp.GetActiveView();
192
193   SUIT_ViewWindow* window = app->desktop()->activeWindow();
194   bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
195   bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
196
197   for( _PTR(ChildIterator) it( aStudy->NewChildIterator( aMainSObject ) ); it->More(); it->Next() )
198   {
199     _PTR(SObject) aChildSObject( it->Value() );
200     GEOM::GEOM_Object_var aChildObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aChildSObject));
201     if( CORBA::is_nil( aChildObject ) )
202       continue;
203
204     if( aChildObject->GetType() != GEOM_GROUP )
205       continue;
206
207     SALOMEDS::Color aColor = GEOM_Displayer::getUniqueColor( aReservedColors );
208     aChildObject->SetColor( aColor );
209     aReservedColors.append( aColor );
210
211     QColor c( (int)( aColor.R * 255.0 ), (int)( aColor.G * 255.0 ), (int)( aColor.B * 255.0 ) );
212
213     SALOME_Prs* aPrs = vf->CreatePrs( aChildSObject->GetID().c_str() );
214
215     if ( isVTK )
216     {
217       SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
218       if ( !vtkVW )
219         return;
220       SVTK_View* aView = vtkVW->getView();
221       SUIT_OverrideCursor();
222       for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() )
223         aView->SetColor( It.Value(), c );
224     }
225     else if ( isOCC )
226     {
227       OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
228       Handle(AIS_InteractiveContext) ic = vm->getAISContext();
229
230       SOCC_Prs* anOCCPrs = dynamic_cast<SOCC_Prs*>( aPrs );
231       if( !anOCCPrs )
232         continue;
233
234       AIS_ListOfInteractive aList;
235       anOCCPrs->GetObjects( aList );
236       if( !aList.Extent() )
237         continue;
238
239       Handle(AIS_InteractiveObject) io = aList.First();
240       if( io.IsNull() )
241         continue;
242
243       Quantity_Color aQuanColor( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB );
244
245       // Set color for a point
246       Handle(AIS_Drawer) aCurDrawer = io->Attributes();
247       Handle(Prs3d_PointAspect) aCurPointAspect = aCurDrawer->PointAspect();
248       Quantity_Color aCurColor;
249       Standard_Real aCurScale;
250       Aspect_TypeOfMarker aCurTypeOfMarker;
251       aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale );
252       aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aCurTypeOfMarker, aQuanColor, aCurScale) );
253       ic->SetLocalAttributes( io, aCurDrawer );
254
255       io->SetColor( aQuanColor );
256       if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) )
257         Handle(GEOM_AISShape)::DownCast( io )->SetShadingColor( aQuanColor );
258
259       io->Redisplay( Standard_True );
260     }
261   }
262
263   app->updateActions(); //SRN: To update a Save button in the toolbar
264 }
265
266 void GEOMToolsGUI::OnDisableAutoColor()
267 {
268   SALOME_ListIO selected;
269   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
270   if( !app )
271     return;
272
273   LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
274   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
275   if( !aSelMgr || !appStudy )
276     return;
277
278   aSelMgr->selectedObjects( selected );
279   if( selected.IsEmpty() )
280     return;
281
282   Handle(SALOME_InteractiveObject) anIObject = selected.First();
283
284   _PTR(Study) aStudy = appStudy->studyDS();
285   _PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) );
286   GEOM::GEOM_Object_var aMainObject =  GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aMainSObject));
287   if( CORBA::is_nil( aMainObject ) )
288     return;
289
290   aMainObject->SetAutoColor( false );
291
292 }
293
294 void GEOMToolsGUI::OnColor()
295 {
296   SALOME_ListIO selected;
297   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
298   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
299   if ( app && appStudy ) {
300     LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
301     if ( aSelMgr ) {
302       aSelMgr->selectedObjects( selected );
303       if ( !selected.IsEmpty() ) {
304         SUIT_ViewWindow* window = app->desktop()->activeWindow();
305         bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
306         bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
307         if ( isVTK ) {
308           SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
309           if ( !vtkVW )
310             return;
311           SVTK_View* aView = vtkVW->getView();
312           QColor initcolor = aView->GetColor( selected.First()  );
313           QColor c = QColorDialog::getColor( initcolor, app->desktop() );
314           if ( c.isValid() ) {
315             SUIT_OverrideCursor();
316             for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
317               aView->SetColor( It.Value(), c );
318             }
319           }
320         } // if ( isVTK )
321         else if ( isOCC ) {
322           Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( selected.First() );
323           if ( !io.IsNull() ) {
324             Quantity_Color aColor;
325             io->Color( aColor );
326             QColor initcolor( (int)( aColor.Red() * 255.0 ), (int)( aColor.Green() * 255.0 ), (int)( aColor.Blue() * 255.0 ) );
327             QColor c =  QColorDialog::getColor( initcolor, app->desktop() );
328             if ( c.isValid() ) {
329               SUIT_OverrideCursor();
330               aColor = Quantity_Color( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB );
331               for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
332                 io = GEOMBase::GetAIS( It.Value(), true );
333                 if ( !io.IsNull() ) {
334                   // Set color for a point
335                   OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
336                   Handle (AIS_InteractiveContext) ic = vm->getAISContext();
337                   Handle(AIS_Drawer) aCurDrawer = io->Attributes();
338                   Handle(Prs3d_PointAspect) aCurPointAspect =  aCurDrawer->PointAspect();
339                   Quantity_Color aCurColor;
340                   Standard_Real aCurScale;
341                   Aspect_TypeOfMarker aCurTypeOfMarker;
342                   aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale );
343                   aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aCurTypeOfMarker, aColor, aCurScale) );
344                   ic->SetLocalAttributes(io, aCurDrawer);
345                   
346                   io->SetColor( aColor );
347                   if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) )
348                     Handle(GEOM_AISShape)::DownCast( io )->SetShadingColor( aColor );
349
350                   io->Redisplay( Standard_True );
351
352                   // store color to GEOM_Object
353                   _PTR(Study) aStudy = appStudy->studyDS();
354                   _PTR(SObject) aSObject( aStudy->FindObjectID( It.Value()->getEntry() ) );
355                   GEOM::GEOM_Object_var anObject =
356                     GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObject));
357
358                   SALOMEDS::Color aSColor;
359                   aSColor.R = (double)c.red() / 255.0;
360                   aSColor.G = (double)c.green() / 255.0;
361                   aSColor.B = (double)c.blue() / 255.0;
362                   anObject->SetColor( aSColor );
363                   anObject->SetAutoColor( false );
364                 }
365               }
366             } // if c.isValid()
367           } // first IO is not null
368         } // if ( isOCC )
369       } // if ( selection not empty )
370     }
371   }
372   
373   app->updateActions(); //SRN: To update a Save button in the toolbar
374 }
375
376 void GEOMToolsGUI::OnTransparency()
377 {
378   GEOMToolsGUI_TransparencyDlg dlg( SUIT_Session::session()->activeApplication()->desktop() );
379   dlg.exec();
380 }
381
382 void GEOMToolsGUI::OnNbIsos()
383 {
384   SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
385   
386   bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
387   bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
388
389   if(isOCC){ // if is OCCViewer
390
391     OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
392     Handle (AIS_InteractiveContext) ic = vm->getAISContext();
393
394     ic->InitCurrent();
395     if ( ic->MoreCurrent() ) {
396       Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
397       Handle(AIS_Drawer)    CurDrawer = CurObject->Attributes();
398       
399       int UIso = CurDrawer->UIsoAspect()->Number();
400       int VIso = CurDrawer->VIsoAspect()->Number();
401       
402       GEOMToolsGUI_NbIsosDlg * NbIsosDlg =
403         new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
404       
405       NbIsosDlg->setU( UIso );
406       NbIsosDlg->setV( VIso );
407       
408       if ( NbIsosDlg->exec() ) {
409         SUIT_OverrideCursor();
410         for(; ic->MoreCurrent(); ic->NextCurrent()) {
411           CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
412           Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
413           
414           int nbUIso = NbIsosDlg->getU();
415           int nbVIso = NbIsosDlg->getV();
416           
417           CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbUIso) );
418           CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbVIso) );
419           
420           ic->SetLocalAttributes(CurObject, CurDrawer);
421           ic->Redisplay(CurObject);
422         }
423       }
424     }
425   }
426   else if(isVTK){ // if is VTKViewer
427     //
428     // Warning. It's works incorrect. must be recheked.
429     //
430     SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
431     if ( !app )
432       return;
433     LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
434     if ( !aSelMgr )
435       return;
436     SALOME_ListIO selected;
437     aSelMgr->selectedObjects( selected );
438     if ( selected.IsEmpty() )
439       return;
440     
441     Handle(SALOME_InteractiveObject) FirstIOS =  selected.First();
442     if ( FirstIOS.IsNull() )
443       return;
444     
445     SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
446     if ( !vtkVW )
447       return;
448     
449     SVTK_View* aView = vtkVW->getView();
450     vtkActorCollection* aCollection = aView->getRenderer()->GetActors();
451     
452     int UIso = 0;
453     int VIso = 0;
454     if(aCollection){
455       aCollection->InitTraversal();
456     }
457     
458     vtkActor *anAct = aCollection->GetNextActor();
459     if(GEOM_Actor *anActor = dynamic_cast<GEOM_Actor*>(anAct)){
460       anActor->GetNbIsos(UIso,VIso);
461     }
462     
463     GEOMToolsGUI_NbIsosDlg * NbIsosDlg =
464       new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
465
466     NbIsosDlg->setU( UIso );
467     NbIsosDlg->setV( VIso );
468
469     if ( NbIsosDlg->exec() ) {
470       SUIT_OverrideCursor();
471       
472       while(anAct = aCollection->GetNextActor()) {
473         if(GEOM_Actor *anActor = dynamic_cast<GEOM_Actor*>(anAct)){
474           // There are no casting to needed actor.
475           UIso = NbIsosDlg->getU();
476           VIso = NbIsosDlg->getV();
477           int aIsos[2]={UIso,VIso};
478           anActor->SetNbIsos(aIsos);
479         }
480       }
481     }
482   } // end vtkviewer
483 }
484
485 void GEOMToolsGUI::OnOpen()
486 {
487 /*
488   SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
489   _PTR(Study) aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
490
491   SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
492   Handle(SALOME_InteractiveObject) anIObject;
493   for(;It.More();It.Next()) {
494     anIObject = It.Value();
495     _PTR(SObject) obj ( aStudy->FindObjectID(anIObject->getEntry()) );
496     _PTR(AttributePersistentRef) aPersist;
497     _PTR(AttributeIOR) anIOR;
498     if(obj) {
499       // this SObject may be GEOM module root SObject
500       _PTR(ChildIterator) anIter ( aStudy->NewChildIterator() );
501       _PTR(GenericAttribute) anAttr;
502       bool useSubItems = false;
503       while (anIter->More() && !useSubItems) {
504         _PTR(SObject) subobj ( anIter->Value() );
505         if (subobj->FindAttribute(anAttr, "AttributePersistentRef")) {
506           useSubItems = true;
507           obj =  subobj;
508         }
509         else
510           anIter->Next();
511       }
512       obj->FindAttribute(anAttr, "AttributePersistentRef");
513
514       while(useSubItems?anIter->More():!anAttr->_is_nil()) {
515         if(!obj->FindAttribute(anAttr, "AttributeIOR") &&
516            obj->FindAttribute(anAttr, "AttributePersistentRef")) {
517           _PTR(SComponent) FComp ( obj->GetFatherComponent() );
518           if (FComp) {
519             if (FComp->FindAttribute(anAttr, "AttributeName")) {
520               _PTR(AttributeName) aName ( anAttr );
521               QString compName = QAD_Application::getDesktop()->getComponentName(aName->Value().c_str());
522               //                    parent->loadComponentData(parent->getComponentName(aName->Value()));
523               Engines::Component_var comp ;
524               if ( compName.compare("SUPERV") == 0 ) {
525                 comp = QAD_Application::getDesktop()->getEngine( "SuperVisionContainer", compName) ;
526               }
527               else {
528                 comp = QAD_Application::getDesktop()->getEngine( "FactoryServer", compName);
529                 if ( comp->_is_nil() )
530                   comp = QAD_Application::getDesktop()->getEngine( "FactoryServerPy", compName);
531               }
532
533               if (!CORBA::is_nil(comp)) {
534                 SALOMEDS::Driver_var   driver = SALOMEDS::Driver::_narrow(comp);
535                 if (!CORBA::is_nil(driver)) {
536                   SALOMEDS::StudyBuilder_var  B = dynamic_cast<SALOMEDS_Study*>(aStudy.get())->GetStudy()->NewBuilder();
537                   if (!CORBA::is_nil(B)) {
538                     B->LoadWith(FComp,driver);
539                   } else {
540                     return;
541                   }
542                 }
543                 else {
544                   MESSAGE("loadComponentData(): Driver is null");
545                   return;
546                 }
547               }
548               else {
549                 MESSAGE("loadComponentData(): Engine is null");
550                 return;
551               }
552                 //              // load
553                 //              Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer","GEOM");
554                 //              if (!CORBA::is_nil(comp)) {
555                 //                SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp);
556                 //                SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
557                 //                SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM");
558                 //                if (!CORBA::is_nil(SC))
559                 //                  aStudyBuilder->LoadWith(SC,driver);
560             }
561           }
562           else {
563             MESSAGE("Component is null");
564           }
565         }
566         if(useSubItems) {
567           anIter->Next();
568           obj.reset( anIter->Value() );
569         }
570         else
571           anAttr = NULL;
572       }
573     }
574   }
575 */
576 }
577
578 void GEOMToolsGUI::OnSelectOnly(int mode)
579 {
580   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
581   if ( app ) {
582     SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
583     GEOM_Displayer aDisp (appStudy);
584     aDisp.GlobalSelection(mode);
585     getGeometryGUI()->setLocalSelectionMode(mode);
586   }
587 }