Salome HOME
IPAL21120 SIGSEGV on Meshing attached Compound with Automatic Hexadralization
[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
25 //  Module : SMESH
26 //  $Header:
27 //
28 #include "SMESHGUI_RevolutionDlg.h"
29
30 #include "SMESHGUI.h"
31 #include "SMESHGUI_SpinBox.h"
32 #include "SMESHGUI_Utils.h"
33 #include "SMESHGUI_VTKUtils.h"
34 #include "SMESHGUI_MeshUtils.h"
35 #include "SMESHGUI_IdValidator.h"
36 #include "SMESHGUI_MeshEditPreview.h"
37
38 #include "SMESH_Actor.h"
39 #include "SMESH_TypeFilter.hxx"
40 #include "SMESH_LogicalFilter.hxx"
41 #include "SMDS_Mesh.hxx"
42
43 #include "SUIT_ResourceMgr.h"
44 #include "SUIT_Session.h"
45 #include "SUIT_MessageBox.h"
46 #include "SUIT_OverrideCursor.h"
47
48 #include "LightApp_Application.h"
49 #include "SalomeApp_Application.h"
50
51 #include "SVTK_ViewModel.h"
52 #include "SVTK_ViewWindow.h"
53 #include "SVTK_Selector.h"
54 #include "SVTK_Selection.h"
55 #include "SALOME_ListIO.hxx"
56 #include "VTKViewer_CellLocationsArray.h"
57
58 #include "utilities.h"
59
60 // OCCT Includes
61 #include <TColStd_MapOfInteger.hxx>
62
63 // QT Includes
64 #include <qapplication.h>
65 #include <qbuttongroup.h>
66 #include <qgroupbox.h>
67 #include <qlabel.h>
68 #include <qlineedit.h>
69 #include <qpushbutton.h>
70 #include <qradiobutton.h>
71 #include <qcheckbox.h>
72 #include <qlayout.h>
73 #include <qspinbox.h>
74 #include <qvalidator.h>
75 #include <qpixmap.h>
76
77 // IDL Headers
78 #include "SALOMEconfig.h"
79 #include CORBA_SERVER_HEADER(SMESH_Group)
80 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
81
82 using namespace std;
83
84 //=================================================================================
85 // class    : SMESHGUI_RevolutionDlg()
86 // purpose  :
87 //=================================================================================
88
89 SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char* name,
90                                                 bool modal, WFlags fl)
91      : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
92                 WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
93      mySMESHGUI( theModule ),
94      mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
95 {
96   mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
97
98   SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
99   QPixmap image0 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
100   QPixmap image1 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
101   QPixmap image2 ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
102
103   if (!name)
104     setName("SMESHGUI_RevolutionDlg");
105   resize(303, 185);
106   setCaption(tr("REVOLUTION_AROUND_AXIS"));
107   setSizeGripEnabled(TRUE);
108   SMESHGUI_RevolutionDlgLayout = new QGridLayout(this);
109   SMESHGUI_RevolutionDlgLayout->setSpacing(6);
110   SMESHGUI_RevolutionDlgLayout->setMargin(11);
111
112   /***************************************************************/
113   GroupConstructors = new QButtonGroup(this, "GroupConstructors");
114   GroupConstructors->setTitle(tr("SMESH_REVOLUTION" ));
115   GroupConstructors->setExclusive(TRUE);
116   GroupConstructors->setColumnLayout(0, Qt::Vertical);
117   GroupConstructors->layout()->setSpacing(0);
118   GroupConstructors->layout()->setMargin(0);
119   GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
120   GroupConstructorsLayout->setAlignment(Qt::AlignTop);
121   GroupConstructorsLayout->setSpacing(6);
122   GroupConstructorsLayout->setMargin(11);
123   RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1");
124   RadioButton1->setText(tr("" ));
125   RadioButton1->setPixmap(image0);
126   GroupConstructorsLayout->addWidget(RadioButton1, 0, 0);
127   RadioButton2= new QRadioButton(GroupConstructors, "RadioButton2");
128   RadioButton2->setText(tr("" ));
129   RadioButton2->setPixmap(image1);
130   GroupConstructorsLayout->addWidget(RadioButton2, 0, 2);
131   SMESHGUI_RevolutionDlgLayout->addWidget(GroupConstructors, 0, 0);
132
133   /***************************************************************/
134   GroupButtons = new QGroupBox(this, "GroupButtons");
135   GroupButtons->setGeometry(QRect(10, 10, 281, 48));
136   GroupButtons->setTitle(tr("" ));
137   GroupButtons->setColumnLayout(0, Qt::Vertical);
138   GroupButtons->layout()->setSpacing(0);
139   GroupButtons->layout()->setMargin(0);
140   GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
141   GroupButtonsLayout->setAlignment(Qt::AlignTop);
142   GroupButtonsLayout->setSpacing(6);
143   GroupButtonsLayout->setMargin(11);
144   buttonHelp = new QPushButton(GroupButtons, "buttonHelp");
145   buttonHelp->setText(tr("SMESH_BUT_HELP" ));
146   buttonHelp->setAutoDefault(TRUE);
147   GroupButtonsLayout->addWidget(buttonHelp, 0, 4);
148   buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
149   buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
150   buttonCancel->setAutoDefault(TRUE);
151   GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
152   buttonApply = new QPushButton(GroupButtons, "buttonApply");
153   buttonApply->setText(tr("SMESH_BUT_APPLY" ));
154   buttonApply->setAutoDefault(TRUE);
155   GroupButtonsLayout->addWidget(buttonApply, 0, 1);
156   QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
157   GroupButtonsLayout->addItem(spacer_9, 0, 2);
158   buttonOk = new QPushButton(GroupButtons, "buttonOk");
159   buttonOk->setText(tr("SMESH_BUT_APPLY_AND_CLOSE" ));
160   buttonOk->setAutoDefault(TRUE);
161   buttonOk->setDefault(TRUE);
162   GroupButtonsLayout->addWidget(buttonOk, 0, 0);
163   SMESHGUI_RevolutionDlgLayout->addWidget(GroupButtons, 2, 0);
164
165   /***************************************************************/
166   GroupArguments = new QGroupBox(this, "GroupArguments");
167   GroupArguments->setTitle(tr("REVOLUTION_1D"));
168   GroupArguments->setColumnLayout(0, Qt::Vertical);
169   GroupArguments->layout()->setSpacing(0);
170   GroupArguments->layout()->setMargin(0);
171   GroupArgumentsLayout = new QGridLayout(GroupArguments->layout());
172   GroupArgumentsLayout->setAlignment(Qt::AlignTop);
173   GroupArgumentsLayout->setSpacing(6);
174   GroupArgumentsLayout->setMargin(11);
175
176   // Controls for elements selection
177   TextLabelElements  = new QLabel(GroupArguments, "TextLabelElements");
178   TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" ));
179   TextLabelElements->setFixedWidth(74);
180   GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
181
182   SelectElementsButton  = new QPushButton(GroupArguments, "SelectElementsButton");
183   SelectElementsButton->setText(tr("" ));
184   SelectElementsButton->setPixmap(image2);
185   SelectElementsButton->setToggleButton(FALSE);
186   GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
187
188   LineEditElements  = new QLineEdit(GroupArguments, "LineEditElements");
189   LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
190   GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
191
192   // Control for the whole mesh selection
193   CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh");
194   CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
195   GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 3);
196
197   // Controls for axis defining
198   GroupAxis = new QGroupBox(GroupArguments, "GroupAxis");
199   GroupAxis->setTitle(tr("SMESH_AXIS"));
200   GroupAxis->setColumnLayout(0, Qt::Vertical);
201   GroupAxis->layout()->setSpacing(0);
202   GroupAxis->layout()->setMargin(0);
203   QGridLayout* GroupAxisLayout = new QGridLayout(GroupAxis->layout());
204   GroupAxisLayout->setAlignment(Qt::AlignTop);
205   GroupAxisLayout->setSpacing(6);
206   GroupAxisLayout->setMargin(11);
207
208   TextLabelPoint = new QLabel(GroupAxis, "TextLabelPoint");
209   TextLabelPoint->setText(tr("SMESH_POINT"));
210   GroupAxisLayout->addWidget(TextLabelPoint, 0, 0);
211
212   SelectPointButton  = new QPushButton(GroupAxis, "SelectPointButton");
213   SelectPointButton->setPixmap(image2);
214   GroupAxisLayout->addWidget(SelectPointButton, 0, 1);
215
216   TextLabelX = new QLabel(GroupAxis, "TextLabelX");
217   TextLabelX->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
218   TextLabelX->setText(tr("SMESH_X"));
219   GroupAxisLayout->addWidget(TextLabelX, 0, 2);
220
221   SpinBox_X = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_X");
222   GroupAxisLayout->addWidget(SpinBox_X, 0, 3);
223
224   TextLabelY = new QLabel(GroupAxis, "TextLabelY");
225   TextLabelY->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
226   TextLabelY->setText(tr("SMESH_Y"));
227   GroupAxisLayout->addWidget(TextLabelY, 0, 4);
228
229   SpinBox_Y = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_Y");
230   GroupAxisLayout->addWidget(SpinBox_Y, 0, 5);
231
232   TextLabelZ = new QLabel(GroupAxis, "TextLabelZ");
233   TextLabelZ->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
234   TextLabelZ->setText(tr("SMESH_Z"));
235   GroupAxisLayout->addWidget(TextLabelZ, 0, 6);
236
237   SpinBox_Z = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_Z");
238   GroupAxisLayout->addWidget(SpinBox_Z, 0, 7);
239
240   TextLabelVector = new QLabel(GroupAxis, "TextLabelVector");
241   TextLabelVector->setText(tr("SMESH_VECTOR"));
242   GroupAxisLayout->addWidget(TextLabelVector, 1, 0);
243
244   SelectVectorButton = new QPushButton(GroupAxis, "SelectVectorButton");
245   SelectVectorButton->setPixmap(image2);
246   GroupAxisLayout->addWidget(SelectVectorButton, 1, 1);
247
248   TextLabelDX = new QLabel(GroupAxis, "TextLabelDX");
249   TextLabelDX->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
250   TextLabelDX->setText(tr("SMESH_DX"));
251   GroupAxisLayout->addWidget(TextLabelDX, 1, 2);
252
253   SpinBox_DX = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DX");
254   GroupAxisLayout->addWidget(SpinBox_DX, 1, 3);
255
256   TextLabelDY = new QLabel(GroupAxis, "TextLabelDY");
257   TextLabelDY->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
258   TextLabelDY->setText(tr("SMESH_DY"));
259   GroupAxisLayout->addWidget(TextLabelDY, 1, 4);
260
261   SpinBox_DY = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DY");
262   GroupAxisLayout->addWidget(SpinBox_DY, 1, 5);
263
264   TextLabelDZ = new QLabel(GroupAxis, "TextLabelDZ");
265   TextLabelDZ->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
266   TextLabelDZ->setText(tr("SMESH_DZ"));
267   GroupAxisLayout->addWidget(TextLabelDZ, 1, 6);
268
269   SpinBox_DZ = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DZ");
270   GroupAxisLayout->addWidget(SpinBox_DZ, 1, 7);
271
272   GroupArgumentsLayout->addMultiCellWidget(GroupAxis, 2, 2, 0, 3);
273
274   // Controls for angle defining
275   GroupAngle = new QButtonGroup(GroupArguments, "GroupAngle");
276   GroupAngle->setTitle(tr("SMESH_ANGLE"));
277   GroupAngle->setExclusive(TRUE);
278   GroupAngle->setColumnLayout(0, Qt::Horizontal);
279   GroupAngle->layout()->setSpacing(0);
280   GroupAngle->layout()->setMargin(0);
281   QGridLayout* GroupAngleLayout = new QGridLayout(GroupAngle->layout());
282   GroupAngleLayout->setAlignment(Qt::AlignTop);
283   GroupAngleLayout->setSpacing(6);
284   GroupAngleLayout->setMargin(11);
285
286   RadioButton3 = new QRadioButton(GroupAngle, "RadioButton3");
287   RadioButton3->setText(tr("ANGLE_BY_STEP"));
288   GroupAngleLayout->addMultiCellWidget(RadioButton3, 0, 0, 0, 1);
289
290   RadioButton4 = new QRadioButton(GroupAngle, "RadioButton4");
291   RadioButton4->setText(tr("TOTAL_ANGLE"));
292   GroupAngleLayout->addWidget(RadioButton4, 0, 2);
293
294   TextLabelAngle = new QLabel(GroupAngle, "TextLabelAngle");
295   TextLabelAngle->setText(tr("SMESH_ANGLE"));
296   GroupAngleLayout->addWidget(TextLabelAngle, 1, 0);
297
298   SpinBox_Angle = new SMESHGUI_SpinBox(GroupAngle, "SpinBox_Angle");
299   GroupAngleLayout->addMultiCellWidget(SpinBox_Angle, 1, 1, 1, 2);
300
301   // Controls for number of steps defining
302   TextLabelNbSteps = new QLabel(GroupAngle, "TextLabelNbSteps");
303   TextLabelNbSteps->setText(tr("SMESH_NUMBEROFSTEPS" ));
304   TextLabelNbSteps->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
305   GroupAngleLayout->addWidget(TextLabelNbSteps, 2, 0);
306
307   SpinBox_NbSteps = new QSpinBox(GroupAngle, "SpinBox_NbSteps");
308   GroupAngleLayout->addMultiCellWidget(SpinBox_NbSteps, 2, 2, 1, 2);
309
310   GroupArgumentsLayout->addMultiCellWidget(GroupAngle, 3, 3, 0, 3);
311
312   // Controls for tolerance defining
313   TextLabelTolerance = new QLabel(GroupArguments, "TextLabelTolerance");
314   TextLabelTolerance->setText(tr("SMESH_TOLERANCE"));
315   GroupArgumentsLayout->addWidget(TextLabelTolerance, 4, 0);
316
317   SpinBox_Tolerance = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Tolerance");
318   GroupArgumentsLayout->addMultiCellWidget(SpinBox_Tolerance, 4, 4, 1, 3);
319
320   // CheckBox for groups generation
321   MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
322   MakeGroupsCheck->setChecked(true);
323   GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 6, 6, 0, 3);
324
325   // Control for mesh preview
326   CheckBoxPreview = new QCheckBox(GroupArguments, "CheckBoxPreview");
327   CheckBoxPreview->setText(tr("PREVIEW" ));
328   GroupArgumentsLayout->addMultiCellWidget(CheckBoxPreview, 5, 5, 0, 3);
329
330   SMESHGUI_RevolutionDlgLayout->addWidget(GroupArguments, 1, 0);
331
332   /* Initialisations */
333   SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
334   SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
335   SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
336   SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
337   SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
338   SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
339
340   RadioButton3->setChecked(TRUE);
341
342   SpinBox_Angle->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5.0, 3);
343
344   QIntValidator* anIntValidator = new QIntValidator(SpinBox_NbSteps);
345   SpinBox_NbSteps->setValidator(anIntValidator);
346   SpinBox_NbSteps->setRange(1, 999999);
347
348   SpinBox_Tolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.1, 6);
349
350   GroupArguments->show();
351   RadioButton1->setChecked(TRUE);
352
353   mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
354
355   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
356
357   // Costruction of the logical filter
358   SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
359   SMESH_TypeFilter* aSmeshGroupFilter    = new SMESH_TypeFilter (GROUP);
360
361   QPtrList<SUIT_SelectionFilter> aListOfFilters;
362   if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
363   if (aSmeshGroupFilter)    aListOfFilters.append(aSmeshGroupFilter);
364
365   myMeshOrSubMeshOrGroupFilter =
366     new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
367
368   myHelpFileName = "revolution_page.html";
369
370   Init();
371
372   /* signals and slots connections */
373   connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
374   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
375   connect(buttonApply, SIGNAL(clicked()),  this, SLOT(ClickOnApply()));
376   connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
377   connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
378
379   connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
380   connect(SelectPointButton, SIGNAL (clicked()),    this, SLOT(SetEditCurrentArgument()));
381   connect(SelectVectorButton, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
382
383   connect(SpinBox_X, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
384   connect(SpinBox_Y, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
385   connect(SpinBox_Z, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
386
387   connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
388   connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
389   connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
390
391   connect(mySMESHGUI,     SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
392   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),      this, SLOT(SelectionIntoArgument()));
393   /* to close dialog if study change */
394   connect(mySMESHGUI,       SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
395   connect(LineEditElements, SIGNAL(textChanged(const QString&)),   SLOT(onTextChange(const QString&)));
396   connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                 SLOT(onSelectMesh(bool)));
397
398   connect(GroupAngle,        SIGNAL(clicked(int)),               SLOT(toDisplaySimulation()));
399   connect(SpinBox_Angle,     SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
400   connect(SpinBox_NbSteps,   SIGNAL(valueChanged(int)),   this, SLOT(toDisplaySimulation()));
401   connect(SpinBox_Tolerance, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
402   connect(CheckBoxPreview,   SIGNAL(toggled(bool)),              SLOT(onDisplaySimulation(bool)));
403
404   this->show(); /* displays Dialog */
405
406   ConstructorsClicked(0);
407   SelectionIntoArgument();
408   resize(0,0); // ??
409 }
410
411 //=================================================================================
412 // function : ~SMESHGUI_RevolutionDlg()
413 // purpose  : Destroys the object and frees any allocated resources
414 //=================================================================================
415 SMESHGUI_RevolutionDlg::~SMESHGUI_RevolutionDlg()
416 {
417   delete mySimulation;
418   // no need to delete child widgets, Qt does it all for us
419 }
420
421 //=================================================================================
422 // function : Init()
423 // purpose  :
424 //=================================================================================
425 void SMESHGUI_RevolutionDlg::Init (bool ResetControls)
426 {
427   myBusy = false;
428
429   myEditCurrentArgument = 0;
430   LineEditElements->clear();
431   myElementsId = "";
432   myNbOkElements = 0;
433
434   myActor = 0;
435   myMesh = SMESH::SMESH_Mesh::_nil();
436
437   if (ResetControls) {
438     SpinBox_X->SetValue(0.0);
439     SpinBox_Y->SetValue(0.0);
440     SpinBox_Z->SetValue(0.0);
441     SpinBox_DX->SetValue(0.0);
442     SpinBox_DY->SetValue(0.0);
443     SpinBox_DZ->SetValue(0.0);
444
445     SpinBox_Angle->SetValue(45);
446     SpinBox_NbSteps->setValue(1);
447     SpinBox_Tolerance->SetValue(1e-05);
448
449     CheckBoxMesh->setChecked(false);
450     onSelectMesh(false);
451     CheckBoxPreview->setChecked(false);
452     onDisplaySimulation(false);
453   }
454 }
455
456 //=================================================================================
457 // function : ConstructorsClicked()
458 // purpose  : Radio button management
459 //=================================================================================
460 void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId)
461 {
462   //disconnect(mySelectionMgr, 0, this, 0);
463
464   SALOME_ListIO io;
465   mySelectionMgr->selectedObjects( io );
466   SALOME_ListIO aList;
467   mySelectionMgr->setSelectedObjects( aList );
468 //   LineEditElements->clear();
469   myNbOkElements = 0;
470   buttonApply->setEnabled(false);
471   buttonOk->setEnabled(false);
472   mySimulation->SetVisibility(false);
473
474   Selection_Mode aSelMode = ActorSelection;
475
476   switch (constructorId) {
477   case 0:
478     {
479       GroupArguments->setTitle(tr("REVOLUTION_1D"));
480       aSelMode = EdgeSelection;
481       break;
482     }
483   case 1:
484     {
485       GroupArguments->setTitle(tr("REVOLUTION_2D"));
486       aSelMode = FaceSelection;
487       break;
488     }
489   }
490
491   if (myEditCurrentArgument != (QWidget*)LineEditElements) {
492     SMESH::SetPointRepresentation(false);
493   }
494
495   if (!CheckBoxMesh->isChecked())
496     {
497       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
498         aViewWindow->SetSelectionMode(aSelMode);
499     }
500
501   myEditCurrentArgument = (QWidget*)LineEditElements;
502   LineEditElements->setFocus();
503
504   if (CheckBoxMesh->isChecked())
505     onSelectMesh(true);
506
507   //connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
508   mySelectionMgr->setSelectedObjects( io );
509 }
510
511 //=================================================================================
512 // function : ClickOnApply()
513 // purpose  :
514 //=================================================================================
515 void SMESHGUI_RevolutionDlg::ClickOnApply()
516 {
517   if (mySMESHGUI->isActiveStudyLocked())
518     return;
519
520   if (myNbOkElements && IsAxisOk()) {
521     QStringList aListElementsId = QStringList::split(" ", myElementsId, false);
522
523     SMESH::long_array_var anElementsId = new SMESH::long_array;
524
525     anElementsId->length(aListElementsId.count());
526     for (int i = 0; i < aListElementsId.count(); i++)
527       anElementsId[i] = aListElementsId[i].toInt();
528
529     SMESH::AxisStruct anAxis;
530
531     anAxis.x =  SpinBox_X->GetValue();
532     anAxis.y =  SpinBox_Y->GetValue();
533     anAxis.z =  SpinBox_Z->GetValue();;
534     anAxis.vx = SpinBox_DX->GetValue();
535     anAxis.vy = SpinBox_DY->GetValue();
536     anAxis.vz = SpinBox_DZ->GetValue();
537
538     double anAngle = (SpinBox_Angle->GetValue())*PI/180;
539     long aNbSteps = (long)SpinBox_NbSteps->value();
540     double aTolerance = SpinBox_Tolerance->GetValue();
541
542     if (GroupAngle->selectedId() == 1)
543       anAngle = anAngle/aNbSteps;
544
545     try {
546       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
547       QApplication::setOverrideCursor(Qt::waitCursor);
548
549       if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
550         SMESH::ListOfGroups_var groups = 
551           aMeshEditor->RotationSweepMakeGroups(anElementsId.inout(), anAxis,
552                                                anAngle, aNbSteps, aTolerance);
553       else
554         aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
555
556       QApplication::restoreOverrideCursor();
557     } catch (...) {
558     }
559
560     SMESH::UpdateView();
561     if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
562       mySMESHGUI->updateObjBrowser(true); // new groups may appear
563     Init(false);
564     ConstructorsClicked(GetConstructorId());
565     SelectionIntoArgument();
566   }
567 }
568
569 //=================================================================================
570 // function : ClickOnOk()
571 // purpose  :
572 //=================================================================================
573 void SMESHGUI_RevolutionDlg::ClickOnOk()
574 {
575   ClickOnApply();
576   ClickOnCancel();
577 }
578
579 //=================================================================================
580 // function : ClickOnCancel()
581 // purpose  :
582 //=================================================================================
583 void SMESHGUI_RevolutionDlg::ClickOnCancel()
584 {
585   disconnect(mySelectionMgr, 0, this, 0);
586   mySelectionMgr->clearFilters();
587   //mySelectionMgr->clearSelected();
588   SMESH::SetPointRepresentation(false);
589   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
590     aViewWindow->SetSelectionMode(ActorSelection);
591   mySMESHGUI->ResetState();
592   reject();
593 }
594
595 //=================================================================================
596 // function : ClickOnHelp()
597 // purpose  :
598 //=================================================================================
599 void SMESHGUI_RevolutionDlg::ClickOnHelp()
600 {
601   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
602   if (app) 
603     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
604   else {
605                 QString platform;
606 #ifdef WIN32
607                 platform = "winapplication";
608 #else
609                 platform = "application";
610 #endif
611     SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
612                            QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
613                            arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
614                            QObject::tr("BUT_OK"));
615   }
616 }
617
618 //=======================================================================
619 // function : onTextChange()
620 // purpose  :
621 //=======================================================================
622 void SMESHGUI_RevolutionDlg::onTextChange (const QString& theNewText)
623 {
624   QLineEdit* send = (QLineEdit*)sender();
625
626   if (myBusy) return;
627   myBusy = true;
628
629   if (send == LineEditElements)
630     myNbOkElements = 0;
631
632   buttonOk->setEnabled(false);
633   buttonApply->setEnabled(false);
634
635   // hilight entered elements
636   SMDS_Mesh* aMesh = 0;
637   if (myActor)
638     aMesh = myActor->GetObject()->GetMesh();
639
640   if (aMesh) {
641     if (send == LineEditElements) {
642       Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
643
644       TColStd_MapOfInteger newIndices;
645
646       QStringList aListId = QStringList::split(" ", theNewText, false);
647       
648       for (int i = 0; i < aListId.count(); i++) {
649         const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
650         if (e)
651           newIndices.Add(e->GetID());
652         myNbOkElements++;
653       }
654
655       mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
656       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
657         aViewWindow->highlight( myActor->getIO(), true, true );
658       
659       myElementsId = theNewText;
660     }
661   }
662
663   if (myNbOkElements && IsAxisOk()) {
664     buttonOk->setEnabled(true);
665     buttonApply->setEnabled(true);
666   }
667   onDisplaySimulation(true);
668
669   myBusy = false;
670 }
671
672 //=================================================================================
673 // function : SelectionIntoArgument()
674 // purpose  : Called when selection as changed or other case
675 //=================================================================================
676 void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
677 {
678   if (myBusy) return;
679
680   // clear
681   myActor = 0;
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   myMesh = SMESH::GetMeshByIO(IO);
705   if (myMesh->_is_nil())
706     return;
707
708   myActor = SMESH::FindActorByObject(myMesh);
709   if (!myActor)
710     myActor = SMESH::FindActorByEntry(IO->getEntry());
711   if (!myActor)
712     return;
713
714   int aNbUnits = 0;
715
716   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
717     myElementsId = "";
718
719     // MakeGroups is available if there are groups
720     if ( myMesh->NbGroups() == 0 ) {
721       MakeGroupsCheck->setChecked(false);
722       MakeGroupsCheck->setEnabled(false);
723     } else {
724       MakeGroupsCheck->setEnabled(true);
725     }
726
727     if (CheckBoxMesh->isChecked()) {
728       int aConstructorId = GetConstructorId();
729
730       SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
731
732       if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
733         // get IDs from mesh
734         SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
735         if (!aSMDSMesh)
736           return;
737
738         if (aConstructorId == 0) {
739           SMDS_EdgeIteratorPtr anIter = aSMDSMesh->edgesIterator();
740
741           while (anIter->more()) {
742             const SMDS_MeshEdge * edge = anIter->next();
743             if (edge) {
744               myElementsId += QString(" %1").arg(edge->GetID());
745               aNbUnits++;
746             }
747           }
748         } else if (aConstructorId == 1) {
749           SMDS_FaceIteratorPtr anIter = aSMDSMesh->facesIterator();
750           while (anIter->more()) {
751             const SMDS_MeshFace * face = anIter->next();
752             if (face) {
753               myElementsId += QString(" %1").arg(face->GetID());
754               aNbUnits++;
755             }
756           }
757         }
758       } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
759         // get submesh
760         SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
761
762         // get IDs from submesh
763         SMESH::long_array_var anElementsIds = new SMESH::long_array;
764         if (aConstructorId == 0)
765           anElementsIds = aSubMesh->GetElementsByType(SMESH::EDGE);
766         else if (aConstructorId == 1)
767           anElementsIds = aSubMesh->GetElementsByType(SMESH::FACE);
768
769         for (int i = 0; i < anElementsIds->length(); i++)
770           myElementsId += QString(" %1").arg(anElementsIds[i]);
771         aNbUnits = anElementsIds->length();
772       } else { // GROUP
773         // get smesh group
774         SMESH::SMESH_GroupBase_var aGroup =
775           SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
776         if (aGroup->_is_nil())
777           return;
778
779         if ((aConstructorId == 0 && aGroup->GetType()!= SMESH::EDGE) ||
780             (aConstructorId == 1 && aGroup->GetType()!= SMESH::FACE))
781           return;
782
783         // get IDs from smesh group
784         SMESH::long_array_var anElementsIds = new SMESH::long_array;
785         anElementsIds = aGroup->GetListOfID();
786         for (int i = 0; i < anElementsIds->length(); i++) {
787           myElementsId += QString(" %1").arg(anElementsIds[i]);
788         }
789         aNbUnits = anElementsIds->length();
790       }
791     } else {
792       aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
793       myElementsId = aString;
794     }
795
796     if (aNbUnits < 1)
797       return;
798
799     myNbOkElements = true;
800   } else {
801     aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
802     if (aNbUnits != 1)
803       return;
804
805     SMDS_Mesh* aMesh =  myActor->GetObject()->GetMesh();
806     if (!aMesh)
807       return;
808
809     const SMDS_MeshNode * n = aMesh->FindNode(aString.toInt());
810     if (!n)
811       return;
812
813     double x = n->X();
814     double y = n->Y();
815     double z = n->Z();
816
817     if (myEditCurrentArgument == (QWidget*)SpinBox_X) {
818       SpinBox_X->SetValue(x);
819       SpinBox_Y->SetValue(y);
820       SpinBox_Z->SetValue(z);
821     } else if (myEditCurrentArgument == (QWidget*)SpinBox_DX) {
822       SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
823       SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
824       SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
825     }
826   }
827
828   myBusy = true;
829   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
830     LineEditElements->setText(aString);
831     LineEditElements->repaint();
832   }
833   myBusy = false;
834
835   // OK
836   if (myNbOkElements && IsAxisOk()) {
837     buttonOk->setEnabled(true);
838     buttonApply->setEnabled(true);
839   }
840
841   onDisplaySimulation(true);
842 }
843
844 //=================================================================================
845 // function : SetEditCurrentArgument()
846 // purpose  :
847 //=================================================================================
848 void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
849 {
850   QPushButton* send = (QPushButton*)sender();
851
852   disconnect(mySelectionMgr, 0, this, 0);
853   mySelectionMgr->clearSelected();
854   mySelectionMgr->clearFilters();
855
856   if (send == SelectElementsButton) {
857     mySimulation->SetVisibility(false);
858     myEditCurrentArgument = (QWidget*)LineEditElements;
859     SMESH::SetPointRepresentation(false);
860     if (CheckBoxMesh->isChecked()) {
861       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
862         aViewWindow->SetSelectionMode(ActorSelection);
863       mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
864     } else {
865       int aConstructorId = GetConstructorId();
866       if (aConstructorId == 0)
867         {
868           if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
869             aViewWindow->SetSelectionMode(EdgeSelection);
870         }
871       else if (aConstructorId == 1)
872         {
873           if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
874             aViewWindow->SetSelectionMode(FaceSelection);
875         }
876     }
877     
878   } else if (send == SelectPointButton) {
879     myEditCurrentArgument = (QWidget*)SpinBox_X;
880     SMESH::SetPointRepresentation(true);
881     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
882       aViewWindow->SetSelectionMode(NodeSelection);
883   } else if (send == SelectVectorButton) {
884     myEditCurrentArgument = (QWidget*)SpinBox_DX;
885     SMESH::SetPointRepresentation(true);
886     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
887       aViewWindow->SetSelectionMode(NodeSelection);
888   } else {
889   }
890
891   myEditCurrentArgument->setFocus();
892   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
893   SelectionIntoArgument();
894 }
895
896 //=================================================================================
897 // function : DeactivateActiveDialog()
898 // purpose  :
899 //=================================================================================
900 void SMESHGUI_RevolutionDlg::DeactivateActiveDialog()
901 {
902   if (GroupConstructors->isEnabled()) {
903     GroupConstructors->setEnabled(false);
904     GroupArguments->setEnabled(false);
905     GroupButtons->setEnabled(false);
906     mySMESHGUI->ResetState();
907     mySMESHGUI->SetActiveDialogBox(0);
908   }
909 }
910
911 //=================================================================================
912 // function : ActivateThisDialog()
913 // purpose  :
914 //=================================================================================
915 void SMESHGUI_RevolutionDlg::ActivateThisDialog()
916 {
917   /* Emit a signal to deactivate the active dialog */
918   mySMESHGUI->EmitSignalDeactivateDialog();
919   GroupConstructors->setEnabled(true);
920   GroupArguments->setEnabled(true);
921   GroupButtons->setEnabled(true);
922
923   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
924
925   ConstructorsClicked(GetConstructorId());
926   SelectionIntoArgument();
927 }
928
929 //=================================================================================
930 // function : enterEvent()
931 // purpose  :
932 //=================================================================================
933 void SMESHGUI_RevolutionDlg::enterEvent (QEvent*)
934 {
935   if (!GroupConstructors->isEnabled())
936     ActivateThisDialog();
937 }
938
939 //=================================================================================
940 // function : closeEvent()
941 // purpose  :
942 //=================================================================================
943 void SMESHGUI_RevolutionDlg::closeEvent (QCloseEvent*)
944 {
945   /* same than click on cancel button */
946   this->ClickOnCancel();
947 }
948
949 //=======================================================================
950 // function : hideEvent()
951 // purpose  : caused by ESC key
952 //=======================================================================
953 void SMESHGUI_RevolutionDlg::hideEvent (QHideEvent*)
954 {
955   if (!isMinimized())
956     ClickOnCancel();
957 }
958
959 //=======================================================================
960 //function : onSelectMesh
961 //purpose  :
962 //=======================================================================
963 void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh)
964 {
965   if (toSelectMesh)
966     TextLabelElements->setText(tr("SMESH_NAME"));
967   else
968     TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
969
970   if (myEditCurrentArgument != LineEditElements) {
971     LineEditElements->clear();
972     mySimulation->SetVisibility(false);
973     return;
974   }
975
976   mySelectionMgr->clearFilters();
977   SMESH::SetPointRepresentation(false);
978
979   if (toSelectMesh) {
980     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
981       aViewWindow->SetSelectionMode(ActorSelection);
982     mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
983     LineEditElements->setReadOnly(true);
984   } else {
985     int aConstructorId = GetConstructorId();
986     if (aConstructorId == 0)
987       {
988         if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
989           aViewWindow->SetSelectionMode(EdgeSelection);
990       }
991     else if (aConstructorId == 0)
992       {
993         if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
994           aViewWindow->SetSelectionMode(FaceSelection);
995       }
996
997     LineEditElements->setReadOnly(false);
998     onTextChange(LineEditElements->text());
999     mySimulation->SetVisibility(false);
1000   }
1001
1002   SelectionIntoArgument();
1003 }
1004
1005 //=================================================================================
1006 // function : GetConstructorId()
1007 // purpose  :
1008 //=================================================================================
1009 int SMESHGUI_RevolutionDlg::GetConstructorId()
1010 {
1011   if (GroupConstructors != NULL && GroupConstructors->selected() != NULL)
1012     return GroupConstructors->id(GroupConstructors->selected());
1013   return -1;
1014 }
1015
1016 //=================================================================================
1017 // function : IsAxisOk()
1018 // purpose  :
1019 //=================================================================================
1020 bool SMESHGUI_RevolutionDlg::IsAxisOk()
1021 {
1022   return (SpinBox_DX->GetValue() != 0 ||
1023           SpinBox_DY->GetValue() != 0 ||
1024           SpinBox_DZ->GetValue() != 0);
1025 }
1026
1027 //=================================================================================
1028 // function : onVectorChanged()
1029 // purpose  :
1030 //=================================================================================
1031 void SMESHGUI_RevolutionDlg::onVectorChanged()
1032 {
1033   if (IsAxisOk()) {
1034     buttonOk->setEnabled(true);
1035     buttonApply->setEnabled(true);
1036   } else {
1037     buttonOk->setEnabled(false);
1038     buttonApply->setEnabled(false);
1039   }
1040   onDisplaySimulation(true);
1041 }
1042
1043 //=================================================================================
1044 // function : keyPressEvent()
1045 // purpose  :
1046 //=================================================================================
1047 void SMESHGUI_RevolutionDlg::keyPressEvent( QKeyEvent* e )
1048 {
1049   QDialog::keyPressEvent( e );
1050   if ( e->isAccepted() )
1051     return;
1052
1053   if ( e->key() == Key_F1 )
1054     {
1055       e->accept();
1056       ClickOnHelp();
1057     }
1058 }
1059
1060 //=================================================================================
1061 // function : toDisplaySimulation()
1062 // purpose  :
1063 //=================================================================================
1064 void SMESHGUI_RevolutionDlg::toDisplaySimulation()
1065 {
1066   onDisplaySimulation(true);
1067 }
1068
1069 //=================================================================================
1070 // function : onDisplaySimulation()
1071 // purpose  :
1072 //=================================================================================
1073 void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
1074 {
1075   if (CheckBoxPreview->isChecked() && toDisplayPreview)
1076     {
1077       //display preview
1078       if (myNbOkElements && IsAxisOk()) {
1079         QStringList aListElementsId = QStringList::split(" ", myElementsId, false);
1080
1081         SMESH::long_array_var anElementsId = new SMESH::long_array;
1082
1083         anElementsId->length(aListElementsId.count());
1084         for (int i = 0; i < aListElementsId.count(); i++)
1085           anElementsId[i] = aListElementsId[i].toInt();
1086
1087         SMESH::AxisStruct anAxis;
1088
1089         anAxis.x =  SpinBox_X->GetValue();
1090         anAxis.y =  SpinBox_Y->GetValue();
1091         anAxis.z =  SpinBox_Z->GetValue();
1092         anAxis.vx = SpinBox_DX->GetValue();
1093         anAxis.vy = SpinBox_DY->GetValue();
1094         anAxis.vz = SpinBox_DZ->GetValue();
1095
1096         double anAngle = (SpinBox_Angle->GetValue())*PI/180;
1097         long aNbSteps = (long)SpinBox_NbSteps->value();
1098         double aTolerance = SpinBox_Tolerance->GetValue();
1099
1100         if (GroupAngle->selectedId() == 1)
1101           anAngle = anAngle/aNbSteps;
1102
1103         try {
1104           SUIT_OverrideCursor aWaitCursor;
1105           SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
1106           aMeshEditor->RotationSweep(anElementsId.inout(), 
1107                                      anAxis, 
1108                                      anAngle, 
1109                                      aNbSteps, 
1110                                      aTolerance);
1111           SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
1112           mySimulation->SetData(aMeshPreviewStruct._retn());
1113         } catch (...) {}
1114       }
1115       else
1116         {
1117           mySimulation->SetVisibility(false);
1118         }
1119     }
1120   else
1121     {
1122       //erase preview
1123       mySimulation->SetVisibility(false);
1124     }
1125 }