Salome HOME
557619a8555f8007f6bbf809aff28510de9eaeec
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_RevolutionDlg.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // SMESH SMESHGUI : GUI for SMESH component
23 // File   : SMESHGUI_RevolutionDlg.cxx
24 // Author : Michael ZORIN, Open CASCADE S.A.S.
25 // SMESH includes
26 //
27 #include "SMESHGUI_RevolutionDlg.h"
28
29 #include "SMESHGUI.h"
30 #include "SMESHGUI_SpinBox.h"
31 #include "SMESHGUI_Utils.h"
32 #include "SMESHGUI_VTKUtils.h"
33 #include "SMESHGUI_MeshUtils.h"
34 #include "SMESHGUI_IdValidator.h"
35 #include "SMESHGUI_MeshEditPreview.h"
36 #include "SMESHGUI_FilterDlg.h"
37
38 #include <SMESH_Actor.h>
39 #include <SMESH_TypeFilter.hxx>
40 #include <SMESH_LogicalFilter.hxx>
41 #include <SMDS_Mesh.hxx>
42
43 // SALOME GUI includes
44 #include <SUIT_ResourceMgr.h>
45 #include <SUIT_Session.h>
46 #include <SUIT_MessageBox.h>
47 #include <SUIT_Desktop.h>
48 #include <SUIT_OverrideCursor.h>
49
50 #include <LightApp_Application.h>
51 #include <LightApp_SelectionMgr.h>
52 #include <SalomeApp_Application.h>
53 #include <SalomeApp_Notebook.h>
54 #include <SalomeApp_IntSpinBox.h>
55
56 #include <SVTK_ViewWindow.h>
57 #include <SVTK_Selector.h>
58 #include <SALOME_ListIO.hxx>
59 #include <VTKViewer_CellLocationsArray.h>
60
61 // OCCT includes
62 #include <TColStd_MapOfInteger.hxx>
63
64 // Qt includes
65 #include <QApplication>
66 #include <QButtonGroup>
67 #include <QGroupBox>
68 #include <QLabel>
69 #include <QLineEdit>
70 #include <QPushButton>
71 #include <QRadioButton>
72 #include <QCheckBox>
73 #include <QHBoxLayout>
74 #include <QVBoxLayout>
75 #include <QGridLayout>
76 #include <QKeyEvent>
77 #include <QMenu>
78
79 // IDL includes
80 #include <SALOMEconfig.h>
81 #include CORBA_SERVER_HEADER(SMESH_Group)
82 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
83
84 #define SPACING 6
85 #define MARGIN  11
86
87 //=================================================================================
88 // class    : SMESHGUI_RevolutionDlg()
89 // purpose  :
90 //=================================================================================
91 SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
92   : QDialog( SMESH::GetDesktop( theModule ) ),
93     SMESHGUI_Helper( theModule ),
94     mySMESHGUI( theModule ),
95     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
96     myVectorDefinition(NONE_SELECT),
97     myFilterDlg( 0 ),
98     mySelectedObject(SMESH::SMESH_IDSource::_nil()),
99     myActor(0)
100 {
101   mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
102
103   SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
104   QPixmap image0 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
105   QPixmap image1 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
106   QPixmap image2 ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
107
108   setModal(false);
109   setAttribute(Qt::WA_DeleteOnClose, true);
110   setWindowTitle(tr("REVOLUTION_AROUND_AXIS"));
111   setSizeGripEnabled(true);
112   
113   QVBoxLayout* SMESHGUI_RevolutionDlgLayout = new QVBoxLayout(this);
114   SMESHGUI_RevolutionDlgLayout->setSpacing(SPACING);
115   SMESHGUI_RevolutionDlgLayout->setMargin(MARGIN);
116
117   /***************************************************************/
118   ConstructorsBox = new QGroupBox(tr("SMESH_REVOLUTION"), this);
119   GroupConstructors = new QButtonGroup(this);
120   QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
121   ConstructorsBoxLayout->setSpacing(SPACING);
122   ConstructorsBoxLayout->setMargin(MARGIN);
123
124   RadioButton1 = new QRadioButton(ConstructorsBox);
125   RadioButton1->setIcon(image0);
126   RadioButton2 = new QRadioButton(ConstructorsBox);
127   RadioButton2->setIcon(image1);
128
129   ConstructorsBoxLayout->addWidget(RadioButton1);
130   ConstructorsBoxLayout->addWidget(RadioButton2);
131   GroupConstructors->addButton(RadioButton1, 0);
132   GroupConstructors->addButton(RadioButton2, 1);
133
134   /***************************************************************/
135   GroupArguments = new QGroupBox(tr("REVOLUTION_1D"), this);
136   QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
137   GroupArgumentsLayout->setSpacing(SPACING);
138   GroupArgumentsLayout->setMargin(MARGIN);
139
140   myIdValidator = new SMESHGUI_IdValidator(this);
141
142   // Controls for elements selection
143   TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
144
145   SelectElementsButton = new QPushButton(GroupArguments);
146   SelectElementsButton->setIcon(image2);
147
148   LineEditElements  = new QLineEdit(GroupArguments);
149   LineEditElements->setValidator(myIdValidator);
150   myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
151   connect(myFilterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
152
153   // Control for the whole mesh selection
154   CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
155
156   // Controls for axis defining
157   GroupAxis = new QGroupBox(tr("SMESH_AXIS"), GroupArguments);
158   QGridLayout* GroupAxisLayout = new QGridLayout(GroupAxis);
159   GroupAxisLayout->setSpacing(SPACING);
160   GroupAxisLayout->setMargin(MARGIN);
161
162   TextLabelPoint = new QLabel(tr("SMESH_POINT"), GroupAxis);
163   SelectPointButton  = new QPushButton(GroupAxis);
164   SelectPointButton->setIcon(image2);
165
166   TextLabelX = new QLabel(tr("SMESH_X"), GroupAxis);
167   SpinBox_X = new SMESHGUI_SpinBox(GroupAxis);
168
169   TextLabelY = new QLabel(tr("SMESH_Y"), GroupAxis);
170   SpinBox_Y = new SMESHGUI_SpinBox(GroupAxis);
171
172   TextLabelZ = new QLabel(tr("SMESH_Z"), GroupAxis);
173   SpinBox_Z = new SMESHGUI_SpinBox(GroupAxis);
174
175   TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupAxis);
176   SelectVectorButton = new QPushButton(GroupAxis);
177   SelectVectorButton->setIcon(image2);
178
179   TextLabelDX = new QLabel(tr("SMESH_DX"), GroupAxis);
180   SpinBox_DX = new SMESHGUI_SpinBox(GroupAxis);
181
182   TextLabelDY = new QLabel(tr("SMESH_DY"), GroupAxis);
183   SpinBox_DY = new SMESHGUI_SpinBox(GroupAxis);
184
185   TextLabelDZ = new QLabel(tr("SMESH_DZ"), GroupAxis);
186   SpinBox_DZ = new SMESHGUI_SpinBox(GroupAxis);
187
188   GroupAxisLayout->addWidget(TextLabelPoint,     0, 0);
189   GroupAxisLayout->addWidget(SelectPointButton,  0, 1);
190   GroupAxisLayout->addWidget(TextLabelX,         0, 2);
191   GroupAxisLayout->addWidget(SpinBox_X,          0, 3);
192   GroupAxisLayout->addWidget(TextLabelY,         0, 4);
193   GroupAxisLayout->addWidget(SpinBox_Y,          0, 5);
194   GroupAxisLayout->addWidget(TextLabelZ,         0, 6);
195   GroupAxisLayout->addWidget(SpinBox_Z,          0, 7);
196   GroupAxisLayout->addWidget(TextLabelVector,    1, 0);
197   GroupAxisLayout->addWidget(SelectVectorButton, 1, 1);
198   GroupAxisLayout->addWidget(TextLabelDX,        1, 2);
199   GroupAxisLayout->addWidget(SpinBox_DX,         1, 3);
200   GroupAxisLayout->addWidget(TextLabelDY,        1, 4);
201   GroupAxisLayout->addWidget(SpinBox_DY,         1, 5);
202   GroupAxisLayout->addWidget(TextLabelDZ,        1, 6);
203   GroupAxisLayout->addWidget(SpinBox_DZ,         1, 7);
204
205   // Controls for angle defining & number of steps defining
206   GroupAngleBox = new QGroupBox(tr("SMESH_ANGLE"), GroupArguments);
207   GroupAngle = new QButtonGroup(GroupAngleBox);
208   QGridLayout* GroupAngleLayout = new QGridLayout(GroupAngleBox);
209   GroupAngleLayout->setSpacing(6);
210   GroupAngleLayout->setMargin(11);
211
212   RadioButton3 = new QRadioButton(tr("ANGLE_BY_STEP"), GroupAngleBox);
213   RadioButton4 = new QRadioButton(tr("TOTAL_ANGLE"),   GroupAngleBox);
214   GroupAngle->addButton(RadioButton3, 0);
215   GroupAngle->addButton(RadioButton4, 1);
216
217   TextLabelAngle = new QLabel(tr("SMESH_ANGLE"), GroupAngleBox);
218   SpinBox_Angle = new SMESHGUI_SpinBox(GroupAngleBox);
219
220   TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupAngleBox);
221   SpinBox_NbSteps = new SalomeApp_IntSpinBox(GroupAngleBox);
222
223   GroupAngleLayout->addWidget(RadioButton3,     0, 0);
224   GroupAngleLayout->addWidget(RadioButton4,     0, 1);
225   GroupAngleLayout->addWidget(TextLabelAngle,   1, 0);
226   GroupAngleLayout->addWidget(SpinBox_Angle,    1, 1);
227   GroupAngleLayout->addWidget(TextLabelNbSteps, 2, 0);
228   GroupAngleLayout->addWidget(SpinBox_NbSteps,  2, 1);
229
230   // Controls for tolerance defining
231   TextLabelTolerance = new QLabel(tr("SMESH_TOLERANCE"), GroupArguments);
232   SpinBox_Tolerance = new SMESHGUI_SpinBox(GroupArguments);
233
234   // Control for mesh preview
235   CheckBoxPreview = new QCheckBox(tr("PREVIEW"), GroupArguments);
236
237   // CheckBox for groups generation
238   MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
239   MakeGroupsCheck->setChecked(true);
240
241   GroupArgumentsLayout->addWidget(TextLabelElements,    0, 0);
242   GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
243   GroupArgumentsLayout->addWidget(LineEditElements,     0, 2);
244   GroupArgumentsLayout->addWidget(myFilterBtn,          0, 3);
245   GroupArgumentsLayout->addWidget(CheckBoxMesh,         1, 0, 1, 4);
246   GroupArgumentsLayout->addWidget(GroupAxis,            2, 0, 1, 4);
247   GroupArgumentsLayout->addWidget(GroupAngleBox,        3, 0, 1, 4);
248   GroupArgumentsLayout->addWidget(TextLabelTolerance,   4, 0, 1, 2);
249   GroupArgumentsLayout->addWidget(SpinBox_Tolerance,    4, 2, 1, 2);
250   GroupArgumentsLayout->addWidget(CheckBoxPreview,      5, 0, 1, 4);
251   GroupArgumentsLayout->addWidget(MakeGroupsCheck,      6, 0, 1, 4);
252
253   /***************************************************************/
254   GroupButtons = new QGroupBox(this);
255   QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
256   GroupButtonsLayout->setSpacing(SPACING);
257   GroupButtonsLayout->setMargin(MARGIN);
258   
259   buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
260   buttonOk->setAutoDefault(true);
261   buttonOk->setDefault(true);
262   buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
263   buttonApply->setAutoDefault(true);
264   buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
265   buttonCancel->setAutoDefault(true);
266   buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
267   buttonHelp->setAutoDefault(true);
268
269   GroupButtonsLayout->addWidget(buttonOk);
270   GroupButtonsLayout->addSpacing(10);
271   GroupButtonsLayout->addWidget(buttonApply);
272   GroupButtonsLayout->addSpacing(10);
273   GroupButtonsLayout->addStretch();
274   GroupButtonsLayout->addWidget(buttonCancel);
275   GroupButtonsLayout->addWidget(buttonHelp);
276
277   /***************************************************************/
278   SMESHGUI_RevolutionDlgLayout->addWidget(ConstructorsBox);
279   SMESHGUI_RevolutionDlgLayout->addWidget(GroupArguments);
280   SMESHGUI_RevolutionDlgLayout->addWidget(GroupButtons);
281
282   /* Initialisations */
283   SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
284   SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
285   SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
286   SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
287   SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
288   SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
289
290   RadioButton3->setChecked(true);
291
292   SpinBox_Angle->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5.0, 3);
293
294   SpinBox_NbSteps->setRange(1, 999999);
295
296   SpinBox_Tolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, 6);
297
298   RadioButton1->setChecked(true);
299
300   mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
301
302   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
303
304   // Costruction of the logical filter
305   SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
306   SMESH_TypeFilter* aSmeshGroupFilter    = new SMESH_TypeFilter (GROUP);
307
308   QList<SUIT_SelectionFilter*> aListOfFilters;
309   if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
310   if (aSmeshGroupFilter)    aListOfFilters.append(aSmeshGroupFilter);
311
312   myMeshOrSubMeshOrGroupFilter =
313     new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
314
315   myHelpFileName = "revolution_page.html";
316
317   Init();
318
319   /*Create menu to vector selection*/
320   SelectVectorMenu = new QMenu(this);
321   myMenuActions[SelectVectorMenu->addAction( tr( "MEN_POINT_SELECT" ) )] = POINT_SELECT;
322   myMenuActions[SelectVectorMenu->addAction( tr( "MEN_FACE_SELECT" ) )] = FACE_SELECT;
323   connect( SelectVectorMenu, SIGNAL( triggered( QAction* ) ), SLOT( onSelectVectorMenu( QAction* ) ) );
324
325   /* signals and slots connections */
326   connect(buttonOk,     SIGNAL(clicked()), this, SLOT(ClickOnOk()));
327   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
328   connect(buttonApply,  SIGNAL(clicked()), this, SLOT(ClickOnApply()));
329   connect(buttonHelp,   SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
330   connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int)));
331
332   connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
333   connect(SelectPointButton,    SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
334   connect(SelectVectorButton,   SIGNAL(clicked()), this, SLOT(onSelectVectorButton()));
335
336   connect(SpinBox_X,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
337   connect(SpinBox_Y,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
338   connect(SpinBox_Z,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
339
340   connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
341   connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
342   connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
343
344   connect(mySMESHGUI,     SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
345   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),      this, SLOT(SelectionIntoArgument()));
346   /* to close dialog if study change */
347   connect(mySMESHGUI,       SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
348   connect(LineEditElements, SIGNAL(textChanged(const QString&)),   SLOT(onTextChange(const QString&)));
349   connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                 SLOT(onSelectMesh(bool)));
350
351   connect(GroupAngle,        SIGNAL(buttonClicked(int)),   this, SLOT(toDisplaySimulation()));
352   connect(SpinBox_Angle,     SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
353   connect(SpinBox_NbSteps,   SIGNAL(valueChanged(int)),    this, SLOT(toDisplaySimulation()));
354   connect(SpinBox_Tolerance, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
355   connect(CheckBoxPreview,   SIGNAL(toggled(bool)),        this, SLOT(onDisplaySimulation(bool)));
356
357   connect(SpinBox_Angle, SIGNAL(textChanged(const QString&)), this, SLOT(onAngleTextChange(const QString&)));
358
359   ConstructorsClicked(0);
360   SelectionIntoArgument();
361 }
362
363 //=================================================================================
364 // function : ~SMESHGUI_RevolutionDlg()
365 // purpose  : Destroys the object and frees any allocated resources
366 //=================================================================================
367 SMESHGUI_RevolutionDlg::~SMESHGUI_RevolutionDlg()
368 {
369   delete mySimulation;
370   if ( myFilterDlg ) {
371     myFilterDlg->setParent( 0 );
372     delete myFilterDlg;
373     myFilterDlg = 0;
374   }
375 }
376
377 //=================================================================================
378 // function : Init()
379 // purpose  :
380 //=================================================================================
381 void SMESHGUI_RevolutionDlg::Init (bool ResetControls)
382 {
383   myBusy = false;
384
385   myEditCurrentArgument = 0;
386   LineEditElements->clear();
387   myElementsId = "";
388   myNbOkElements = 0;
389   myIDs.clear();
390
391   myActor = 0;
392   myMesh = SMESH::SMESH_Mesh::_nil();
393
394   if (ResetControls) {
395     SpinBox_X->SetValue(0.0);
396     SpinBox_Y->SetValue(0.0);
397     SpinBox_Z->SetValue(0.0);
398     SpinBox_DX->SetValue(0.0);
399     SpinBox_DY->SetValue(0.0);
400     SpinBox_DZ->SetValue(0.0);
401
402     SpinBox_Angle->SetValue(45);
403     SpinBox_NbSteps->setValue(1);
404     SpinBox_Tolerance->SetValue(1e-05);
405
406     CheckBoxMesh->setChecked(false);
407     onSelectMesh(false);
408     CheckBoxPreview->setChecked(false);
409     onDisplaySimulation(false);
410   }
411 }
412
413 //=================================================================================
414 // function : ConstructorsClicked()
415 // purpose  : Radio button management
416 //=================================================================================
417 void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId)
418 {
419   disconnect(mySelectionMgr, 0, this, 0);
420
421   /*  SALOME_ListIO io;
422   mySelectionMgr->selectedObjects( io );
423   SALOME_ListIO aList;
424   mySelectionMgr->setSelectedObjects( aList );*/
425
426   buttonApply->setEnabled(false);
427   buttonOk->setEnabled(false);
428   mySimulation->SetVisibility(false);
429
430   Selection_Mode aSelMode = ActorSelection;
431
432   switch (constructorId) {
433   case 0:
434     {
435       GroupArguments->setTitle(tr("REVOLUTION_1D"));
436       aSelMode = EdgeSelection;
437       break;
438     }
439   case 1:
440     {
441       GroupArguments->setTitle(tr("REVOLUTION_2D"));
442       aSelMode = FaceSelection;
443       break;
444     }
445   }
446
447   if (myEditCurrentArgument != (QWidget*)LineEditElements) {
448     SMESH::SetPointRepresentation(false);
449   }
450
451   if (!CheckBoxMesh->isChecked())
452     {
453       LineEditElements->clear();
454       myIDs.clear();
455       myNbOkElements = 0;
456       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
457         aViewWindow->SetSelectionMode(aSelMode);
458     }
459
460   myEditCurrentArgument = (QWidget*)LineEditElements;
461   LineEditElements->setFocus();
462
463   if (CheckBoxMesh->isChecked())
464     onSelectMesh(true);
465
466   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
467   //  mySelectionMgr->setSelectedObjects( io );
468 }
469
470 //=================================================================================
471 // function : ClickOnApply()
472 // purpose  :
473 //=================================================================================
474 bool SMESHGUI_RevolutionDlg::ClickOnApply()
475 {
476   if (mySMESHGUI->isActiveStudyLocked())
477     return false;
478
479   if (!isValid())
480     return false;
481
482   if (myNbOkElements && IsAxisOk()) {
483     QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
484
485     SMESH::long_array_var anElementsId = new SMESH::long_array;
486
487     anElementsId->length(aListElementsId.count());
488     for (int i = 0; i < aListElementsId.count(); i++)
489       anElementsId[i] = aListElementsId[i].toInt();
490
491     SMESH::AxisStruct anAxis;
492
493     anAxis.x =  SpinBox_X->GetValue();
494     anAxis.y =  SpinBox_Y->GetValue();
495     anAxis.z =  SpinBox_Z->GetValue();;
496     anAxis.vx = SpinBox_DX->GetValue();
497     anAxis.vy = SpinBox_DY->GetValue();
498     anAxis.vz = SpinBox_DZ->GetValue();
499
500     double anAngle = (SpinBox_Angle->GetValue())*PI/180;
501     long aNbSteps = (long)SpinBox_NbSteps->value();
502     double aTolerance = SpinBox_Tolerance->GetValue();
503
504     if ( GroupAngle->checkedId() == 1 )
505       anAngle = anAngle/aNbSteps;
506
507     try {
508       SUIT_OverrideCursor aWaitCursor;
509       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
510       
511       if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
512         if( CheckBoxMesh->isChecked() ) {
513           if( GetConstructorId() == 0 )
514             SMESH::ListOfGroups_var groups = 
515               aMeshEditor->RotationSweepObject1DMakeGroups(mySelectedObject, anAxis,
516                                                            anAngle, aNbSteps, aTolerance);
517           else
518             SMESH::ListOfGroups_var groups = 
519               aMeshEditor->RotationSweepObject2DMakeGroups(mySelectedObject, anAxis,
520                                                            anAngle, aNbSteps, aTolerance);
521         }
522         else
523           SMESH::ListOfGroups_var groups = 
524             aMeshEditor->RotationSweepMakeGroups(anElementsId.inout(), anAxis,
525                                                  anAngle, aNbSteps, aTolerance);
526       }
527       else {
528         if( CheckBoxMesh->isChecked() ) {
529           if( GetConstructorId() == 0 )
530             aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis, anAngle, aNbSteps, aTolerance);
531           else
532             aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis, anAngle, aNbSteps, aTolerance);
533         }
534         else
535           aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
536       }
537
538       getNotebook()->setParameters( myMesh, 9,
539                                     SpinBox_X, SpinBox_Y, SpinBox_Z,
540                                     SpinBox_DX, SpinBox_DY, SpinBox_DZ,
541                                     SpinBox_Angle, SpinBox_NbSteps, SpinBox_Tolerance );
542     } catch (...) {
543     }
544
545     SMESH::UpdateView();
546     SMESH::Update(myIO, SMESH::eDisplay);
547     if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
548       mySMESHGUI->updateObjBrowser(true); // new groups may appear
549     Init(false);
550     ConstructorsClicked(GetConstructorId());
551     mySelectedObject = SMESH::SMESH_IDSource::_nil();
552     SelectionIntoArgument();
553   }
554
555   return true;
556 }
557
558 //=================================================================================
559 // function : ClickOnOk()
560 // purpose  :
561 //=================================================================================
562 void SMESHGUI_RevolutionDlg::ClickOnOk()
563 {
564   if( ClickOnApply() )
565     ClickOnCancel();
566 }
567
568 //=================================================================================
569 // function : ClickOnCancel()
570 // purpose  :
571 //=================================================================================
572 void SMESHGUI_RevolutionDlg::ClickOnCancel()
573 {
574   reject();
575 }
576
577 void SMESHGUI_RevolutionDlg::reject()
578 {
579   close();
580 }
581
582 //=================================================================================
583 // function : ClickOnHelp()
584 // purpose  :
585 //=================================================================================
586 void SMESHGUI_RevolutionDlg::ClickOnHelp()
587 {
588   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
589   if (app) 
590     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
591   else {
592     QString platform;
593 #ifdef WIN32
594     platform = "winapplication";
595 #else
596     platform = "application";
597 #endif
598     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
599                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
600                              arg(app->resourceMgr()->stringValue("ExternalBrowser", 
601                                                                  platform)).
602                              arg(myHelpFileName));
603   }
604 }
605
606 //=======================================================================
607 // function : onAngleTextChange()
608 // purpose  :
609 //=======================================================================
610 void SMESHGUI_RevolutionDlg::onAngleTextChange (const QString& theNewText)
611 {
612   bool isNumber;
613   SpinBox_Angle->text().toDouble( &isNumber );
614   if( !isNumber )
615     RadioButton3->setChecked( true );
616   RadioButton4->setEnabled( isNumber );
617 }
618
619 //=======================================================================
620 // function : onTextChange()
621 // purpose  :
622 //=======================================================================
623 void SMESHGUI_RevolutionDlg::onTextChange (const QString& theNewText)
624 {
625   QLineEdit* send = (QLineEdit*)sender();
626
627   if (myBusy) return;
628   myBusy = true;
629
630   if (send == LineEditElements)
631     myNbOkElements = 0;
632
633   buttonOk->setEnabled(false);
634   buttonApply->setEnabled(false);
635
636   // hilight entered elements
637   SMDS_Mesh* aMesh = 0;
638   if (myActor)
639     aMesh = myActor->GetObject()->GetMesh();
640
641   if (aMesh) {
642     if (send == LineEditElements) {
643       Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
644
645       TColStd_MapOfInteger newIndices;
646
647       QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
648       
649       for (int i = 0; i < aListId.count(); i++) {
650         const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
651         if (e)
652           newIndices.Add(e->GetID());
653         myNbOkElements++;
654       }
655
656       mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
657       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
658         aViewWindow->highlight( myActor->getIO(), true, true );
659       
660       myElementsId = theNewText;
661     }
662   }
663
664   if (myNbOkElements && IsAxisOk()) {
665     buttonOk->setEnabled(true);
666     buttonApply->setEnabled(true);
667   }
668   onDisplaySimulation(true);
669
670   myBusy = false;
671 }
672
673 //=================================================================================
674 // function : SelectionIntoArgument()
675 // purpose  : Called when selection as changed or other case
676 //=================================================================================
677 void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
678 {
679   if (myBusy) return;
680
681   // clear
682   QString aString = "";
683
684   myBusy = true;
685   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
686     LineEditElements->setText(aString);
687     myNbOkElements = 0;
688     buttonOk->setEnabled(false);
689     buttonApply->setEnabled(false);
690   }
691   myBusy = false;
692
693   if (!GroupButtons->isEnabled()) // inactive
694     return;
695
696   // get selected mesh
697   const SALOME_ListIO& aList = mySelector->StoredIObjects();
698
699   int nbSel = aList.Extent();
700   if (nbSel != 1)
701     return;
702
703   Handle(SALOME_InteractiveObject) IO = aList.First();
704   SMESH::SMESH_Mesh_var aMeshVar = SMESH::GetMeshByIO(IO);
705   if (aMeshVar->_is_nil())
706     return;
707
708   SMESH_Actor* anActor = SMESH::FindActorByObject(aMeshVar);
709   if (!anActor)
710     anActor = SMESH::FindActorByEntry(IO->getEntry());
711   if (!anActor)
712     return;
713
714   int aNbUnits = 0;
715
716   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
717     myElementsId = "";
718     myMesh = aMeshVar;
719     myActor = anActor;
720     myIO = IO;
721
722     // MakeGroups is available if there are groups
723     if ( myMesh->NbGroups() == 0 ) {
724       MakeGroupsCheck->setChecked(false);
725       MakeGroupsCheck->setEnabled(false);
726     } else {
727       MakeGroupsCheck->setEnabled(true);
728     }
729
730     if (CheckBoxMesh->isChecked()) {
731       SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
732
733       if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
734         mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
735       else
736         return;
737     } else {
738       aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
739       myElementsId = aString;
740       if (aNbUnits < 1)
741         return;
742     }
743     myNbOkElements = true;
744   } else {
745
746     SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
747     if (!aMesh)
748       return;
749
750     bool isNodeSelected = (myEditCurrentArgument == (QWidget*)SpinBox_X ||
751                            (myEditCurrentArgument == (QWidget*)SpinBox_DX && 
752                             myVectorDefinition==POINT_SELECT));
753
754     bool isFaceSelected = (myEditCurrentArgument == (QWidget*)SpinBox_DX && 
755                            myVectorDefinition==FACE_SELECT);
756
757     if(isNodeSelected) {
758       aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
759     }
760     else if(isFaceSelected){
761       aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
762     }
763     
764     if (aNbUnits != 1)
765       return;
766
767     if(isNodeSelected) {
768       const SMDS_MeshNode * n = aMesh->FindNode(aString.toInt());
769       if (!n)
770         return;
771
772       double x = n->X();
773       double y = n->Y();
774       double z = n->Z();
775
776       if (myEditCurrentArgument == (QWidget*)SpinBox_X) {
777         SpinBox_X->SetValue(x);
778         SpinBox_Y->SetValue(y);
779         SpinBox_Z->SetValue(z);
780       } else if (myEditCurrentArgument == (QWidget*)SpinBox_DX) {
781         SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
782         SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
783         SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
784       }
785     }
786     else if(isFaceSelected){
787       const SMDS_MeshFace* face = dynamic_cast<const SMDS_MeshFace*>(aMesh->FindElement(aString.toInt()));
788       if (!face)
789         return;
790       
791       gp_XYZ aNormale = SMESH::getNormale(face);
792       SpinBox_DX->SetValue(aNormale.X());
793       SpinBox_DY->SetValue(aNormale.Y());
794       SpinBox_DZ->SetValue(aNormale.Z());
795       
796     }
797   }
798
799   myBusy = true;
800   if (myEditCurrentArgument == (QWidget*)LineEditElements)
801     LineEditElements->setText(aString);
802   myBusy = false;
803
804   // OK
805   if (myNbOkElements && IsAxisOk()) {
806     buttonOk->setEnabled(true);
807     buttonApply->setEnabled(true);
808   }
809
810   onDisplaySimulation(true);
811 }
812
813 //=================================================================================
814 // function : SetEditCurrentArgument()
815 // purpose  :
816 //=================================================================================
817 void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
818 {
819   QPushButton* send = (QPushButton*)sender();
820
821   disconnect(mySelectionMgr, 0, this, 0);
822   mySelectionMgr->clearSelected();
823   mySelectionMgr->clearFilters();
824
825   if (send == SelectElementsButton) {
826     mySimulation->SetVisibility(false);
827     myEditCurrentArgument = (QWidget*)LineEditElements;
828     SMESH::SetPointRepresentation(false);
829     if (CheckBoxMesh->isChecked()) {
830       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
831         aViewWindow->SetSelectionMode(ActorSelection);
832       mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
833     } else {
834       int aConstructorId = GetConstructorId();
835       if (aConstructorId == 0)
836         {
837           if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
838             aViewWindow->SetSelectionMode(EdgeSelection);
839         }
840       else if (aConstructorId == 1)
841         {
842           if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
843             aViewWindow->SetSelectionMode(FaceSelection);
844         }
845     }
846   } else if (send == SelectPointButton) {
847     myEditCurrentArgument = (QWidget*)SpinBox_X;
848     SMESH::SetPointRepresentation(true);
849     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
850       aViewWindow->SetSelectionMode(NodeSelection);
851   }
852
853   myEditCurrentArgument->setFocus();
854   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
855   SelectionIntoArgument();
856 }
857
858 //=================================================================================
859 // function : DeactivateActiveDialog()
860 // purpose  :
861 //=================================================================================
862 void SMESHGUI_RevolutionDlg::DeactivateActiveDialog()
863 {
864   if (ConstructorsBox->isEnabled()) {
865     ConstructorsBox->setEnabled(false);
866     GroupArguments->setEnabled(false);
867     GroupButtons->setEnabled(false);
868     mySMESHGUI->ResetState();
869     mySMESHGUI->SetActiveDialogBox(0);
870   }
871 }
872
873 //=================================================================================
874 // function : ActivateThisDialog()
875 // purpose  :
876 //=================================================================================
877 void SMESHGUI_RevolutionDlg::ActivateThisDialog()
878 {
879   /* Emit a signal to deactivate the active dialog */
880   mySMESHGUI->EmitSignalDeactivateDialog();
881   ConstructorsBox->setEnabled(true);
882   GroupArguments->setEnabled(true);
883   GroupButtons->setEnabled(true);
884
885   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
886
887   ConstructorsClicked(GetConstructorId());
888   SelectionIntoArgument();
889 }
890
891 //=================================================================================
892 // function : enterEvent()
893 // purpose  :
894 //=================================================================================
895 void SMESHGUI_RevolutionDlg::enterEvent (QEvent*)
896 {
897   if (!ConstructorsBox->isEnabled())
898     ActivateThisDialog();
899 }
900
901 //=================================================================================
902 // function : closeEvent()
903 // purpose  :
904 //=================================================================================
905 void SMESHGUI_RevolutionDlg::closeEvent (QCloseEvent*)
906 {
907   /* same than click on cancel button */
908   disconnect(mySelectionMgr, 0, this, 0);
909   mySelectionMgr->clearFilters();
910   //mySelectionMgr->clearSelected();
911   if (SMESH::GetCurrentVtkView()) {
912     SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
913     SMESH::SetPointRepresentation(false);
914   }
915   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
916     aViewWindow->SetSelectionMode(ActorSelection);
917   mySMESHGUI->ResetState();
918 }
919
920 //=======================================================================
921 //function : onSelectMesh
922 //purpose  :
923 //=======================================================================
924 void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh)
925 {
926   if (toSelectMesh) {
927     myIDs = LineEditElements->text();
928     TextLabelElements->setText(tr("SMESH_NAME"));
929   }
930   else
931     TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
932   myFilterBtn->setEnabled(!toSelectMesh);
933
934   if (myEditCurrentArgument != LineEditElements) {
935     LineEditElements->clear();
936     mySimulation->SetVisibility(false);
937     return;
938   }
939
940   mySelectionMgr->clearFilters();
941   SMESH::SetPointRepresentation(false);
942
943   if (toSelectMesh) {
944     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
945       aViewWindow->SetSelectionMode(ActorSelection);
946     mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
947     LineEditElements->setReadOnly(true);
948     LineEditElements->setValidator(0);
949   } else {
950     int aConstructorId = GetConstructorId();
951     if (aConstructorId == 0)
952       {
953         if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
954           aViewWindow->SetSelectionMode(EdgeSelection);
955       }
956     else if (aConstructorId == 1)
957       {
958         if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
959           aViewWindow->SetSelectionMode(FaceSelection);
960       }
961
962     LineEditElements->setReadOnly(false);
963     LineEditElements->setValidator(myIdValidator);
964     onTextChange(LineEditElements->text());
965     mySimulation->SetVisibility(false);
966   }
967
968   SelectionIntoArgument();
969
970   if (!toSelectMesh)
971     LineEditElements->setText( myIDs );
972 }
973
974 //=================================================================================
975 // function : GetConstructorId()
976 // purpose  :
977 //=================================================================================
978 int SMESHGUI_RevolutionDlg::GetConstructorId()
979 {
980   return GroupConstructors->checkedId();
981 }
982
983 //=================================================================================
984 // function : IsAxisOk()
985 // purpose  :
986 //=================================================================================
987 bool SMESHGUI_RevolutionDlg::IsAxisOk()
988 {
989   return (SpinBox_DX->GetValue() != 0 ||
990           SpinBox_DY->GetValue() != 0 ||
991           SpinBox_DZ->GetValue() != 0);
992 }
993
994 //=================================================================================
995 // function : onVectorChanged()
996 // purpose  :
997 //=================================================================================
998 void SMESHGUI_RevolutionDlg::onVectorChanged()
999 {
1000   if (IsAxisOk()) {
1001     buttonOk->setEnabled(true);
1002     buttonApply->setEnabled(true);
1003   } else {
1004     buttonOk->setEnabled(false);
1005     buttonApply->setEnabled(false);
1006   }
1007   onDisplaySimulation(true);
1008 }
1009
1010 //=================================================================================
1011 // function : keyPressEvent()
1012 // purpose  :
1013 //=================================================================================
1014 void SMESHGUI_RevolutionDlg::keyPressEvent( QKeyEvent* e )
1015 {
1016   QDialog::keyPressEvent( e );
1017   if ( e->isAccepted() )
1018     return;
1019
1020   if ( e->key() == Qt::Key_F1 ) {
1021     e->accept();
1022     ClickOnHelp();
1023   }
1024 }
1025
1026 //=================================================================================
1027 // function : toDisplaySimulation()
1028 // purpose  :
1029 //=================================================================================
1030 void SMESHGUI_RevolutionDlg::toDisplaySimulation()
1031 {
1032   onDisplaySimulation(true);
1033 }
1034
1035 //=================================================================================
1036 // function : onDisplaySimulation()
1037 // purpose  :
1038 //=================================================================================
1039 void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
1040 {
1041   if (CheckBoxPreview->isChecked() && toDisplayPreview)
1042   {
1043     //display preview
1044     if (myNbOkElements && IsAxisOk())
1045     {
1046       QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
1047       
1048       SMESH::long_array_var anElementsId = new SMESH::long_array;
1049       
1050       anElementsId->length(aListElementsId.count());
1051       for (int i = 0; i < aListElementsId.count(); i++)
1052         anElementsId[i] = aListElementsId[i].toInt();
1053       
1054       SMESH::AxisStruct anAxis;
1055       
1056       anAxis.x =  SpinBox_X->GetValue();
1057       anAxis.y =  SpinBox_Y->GetValue();
1058       anAxis.z =  SpinBox_Z->GetValue();
1059       anAxis.vx = SpinBox_DX->GetValue();
1060       anAxis.vy = SpinBox_DY->GetValue();
1061       anAxis.vz = SpinBox_DZ->GetValue();
1062       
1063       double anAngle = (SpinBox_Angle->GetValue())*PI/180;
1064       long aNbSteps = (long)SpinBox_NbSteps->value();
1065       double aTolerance = SpinBox_Tolerance->GetValue();
1066       
1067       if (GroupAngle->checkedId() == 1)
1068         anAngle = anAngle/aNbSteps;
1069       
1070       try {
1071         SUIT_OverrideCursor aWaitCursor;
1072         SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
1073         if( CheckBoxMesh->isChecked() ) {
1074           if( GetConstructorId() == 0 )
1075             aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis,
1076                                                anAngle, aNbSteps, aTolerance);
1077           else
1078             aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis,
1079                                                anAngle, aNbSteps, aTolerance);
1080         }
1081         else
1082           aMeshEditor->RotationSweep(anElementsId.inout(), 
1083                                      anAxis, 
1084                                      anAngle, 
1085                                      aNbSteps, 
1086                                      aTolerance);
1087         SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
1088         mySimulation->SetData(aMeshPreviewStruct._retn());
1089       } catch (...) {}
1090     }
1091     else
1092     {
1093       mySimulation->SetVisibility(false);
1094     }
1095   }
1096   else
1097   {
1098     //erase preview
1099     mySimulation->SetVisibility(false);
1100   }
1101 }
1102
1103 //=================================================================================
1104 // function : onSelectVectorButton()
1105 // purpose  : [slot]
1106 //=================================================================================
1107 void SMESHGUI_RevolutionDlg::onSelectVectorButton(){
1108   if(SelectVectorMenu) {
1109     SelectVectorMenu->exec( QCursor::pos() );
1110   }
1111 }
1112
1113 //=================================================================================
1114 // function : onSelectVectorMenu()
1115 // purpose  : [slot]
1116 //=================================================================================
1117 void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action){
1118   if(!action)
1119     return;
1120
1121   disconnect(mySelectionMgr, 0, this, 0);
1122
1123   switch(myMenuActions[action]) {
1124   case POINT_SELECT: 
1125     SMESH::SetPointRepresentation(true);
1126     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1127       aViewWindow->SetSelectionMode(NodeSelection);
1128     break;
1129     
1130   case FACE_SELECT: 
1131     SMESH::SetPointRepresentation(false);
1132     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1133       aViewWindow->SetSelectionMode(FaceSelection);
1134     break;
1135   }
1136
1137   myVectorDefinition = myMenuActions[action];
1138   myEditCurrentArgument = (QWidget*)SpinBox_DX;
1139   myEditCurrentArgument->setFocus();
1140   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
1141   SelectionIntoArgument();
1142 }
1143
1144 //=================================================================================
1145 // function : setFilters()
1146 // purpose  : SLOT. Called when "Filter" button pressed.
1147 //=================================================================================
1148 void SMESHGUI_RevolutionDlg::setFilters()
1149 {
1150   if(myMesh->_is_nil()) {
1151     SUIT_MessageBox::critical(this,
1152                               tr("SMESH_ERROR"),
1153                               tr("NO_MESH_SELECTED"));
1154    return;
1155   }
1156   if ( !myFilterDlg )
1157   {
1158     QList<int> types;  
1159     types.append( SMESH::EDGE );
1160     types.append( SMESH::FACE );
1161     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
1162   }
1163   myFilterDlg->Init( GetConstructorId() ? SMESH::FACE : SMESH::EDGE );
1164
1165   myFilterDlg->SetSelection();
1166   myFilterDlg->SetMesh( myMesh );
1167   myFilterDlg->SetSourceWg( LineEditElements );
1168
1169   myFilterDlg->show();
1170 }
1171
1172 //=================================================================================
1173 // function : isValid
1174 // purpose  :
1175 //=================================================================================
1176 bool SMESHGUI_RevolutionDlg::isValid()
1177 {
1178   return checkParameters( true, 9,
1179                           SpinBox_X, SpinBox_Y, SpinBox_Z,
1180                           SpinBox_DX, SpinBox_DY, SpinBox_DZ,
1181                           SpinBox_Angle, SpinBox_NbSteps, SpinBox_Tolerance );
1182 }