1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // GEOM GEOMGUI : GUI for Geometry component
23 // File : GEOMToolsGUI_1.cxx
24 // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
26 #include <PyConsole_Console.h>
28 #include "GEOMToolsGUI.h"
29 #include "GEOMToolsGUI_TransparencyDlg.h"
30 #include "GEOMToolsGUI_NbIsosDlg.h"
31 #include "GEOMToolsGUI_MarkerDlg.h"
33 #include <GeometryGUI.h>
34 #include <GEOM_Displayer.h>
37 #include <GEOM_Actor.h>
39 #include <SALOME_ListIO.hxx>
40 #include <SALOME_ListIteratorOfListIO.hxx>
45 #include <SVTK_ViewModel.h>
46 #include <SVTK_ViewWindow.h>
47 #include <SVTK_View.h>
49 #include <OCCViewer_ViewModel.h>
51 #include <SUIT_ViewManager.h>
52 #include <SUIT_Desktop.h>
53 #include <SUIT_ResourceMgr.h>
54 #include <SUIT_Session.h>
55 #include <SUIT_OverrideCursor.h>
56 #include <SUIT_MessageBox.h>
58 #include <SalomeApp_Application.h>
59 #include <SalomeApp_Study.h>
60 #include <SalomeApp_Module.h>
62 #include <LightApp_SelectionMgr.h>
63 #include <LightApp_NameDlg.h>
65 #include <GEOMImpl_Types.hxx>
67 #include "utilities.h"
70 #include <AIS_Drawer.hxx>
71 #include <Prs3d_IsoAspect.hxx>
72 #include <Prs3d_PointAspect.hxx>
73 #include <Graphic3d_AspectMarker3d.hxx>
74 #include <Graphic3d_HArray1OfBytes.hxx>
77 #include <QColorDialog>
81 #include <vtkRenderer.h>
83 void GEOMToolsGUI::OnSettingsColor()
85 SUIT_Session* sess = SUIT_Session::session();
86 SUIT_ResourceMgr* resMgr = sess->resourceMgr();
87 SUIT_Desktop* desk = sess->activeApplication()->desktop();
89 QColor anInitColor = resMgr->colorValue( "Geometry", "SettingsShadingColor", QColor( "yellow" ) );
91 QColor aDialogColor = QColorDialog::getColor(anInitColor, desk );
92 if( aDialogColor.isValid() )
94 QString type = desk->activeWindow()->getViewManager()->getType();
95 if( type != OCCViewer_Viewer::Type() && type != SVTK_Viewer::Type() )
96 MESSAGE("Settings Color is not supported for current Viewer");
98 resMgr->setValue( "Geometry", "SettingsShadingColor", aDialogColor );
102 void GEOMToolsGUI::OnRename()
104 SALOME_ListIO selected;
105 SalomeApp_Application* app =
106 dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
108 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
109 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
110 if ( aSelMgr && appStudy ) {
111 aSelMgr->selectedObjects( selected );
112 if ( !selected.IsEmpty() ) {
113 _PTR(Study) aStudy = appStudy->studyDS();
115 bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
117 SUIT_MessageBox::warning ( app->desktop(),
118 QObject::tr("WRN_WARNING"),
119 QObject::tr("WRN_STUDY_LOCKED") );
123 bool isAny = false; // is there any appropriate object selected
124 for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
125 Handle(SALOME_InteractiveObject) IObject = It.Value();
127 _PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) );
128 _PTR(GenericAttribute) anAttr;
130 if ( obj->FindAttribute(anAttr, "AttributeName") ) {
131 _PTR(AttributeName) aName (anAttr);
133 GEOM::GEOM_Object_var anObj =
134 GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj));
135 if (!CORBA::is_nil(anObj)) {
137 QString newName = LightApp_NameDlg::getName( app->desktop(), aName->Value().c_str() );
138 if (!newName.isEmpty()) {
139 aName->SetValue( newName.toLatin1().data() ); // rename the SObject
140 IObject->setName( newName.toLatin1().data() );// rename the InteractiveObject
141 anObj->SetName( newName.toLatin1().data() ); // Rename the corresponding GEOM_Object
142 (dynamic_cast<SalomeApp_Module*>(app->activeModule()))->updateObjBrowser( false );
145 } // if ( name attribute )
150 SUIT_MessageBox::warning( app->desktop(),
151 QObject::tr("WRN_WARNING"),
152 QObject::tr("GEOM_WRN_NO_APPROPRIATE_SELECTION") );
159 app->updateActions(); //SRN: To update a Save button in the toolbar
162 void GEOMToolsGUI::OnCheckGeometry()
164 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
165 PyConsole_Console* pyConsole = app->pythonConsole();
168 pyConsole->exec("from GEOM_usinggeom import *");
171 void GEOMToolsGUI::OnAutoColor()
173 SALOME_ListIO selected;
174 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
178 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
179 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
180 if( !aSelMgr || !appStudy )
183 aSelMgr->selectedObjects( selected );
184 if( selected.IsEmpty() )
187 Handle(SALOME_InteractiveObject) anIObject = selected.First();
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 ) )
195 aMainObject->SetAutoColor( true );
197 QList<SALOMEDS::Color> aReservedColors;
199 GEOM_Displayer aDisp (appStudy);
201 SALOME_View* vf = aDisp.GetActiveView();
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() );
207 for( _PTR(ChildIterator) it( aStudy->NewChildIterator( aMainSObject ) ); it->More(); it->Next() )
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 ) )
214 if( aChildObject->GetType() != GEOM_GROUP )
217 SALOMEDS::Color aColor = GEOM_Displayer::getUniqueColor( aReservedColors );
218 aChildObject->SetColor( aColor );
219 aReservedColors.append( aColor );
221 QColor c( (int)( aColor.R * 255.0 ), (int)( aColor.G * 255.0 ), (int)( aColor.B * 255.0 ) );
223 SALOME_Prs* aPrs = vf->CreatePrs( aChildSObject->GetID().c_str() );
227 SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
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 );
237 OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
238 Handle(AIS_InteractiveContext) ic = vm->getAISContext();
240 SOCC_Prs* anOCCPrs = dynamic_cast<SOCC_Prs*>( aPrs );
244 AIS_ListOfInteractive aList;
245 anOCCPrs->GetObjects( aList );
246 if( !aList.Extent() )
249 Handle(AIS_InteractiveObject) io = aList.First();
253 Quantity_Color aQuanColor( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB );
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 if ( aCurTypeOfMarker != Aspect_TOM_USERDEFINED ) {
263 aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aCurTypeOfMarker, aQuanColor, aCurScale) );
266 Standard_Integer aWidth, aHeight;
267 aCurPointAspect->GetTextureSize( aWidth, aHeight );
268 Handle(Graphic3d_HArray1OfBytes) aTexture = aCurPointAspect->GetTexture();
269 aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aQuanColor, 1, aWidth, aHeight, aTexture ) );
271 ic->SetLocalAttributes( io, aCurDrawer );
273 io->SetColor( aQuanColor );
274 if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) )
275 Handle(GEOM_AISShape)::DownCast( io )->SetShadingColor( aQuanColor );
277 io->Redisplay( Standard_True );
281 app->updateActions(); //SRN: To update a Save button in the toolbar
284 void GEOMToolsGUI::OnDisableAutoColor()
286 SALOME_ListIO selected;
287 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
291 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
292 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
293 if( !aSelMgr || !appStudy )
296 aSelMgr->selectedObjects( selected );
297 if( selected.IsEmpty() )
300 Handle(SALOME_InteractiveObject) anIObject = selected.First();
302 _PTR(Study) aStudy = appStudy->studyDS();
303 _PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) );
304 GEOM::GEOM_Object_var aMainObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aMainSObject));
305 if( CORBA::is_nil( aMainObject ) )
308 aMainObject->SetAutoColor( false );
312 void GEOMToolsGUI::OnColor()
314 SALOME_ListIO selected;
315 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
316 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
317 if ( app && appStudy ) {
318 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
320 aSelMgr->selectedObjects( selected );
321 if ( !selected.IsEmpty() ) {
322 SUIT_ViewWindow* window = app->desktop()->activeWindow();
323 bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
324 bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
326 SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
329 SVTK_View* aView = vtkVW->getView();
330 QColor initcolor = aView->GetColor( selected.First() );
331 QColor c = QColorDialog::getColor( initcolor, app->desktop() );
333 SUIT_OverrideCursor();
334 for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
335 aView->SetColor( It.Value(), c );
340 Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( selected.First() );
341 if ( !io.IsNull() ) {
342 Quantity_Color aColor;
344 QColor initcolor( (int)( aColor.Red() * 255.0 ), (int)( aColor.Green() * 255.0 ), (int)( aColor.Blue() * 255.0 ) );
345 QColor c = QColorDialog::getColor( initcolor, app->desktop() );
347 SUIT_OverrideCursor();
348 aColor = Quantity_Color( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB );
349 for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
350 io = GEOMBase::GetAIS( It.Value(), true );
351 if ( !io.IsNull() ) {
352 // Set color for a point
353 OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
354 Handle (AIS_InteractiveContext) ic = vm->getAISContext();
355 Handle(AIS_Drawer) aCurDrawer = io->Attributes();
356 Handle(Prs3d_PointAspect) aCurPointAspect = aCurDrawer->PointAspect();
357 Quantity_Color aCurColor;
358 Standard_Real aCurScale;
359 Aspect_TypeOfMarker aCurTypeOfMarker;
360 aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale );
361 if ( aCurTypeOfMarker != Aspect_TOM_USERDEFINED ) {
362 aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aCurTypeOfMarker, aColor, aCurScale) );
365 Standard_Integer aWidth, aHeight;
366 aCurPointAspect->GetTextureSize( aWidth, aHeight );
367 Handle(Graphic3d_HArray1OfBytes) aTexture = aCurPointAspect->GetTexture();
368 aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aColor, 1, aWidth, aHeight, aTexture ) );
370 ic->SetLocalAttributes(io, aCurDrawer);
372 io->SetColor( aColor );
373 if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) )
374 Handle(GEOM_AISShape)::DownCast( io )->SetShadingColor( aColor );
376 io->Redisplay( Standard_True );
378 // store color to GEOM_Object
379 _PTR(Study) aStudy = appStudy->studyDS();
380 _PTR(SObject) aSObject( aStudy->FindObjectID( It.Value()->getEntry() ) );
381 GEOM::GEOM_Object_var anObject =
382 GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObject));
384 SALOMEDS::Color aSColor;
385 aSColor.R = (double)c.red() / 255.0;
386 aSColor.G = (double)c.green() / 255.0;
387 aSColor.B = (double)c.blue() / 255.0;
388 anObject->SetColor( aSColor );
389 anObject->SetAutoColor( false );
393 } // first IO is not null
395 } // if ( selection not empty )
399 app->updateActions(); //SRN: To update a Save button in the toolbar
402 void GEOMToolsGUI::OnTransparency()
404 GEOMToolsGUI_TransparencyDlg dlg( SUIT_Session::session()->activeApplication()->desktop() );
408 void GEOMToolsGUI::OnNbIsos()
410 SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
412 bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
413 bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
415 if(isOCC){ // if is OCCViewer
417 OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
418 Handle (AIS_InteractiveContext) ic = vm->getAISContext();
421 if ( ic->MoreCurrent() ) {
422 Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
423 Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
425 int UIso = CurDrawer->UIsoAspect()->Number();
426 int VIso = CurDrawer->VIsoAspect()->Number();
428 GEOMToolsGUI_NbIsosDlg * NbIsosDlg =
429 new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
431 NbIsosDlg->setU( UIso );
432 NbIsosDlg->setV( VIso );
434 if ( NbIsosDlg->exec() ) {
435 SUIT_OverrideCursor();
436 for(; ic->MoreCurrent(); ic->NextCurrent()) {
437 CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
438 Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
440 int nbUIso = NbIsosDlg->getU();
441 int nbVIso = NbIsosDlg->getV();
443 CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbUIso) );
444 CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbVIso) );
446 ic->SetLocalAttributes(CurObject, CurDrawer);
447 ic->Redisplay(CurObject);
452 else if(isVTK){ // if is VTKViewer
454 // Warning. It's works incorrect. must be recheked.
456 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
459 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
462 SALOME_ListIO selected;
463 aSelMgr->selectedObjects( selected );
464 if ( selected.IsEmpty() )
467 SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
471 SALOME_View* view = GEOM_Displayer::GetActiveView();
473 vtkActorCollection* aCollection = vtkActorCollection::New();
475 for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
476 Handle(SALOME_InteractiveObject) anIObject = It.Value();
477 SALOME_Prs* aPrs = view->CreatePrs( anIObject->getEntry() );
478 SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( aPrs );
480 vtkActorCollection* anActors = vtkPrs->GetObjects();
481 anActors->InitTraversal();
482 vtkActor* anAct = anActors->GetNextActor();
483 aCollection->AddItem(anAct);
488 aCollection->InitTraversal();
495 vtkActor* anAct = aCollection->GetNextActor();
496 if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct))
497 anActor->GetNbIsos(UIso,VIso);
501 GEOMToolsGUI_NbIsosDlg* NbIsosDlg =
502 new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
504 NbIsosDlg->setU( UIso );
505 NbIsosDlg->setV( VIso );
507 if ( NbIsosDlg->exec() ) {
508 SUIT_OverrideCursor();
510 while( anAct!=NULL ) {
511 if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)){
512 // There are no casting to needed actor.
513 UIso = NbIsosDlg->getU();
514 VIso = NbIsosDlg->getV();
515 int aIsos[2]={UIso,VIso};
516 anActor->SetNbIsos(aIsos);
518 anAct = aCollection->GetNextActor();
524 void GEOMToolsGUI::OnOpen()
527 SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
528 _PTR(Study) aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
530 SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
531 Handle(SALOME_InteractiveObject) anIObject;
532 for(;It.More();It.Next()) {
533 anIObject = It.Value();
534 _PTR(SObject) obj ( aStudy->FindObjectID(anIObject->getEntry()) );
535 _PTR(AttributePersistentRef) aPersist;
536 _PTR(AttributeIOR) anIOR;
538 // this SObject may be GEOM module root SObject
539 _PTR(ChildIterator) anIter ( aStudy->NewChildIterator() );
540 _PTR(GenericAttribute) anAttr;
541 bool useSubItems = false;
542 while (anIter->More() && !useSubItems) {
543 _PTR(SObject) subobj ( anIter->Value() );
544 if (subobj->FindAttribute(anAttr, "AttributePersistentRef")) {
551 obj->FindAttribute(anAttr, "AttributePersistentRef");
553 while(useSubItems?anIter->More():!anAttr->_is_nil()) {
554 if(!obj->FindAttribute(anAttr, "AttributeIOR") &&
555 obj->FindAttribute(anAttr, "AttributePersistentRef")) {
556 _PTR(SComponent) FComp ( obj->GetFatherComponent() );
558 if (FComp->FindAttribute(anAttr, "AttributeName")) {
559 _PTR(AttributeName) aName ( anAttr );
560 QString compName = QAD_Application::getDesktop()->getComponentName(aName->Value().c_str());
561 // parent->loadComponentData(parent->getComponentName(aName->Value()));
562 Engines::Component_var comp ;
563 if ( compName.compare("SUPERV") == 0 ) {
564 comp = QAD_Application::getDesktop()->getEngine( "SuperVisionContainer", compName) ;
567 comp = QAD_Application::getDesktop()->getEngine( "FactoryServer", compName);
568 if ( comp->_is_nil() )
569 comp = QAD_Application::getDesktop()->getEngine( "FactoryServerPy", compName);
572 if (!CORBA::is_nil(comp)) {
573 SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp);
574 if (!CORBA::is_nil(driver)) {
575 SALOMEDS::StudyBuilder_var B = dynamic_cast<SALOMEDS_Study*>(aStudy.get())->GetStudy()->NewBuilder();
576 if (!CORBA::is_nil(B)) {
577 B->LoadWith(FComp,driver);
583 MESSAGE("loadComponentData(): Driver is null");
588 MESSAGE("loadComponentData(): Engine is null");
592 // Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer","GEOM");
593 // if (!CORBA::is_nil(comp)) {
594 // SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp);
595 // SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
596 // SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM");
597 // if (!CORBA::is_nil(SC))
598 // aStudyBuilder->LoadWith(SC,driver);
602 MESSAGE("Component is null");
607 obj.reset( anIter->Value() );
617 void GEOMToolsGUI::OnSelectOnly(int mode)
619 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
621 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
622 GEOM_Displayer aDisp (appStudy);
623 aDisp.GlobalSelection(mode);
624 getGeometryGUI()->setLocalSelectionMode(mode);
628 void GEOMToolsGUI::OnShowHideChildren( bool show )
630 SALOME_ListIO selected;
631 SalomeApp_Application* app =
632 dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
634 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
635 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
636 if ( aSelMgr && appStudy ) {
637 aSelMgr->selectedObjects( selected );
638 if ( !selected.IsEmpty() ) {
639 _PTR(Study) aStudy = appStudy->studyDS();
640 _PTR(StudyBuilder) B = aStudy->NewBuilder();
642 bool aLocked = ( _PTR(AttributeStudyProperties)( aStudy->GetProperties() ) )->IsLocked();
644 SUIT_MessageBox::warning( app->desktop(),
645 QObject::tr( "WRN_WARNING" ),
646 QObject::tr( "WRN_STUDY_LOCKED" ) );
650 for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
651 Handle(SALOME_InteractiveObject) IObject = It.Value();
653 _PTR(SObject) obj ( aStudy->FindObjectID( IObject->getEntry() ) );
654 _PTR(GenericAttribute) anAttr;
656 _PTR(AttributeExpandable) aExp = B->FindOrCreateAttribute( obj, "AttributeExpandable" );
657 aExp->SetExpandable( show );
662 app->updateObjectBrowser( false );
663 app->updateActions();
667 void GEOMToolsGUI::OnPointMarker()
669 GEOMToolsGUI_MarkerDlg dlg( SUIT_Session::session()->activeApplication()->desktop() );