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.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SMESHGUI_ExtrusionDlg.cxx
23 // Author : Michael ZORIN, Open CASCADE S.A.S.
27 #include "SMESHGUI_ExtrusionDlg.h"
30 #include "SMESHGUI_Utils.h"
31 #include "SMESHGUI_VTKUtils.h"
32 #include "SMESHGUI_MeshUtils.h"
33 #include "SMESHGUI_SpinBox.h"
34 #include "SMESHGUI_IdValidator.h"
36 #include <SMESH_Actor.h>
37 #include <SMESH_TypeFilter.hxx>
38 #include <SMESH_LogicalFilter.hxx>
40 #include <SMDS_Mesh.hxx>
42 // SALOME GUI includes
43 #include <SUIT_ResourceMgr.h>
44 #include <SUIT_Desktop.h>
45 #include <SUIT_MessageBox.h>
46 #include <SUIT_Session.h>
48 #include <LightApp_Application.h>
49 #include <LightApp_SelectionMgr.h>
51 #include <SVTK_ViewModel.h>
52 #include <SVTK_ViewWindow.h>
55 #include <TColStd_MapOfInteger.hxx>
56 #include <TColStd_IndexedMapOfInteger.hxx>
59 #include <QApplication>
60 #include <QButtonGroup>
64 #include <QPushButton>
65 #include <QRadioButton>
68 #include <QHBoxLayout>
69 #include <QVBoxLayout>
70 #include <QGridLayout>
74 #include <SALOMEconfig.h>
75 #include CORBA_SERVER_HEADER(SMESH_Group)
76 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
81 //=================================================================================
82 // function : SMESHGUI_ExtrusionDlg()
83 // purpose : constructor
84 //=================================================================================
85 SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
86 : QDialog( SMESH::GetDesktop( theModule ) ),
87 mySMESHGUI( theModule ),
88 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
90 QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
91 QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
92 QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
95 setAttribute( Qt::WA_DeleteOnClose, true );
96 setWindowTitle(tr("EXTRUSION_ALONG_LINE"));
97 setSizeGripEnabled(true);
99 QVBoxLayout* SMESHGUI_ExtrusionDlgLayout = new QVBoxLayout(this);
100 SMESHGUI_ExtrusionDlgLayout->setSpacing(SPACING);
101 SMESHGUI_ExtrusionDlgLayout->setMargin(MARGIN);
103 /***************************************************************/
104 ConstructorsBox = new QGroupBox(tr("SMESH_EXTRUSION"), this);
105 GroupConstructors = new QButtonGroup(this);
106 QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
107 ConstructorsBoxLayout->setSpacing(SPACING);
108 ConstructorsBoxLayout->setMargin(MARGIN);
110 RadioButton1= new QRadioButton(ConstructorsBox);
111 RadioButton1->setIcon(image0);
112 RadioButton2= new QRadioButton(ConstructorsBox);
113 RadioButton2->setIcon(image1);
115 ConstructorsBoxLayout->addWidget(RadioButton1);
116 ConstructorsBoxLayout->addWidget(RadioButton2);
118 GroupConstructors->addButton(RadioButton1, 0);
119 GroupConstructors->addButton(RadioButton2, 1);
121 /***************************************************************/
122 GroupButtons = new QGroupBox(this);
123 QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
124 GroupButtonsLayout->setSpacing(SPACING);
125 GroupButtonsLayout->setMargin(MARGIN);
127 buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
128 buttonOk->setAutoDefault(true);
129 buttonOk->setDefault(true);
130 buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
131 buttonApply->setAutoDefault(true);
132 buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
133 buttonCancel->setAutoDefault(true);
134 buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
135 buttonHelp->setAutoDefault(true);
137 GroupButtonsLayout->addWidget(buttonOk);
138 GroupButtonsLayout->addSpacing(10);
139 GroupButtonsLayout->addWidget(buttonApply);
140 GroupButtonsLayout->addSpacing(10);
141 GroupButtonsLayout->addStretch();
142 GroupButtonsLayout->addWidget(buttonCancel);
143 GroupButtonsLayout->addWidget(buttonHelp);
145 /***************************************************************/
146 GroupArguments = new QGroupBox(tr("EXTRUSION_1D"), this);
147 QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
148 GroupArgumentsLayout->setSpacing(SPACING);
149 GroupArgumentsLayout->setMargin(MARGIN);
151 // Controls for elements selection
152 TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
154 SelectElementsButton = new QPushButton(GroupArguments);
155 SelectElementsButton->setIcon(image2);
157 LineEditElements = new QLineEdit(GroupArguments);
158 LineEditElements->setValidator(new SMESHGUI_IdValidator(this));
160 // Control for the whole mesh selection
161 CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
163 // Controls for vector selection
164 TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupArguments);
166 TextLabelDx = new QLabel(tr("SMESH_DX"), GroupArguments);
167 SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments);
169 TextLabelDy = new QLabel(tr("SMESH_DY"), GroupArguments);
170 SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments);
172 TextLabelDz = new QLabel(tr("SMESH_DZ"), GroupArguments);
173 SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments);
175 // Controls for nb. steps defining
176 TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments);
177 SpinBox_NbSteps = new QSpinBox(GroupArguments);
179 // CheckBox for groups generation
180 MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
182 GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
183 GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
184 GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 6);
185 GroupArgumentsLayout->addWidget(CheckBoxMesh, 0, 0, 1, 8);
186 GroupArgumentsLayout->addWidget(TextLabelVector, 2, 0);
187 GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2);
188 GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3);
189 GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4);
190 GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5);
191 GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6);
192 GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7);
193 GroupArgumentsLayout->addWidget(TextLabelNbSteps, 3, 0);
194 GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 3, 2, 1, 6);
195 GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 0, 1, 8);
197 /***************************************************************/
198 SMESHGUI_ExtrusionDlgLayout->addWidget(ConstructorsBox);
199 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments);
200 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons);
202 /* Initialisations */
203 SpinBox_Dx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
204 SpinBox_Dy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
205 SpinBox_Dz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
207 SpinBox_NbSteps->setRange(1, 999999);
209 RadioButton1->setChecked(true);
210 MakeGroupsCheck->setChecked(true);
212 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
214 mySMESHGUI->SetActiveDialogBox(this);
216 // Costruction of the logical filter for the elements: mesh/sub-mesh/group
217 SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
218 SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP);
220 QList<SUIT_SelectionFilter*> aListOfFilters;
221 if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
222 if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
224 myMeshOrSubMeshOrGroupFilter =
225 new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
227 myHelpFileName = "extrusion_page.html";
231 /***************************************************************/
232 // signals and slots connections
233 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
234 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
235 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
236 connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
238 // to update state of the Ok & Apply buttons
239 connect(SpinBox_Dx, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
240 connect(SpinBox_Dy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
241 connect(SpinBox_Dz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
243 connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int)));
244 connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
245 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
246 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
247 /* to close dialog if study change */
248 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
249 connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
250 connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
252 /***************************************************************/
254 ConstructorsClicked(0);
255 SelectionIntoArgument();
258 //=================================================================================
259 // function : ~SMESHGUI_ExtrusionDlg()
260 // purpose : destructor
261 //=================================================================================
262 SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
266 //=================================================================================
268 // purpose : initialization
269 //=================================================================================
270 void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
274 LineEditElements->clear();
278 myMesh = SMESH::SMESH_Mesh::_nil();
281 SpinBox_NbSteps->setValue(1);
282 SpinBox_Dx->SetValue(0);
283 SpinBox_Dy->SetValue(0);
284 SpinBox_Dz->SetValue(0);
286 CheckBoxMesh->setChecked(false);
293 //=================================================================================
294 // function : CheckIsEnable()
295 // purpose : Check whether the Ok and Apply buttons should be enabled or not
296 //=================================================================================
297 void SMESHGUI_ExtrusionDlg::CheckIsEnable()
299 double aX = SpinBox_Dx->GetValue();
300 double aY = SpinBox_Dy->GetValue();
301 double aZ = SpinBox_Dz->GetValue();
302 double aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
304 bool anIsEnable = myNbOkElements > 0 && aModule > 1.0E-38;
306 buttonOk->setEnabled(anIsEnable);
307 buttonApply->setEnabled(anIsEnable);
310 //=================================================================================
311 // function : ConstructorsClicked()
312 // purpose : Radio button management
313 //=================================================================================
314 void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
316 disconnect(mySelectionMgr, 0, this, 0);
318 switch (constructorId) {
321 GroupArguments->setTitle(tr("EXTRUSION_1D"));
322 if (!CheckBoxMesh->isChecked())
324 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
325 aViewWindow->SetSelectionMode(EdgeSelection);
331 GroupArguments->setTitle(tr("EXTRUSION_2D"));
332 if (!CheckBoxMesh->isChecked())
334 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
335 aViewWindow->SetSelectionMode(FaceSelection);
341 myEditCurrentArgument = LineEditElements;
342 LineEditElements->setFocus();
344 if (CheckBoxMesh->isChecked())
347 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
350 //=================================================================================
351 // function : ClickOnApply()
352 // purpose : Called when user presses <Apply> button
353 //=================================================================================
354 bool SMESHGUI_ExtrusionDlg::ClickOnApply()
356 if (mySMESHGUI->isActiveStudyLocked())
359 if (myNbOkElements) {
361 SMESH::DirStruct aVector;
362 aVector.PS.x = SpinBox_Dx->GetValue();
363 aVector.PS.y = SpinBox_Dy->GetValue();
364 aVector.PS.z = SpinBox_Dz->GetValue();
366 long aNbSteps = (long)SpinBox_NbSteps->value();
369 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
370 QApplication::setOverrideCursor(Qt::WaitCursor);
372 if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
373 SMESH::ListOfGroups_var groups =
374 aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector, aNbSteps);
376 aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
378 QApplication::restoreOverrideCursor();
383 if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
384 mySMESHGUI->updateObjBrowser(true); // new groups may appear
386 ConstructorsClicked(GetConstructorId());
387 SelectionIntoArgument();
392 //=================================================================================
393 // function : ClickOnOk()
394 // purpose : Called when user presses <OK> button
395 //=================================================================================
396 void SMESHGUI_ExtrusionDlg::ClickOnOk()
402 //=================================================================================
403 // function : ClickOnCancel()
404 // purpose : Called when dialog box is closed
405 //=================================================================================
406 void SMESHGUI_ExtrusionDlg::ClickOnCancel()
408 disconnect(mySelectionMgr, 0, this, 0);
409 mySelectionMgr->clearFilters();
410 //mySelectionMgr->clearSelected();
411 SMESH::SetPickable(); // ???
412 SMESH::SetPointRepresentation(false);
413 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
414 aViewWindow->SetSelectionMode(ActorSelection);
415 mySMESHGUI->ResetState();
419 //=================================================================================
420 // function : ClickOnHelp()
422 //=================================================================================
423 void SMESHGUI_ExtrusionDlg::ClickOnHelp()
425 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
427 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
431 platform = "winapplication";
433 platform = "application";
435 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
436 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
437 arg(app->resourceMgr()->stringValue("ExternalBrowser",
439 arg(myHelpFileName));
443 //=================================================================================
444 // function : onTextChange()
446 //=================================================================================
447 void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
449 QLineEdit* send = (QLineEdit*)sender();
457 if (send == LineEditElements)
460 // hilight entered elements/nodes
462 if (!myIO.IsNull()) {
463 QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
465 if (send == LineEditElements)
467 SMDS_Mesh* aMesh = myActor ? myActor->GetObject()->GetMesh() : 0;
468 SMESH::ElementType SMESHType = GetConstructorId() ? SMESH::FACE : SMESH::EDGE;
469 SMDSAbs_ElementType SMDSType = GetConstructorId() ? SMDSAbs_Face: SMDSAbs_Edge;
471 myElementsId = new SMESH::long_array;
472 myElementsId->length( aListId.count() );
473 TColStd_MapOfInteger newIndices;
474 for (int i = 0; i < aListId.count(); i++) {
475 int id = aListId[ i ].toInt();
476 bool validId = false;
479 const SMDS_MeshElement * e = aMesh->FindElement( id );
480 validId = ( e && e->GetType() == SMDSType );
482 validId = ( myMesh->GetElementType( id, true ) == SMESHType );
485 if ( validId && newIndices.Add( id ))
486 myElementsId[ newIndices.Extent()-1 ] = id;
488 myElementsId->length( myNbOkElements = newIndices.Extent() );
489 mySelector->AddOrRemoveIndex(myIO, newIndices, false);
490 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
491 aViewWindow->highlight( myIO, true, true );
500 //=================================================================================
501 // function : SelectionIntoArgument()
502 // purpose : Called when selection as changed or other case
503 //=================================================================================
504 void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
508 // return if dialog box is inactive
509 if (!GroupButtons->isEnabled())
515 QString aString = "";
520 myEditCurrentArgument->setText(aString);
526 mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
527 int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
531 Handle(SALOME_InteractiveObject) IO = aList.First();
532 myMesh = SMESH::GetMeshByIO(IO);
533 if (myMesh->_is_nil())
536 myActor = SMESH::FindActorByObject(myMesh);
538 if (myEditCurrentArgument == LineEditElements) {
541 // MakeGroups is available if there are groups
542 if ( myMesh->NbGroups() == 0 ) {
543 MakeGroupsCheck->setChecked(false);
544 MakeGroupsCheck->setEnabled(false);
546 MakeGroupsCheck->setEnabled(true);
549 if (CheckBoxMesh->isChecked()) {
550 SMESH::ElementType neededType = GetConstructorId() ? SMESH::FACE : SMESH::EDGE;
552 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
554 SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
556 if (!mesh->_is_nil()) { //MESH
557 // get elements from mesh
558 myElementsId = mesh->GetElementsByType(neededType);
559 aNbElements = myElementsId->length();
561 SMESH::SMESH_subMesh_var aSubMesh =
562 SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
564 if (!aSubMesh->_is_nil()) { //SUBMESH
565 // get IDs from submesh
566 myElementsId = aSubMesh->GetElementsByType(neededType);
567 aNbElements = myElementsId->length();
569 SMESH::SMESH_GroupBase_var aGroup =
570 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
572 if (!aGroup->_is_nil() && aGroup->GetType() == neededType) { // GROUP
573 // get IDs from smesh group
574 myElementsId = aGroup->GetListOfID();
575 aNbElements = myElementsId->length();
580 // get indices of selcted elements
581 TColStd_IndexedMapOfInteger aMapIndex;
582 mySelector->GetIndex(IO,aMapIndex);
583 aNbElements = aMapIndex.Extent();
585 myElementsId = new SMESH::long_array;
586 myElementsId->length( aNbElements );
588 for ( int i = 0; i < aNbElements; ++i )
589 aString += QString(" %1").arg( myElementsId[ i ] = aMapIndex( i+1 ) );
595 myNbOkElements = true;
599 myEditCurrentArgument->setText(aString);
606 //=================================================================================
607 // function : SetEditCurrentArgument()
609 //=================================================================================
610 void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
612 QPushButton* send = (QPushButton*)sender();
614 disconnect(mySelectionMgr, 0, this, 0);
615 mySelectionMgr->clearSelected();
616 mySelectionMgr->clearFilters();
618 if (send == SelectElementsButton) {
619 myEditCurrentArgument = LineEditElements;
620 if (CheckBoxMesh->isChecked()) {
621 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
622 aViewWindow->SetSelectionMode(ActorSelection);
623 mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
625 int aConstructorId = GetConstructorId();
626 if (aConstructorId == 0)
628 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
629 aViewWindow->SetSelectionMode(EdgeSelection);
631 else if (aConstructorId == 1)
633 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
634 aViewWindow->SetSelectionMode(FaceSelection);
639 myEditCurrentArgument->setFocus();
640 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
641 SelectionIntoArgument();
644 //=================================================================================
645 // function : DeactivateActiveDialog()
646 // purpose : Deactivates this dialog
647 //=================================================================================
648 void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog()
650 if (ConstructorsBox->isEnabled()) {
651 ConstructorsBox->setEnabled(false);
652 GroupArguments->setEnabled(false);
653 GroupButtons->setEnabled(false);
654 mySMESHGUI->ResetState();
655 mySMESHGUI->SetActiveDialogBox(0);
659 //=================================================================================
660 // function : ActivateThisDialog()
661 // purpose : Activates this dialog
662 //=================================================================================
663 void SMESHGUI_ExtrusionDlg::ActivateThisDialog()
665 // Emit a signal to deactivate the active dialog
666 mySMESHGUI->EmitSignalDeactivateDialog();
667 ConstructorsBox->setEnabled(true);
668 GroupArguments->setEnabled(true);
669 GroupButtons->setEnabled(true);
671 mySMESHGUI->SetActiveDialogBox(this);
673 ConstructorsClicked(GetConstructorId());
674 SelectionIntoArgument();
677 //=================================================================================
678 // function : enterEvent()
679 // purpose : Mouse enter event
680 //=================================================================================
681 void SMESHGUI_ExtrusionDlg::enterEvent (QEvent*)
683 if (!ConstructorsBox->isEnabled())
684 ActivateThisDialog();
687 //=================================================================================
688 // function : onSelectMesh()
690 //=================================================================================
691 void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh)
694 TextLabelElements->setText(tr("SMESH_NAME"));
696 TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
698 if (myEditCurrentArgument != LineEditElements) {
699 LineEditElements->clear();
703 mySelectionMgr->clearFilters();
706 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
707 aViewWindow->SetSelectionMode(ActorSelection);
708 mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
709 LineEditElements->setReadOnly(true);
711 int aConstructorId = GetConstructorId();
712 if (aConstructorId == 0)
714 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
715 aViewWindow->SetSelectionMode(EdgeSelection);
717 else if (aConstructorId == 0)
719 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
720 aViewWindow->SetSelectionMode(FaceSelection);
723 LineEditElements->setReadOnly(false);
724 onTextChange(LineEditElements->text());
727 SelectionIntoArgument();
730 //=================================================================================
731 // function : GetConstructorId()
733 //=================================================================================
734 int SMESHGUI_ExtrusionDlg::GetConstructorId()
736 return GroupConstructors->checkedId();
739 //=================================================================================
740 // function : keyPressEvent()
742 //=================================================================================
743 void SMESHGUI_ExtrusionDlg::keyPressEvent( QKeyEvent* e )
745 QDialog::keyPressEvent( e );
746 if ( e->isAccepted() )
749 if ( e->key() == Qt::Key_F1 ) {