1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESHGUI_ExtrusionDlg.cxx
25 // Author : Michael ZORIN
29 #include "SMESHGUI_ExtrusionDlg.h"
31 #include "SMESHGUI_SpinBox.h"
32 #include "SMESHGUI_Utils.h"
33 #include "SMESHGUI_VTKUtils.h"
34 #include "SMESHGUI_MeshUtils.h"
35 #include "SMESHGUI_IdValidator.h"
36 #include "SMESH_Actor.h"
37 #include "SMESH_TypeFilter.hxx"
38 #include "SMDS_Mesh.hxx"
40 #include "QAD_Application.h"
41 #include "QAD_Desktop.h"
42 #include "QAD_MessageBox.h"
43 #include "utilities.h"
46 #include <qapplication.h>
47 #include <qbuttongroup.h>
48 #include <qgroupbox.h>
50 #include <qlineedit.h>
51 #include <qpushbutton.h>
52 #include <qradiobutton.h>
53 #include <qcheckbox.h>
56 #include <qvalidator.h>
61 //=================================================================================
62 // class : SMESHGUI_ExtrusionDlg()
64 //=================================================================================
65 SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
66 bool modal, WFlags fl )
67 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
68 Qt::WDestructiveClose)
70 QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_EDGE")));
71 QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_TRIANGLE")));
72 QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
75 setName( "SMESHGUI_ExtrusionDlg" );
77 setCaption( tr( "EXTRUSION_ALONG_LINE" ) );
78 setSizeGripEnabled( TRUE );
79 SMESHGUI_ExtrusionDlgLayout = new QGridLayout( this );
80 SMESHGUI_ExtrusionDlgLayout->setSpacing( 6 );
81 SMESHGUI_ExtrusionDlgLayout->setMargin( 11 );
83 /***************************************************************/
84 GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
85 GroupConstructors->setTitle( tr( "SMESH_EXTRUSION" ) );
86 GroupConstructors->setExclusive( TRUE );
87 GroupConstructors->setColumnLayout(0, Qt::Vertical );
88 GroupConstructors->layout()->setSpacing( 0 );
89 GroupConstructors->layout()->setMargin( 0 );
90 GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
91 GroupConstructorsLayout->setAlignment( Qt::AlignTop );
92 GroupConstructorsLayout->setSpacing( 6 );
93 GroupConstructorsLayout->setMargin( 11 );
94 RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" );
95 RadioButton1->setText( tr( "" ) );
96 RadioButton1->setPixmap( image0 );
97 GroupConstructorsLayout->addWidget( RadioButton1, 0, 0 );
98 RadioButton2= new QRadioButton( GroupConstructors, "RadioButton2" );
99 RadioButton2->setText( tr( "" ) );
100 RadioButton2->setPixmap( image1 );
101 GroupConstructorsLayout->addWidget( RadioButton2, 0, 2 );
102 SMESHGUI_ExtrusionDlgLayout->addWidget( GroupConstructors, 0, 0 );
104 /***************************************************************/
105 GroupButtons = new QGroupBox( this, "GroupButtons" );
106 GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
107 GroupButtons->setTitle( tr( "" ) );
108 GroupButtons->setColumnLayout(0, Qt::Vertical );
109 GroupButtons->layout()->setSpacing( 0 );
110 GroupButtons->layout()->setMargin( 0 );
111 GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
112 GroupButtonsLayout->setAlignment( Qt::AlignTop );
113 GroupButtonsLayout->setSpacing( 6 );
114 GroupButtonsLayout->setMargin( 11 );
115 buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
116 buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
117 buttonCancel->setAutoDefault( TRUE );
118 GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
119 buttonApply = new QPushButton( GroupButtons, "buttonApply" );
120 buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
121 buttonApply->setAutoDefault( TRUE );
122 GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
123 QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
124 GroupButtonsLayout->addItem( spacer_9, 0, 2 );
125 buttonOk = new QPushButton( GroupButtons, "buttonOk" );
126 buttonOk->setText( tr( "SMESH_BUT_OK" ) );
127 buttonOk->setAutoDefault( TRUE );
128 buttonOk->setDefault( TRUE );
129 GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
130 SMESHGUI_ExtrusionDlgLayout->addWidget( GroupButtons, 2, 0 );
132 /***************************************************************/
133 GroupArguments = new QGroupBox( this, "GroupArguments" );
134 GroupArguments->setTitle( tr( "EXTRUSION_1D" ) );
135 GroupArguments->setColumnLayout(0, Qt::Vertical );
136 GroupArguments->layout()->setSpacing( 0 );
137 GroupArguments->layout()->setMargin( 0 );
138 GroupArgumentsLayout = new QGridLayout( GroupArguments->layout());
139 GroupArgumentsLayout->setAlignment( Qt::AlignTop );
140 GroupArgumentsLayout->setSpacing( 6 );
141 GroupArgumentsLayout->setMargin( 11 );
143 // Controls for elements selection
144 TextLabelElements = new QLabel( GroupArguments, "TextLabelElements" );
145 TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
146 TextLabelElements->setFixedWidth(74);
147 GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
149 SelectElementsButton = new QPushButton( GroupArguments, "SelectElementsButton" );
150 SelectElementsButton->setText( tr( "" ) );
151 SelectElementsButton->setPixmap( image2 );
152 SelectElementsButton->setToggleButton( FALSE );
153 GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
155 LineEditElements = new QLineEdit( GroupArguments, "LineEditElements" );
156 LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
157 GroupArgumentsLayout->addMultiCellWidget( LineEditElements, 0, 0, 2, 7 );
159 // Control for the whole mesh selection
160 CheckBoxMesh = new QCheckBox( GroupArguments, "CheckBoxMesh" );
161 CheckBoxMesh->setText( tr( "SMESH_SELECT_WHOLE_MESH" ) );
162 GroupArgumentsLayout->addMultiCellWidget( CheckBoxMesh, 1, 1, 0, 7 );
164 // Controls for vector selection
165 TextLabelVector = new QLabel( GroupArguments, "TextLabelVector" );
166 TextLabelVector->setText( tr( "SMESH_VECTOR" ) );
167 GroupArgumentsLayout->addWidget( TextLabelVector, 2, 0 );
169 TextLabelDx = new QLabel( GroupArguments, "TextLabelDx" );
170 TextLabelDx->setText( tr( "SMESH_DX" ) );
171 GroupArgumentsLayout->addWidget( TextLabelDx, 2, 2 );
173 SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dx");
174 GroupArgumentsLayout->addWidget( SpinBox_Dx, 2, 3 );
176 TextLabelDy = new QLabel( GroupArguments, "TextLabelDy" );
177 TextLabelDy->setText( tr( "SMESH_DY" ) );
178 GroupArgumentsLayout->addWidget( TextLabelDy, 2, 4 );
180 SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dy");
181 GroupArgumentsLayout->addWidget( SpinBox_Dy, 2, 5 );
183 TextLabelDz = new QLabel( GroupArguments, "TextLabelDz" );
184 TextLabelDz->setText( tr( "SMESH_DZ" ) );
185 GroupArgumentsLayout->addWidget( TextLabelDz, 2, 6 );
187 SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dz");
188 GroupArgumentsLayout->addWidget( SpinBox_Dz, 2, 7 );
190 // Controls for nb. steps defining
191 TextLabelNbSteps = new QLabel( GroupArguments, "TextLabelNbSteps" );
192 TextLabelNbSteps->setText( tr( "SMESH_NUMBEROFSTEPS" ) );
193 GroupArgumentsLayout->addMultiCellWidget( TextLabelNbSteps, 3, 3, 0, 1 );
195 SpinBox_NbSteps = new QSpinBox(GroupArguments, "SpinBox_NbSteps");
196 GroupArgumentsLayout->addMultiCellWidget( SpinBox_NbSteps, 3, 3, 2, 7 );
198 SMESHGUI_ExtrusionDlgLayout->addWidget( GroupArguments, 1, 0 );
200 /* Initialisations */
201 SpinBox_Dx->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
202 SpinBox_Dy->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
203 SpinBox_Dz->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
205 QIntValidator* anIntValidator = new QIntValidator(SpinBox_NbSteps);
206 SpinBox_NbSteps->setValidator(anIntValidator);
207 SpinBox_NbSteps->setRange( 1, 999999 );
209 GroupArguments->show();
210 RadioButton1->setChecked( TRUE );
213 mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
214 mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
216 // Costruction of the logical filter
217 SMESH_ListOfFilter aListOfFilters;
218 Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
219 if ( !aMeshOrSubMeshFilter.IsNull() )
220 aListOfFilters.Append( aMeshOrSubMeshFilter );
221 Handle(SMESH_TypeFilter) aSmeshGroupFilter = new SMESH_TypeFilter( GROUP );
222 if ( !aSmeshGroupFilter.IsNull() )
223 aListOfFilters.Append( aSmeshGroupFilter );
225 myMeshOrSubMeshOrGroupFilter = new SMESH_LogicalFilter( aListOfFilters, SMESH_LogicalFilter::LO_OR );
228 /* signals and slots connections */
229 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
230 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
231 connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
232 connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
234 connect( SelectElementsButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
235 connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
236 connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
237 /* to close dialog if study change */
238 connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
239 connect( LineEditElements, SIGNAL( textChanged( const QString& )),
240 SLOT( onTextChange( const QString& )));
241 connect( CheckBoxMesh, SIGNAL( toggled( bool )),
242 SLOT( onSelectMesh( bool )));
244 /* Move widget on the botton right corner of main widget */
246 mySMESHGUI->DefineDlgPosition( this, x, y ) ;
248 this->show() ; /* displays Dialog */
250 ConstructorsClicked(0);
253 //=================================================================================
254 // function : ~SMESHGUI_ExtrusionDlg()
255 // purpose : Destroys the object and frees any allocated resources
256 //=================================================================================
257 SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
259 // no need to delete child widgets, Qt does it all for us
263 //=================================================================================
266 //=================================================================================
267 void SMESHGUI_ExtrusionDlg::Init( bool ResetControls )
271 LineEditElements->clear();
275 buttonOk->setEnabled( false );
276 buttonApply->setEnabled( false );
279 myMesh = SMESH::SMESH_Mesh::_nil();
283 SpinBox_NbSteps->setValue(1);
284 SpinBox_Dx->SetValue(0);
285 SpinBox_Dy->SetValue(0);
286 SpinBox_Dz->SetValue(0);
288 CheckBoxMesh->setChecked(false);
289 onSelectMesh( false );
294 //=================================================================================
295 // function : ConstructorsClicked()
296 // purpose : Radio button management
297 //=================================================================================
298 void SMESHGUI_ExtrusionDlg::ConstructorsClicked(int constructorId)
300 disconnect(mySelection, 0, this, 0);
302 switch(constructorId)
306 GroupArguments->setTitle( tr( "EXTRUSION_1D" ) );
307 if ( !CheckBoxMesh->isChecked() )
308 QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
313 GroupArguments->setTitle( tr( "EXTRUSION_2D" ) );
314 if ( !CheckBoxMesh->isChecked() )
315 QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
320 myEditCurrentArgument = LineEditElements;
321 LineEditElements->setFocus();
323 if (CheckBoxMesh->isChecked())
326 connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
330 //=================================================================================
331 // function : ClickOnApply()
333 //=================================================================================
334 void SMESHGUI_ExtrusionDlg::ClickOnApply()
336 if (mySMESHGUI->ActiveStudyLocked())
341 QStringList aListElementsId = QStringList::split( " ", myElementsId, false);
343 SMESH::long_array_var anElementsId = new SMESH::long_array;
345 anElementsId->length( aListElementsId.count() );
346 for ( int i = 0; i < aListElementsId.count(); i++ )
347 anElementsId[i] = aListElementsId[i].toInt();
349 SMESH::DirStruct aVector;
350 aVector.PS.x = SpinBox_Dx->GetValue();
351 aVector.PS.y = SpinBox_Dy->GetValue();
352 aVector.PS.z = SpinBox_Dz->GetValue();
354 long aNbSteps = (long)SpinBox_NbSteps->value();
358 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
359 QApplication::setOverrideCursor(Qt::waitCursor);
360 aMeshEditor->ExtrusionSweep(anElementsId.inout(), aVector, aNbSteps);
361 QApplication::restoreOverrideCursor();
367 mySelection->ClearIObjects();
370 ConstructorsClicked( GetConstructorId() );
374 //=================================================================================
375 // function : ClickOnOk()
377 //=================================================================================
378 void SMESHGUI_ExtrusionDlg::ClickOnOk()
385 //=================================================================================
386 // function : ClickOnCancel()
388 //=================================================================================
389 void SMESHGUI_ExtrusionDlg::ClickOnCancel()
391 mySelection->ClearFilters();
392 mySelection->ClearIObjects();
393 SMESH::SetPointRepresentation(false);
394 QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
395 disconnect( mySelection, 0, this, 0 );
396 mySMESHGUI->ResetState() ;
400 //=======================================================================
401 //function : onTextChange
403 //=======================================================================
404 void SMESHGUI_ExtrusionDlg::onTextChange(const QString& theNewText)
406 QLineEdit* send = (QLineEdit*)sender();
408 if ( myBusy ) return;
411 if (send == LineEditElements)
414 buttonOk->setEnabled( false );
415 buttonApply->setEnabled( false );
417 // hilight entered elements/nodes
418 SMDS_Mesh* aMesh = 0;
420 aMesh = myActor->GetObject()->GetMesh();
423 mySelection->ClearIObjects();
424 mySelection->AddIObject( myActor->getIO() );
426 QStringList aListId = QStringList::split( " ", theNewText, false);
428 if (send == LineEditElements) {
429 for ( int i = 0; i < aListId.count(); i++ ) {
430 const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
432 if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
433 mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
437 myElementsId = theNewText;
441 if ( myNbOkElements ) {
442 buttonOk->setEnabled( true );
443 buttonApply->setEnabled( true );
449 //=================================================================================
450 // function : SelectionIntoArgument()
451 // purpose : Called when selection as changed or other case
452 //=================================================================================
453 void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
455 if ( myBusy ) return;
459 QString aString = "";
462 myEditCurrentArgument->setText( aString );
464 buttonOk->setEnabled( false );
465 buttonApply->setEnabled( false );
468 if ( !GroupButtons->isEnabled() ) // inactive
471 buttonOk->setEnabled( false );
472 buttonApply->setEnabled( false );
476 int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString);
480 Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
481 myMesh = SMESH::GetMeshByIO(IO);
482 if(myMesh->_is_nil())
484 myActor = SMESH::FindActorByObject(myMesh);
488 if (myEditCurrentArgument == LineEditElements)
493 if (CheckBoxMesh->isChecked())
495 SMESH::GetNameOfSelectedIObjects(mySelection, aString);
497 int aConstructorId = GetConstructorId();
499 if(!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) //MESH
502 SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
506 if (aConstructorId == 0)
508 SMDS_EdgeIteratorPtr anIter = aSMDSMesh->edgesIterator();
510 while ( anIter->more() )
512 const SMDS_MeshEdge * edge = anIter->next();
514 myElementsId += QString(" %1").arg(edge->GetID());
519 else if (aConstructorId == 1)
521 SMDS_FaceIteratorPtr anIter = aSMDSMesh->facesIterator();
522 while ( anIter->more() )
524 const SMDS_MeshFace * face = anIter->next();
526 myElementsId += QString(" %1").arg(face->GetID());
532 else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) //SUBMESH
535 SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
537 // get IDs from submesh
538 SMESH::long_array_var anElementsIds = new SMESH::long_array;
539 if (aConstructorId == 0)
540 anElementsIds = aSubMesh->GetElementsByType(SMESH::EDGE);
541 else if (aConstructorId == 1)
542 anElementsIds = aSubMesh->GetElementsByType(SMESH::FACE);
544 for ( int i = 0; i < anElementsIds->length(); i++ )
545 myElementsId += QString(" %1").arg(anElementsIds[i]);
546 aNbElements = anElementsIds->length();
551 SMESH::SMESH_GroupBase_var aGroup =
552 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
553 if (aGroup->_is_nil())
556 if ( (aConstructorId == 0 && aGroup->GetType()!= SMESH::EDGE) ||
557 (aConstructorId == 1 && aGroup->GetType()!= SMESH::FACE) )
560 // get IDs from smesh group
561 SMESH::long_array_var anElementsIds = new SMESH::long_array;
562 anElementsIds = aGroup->GetListOfID();
563 for ( int i = 0; i < anElementsIds->length(); i++ )
564 myElementsId += QString(" %1").arg(anElementsIds[i]);
565 aNbElements = anElementsIds->length();
570 aNbElements = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
571 myElementsId = aString;
577 myNbOkElements = true;
581 myEditCurrentArgument->setText( aString );
588 buttonOk->setEnabled( true );
589 buttonApply->setEnabled( true );
594 //=================================================================================
595 // function : SetEditCurrentArgument()
597 //=================================================================================
598 void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
600 QPushButton* send = (QPushButton*)sender();
602 disconnect( mySelection, 0, this, 0 );
603 mySelection->ClearIObjects();
604 mySelection->ClearFilters();
606 if(send == SelectElementsButton) {
607 myEditCurrentArgument = LineEditElements;
608 if (CheckBoxMesh->isChecked())
610 QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
611 mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
615 int aConstructorId = GetConstructorId();
616 if (aConstructorId == 0)
617 QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
618 else if (aConstructorId == 1)
619 QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
623 myEditCurrentArgument->setFocus();
624 connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
625 SelectionIntoArgument() ;
628 //=================================================================================
629 // function : DeactivateActiveDialog()
631 //=================================================================================
632 void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog()
634 if ( GroupConstructors->isEnabled() ) {
635 GroupConstructors->setEnabled(false) ;
636 GroupArguments->setEnabled(false) ;
637 GroupButtons->setEnabled(false) ;
638 mySMESHGUI->ResetState() ;
639 mySMESHGUI->SetActiveDialogBox(0) ;
644 //=================================================================================
645 // function : ActivateThisDialog()
647 //=================================================================================
648 void SMESHGUI_ExtrusionDlg::ActivateThisDialog()
650 /* Emit a signal to deactivate the active dialog */
651 mySMESHGUI->EmitSignalDeactivateDialog() ;
652 GroupConstructors->setEnabled(true) ;
653 GroupArguments->setEnabled(true) ;
654 GroupButtons->setEnabled(true) ;
656 mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
658 ConstructorsClicked(GetConstructorId());
659 SelectionIntoArgument();
663 //=================================================================================
664 // function : enterEvent()
666 //=================================================================================
667 void SMESHGUI_ExtrusionDlg::enterEvent(QEvent* e)
669 if ( GroupConstructors->isEnabled() )
671 ActivateThisDialog() ;
675 //=================================================================================
676 // function : closeEvent()
678 //=================================================================================
679 void SMESHGUI_ExtrusionDlg::closeEvent( QCloseEvent* e )
681 /* same than click on cancel button */
682 this->ClickOnCancel() ;
686 //=======================================================================
687 //function : hideEvent
688 //purpose : caused by ESC key
689 //=======================================================================
691 void SMESHGUI_ExtrusionDlg::hideEvent ( QHideEvent * e )
693 if ( !isMinimized() )
698 //=======================================================================
699 //function : onSelectMesh
701 //=======================================================================
702 void SMESHGUI_ExtrusionDlg::onSelectMesh ( bool toSelectMesh )
705 TextLabelElements->setText( tr( "SMESH_NAME" ) );
707 TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
709 if (myEditCurrentArgument != LineEditElements)
711 LineEditElements->clear();
715 mySelection->ClearFilters() ;
719 QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
720 mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
721 LineEditElements->setReadOnly(true);
725 int aConstructorId = GetConstructorId();
726 if (aConstructorId == 0)
727 QAD_Application::getDesktop()->SetSelectionMode( EdgeSelection, true );
728 else if (aConstructorId == 0)
729 QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
731 LineEditElements->setReadOnly(false);
732 onTextChange(LineEditElements->text());
735 SelectionIntoArgument();
739 //=================================================================================
740 // function : GetConstructorId()
742 //=================================================================================
743 int SMESHGUI_ExtrusionDlg::GetConstructorId()
745 if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
746 return GroupConstructors->id( GroupConstructors->selected() );