Salome HOME
PAL6938
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_AddSubMeshDlg.cxx
1 //  SMESH SMESHGUI : GUI for SMESH component
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SMESHGUI_AddSubMeshDlg.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SMESH
27 //  $Header$
28
29 #include "SMESHGUI_AddSubMeshDlg.h"
30
31 #include "SMESHGUI.h"
32 #include "SMESHGUI_Utils.h"
33 #include "SMESHGUI_GEOMGenUtils.h"
34 #include "SMESHGUI_HypothesesUtils.h"
35
36 #include "GEOMBase.h"
37
38 #include "QAD_Application.h"
39 #include "QAD_Desktop.h"
40 #include "QAD_MessageBox.h"
41 #include "QAD_WaitCursor.h"
42 #include "QAD_Operation.h"
43
44 #include "SALOME_ListIteratorOfListIO.hxx"
45 #include "SALOMEGUI_QtCatchCorbaException.hxx"
46
47 #include "utilities.h"
48
49 // QT Includes
50 #include <qgroupbox.h>
51 #include <qlabel.h>
52 #include <qlineedit.h>
53 #include <qpushbutton.h>
54 #include <qlayout.h>
55 #include <qpixmap.h>
56
57 using namespace std;
58
59 namespace SMESH{
60   SMESH::SMESH_subMesh_var AddSubMesh(SMESH::SMESH_Mesh_ptr theMesh, 
61                                       GEOM::GEOM_Object_ptr theShapeObject, 
62                                       const char* theMeshName )
63   {
64     SMESH::SMESH_subMesh_var aSubMesh;
65     try {
66       if ( !theMesh->_is_nil() && !theShapeObject->_is_nil() )
67         aSubMesh = theMesh->GetSubMesh( theShapeObject, theMeshName );
68     }
69     catch( const SALOME::SALOME_Exception& S_ex ) {
70       QtCatchCorbaException( S_ex );
71     }
72     return aSubMesh._retn();
73   }
74 }
75
76 //=================================================================================
77 // class    : SMESHGUI_AddSubMeshDlg()
78 // purpose  : Constructs a SMESHGUI_AddSubMeshDlg which is a child of 'parent', with the 
79 //            name 'name' and widget flags set to 'f'.
80 //            The dialog will by default be modeless, unless you set 'modal' to
81 //            TRUE to construct a modal dialog.
82 //=================================================================================
83 SMESHGUI_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
84     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
85 {
86     QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
87     if ( !name )
88         setName( "SMESHGUI_AddSubMeshDlg" );
89     setCaption( tr( "SMESH_ADD_SUBMESH"  ) );
90     setSizeGripEnabled( TRUE );
91     QGridLayout* SMESHGUI_AddSubMeshDlgLayout = new QGridLayout( this ); 
92     SMESHGUI_AddSubMeshDlgLayout->setSpacing( 6 );
93     SMESHGUI_AddSubMeshDlgLayout->setMargin( 11 );
94     
95     /***************************************************************/
96     GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), this, "GroupC1" );
97     GroupC1->setColumnLayout(0, Qt::Vertical );
98     GroupC1->layout()->setSpacing( 0 );
99     GroupC1->layout()->setMargin( 0 );
100     QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
101     GroupC1Layout->setAlignment( Qt::AlignTop );
102     GroupC1Layout->setSpacing( 6 );
103     GroupC1Layout->setMargin( 11 );
104
105     TextLabel_NameMesh = new QLabel(  tr( "SMESH_NAME" ), GroupC1, "TextLabel_NameMesh" );
106     GroupC1Layout->addWidget( TextLabel_NameMesh, 0, 0 );
107     LineEdit_NameMesh = new QLineEdit( GroupC1, "LineEdit_NameMesh" );
108     GroupC1Layout->addWidget( LineEdit_NameMesh, 0, 2 );
109
110     TextLabelC1A1 = new QLabel( tr( "SMESH_OBJECT_MESH" ), GroupC1, "TextLabelC1A1" );
111     GroupC1Layout->addWidget( TextLabelC1A1, 1, 0 );
112     SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
113     SelectButtonC1A1->setPixmap( image0 );
114     SelectButtonC1A1->setToggleButton( FALSE );
115     GroupC1Layout->addWidget( SelectButtonC1A1, 1, 1 );
116     LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
117     LineEditC1A1->setReadOnly( true );
118     GroupC1Layout->addWidget( LineEditC1A1, 1, 2 );
119
120     TextLabelC1A2 = new QLabel( tr( "SMESH_OBJECT_GEOM" ), GroupC1, "TextLabelC1A2" );
121     GroupC1Layout->addWidget( TextLabelC1A2, 2, 0 );
122     SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
123     SelectButtonC1A2->setPixmap( image0 );
124     SelectButtonC1A2->setToggleButton( FALSE );
125     GroupC1Layout->addWidget( SelectButtonC1A2, 2, 1 );
126     LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
127     LineEditC1A2->setReadOnly( true );
128     GroupC1Layout->addWidget( LineEditC1A2, 2, 2 );
129
130     TextLabelC1A1Hyp = new QLabel( tr( "SMESH_OBJECT_HYPOTHESIS" ), GroupC1, "TextLabelC1A1Hyp" );
131     GroupC1Layout->addWidget( TextLabelC1A1Hyp, 3, 0 );
132     SelectButtonC1A1Hyp = new QPushButton( GroupC1, "SelectButtonC1A1Hyp" );
133     SelectButtonC1A1Hyp->setPixmap( image0 );
134     GroupC1Layout->addWidget( SelectButtonC1A1Hyp, 3, 1 );
135     LineEditC1A1Hyp = new QLineEdit( GroupC1, "LineEditC1A1Hyp" );
136     LineEditC1A1Hyp->setReadOnly( true );
137     GroupC1Layout->addWidget( LineEditC1A1Hyp, 3, 2 );
138
139     TextLabelC1A1Algo = new QLabel( tr( "SMESH_OBJECT_ALGORITHM" ), GroupC1, "TextLabelC1A1Algo" );
140     GroupC1Layout->addWidget( TextLabelC1A1Algo, 4, 0 );
141     SelectButtonC1A1Algo = new QPushButton( GroupC1, "SelectButtonC1A1Algo" );
142     SelectButtonC1A1Algo->setPixmap( image0 );
143     GroupC1Layout->addWidget( SelectButtonC1A1Algo, 4, 1 );
144     LineEditC1A1Algo = new QLineEdit( GroupC1, "LineEditC1A1Algo" );
145     LineEditC1A1Algo->setReadOnly( true );
146     GroupC1Layout->addWidget( LineEditC1A1Algo, 4, 2 );
147
148     SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupC1, 1, 0 );
149
150     /***************************************************************/
151     GroupButtons = new QGroupBox( this, "GroupButtons" );
152     GroupButtons->setColumnLayout(0, Qt::Vertical );
153     GroupButtons->layout()->setSpacing( 0 );
154     GroupButtons->layout()->setMargin( 0 );
155     QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
156     GroupButtonsLayout->setAlignment( Qt::AlignTop );
157     GroupButtonsLayout->setSpacing( 6 );
158     GroupButtonsLayout->setMargin( 11 );
159
160     buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons, "buttonOk" );
161     buttonOk->setAutoDefault( TRUE );
162     buttonOk->setDefault( TRUE );
163     GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
164
165     buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons, "buttonApply" );
166     buttonApply->setAutoDefault( TRUE );
167     GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
168
169     GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 );
170
171     buttonCancel = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons, "buttonCancel" );
172     buttonCancel->setAutoDefault( TRUE );
173     GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
174
175     SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupButtons, 2, 0 );
176
177     /***************************************************************/
178     Init( Sel ) ;
179 }
180
181
182 //=================================================================================
183 // function : ~SMESHGUI_AddSubMeshDlg()
184 // purpose  : Destroys the object and frees any allocated resources
185 //=================================================================================
186 SMESHGUI_AddSubMeshDlg::~SMESHGUI_AddSubMeshDlg()
187 {
188     // no need to delete child widgets, Qt does it all for us
189 }
190
191
192 //=================================================================================
193 // function : Init()
194 // purpose  :
195 //=================================================================================
196 void SMESHGUI_AddSubMeshDlg::Init( SALOME_Selection* Sel )
197 {
198   mySelection = Sel;
199   mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
200   mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
201
202   myGeomFilter       = new SALOME_TypeFilter( "GEOM" );
203   myMeshFilter       = new SMESH_TypeFilter( MESH );
204   myAlgorithmFilter  = new SMESH_TypeFilter( ALGORITHM );
205   myHypothesisFilter = new SMESH_TypeFilter( HYPOTHESIS );
206
207   /* signals and slots connections */
208   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
209   connect( buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
210   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
211
212   connect( SelectButtonC1A1,     SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
213   connect( SelectButtonC1A2,     SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
214   connect( SelectButtonC1A1Hyp,  SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
215   connect( SelectButtonC1A1Algo, SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
216
217   connect( mySelection, SIGNAL( currentSelectionChanged() ),      this, SLOT( SelectionIntoArgument() ) );
218   connect( mySMESHGUI,  SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
219   connect( mySMESHGUI,  SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) ) ;
220   
221   int x, y ;
222   mySMESHGUI->DefineDlgPosition( this, x, y ) ;
223   this->move( x, y ) ;
224   this->show() ; 
225
226   LineEdit_NameMesh->setText( tr( "SMESH_SUBMESH" ) );
227   LineEdit_NameMesh->setFocus() ;
228   myEditCurrentArgument = LineEditC1A1 ;        
229   mySelection->ClearFilters() ;   
230   mySelection->AddFilter( myMeshFilter ) ;
231
232   SelectionIntoArgument();
233 }
234
235 //=================================================================================
236 // function : ClickOnOk()
237 // purpose  :
238 //=================================================================================
239 void SMESHGUI_AddSubMeshDlg::ClickOnOk()
240 {
241   if ( this->ClickOnApply() )
242     this->ClickOnCancel() ;
243 }
244
245 //=================================================================================
246 // function : ClickOnApply()
247 // purpose  :
248 //=================================================================================
249 bool SMESHGUI_AddSubMeshDlg::ClickOnApply()
250 {
251   if (mySMESHGUI->ActiveStudyLocked())
252     return false;
253
254   QString myNameSubMesh = LineEdit_NameMesh->text().stripWhiteSpace();
255   if ( myNameSubMesh.isEmpty() ) {
256     QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
257     return false;
258   }
259   
260   if ( myMesh->_is_nil() || myGeomShape->_is_nil() || ( !HypoList.count() && !AlgoList.count() ) )
261     return false;
262
263   SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
264   GEOM::GEOM_Object_var myMainShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
265   if ( myMainShape->_is_nil() )
266     return false;
267
268   QAD_WaitCursor wc;
269
270   QAD_Operation* op = new QAD_Operation( mySMESHGUI->GetActiveStudy() );
271
272   // start transaction
273   op->start();
274   
275   // create submesh
276   SMESH::SMESH_subMesh_var aSubMesh = SMESH::AddSubMesh( myMesh, myGeomShape, myNameSubMesh ) ;
277   int nbSuccess = 0;
278   
279   if ( !aSubMesh->_is_nil() ) {
280     // assign hypotheses
281     int nbAlgo = AlgoList.count();
282     int nbHyps = HypoList.count() + nbAlgo;
283     for( int i = 0; i < nbHyps; i++ ) {
284       SALOMEDS::SObject_var aHypSO = SMESH::GetActiveStudyDocument()->FindObjectID
285         ( i < nbAlgo ? AlgoList[i] : HypoList[i-nbAlgo] );
286       if ( !aHypSO->_is_nil() ) {
287         CORBA::Object_var anObject = aHypSO->GetObject();
288         if ( !CORBA::is_nil( anObject ) ) {
289           SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
290           if ( !aHyp->_is_nil() )
291             if ( SMESH::AddHypothesisOnSubMesh( aSubMesh, aHyp ) )
292               nbSuccess++;
293         }
294         else {
295           SCRUTE( CORBA::is_nil( anObject ));
296         }
297       }
298       else {
299         SCRUTE( aHypSO->_is_nil() );
300       }
301     }
302   }
303   else {
304     SCRUTE( aSubMesh->_is_nil() );
305   }
306   
307   // commit transaction
308   op->finish();
309   return ( nbSuccess > 0 );
310 }
311
312
313 //=================================================================================
314 // function : ClickOnCancel()
315 // purpose  :
316 //=================================================================================
317 void SMESHGUI_AddSubMeshDlg::ClickOnCancel()
318 {
319   close();
320 }
321
322 //=======================================================================
323 //function : IsFatherOf
324 //purpose  : 
325 //=======================================================================
326
327 static bool IsFatherOf( SALOMEDS::SObject_ptr SO, SALOMEDS::SObject_ptr fatherSO ) {
328   if ( !SO->_is_nil() && !fatherSO->_is_nil() ) {
329     SALOMEDS::SObject_var aSO = SO->GetFather();
330     while( strlen( aSO->GetID() ) >= strlen( fatherSO->GetID() ) ) {
331       if ( QString( aSO->GetID() ) == QString( fatherSO->GetID() ) )
332         return true;
333       aSO = aSO->GetFather();
334     }
335   }
336   return false;
337 }
338
339 //=================================================================================
340 // function : SelectionIntoArgument()
341 // purpose  : Called when selection as changed or other case
342 //=================================================================================
343 void SMESHGUI_AddSubMeshDlg::SelectionIntoArgument()
344 {
345   QString aString = ""; 
346   int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString) ;
347
348   if ( myEditCurrentArgument == LineEditC1A1 ) {
349     // mesh
350     if ( nbSel != 1 ) {
351       myMesh = SMESH::SMESH_Mesh::_nil();
352       aString = "";
353     } 
354     else {
355       Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
356       myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
357       if( myMesh->_is_nil() ) {
358         aString = "";
359       }
360     }
361     myGeomShape = GEOM::GEOM_Object::_nil();
362     LineEditC1A2->setText( "" );
363   }
364   else if ( myEditCurrentArgument == LineEditC1A2 ) {
365     // geom shape
366     if ( nbSel != 1 ) {
367       myGeomShape = GEOM::GEOM_Object::_nil();
368       aString = "";
369     } 
370     else {
371       Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
372       myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO) ;
373       if( myGeomShape->_is_nil() || !GEOMBase::IsShape( myGeomShape ) )
374       {
375         myGeomShape = GEOM::GEOM_Object::_nil();
376         aString = "";
377       }
378       if ( !myMesh->_is_nil() ) {
379         SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
380         GEOM::GEOM_Object_var aMainGeomShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
381         SALOMEDS::SObject_var aMainGeomShapeSO = SMESH::FindSObject( aMainGeomShape );
382         if ( aMainGeomShapeSO->_is_nil() || !IsFatherOf( SMESH::GetActiveStudyDocument()->FindObjectID( IO->getEntry() ), aMainGeomShapeSO ) ) {
383           myGeomShape = GEOM::GEOM_Object::_nil();
384           aString = "";
385         }         
386       }
387     }
388   } 
389   else if ( myEditCurrentArgument == LineEditC1A1Hyp ) {
390     // hypotheses
391     HypoList.clear();
392     if ( nbSel >= 1 ) {
393       SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
394       for ( ; Itinit.More(); Itinit.Next() ) {
395         HypoList.append( Itinit.Value()->getEntry() );
396       }
397       if ( nbSel > 1 )
398         aString = tr( "%1 Hypothesis" ).arg( nbSel ) ;
399     }
400     else {
401       aString = "";
402     }
403   }
404   else if ( myEditCurrentArgument == LineEditC1A1Algo ) {
405     // algorithms
406     AlgoList.clear(); 
407     if ( nbSel >= 1 ) {
408       SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
409       for ( ; Itinit.More(); Itinit.Next() ) {
410         AlgoList.append( Itinit.Value()->getEntry() );
411       }
412       if ( nbSel > 1 )
413         aString = tr( "%1 Algorithms" ).arg( nbSel ) ;
414     }
415     else {
416       aString = "";
417     }
418   }
419   
420   myEditCurrentArgument->setText(aString) ;
421
422   UpdateControlState();
423 }
424
425
426 //=================================================================================
427 // function : SetEditCurrentArgument()
428 // purpose  :
429 //=================================================================================
430 void SMESHGUI_AddSubMeshDlg::SetEditCurrentArgument()
431 {
432   QPushButton* send = (QPushButton*)sender();
433   if(send == SelectButtonC1A1) {
434     LineEditC1A1->setFocus() ;
435     myEditCurrentArgument = LineEditC1A1;
436     mySelection->ClearFilters() ;         
437     mySelection->AddFilter(myMeshFilter) ;
438   } else if (send == SelectButtonC1A2) {
439     LineEditC1A2->setFocus() ;
440     myEditCurrentArgument = LineEditC1A2;
441     mySelection->ClearFilters() ;
442     mySelection->AddFilter(myGeomFilter) ;
443   } else if( send == SelectButtonC1A1Hyp ) {
444     LineEditC1A1Hyp->setFocus() ;
445     myEditCurrentArgument = LineEditC1A1Hyp ;
446     mySelection->ClearFilters() ;         
447     mySelection->AddFilter(myHypothesisFilter) ;
448   } else if( send == SelectButtonC1A1Algo ) {
449     LineEditC1A1Algo->setFocus() ;
450     myEditCurrentArgument = LineEditC1A1Algo ;
451     mySelection->ClearFilters() ;         
452     mySelection->AddFilter(myAlgorithmFilter) ;
453   }
454   SelectionIntoArgument() ;
455 }
456
457 //=================================================================================
458 // function : DeactivateActiveDialog()
459 // purpose  :
460 //=================================================================================
461 void SMESHGUI_AddSubMeshDlg::DeactivateActiveDialog()
462 {
463   if ( GroupC1->isEnabled() ) {
464     disconnect( mySelection, 0, this, 0 );
465     GroupC1->setEnabled(false) ;
466     GroupButtons->setEnabled(false) ;
467   }
468 }
469
470
471 //=================================================================================
472 // function : ActivateThisDialog()
473 // purpose  :
474 //=================================================================================
475 void SMESHGUI_AddSubMeshDlg::ActivateThisDialog()
476 {
477   mySMESHGUI->EmitSignalDeactivateDialog() ;   
478   GroupC1->setEnabled(true) ;
479   GroupButtons->setEnabled(true) ;
480   connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
481 }
482
483
484 //=================================================================================
485 // function : enterEvent()
486 // purpose  :
487 //=================================================================================
488 void SMESHGUI_AddSubMeshDlg::enterEvent(QEvent* e)
489 {
490   if ( !GroupC1->isEnabled() )
491     ActivateThisDialog() ;
492 }
493
494
495 //=================================================================================
496 // function : closeEvent()
497 // purpose  :
498 //=================================================================================
499 void SMESHGUI_AddSubMeshDlg::closeEvent( QCloseEvent* e )
500 {
501   disconnect( mySelection, 0, this, 0 );
502   mySMESHGUI->ResetState() ;
503   mySelection->ClearFilters() ;
504   QDialog::closeEvent( e );
505 }
506
507 //=================================================================================
508 // function : UpdateControlState()
509 // purpose  :
510 //=================================================================================
511 void SMESHGUI_AddSubMeshDlg::UpdateControlState()
512 {
513   bool isEnabled = ( !myMesh->_is_nil() && !myGeomShape->_is_nil() && ( HypoList.count() || AlgoList.count() ) );
514   bool isImportedMesh = false;
515   if ( !myMesh->_is_nil() ) {
516     SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
517     GEOM::GEOM_Object_var myGeomShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
518     isImportedMesh = myGeomShape->_is_nil();
519   }
520
521   buttonOk   ->setEnabled( isEnabled && !isImportedMesh );
522   buttonApply->setEnabled( isEnabled && !isImportedMesh );
523 }