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>
47 #include <SUIT_OverrideCursor.h>
49 #include <LightApp_Application.h>
50 #include <LightApp_SelectionMgr.h>
52 #include <SVTK_ViewModel.h>
53 #include <SVTK_ViewWindow.h>
56 #include <TColStd_MapOfInteger.hxx>
57 #include <TColStd_IndexedMapOfInteger.hxx>
60 #include <QApplication>
61 #include <QButtonGroup>
65 #include <QPushButton>
66 #include <QRadioButton>
69 #include <QHBoxLayout>
70 #include <QVBoxLayout>
71 #include <QGridLayout>
75 #include <SALOMEconfig.h>
76 #include CORBA_SERVER_HEADER(SMESH_Group)
77 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
82 //=================================================================================
83 // function : SMESHGUI_ExtrusionDlg()
84 // purpose : constructor
85 //=================================================================================
86 SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
87 : QDialog( SMESH::GetDesktop( theModule ) ),
88 mySMESHGUI( theModule ),
89 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
91 QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
92 QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
93 QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
96 setAttribute( Qt::WA_DeleteOnClose, true );
97 setWindowTitle(tr("EXTRUSION_ALONG_LINE"));
98 setSizeGripEnabled(true);
100 QVBoxLayout* SMESHGUI_ExtrusionDlgLayout = new QVBoxLayout(this);
101 SMESHGUI_ExtrusionDlgLayout->setSpacing(SPACING);
102 SMESHGUI_ExtrusionDlgLayout->setMargin(MARGIN);
104 /***************************************************************/
105 ConstructorsBox = new QGroupBox(tr("SMESH_EXTRUSION"), this);
106 GroupConstructors = new QButtonGroup(this);
107 QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
108 ConstructorsBoxLayout->setSpacing(SPACING);
109 ConstructorsBoxLayout->setMargin(MARGIN);
111 RadioButton1= new QRadioButton(ConstructorsBox);
112 RadioButton1->setIcon(image0);
113 RadioButton2= new QRadioButton(ConstructorsBox);
114 RadioButton2->setIcon(image1);
116 ConstructorsBoxLayout->addWidget(RadioButton1);
117 ConstructorsBoxLayout->addWidget(RadioButton2);
119 GroupConstructors->addButton(RadioButton1, 0);
120 GroupConstructors->addButton(RadioButton2, 1);
122 /***************************************************************/
123 GroupButtons = new QGroupBox(this);
124 QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
125 GroupButtonsLayout->setSpacing(SPACING);
126 GroupButtonsLayout->setMargin(MARGIN);
128 buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
129 buttonOk->setAutoDefault(true);
130 buttonOk->setDefault(true);
131 buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
132 buttonApply->setAutoDefault(true);
133 buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
134 buttonCancel->setAutoDefault(true);
135 buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
136 buttonHelp->setAutoDefault(true);
138 GroupButtonsLayout->addWidget(buttonOk);
139 GroupButtonsLayout->addSpacing(10);
140 GroupButtonsLayout->addWidget(buttonApply);
141 GroupButtonsLayout->addSpacing(10);
142 GroupButtonsLayout->addStretch();
143 GroupButtonsLayout->addWidget(buttonCancel);
144 GroupButtonsLayout->addWidget(buttonHelp);
146 /***************************************************************/
147 GroupArguments = new QGroupBox(tr("EXTRUSION_1D"), this);
148 QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
149 GroupArgumentsLayout->setSpacing(SPACING);
150 GroupArgumentsLayout->setMargin(MARGIN);
152 myIdValidator = new SMESHGUI_IdValidator(this);
154 // Controls for elements selection
155 TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
157 SelectElementsButton = new QPushButton(GroupArguments);
158 SelectElementsButton->setIcon(image2);
160 LineEditElements = new QLineEdit(GroupArguments);
161 LineEditElements->setValidator(myIdValidator);
163 // Control for the whole mesh selection
164 CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
166 // Controls for vector selection
167 TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupArguments);
169 TextLabelDx = new QLabel(tr("SMESH_DX"), GroupArguments);
170 SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments);
172 TextLabelDy = new QLabel(tr("SMESH_DY"), GroupArguments);
173 SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments);
175 TextLabelDz = new QLabel(tr("SMESH_DZ"), GroupArguments);
176 SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments);
178 // Controls for nb. steps defining
179 TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments);
180 SpinBox_NbSteps = new QSpinBox(GroupArguments);
182 // CheckBox for groups generation
183 MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
185 GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
186 GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
187 GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 6);
188 GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 8);
189 GroupArgumentsLayout->addWidget(TextLabelVector, 2, 0);
190 GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2);
191 GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3);
192 GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4);
193 GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5);
194 GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6);
195 GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7);
196 GroupArgumentsLayout->addWidget(TextLabelNbSteps, 3, 0);
197 GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 3, 2, 1, 6);
198 GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 0, 1, 8);
200 /***************************************************************/
201 SMESHGUI_ExtrusionDlgLayout->addWidget(ConstructorsBox);
202 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments);
203 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons);
205 /* Initialisations */
206 SpinBox_Dx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
207 SpinBox_Dy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
208 SpinBox_Dz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
210 SpinBox_NbSteps->setRange(1, 999999);
212 RadioButton1->setChecked(true);
213 MakeGroupsCheck->setChecked(true);
215 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
217 mySMESHGUI->SetActiveDialogBox(this);
219 // Costruction of the logical filter for the elements: mesh/sub-mesh/group
220 SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
221 SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP);
223 QList<SUIT_SelectionFilter*> aListOfFilters;
224 if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
225 if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
227 myMeshOrSubMeshOrGroupFilter =
228 new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
230 myHelpFileName = "extrusion_page.html";
234 /***************************************************************/
235 // signals and slots connections
236 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
237 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
238 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
239 connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
241 // to update state of the Ok & Apply buttons
242 connect(SpinBox_Dx, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
243 connect(SpinBox_Dy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
244 connect(SpinBox_Dz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
246 connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int)));
247 connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
248 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
249 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
250 /* to close dialog if study change */
251 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
252 connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
253 connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
255 /***************************************************************/
257 ConstructorsClicked(0);
258 SelectionIntoArgument();
261 //=================================================================================
262 // function : ~SMESHGUI_ExtrusionDlg()
263 // purpose : destructor
264 //=================================================================================
265 SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
269 //=================================================================================
271 // purpose : initialization
272 //=================================================================================
273 void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
277 LineEditElements->clear();
281 myMesh = SMESH::SMESH_Mesh::_nil();
284 SpinBox_NbSteps->setValue(1);
285 SpinBox_Dx->SetValue(0);
286 SpinBox_Dy->SetValue(0);
287 SpinBox_Dz->SetValue(0);
289 CheckBoxMesh->setChecked(false);
296 //=================================================================================
297 // function : CheckIsEnable()
298 // purpose : Check whether the Ok and Apply buttons should be enabled or not
299 //=================================================================================
300 void SMESHGUI_ExtrusionDlg::CheckIsEnable()
302 double aX = SpinBox_Dx->GetValue();
303 double aY = SpinBox_Dy->GetValue();
304 double aZ = SpinBox_Dz->GetValue();
305 double aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
307 bool anIsEnable = myNbOkElements > 0 && aModule > 1.0E-38;
309 buttonOk->setEnabled(anIsEnable);
310 buttonApply->setEnabled(anIsEnable);
313 //=================================================================================
314 // function : ConstructorsClicked()
315 // purpose : Radio button management
316 //=================================================================================
317 void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
319 disconnect(mySelectionMgr, 0, this, 0);
321 switch (constructorId) {
324 GroupArguments->setTitle(tr("EXTRUSION_1D"));
325 if (!CheckBoxMesh->isChecked())
327 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
328 aViewWindow->SetSelectionMode(EdgeSelection);
334 GroupArguments->setTitle(tr("EXTRUSION_2D"));
335 if (!CheckBoxMesh->isChecked())
337 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
338 aViewWindow->SetSelectionMode(FaceSelection);
344 myEditCurrentArgument = LineEditElements;
345 LineEditElements->setFocus();
347 if (CheckBoxMesh->isChecked())
350 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
353 //=================================================================================
354 // function : ClickOnApply()
355 // purpose : Called when user presses <Apply> button
356 //=================================================================================
357 bool SMESHGUI_ExtrusionDlg::ClickOnApply()
359 if (mySMESHGUI->isActiveStudyLocked())
362 if (myNbOkElements) {
364 SMESH::DirStruct aVector;
365 aVector.PS.x = SpinBox_Dx->GetValue();
366 aVector.PS.y = SpinBox_Dy->GetValue();
367 aVector.PS.z = SpinBox_Dz->GetValue();
369 long aNbSteps = (long)SpinBox_NbSteps->value();
372 SUIT_OverrideCursor aWaitCursor;
373 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
375 if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
376 SMESH::ListOfGroups_var groups =
377 aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector, aNbSteps);
379 aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
385 if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
386 mySMESHGUI->updateObjBrowser(true); // new groups may appear
388 ConstructorsClicked(GetConstructorId());
389 SelectionIntoArgument();
394 //=================================================================================
395 // function : ClickOnOk()
396 // purpose : Called when user presses <OK> button
397 //=================================================================================
398 void SMESHGUI_ExtrusionDlg::ClickOnOk()
404 //=================================================================================
405 // function : ClickOnCancel()
406 // purpose : Called when dialog box is closed
407 //=================================================================================
408 void SMESHGUI_ExtrusionDlg::ClickOnCancel()
410 disconnect(mySelectionMgr, 0, this, 0);
411 mySelectionMgr->clearFilters();
412 //mySelectionMgr->clearSelected();
413 SMESH::SetPickable(); // ???
414 SMESH::SetPointRepresentation(false);
415 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
416 aViewWindow->SetSelectionMode(ActorSelection);
417 mySMESHGUI->ResetState();
421 //=================================================================================
422 // function : ClickOnHelp()
424 //=================================================================================
425 void SMESHGUI_ExtrusionDlg::ClickOnHelp()
427 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
429 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
433 platform = "winapplication";
435 platform = "application";
437 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
438 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
439 arg(app->resourceMgr()->stringValue("ExternalBrowser",
441 arg(myHelpFileName));
445 //=================================================================================
446 // function : onTextChange()
448 //=================================================================================
449 void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
451 QLineEdit* send = (QLineEdit*)sender();
459 if (send == LineEditElements)
462 // hilight entered elements/nodes
464 if (!myIO.IsNull()) {
465 QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
467 if (send == LineEditElements)
469 SMDS_Mesh* aMesh = myActor ? myActor->GetObject()->GetMesh() : 0;
470 SMESH::ElementType SMESHType = GetConstructorId() ? SMESH::FACE : SMESH::EDGE;
471 SMDSAbs_ElementType SMDSType = GetConstructorId() ? SMDSAbs_Face: SMDSAbs_Edge;
473 myElementsId = new SMESH::long_array;
474 myElementsId->length( aListId.count() );
475 TColStd_MapOfInteger newIndices;
476 for (int i = 0; i < aListId.count(); i++) {
477 int id = aListId[ i ].toInt();
478 bool validId = false;
481 const SMDS_MeshElement * e = aMesh->FindElement( id );
482 validId = ( e && e->GetType() == SMDSType );
484 validId = ( myMesh->GetElementType( id, true ) == SMESHType );
487 if ( validId && newIndices.Add( id ))
488 myElementsId[ newIndices.Extent()-1 ] = id;
490 myElementsId->length( myNbOkElements = newIndices.Extent() );
491 mySelector->AddOrRemoveIndex(myIO, newIndices, false);
492 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
493 aViewWindow->highlight( myIO, true, true );
502 //=================================================================================
503 // function : SelectionIntoArgument()
504 // purpose : Called when selection as changed or other case
505 //=================================================================================
506 void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
510 // return if dialog box is inactive
511 if (!GroupButtons->isEnabled())
517 QString aString = "";
522 myEditCurrentArgument->setText(aString);
528 mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
529 int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
533 Handle(SALOME_InteractiveObject) IO = aList.First();
534 myMesh = SMESH::GetMeshByIO(IO);
535 if (myMesh->_is_nil())
538 myActor = SMESH::FindActorByObject(myMesh);
540 if (myEditCurrentArgument == LineEditElements) {
543 // MakeGroups is available if there are groups
544 if ( myMesh->NbGroups() == 0 ) {
545 MakeGroupsCheck->setChecked(false);
546 MakeGroupsCheck->setEnabled(false);
548 MakeGroupsCheck->setEnabled(true);
551 if (CheckBoxMesh->isChecked()) {
552 SMESH::ElementType neededType = GetConstructorId() ? SMESH::FACE : SMESH::EDGE;
554 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
556 SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
558 if (!mesh->_is_nil()) { //MESH
559 // get elements from mesh
560 myElementsId = mesh->GetElementsByType(neededType);
561 aNbElements = myElementsId->length();
563 SMESH::SMESH_subMesh_var aSubMesh =
564 SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
566 if (!aSubMesh->_is_nil()) { //SUBMESH
567 // get IDs from submesh
568 myElementsId = aSubMesh->GetElementsByType(neededType);
569 aNbElements = myElementsId->length();
571 SMESH::SMESH_GroupBase_var aGroup =
572 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
574 if (!aGroup->_is_nil() && aGroup->GetType() == neededType) { // GROUP
575 // get IDs from smesh group
576 myElementsId = aGroup->GetListOfID();
577 aNbElements = myElementsId->length();
582 // get indices of selcted elements
583 TColStd_IndexedMapOfInteger aMapIndex;
584 mySelector->GetIndex(IO,aMapIndex);
585 aNbElements = aMapIndex.Extent();
587 myElementsId = new SMESH::long_array;
588 myElementsId->length( aNbElements );
590 for ( int i = 0; i < aNbElements; ++i )
591 aString += QString(" %1").arg( myElementsId[ i ] = aMapIndex( i+1 ) );
597 myNbOkElements = true;
601 myEditCurrentArgument->setText(aString);
608 //=================================================================================
609 // function : SetEditCurrentArgument()
611 //=================================================================================
612 void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
614 QPushButton* send = (QPushButton*)sender();
616 disconnect(mySelectionMgr, 0, this, 0);
617 mySelectionMgr->clearSelected();
618 mySelectionMgr->clearFilters();
620 if (send == SelectElementsButton) {
621 myEditCurrentArgument = LineEditElements;
622 if (CheckBoxMesh->isChecked()) {
623 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
624 aViewWindow->SetSelectionMode(ActorSelection);
625 mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
627 int aConstructorId = GetConstructorId();
628 if (aConstructorId == 0)
630 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
631 aViewWindow->SetSelectionMode(EdgeSelection);
633 else if (aConstructorId == 1)
635 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
636 aViewWindow->SetSelectionMode(FaceSelection);
641 myEditCurrentArgument->setFocus();
642 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
643 SelectionIntoArgument();
646 //=================================================================================
647 // function : DeactivateActiveDialog()
648 // purpose : Deactivates this dialog
649 //=================================================================================
650 void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog()
652 if (ConstructorsBox->isEnabled()) {
653 ConstructorsBox->setEnabled(false);
654 GroupArguments->setEnabled(false);
655 GroupButtons->setEnabled(false);
656 mySMESHGUI->ResetState();
657 mySMESHGUI->SetActiveDialogBox(0);
661 //=================================================================================
662 // function : ActivateThisDialog()
663 // purpose : Activates this dialog
664 //=================================================================================
665 void SMESHGUI_ExtrusionDlg::ActivateThisDialog()
667 // Emit a signal to deactivate the active dialog
668 mySMESHGUI->EmitSignalDeactivateDialog();
669 ConstructorsBox->setEnabled(true);
670 GroupArguments->setEnabled(true);
671 GroupButtons->setEnabled(true);
673 mySMESHGUI->SetActiveDialogBox(this);
675 ConstructorsClicked(GetConstructorId());
676 SelectionIntoArgument();
679 //=================================================================================
680 // function : enterEvent()
681 // purpose : Mouse enter event
682 //=================================================================================
683 void SMESHGUI_ExtrusionDlg::enterEvent (QEvent*)
685 if (!ConstructorsBox->isEnabled())
686 ActivateThisDialog();
689 //=================================================================================
690 // function : onSelectMesh()
692 //=================================================================================
693 void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh)
696 TextLabelElements->setText(tr("SMESH_NAME"));
698 TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
700 if (myEditCurrentArgument != LineEditElements) {
701 LineEditElements->clear();
705 mySelectionMgr->clearFilters();
708 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
709 aViewWindow->SetSelectionMode(ActorSelection);
710 mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
711 LineEditElements->setReadOnly(true);
712 LineEditElements->setValidator(0);
714 int aConstructorId = GetConstructorId();
715 if (aConstructorId == 0)
717 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
718 aViewWindow->SetSelectionMode(EdgeSelection);
720 else if (aConstructorId == 0)
722 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
723 aViewWindow->SetSelectionMode(FaceSelection);
726 LineEditElements->setReadOnly(false);
727 LineEditElements->setValidator(myIdValidator);
728 onTextChange(LineEditElements->text());
731 SelectionIntoArgument();
734 //=================================================================================
735 // function : GetConstructorId()
737 //=================================================================================
738 int SMESHGUI_ExtrusionDlg::GetConstructorId()
740 return GroupConstructors->checkedId();
743 //=================================================================================
744 // function : keyPressEvent()
746 //=================================================================================
747 void SMESHGUI_ExtrusionDlg::keyPressEvent( QKeyEvent* e )
749 QDialog::keyPressEvent( e );
750 if ( e->isAccepted() )
753 if ( e->key() == Qt::Key_F1 ) {