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