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"
32 #include "SMESHGUI_Utils.h"
33 #include "SMESHGUI_VTKUtils.h"
34 #include "SMESHGUI_MeshUtils.h"
35 #include "SMESHGUI_SpinBox.h"
36 #include "SMESHGUI_IdValidator.h"
38 #include "SMESH_Actor.h"
39 #include "SMESH_TypeFilter.hxx"
40 #include "SMESH_NumberFilter.hxx"
41 #include "SMESH_LogicalFilter.hxx"
43 #include "SMDS_Mesh.hxx"
45 #include "SUIT_ResourceMgr.h"
46 #include "SUIT_OverrideCursor.h"
47 #include "SUIT_Desktop.h"
48 #include "SUIT_MessageBox.h"
50 #include "SVTK_ViewModel.h"
51 #include "SVTK_ViewWindow.h"
52 #include "SVTK_Selector.h"
53 #include "SVTK_Selection.h"
54 #include "SALOME_ListIO.hxx"
56 #include "utilities.h"
59 #include <TColStd_MapOfInteger.hxx>
60 #include <TColStd_IndexedMapOfInteger.hxx>
63 #include <qapplication.h>
64 #include <qbuttongroup.h>
65 #include <qgroupbox.h>
67 #include <qlineedit.h>
68 #include <qpushbutton.h>
69 #include <qradiobutton.h>
70 #include <qcheckbox.h>
73 #include <qvalidator.h>
77 #include "SALOMEconfig.h"
78 #include CORBA_SERVER_HEADER(SMESH_Group)
82 //=================================================================================
83 // function : SMESHGUI_ExtrusionDlg()
84 // purpose : constructor
85 //=================================================================================
86 SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule,
88 : QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_ExtrusionDlg", modal, WStyle_Customize |
89 WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
90 mySMESHGUI( theModule ),
91 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
93 QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
94 QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
95 QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
98 setCaption(tr("EXTRUSION_ALONG_LINE"));
99 setSizeGripEnabled(TRUE);
101 QGridLayout* SMESHGUI_ExtrusionDlgLayout = new QGridLayout(this);
102 SMESHGUI_ExtrusionDlgLayout->setSpacing(6);
103 SMESHGUI_ExtrusionDlgLayout->setMargin(11);
105 /***************************************************************/
106 GroupConstructors = new QButtonGroup("GroupConstructors", this);
107 GroupConstructors->setTitle(tr("SMESH_EXTRUSION"));
108 GroupConstructors->setExclusive(TRUE);
109 GroupConstructors->setColumnLayout(0, Qt::Vertical);
110 GroupConstructors->layout()->setSpacing(0);
111 GroupConstructors->layout()->setMargin(0);
112 QGridLayout* GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
113 GroupConstructorsLayout->setAlignment(Qt::AlignTop);
114 GroupConstructorsLayout->setSpacing(6);
115 GroupConstructorsLayout->setMargin(11);
116 RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1");
117 RadioButton1->setText(tr(""));
118 RadioButton1->setPixmap(image0);
119 GroupConstructorsLayout->addWidget(RadioButton1, 0, 0);
120 RadioButton2= new QRadioButton(GroupConstructors, "RadioButton2");
121 RadioButton2->setText(tr(""));
122 RadioButton2->setPixmap(image1);
123 GroupConstructorsLayout->addWidget(RadioButton2, 0, 2);
124 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupConstructors, 0, 0);
126 /***************************************************************/
127 GroupButtons = new QGroupBox(this, "GroupButtons");
128 GroupButtons->setGeometry(QRect(10, 10, 281, 48));
129 GroupButtons->setTitle(tr(""));
130 GroupButtons->setColumnLayout(0, Qt::Vertical);
131 GroupButtons->layout()->setSpacing(0);
132 GroupButtons->layout()->setMargin(0);
133 QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
134 GroupButtonsLayout->setAlignment(Qt::AlignTop);
135 GroupButtonsLayout->setSpacing(6);
136 GroupButtonsLayout->setMargin(11);
137 buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
138 buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
139 buttonCancel->setAutoDefault(TRUE);
140 GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
141 buttonApply = new QPushButton(GroupButtons, "buttonApply");
142 buttonApply->setText(tr("SMESH_BUT_APPLY" ));
143 buttonApply->setAutoDefault(TRUE);
144 GroupButtonsLayout->addWidget(buttonApply, 0, 1);
145 QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
146 GroupButtonsLayout->addItem(spacer_9, 0, 2);
147 buttonOk = new QPushButton(GroupButtons, "buttonOk");
148 buttonOk->setText(tr("SMESH_BUT_OK" ));
149 buttonOk->setAutoDefault(TRUE);
150 buttonOk->setDefault(TRUE);
151 GroupButtonsLayout->addWidget(buttonOk, 0, 0);
152 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons, 2, 0);
154 /***************************************************************/
155 GroupArguments = new QGroupBox(this, "GroupArguments");
156 GroupArguments->setTitle(tr("EXTRUSION_1D"));
157 GroupArguments->setColumnLayout(0, Qt::Vertical);
158 GroupArguments->layout()->setSpacing(0);
159 GroupArguments->layout()->setMargin(0);
160 QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments->layout());
161 GroupArgumentsLayout->setAlignment(Qt::AlignTop);
162 GroupArgumentsLayout->setSpacing(6);
163 GroupArgumentsLayout->setMargin(11);
165 // Controls for elements selection
166 TextLabelElements = new QLabel(GroupArguments, "TextLabelElements");
167 TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" ));
168 TextLabelElements->setFixedWidth(74);
169 GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
171 SelectElementsButton = new QPushButton(GroupArguments, "SelectElementsButton");
172 SelectElementsButton->setText(tr("" ));
173 SelectElementsButton->setPixmap(image2);
174 SelectElementsButton->setToggleButton(FALSE);
175 GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
177 LineEditElements = new QLineEdit(GroupArguments, "LineEditElements");
178 LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
179 GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 7);
181 // Control for the whole mesh selection
182 CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh");
183 CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
184 GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 7);
186 // Controls for vector selection
187 TextLabelVector = new QLabel(GroupArguments, "TextLabelVector");
188 TextLabelVector->setText(tr("SMESH_VECTOR"));
189 GroupArgumentsLayout->addWidget(TextLabelVector, 2, 0);
191 TextLabelDx = new QLabel(GroupArguments, "TextLabelDx");
192 TextLabelDx->setText(tr("SMESH_DX"));
193 GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2);
195 SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dx");
196 GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3);
198 TextLabelDy = new QLabel(GroupArguments, "TextLabelDy");
199 TextLabelDy->setText(tr("SMESH_DY"));
200 GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4);
202 SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dy");
203 GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5);
205 TextLabelDz = new QLabel(GroupArguments, "TextLabelDz");
206 TextLabelDz->setText(tr("SMESH_DZ"));
207 GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6);
209 SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dz");
210 GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7);
212 // Controls for nb. steps defining
213 TextLabelNbSteps = new QLabel(GroupArguments, "TextLabelNbSteps");
214 TextLabelNbSteps->setText(tr("SMESH_NUMBEROFSTEPS" ));
215 GroupArgumentsLayout->addMultiCellWidget(TextLabelNbSteps, 3, 3, 0, 1);
217 SpinBox_NbSteps = new QSpinBox(GroupArguments, "SpinBox_NbSteps");
218 GroupArgumentsLayout->addMultiCellWidget(SpinBox_NbSteps, 3, 3, 2, 7);
220 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments, 1, 0);
222 /* Initialisations */
223 SpinBox_Dx->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
224 SpinBox_Dy->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
225 SpinBox_Dz->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
227 QIntValidator* anIntValidator = new QIntValidator(SpinBox_NbSteps);
228 SpinBox_NbSteps->setValidator(anIntValidator);
229 SpinBox_NbSteps->setRange(1, 999999);
231 GroupArguments->show();
232 RadioButton1->setChecked(TRUE);
234 mySMESHGUI->SetActiveDialogBox(this);
236 // Costruction of the logical filter for the elements: mesh/sub-mesh/group
237 SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
238 SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP);
240 QPtrList<SUIT_SelectionFilter> aListOfFilters;
241 if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
242 if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
244 myMeshOrSubMeshOrGroupFilter =
245 new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
249 /***************************************************************/
250 // signals and slots connections
251 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
252 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
253 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
254 connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
256 connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
257 connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
258 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
259 /* to close dialog if study change */
260 connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
261 connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
262 connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
264 /***************************************************************/
265 /* Move widget on the botton right corner of main widget */
267 mySMESHGUI->DefineDlgPosition(this, x, y);
269 this->show(); // displays Dialog
271 ConstructorsClicked(0);
274 //=================================================================================
275 // function : ~SMESHGUI_ExtrusionDlg()
276 // purpose : destructor
277 //=================================================================================
278 SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
280 // no need to delete child widgets, Qt does it all for us
283 //=================================================================================
285 // purpose : initialization
286 //=================================================================================
287 void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
291 LineEditElements->clear();
295 buttonOk->setEnabled(false);
296 buttonApply->setEnabled(false);
299 myMesh = SMESH::SMESH_Mesh::_nil();
302 SpinBox_NbSteps->setValue(1);
303 SpinBox_Dx->SetValue(0);
304 SpinBox_Dy->SetValue(0);
305 SpinBox_Dz->SetValue(0);
307 CheckBoxMesh->setChecked(false);
312 //=================================================================================
313 // function : ConstructorsClicked()
314 // purpose : Radio button management
315 //=================================================================================
316 void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
318 disconnect(mySelectionMgr, 0, this, 0);
320 switch (constructorId) {
323 GroupArguments->setTitle(tr("EXTRUSION_1D"));
324 if (!CheckBoxMesh->isChecked())
326 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
327 aViewWindow->SetSelectionMode(EdgeSelection);
333 GroupArguments->setTitle(tr("EXTRUSION_2D"));
334 if (!CheckBoxMesh->isChecked())
336 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
337 aViewWindow->SetSelectionMode(FaceSelection);
343 myEditCurrentArgument = LineEditElements;
344 LineEditElements->setFocus();
346 if (CheckBoxMesh->isChecked())
349 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
352 //=================================================================================
353 // function : ClickOnApply()
354 // purpose : Called when user presses <Apply> button
355 //=================================================================================
356 bool SMESHGUI_ExtrusionDlg::ClickOnApply()
358 if (mySMESHGUI->isActiveStudyLocked())
361 if (myNbOkElements) {
362 QStringList aListElementsId = QStringList::split(" ", myElementsId, false);
364 SMESH::long_array_var anElementsId = new SMESH::long_array;
366 anElementsId->length(aListElementsId.count());
367 for (int i = 0; i < aListElementsId.count(); i++)
368 anElementsId[i] = aListElementsId[i].toInt();
370 SMESH::DirStruct aVector;
371 aVector.PS.x = SpinBox_Dx->GetValue();
372 aVector.PS.y = SpinBox_Dy->GetValue();
373 aVector.PS.z = SpinBox_Dz->GetValue();
375 long aNbSteps = (long)SpinBox_NbSteps->value();
378 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
379 QApplication::setOverrideCursor(Qt::waitCursor);
380 aMeshEditor->ExtrusionSweep(anElementsId.inout(), aVector, aNbSteps);
381 QApplication::restoreOverrideCursor();
385 mySelectionMgr->clearSelected();
388 ConstructorsClicked(GetConstructorId());
393 //=================================================================================
394 // function : ClickOnOk()
395 // purpose : Called when user presses <OK> button
396 //=================================================================================
397 void SMESHGUI_ExtrusionDlg::ClickOnOk()
403 //=================================================================================
404 // function : ClickOnCancel()
405 // purpose : Called when dialog box is closed
406 //=================================================================================
407 void SMESHGUI_ExtrusionDlg::ClickOnCancel()
409 disconnect(mySelectionMgr, 0, this, 0);
410 mySelectionMgr->clearFilters();
411 mySelectionMgr->clearSelected();
412 SMESH::SetPickable(); // ???
413 SMESH::SetPointRepresentation(false);
414 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
415 aViewWindow->SetSelectionMode(ActorSelection);
416 mySMESHGUI->ResetState();
420 //=================================================================================
421 // function : onTextChange()
423 //=================================================================================
424 void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
426 QLineEdit* send = (QLineEdit*)sender();
434 if (send == LineEditElements)
437 buttonOk->setEnabled(false);
438 buttonApply->setEnabled(false);
440 // hilight entered elements/nodes
441 SMDS_Mesh* aMesh = 0;
443 aMesh = myActor->GetObject()->GetMesh();
446 QStringList aListId = QStringList::split(" ", theNewText, false);
448 if (send == LineEditElements) {
449 const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO();
450 TColStd_MapOfInteger newIndices;
451 for (int i = 0; i < aListId.count(); i++) {
452 const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
454 newIndices.Add(e->GetID());
457 mySelector->AddOrRemoveIndex(anIO, newIndices, false);
458 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
459 aViewWindow->highlight( anIO, true, true );
460 myElementsId = theNewText;
464 if (myNbOkElements) {
465 buttonOk->setEnabled(true);
466 buttonApply->setEnabled(true);
472 //=================================================================================
473 // function : SelectionIntoArgument()
474 // purpose : Called when selection as changed or other case
475 //=================================================================================
476 void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
480 // return if dialog box is inactive
481 if (!GroupButtons->isEnabled())
486 QString aString = "";
491 myEditCurrentArgument->setText(aString);
493 buttonOk->setEnabled(false);
494 buttonApply->setEnabled(false);
499 mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
500 int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
504 Handle(SALOME_InteractiveObject) IO = aList.First();
505 myMesh = SMESH::GetMeshByIO(IO);
506 if (myMesh->_is_nil())
509 myActor = SMESH::FindActorByObject(myMesh);
513 if (myEditCurrentArgument == LineEditElements) {
517 if (CheckBoxMesh->isChecked()) {
518 int aConstructorId = GetConstructorId();
520 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
522 if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
524 SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
528 if (aConstructorId == 0) {
529 SMDS_EdgeIteratorPtr anIter = aSMDSMesh->edgesIterator();
531 while (anIter->more()) {
532 const SMDS_MeshEdge * edge = anIter->next();
534 myElementsId += QString(" %1").arg(edge->GetID());
538 } else if (aConstructorId == 1) {
539 SMDS_FaceIteratorPtr anIter = aSMDSMesh->facesIterator();
540 while (anIter->more()) {
541 const SMDS_MeshFace * face = anIter->next();
543 myElementsId += QString(" %1").arg(face->GetID());
548 } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
550 SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
552 // get IDs from submesh
553 SMESH::long_array_var anElementsIds = new SMESH::long_array;
554 if (aConstructorId == 0)
555 anElementsIds = aSubMesh->GetElementsByType(SMESH::EDGE);
556 else if (aConstructorId == 1)
557 anElementsIds = aSubMesh->GetElementsByType(SMESH::FACE);
559 for (int i = 0; i < anElementsIds->length(); i++)
560 myElementsId += QString(" %1").arg(anElementsIds[i]);
561 aNbElements = anElementsIds->length();
564 SMESH::SMESH_GroupBase_var aGroup =
565 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
566 if (aGroup->_is_nil())
569 if ((aConstructorId == 0 && aGroup->GetType() != SMESH::EDGE) ||
570 (aConstructorId == 1 && aGroup->GetType()!= SMESH::FACE))
573 // get IDs from smesh group
574 SMESH::long_array_var anElementsIds = new SMESH::long_array;
575 anElementsIds = aGroup->GetListOfID();
576 for (int i = 0; i < anElementsIds->length(); i++)
577 myElementsId += QString(" %1").arg(anElementsIds[i]);
578 aNbElements = anElementsIds->length();
581 aNbElements = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString);
582 myElementsId = aString;
588 myNbOkElements = true;
592 myEditCurrentArgument->setText(aString);
596 if (myNbOkElements) {
597 buttonOk->setEnabled(true);
598 buttonApply->setEnabled(true);
602 //=================================================================================
603 // function : SetEditCurrentArgument()
605 //=================================================================================
606 void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
608 QPushButton* send = (QPushButton*)sender();
610 disconnect(mySelectionMgr, 0, this, 0);
611 mySelectionMgr->clearSelected();
612 mySelectionMgr->clearFilters();
614 if (send == SelectElementsButton) {
615 myEditCurrentArgument = LineEditElements;
616 if (CheckBoxMesh->isChecked()) {
617 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
618 aViewWindow->SetSelectionMode(ActorSelection);
619 mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
621 int aConstructorId = GetConstructorId();
622 if (aConstructorId == 0)
624 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
625 aViewWindow->SetSelectionMode(EdgeSelection);
627 else if (aConstructorId == 1)
629 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
630 aViewWindow->SetSelectionMode(FaceSelection);
635 myEditCurrentArgument->setFocus();
636 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
637 SelectionIntoArgument();
640 //=================================================================================
641 // function : DeactivateActiveDialog()
642 // purpose : Deactivates this dialog
643 //=================================================================================
644 void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog()
646 if (GroupConstructors->isEnabled()) {
647 GroupConstructors->setEnabled(false);
648 GroupArguments->setEnabled(false);
649 GroupButtons->setEnabled(false);
650 mySMESHGUI->ResetState();
651 mySMESHGUI->SetActiveDialogBox(0);
655 //=================================================================================
656 // function : ActivateThisDialog()
657 // purpose : Activates this dialog
658 //=================================================================================
659 void SMESHGUI_ExtrusionDlg::ActivateThisDialog()
661 // Emit a signal to deactivate the active dialog
662 mySMESHGUI->EmitSignalDeactivateDialog();
663 GroupConstructors->setEnabled(true);
664 GroupArguments->setEnabled(true);
665 GroupButtons->setEnabled(true);
667 mySMESHGUI->SetActiveDialogBox(this);
669 ConstructorsClicked(GetConstructorId());
670 SelectionIntoArgument();
673 //=================================================================================
674 // function : enterEvent()
675 // purpose : Mouse enter event
676 //=================================================================================
677 void SMESHGUI_ExtrusionDlg::enterEvent (QEvent*)
679 if (!GroupConstructors->isEnabled())
680 ActivateThisDialog();
683 //=================================================================================
684 // function : closeEvent()
686 //=================================================================================
687 //void SMESHGUI_ExtrusionDlg::closeEvent (QCloseEvent*)
689 // /* same than click on cancel button */
690 // this->ClickOnCancel();
693 //=================================================================================
694 // function : hideEvent()
695 // purpose : caused by ESC key
696 //=================================================================================
697 //void SMESHGUI_ExtrusionDlg::hideEvent (QHideEvent*)
699 // if (!isMinimized())
703 //=================================================================================
704 // function : onSelectMesh()
706 //=================================================================================
707 void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh)
710 TextLabelElements->setText(tr("SMESH_NAME"));
712 TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
714 if (myEditCurrentArgument != LineEditElements) {
715 LineEditElements->clear();
719 mySelectionMgr->clearFilters();
722 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
723 aViewWindow->SetSelectionMode(ActorSelection);
724 mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
725 LineEditElements->setReadOnly(true);
727 int aConstructorId = GetConstructorId();
728 if (aConstructorId == 0)
730 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
731 aViewWindow->SetSelectionMode(EdgeSelection);
733 else if (aConstructorId == 0)
735 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
736 aViewWindow->SetSelectionMode(FaceSelection);
739 LineEditElements->setReadOnly(false);
740 onTextChange(LineEditElements->text());
743 SelectionIntoArgument();
746 //=================================================================================
747 // function : GetConstructorId()
749 //=================================================================================
750 int SMESHGUI_ExtrusionDlg::GetConstructorId()
752 if (GroupConstructors != NULL && GroupConstructors->selected() != NULL)
753 return GroupConstructors->id(GroupConstructors->selected());