Salome HOME
Remove obsolete staff; redesign Handle-based and CDL-generated classes
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_RotationDlg.cxx
1 // Copyright (C) 2007-2014  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, or (at your option) any later version.
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 //  File   : SMESHGUI_RotationDlg.cxx
23 //  Author : Michael ZORIN, Open CASCADE S.A.S.
24 //  SMESH includes
25
26 #include "SMESHGUI_RotationDlg.h"
27
28 #include "SMESHGUI.h"
29 #include "SMESHGUI_SpinBox.h"
30 #include "SMESHGUI_Utils.h"
31 #include "SMESHGUI_VTKUtils.h"
32 #include "SMESHGUI_MeshUtils.h"
33 #include "SMESHGUI_IdValidator.h"
34 #include "SMESHGUI_FilterDlg.h"
35 #include "SMESHGUI_MeshEditPreview.h"
36
37 #include <SMESH_Actor.h>
38 #include <SMESH_TypeFilter.hxx>
39 #include <SMESH_LogicalFilter.hxx>
40 #include <SMDS_Mesh.hxx>
41
42 // SALOME GUI includes
43 #include <SUIT_Desktop.h>
44 #include <SUIT_Session.h>
45 #include <SUIT_MessageBox.h>
46 #include <SUIT_ResourceMgr.h>
47 #include <SUIT_OverrideCursor.h>
48
49 #include <LightApp_Application.h>
50 #include <LightApp_SelectionMgr.h>
51
52 #include <SVTK_ViewModel.h>
53 #include <SVTK_ViewWindow.h>
54 #include <SALOME_ListIO.hxx>
55
56 // SALOME KERNEL includes
57 #include <SALOMEDSClient.hxx>
58 #include <SALOMEDSClient_SObject.hxx>
59
60 // OCCT includes
61 #include <TColStd_MapOfInteger.hxx>
62
63 // Qt includes
64 #include <QApplication>
65 #include <QButtonGroup>
66 #include <QGroupBox>
67 #include <QLabel>
68 #include <QLineEdit>
69 #include <QPushButton>
70 #include <QRadioButton>
71 #include <QCheckBox>
72 #include <QHBoxLayout>
73 #include <QVBoxLayout>
74 #include <QGridLayout>
75 #include <QKeyEvent>
76
77 // IDL includes
78 #include <SALOMEconfig.h>
79 #include CORBA_SERVER_HEADER(SMESH_Group)
80 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
81
82 enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action type
83
84 #define SPACING 8
85 #define MARGIN  11
86
87
88 //=================================================================================
89 // class    : SMESHGUI_RotationDlg()
90 // purpose  :
91 //=================================================================================
92 SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule ) :
93     SMESHGUI_MultiPreviewDlg( theModule ),
94     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
95     myFilterDlg(0)
96 {
97   QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MESH_ROTATION")));
98   QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
99
100   setModal(false);
101   setAttribute(Qt::WA_DeleteOnClose, true);
102   setWindowTitle(tr("SMESH_ROTATION_TITLE"));
103   setSizeGripEnabled(true);
104
105   QVBoxLayout* SMESHGUI_RotationDlgLayout = new QVBoxLayout(this);
106   SMESHGUI_RotationDlgLayout->setSpacing(SPACING);
107   SMESHGUI_RotationDlgLayout->setMargin(MARGIN);
108
109   /***************************************************************/
110   GroupConstructors = new QGroupBox(tr("SMESH_ROTATION"), this);
111   QButtonGroup* ButtonGroup = new QButtonGroup(this);
112   QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors);
113   GroupConstructorsLayout->setSpacing(SPACING);
114   GroupConstructorsLayout->setMargin(MARGIN);
115
116   RadioButton1= new QRadioButton(GroupConstructors);
117   RadioButton1->setIcon(image0);
118
119   GroupConstructorsLayout->addWidget(RadioButton1);
120   ButtonGroup->addButton(RadioButton1, 0);
121
122   /***************************************************************/
123   GroupArguments = new QGroupBox(tr("SMESH_ARGUMENTS"), this);
124   QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
125   GroupArgumentsLayout->setSpacing(SPACING);
126   GroupArgumentsLayout->setMargin(MARGIN);
127
128   myIdValidator = new SMESHGUI_IdValidator(this);
129
130   // Controls for elements selection
131   TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
132   SelectElementsButton  = new QPushButton(GroupArguments);
133   SelectElementsButton->setIcon(image1);
134   LineEditElements = new QLineEdit(GroupArguments);
135   LineEditElements->setValidator(myIdValidator);
136   LineEditElements->setMaxLength(-1);
137   myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
138   connect(myFilterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
139
140   // Control for the whole mesh selection
141   CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
142
143   // Controls for axis defining
144   GroupAxis = new QGroupBox(tr("SMESH_AXIS"), GroupArguments);
145   QGridLayout* GroupAxisLayout = new QGridLayout(GroupAxis);
146   GroupAxisLayout->setSpacing(SPACING);
147   GroupAxisLayout->setMargin(MARGIN);
148
149   TextLabelPoint = new QLabel(tr("SMESH_POINT"), GroupAxis);
150   SelectPointButton  = new QPushButton(GroupAxis);
151   SelectPointButton->setIcon(image1);
152
153   TextLabelX = new QLabel(tr("SMESH_X"), GroupAxis);
154   SpinBox_X = new SMESHGUI_SpinBox(GroupAxis);
155   TextLabelY = new QLabel(tr("SMESH_Y"), GroupAxis);
156   SpinBox_Y = new SMESHGUI_SpinBox(GroupAxis);
157   TextLabelZ = new QLabel(tr("SMESH_Z"), GroupAxis);
158   SpinBox_Z = new SMESHGUI_SpinBox(GroupAxis);
159
160   TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupAxis);
161   SelectVectorButton = new QPushButton(GroupAxis);
162   SelectVectorButton->setIcon(image1);
163
164   TextLabelDX = new QLabel(tr("SMESH_DX"), GroupAxis);
165   SpinBox_DX = new SMESHGUI_SpinBox(GroupAxis);
166   TextLabelDY = new QLabel(tr("SMESH_DY"), GroupAxis);
167   SpinBox_DY = new SMESHGUI_SpinBox(GroupAxis);
168   TextLabelDZ = new QLabel(tr("SMESH_DZ"), GroupAxis);
169   SpinBox_DZ = new SMESHGUI_SpinBox(GroupAxis);
170
171   GroupAxisLayout->addWidget(TextLabelPoint,     0, 0);
172   GroupAxisLayout->addWidget(SelectPointButton,  0, 1);
173   GroupAxisLayout->addWidget(TextLabelX,         0, 2);
174   GroupAxisLayout->addWidget(SpinBox_X,          0, 3);
175   GroupAxisLayout->addWidget(TextLabelY,         0, 4);
176   GroupAxisLayout->addWidget(SpinBox_Y,          0, 5);
177   GroupAxisLayout->addWidget(TextLabelZ,         0, 6);
178   GroupAxisLayout->addWidget(SpinBox_Z,          0, 7);
179   GroupAxisLayout->addWidget(TextLabelVector,    1, 0);
180   GroupAxisLayout->addWidget(SelectVectorButton, 1, 1);
181   GroupAxisLayout->addWidget(TextLabelDX,        1, 2);
182   GroupAxisLayout->addWidget(SpinBox_DX,         1, 3);
183   GroupAxisLayout->addWidget(TextLabelDY,        1, 4);
184   GroupAxisLayout->addWidget(SpinBox_DY,         1, 5);
185   GroupAxisLayout->addWidget(TextLabelDZ,        1, 6);
186   GroupAxisLayout->addWidget(SpinBox_DZ,         1, 7);
187
188   // Controls for angle defining
189   TextLabelAngle = new QLabel(tr("SMESH_ANGLE"), GroupArguments);
190   SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments);
191
192   // action switch
193   ActionBox = new QGroupBox(GroupArguments);
194   ActionGroup = new QButtonGroup(GroupArguments);
195   QVBoxLayout* ActionBoxLayout = new QVBoxLayout(ActionBox);
196   ActionBoxLayout->setSpacing(SPACING);
197   ActionBoxLayout->setMargin(MARGIN);
198
199   QRadioButton* aMoveElements = new QRadioButton(tr("SMESH_MOVE_ELEMENTS"), ActionBox);
200   QRadioButton* aCopyElements = new QRadioButton(tr("SMESH_COPY_ELEMENTS"), ActionBox);
201   QRadioButton* aCreateMesh   = new QRadioButton(tr("SMESH_CREATE_MESH"),   ActionBox);
202
203   ActionBoxLayout->addWidget(aMoveElements);
204   ActionBoxLayout->addWidget(aCopyElements);
205   ActionBoxLayout->addWidget(aCreateMesh);
206   ActionGroup->addButton(aMoveElements, MOVE_ELEMS_BUTTON);
207   ActionGroup->addButton(aCopyElements, COPY_ELEMS_BUTTON);
208   ActionGroup->addButton(aCreateMesh,   MAKE_MESH_BUTTON);
209
210   // CheckBox for groups generation
211   MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
212
213   // Name of a mesh to create
214   LineEditNewMesh = new QLineEdit(GroupArguments);
215
216
217   //Preview check box
218   myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
219
220   GroupArgumentsLayout->addWidget(TextLabelElements,    0, 0);
221   GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
222   GroupArgumentsLayout->addWidget(LineEditElements,     0, 2, 1, 1);
223   GroupArgumentsLayout->addWidget(myFilterBtn,          0, 3);
224   GroupArgumentsLayout->addWidget(CheckBoxMesh,         1, 0, 1, 4);
225   GroupArgumentsLayout->addWidget(GroupAxis,            2, 0, 1, 4);
226   GroupArgumentsLayout->addWidget(TextLabelAngle,       3, 0, 1, 2);
227   GroupArgumentsLayout->addWidget(SpinBox_Angle,        3, 2);
228   GroupArgumentsLayout->addWidget(ActionBox,            4, 0, 3, 3);
229   GroupArgumentsLayout->addWidget(MakeGroupsCheck,      5, 3);
230   GroupArgumentsLayout->addWidget(LineEditNewMesh,      6, 3);
231   GroupArgumentsLayout->addWidget(myPreviewCheckBox,    7, 0);
232
233
234   /***************************************************************/
235   GroupButtons = new QGroupBox(this);
236   QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
237   GroupButtonsLayout->setSpacing(SPACING);
238   GroupButtonsLayout->setMargin(MARGIN);
239
240   buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
241   buttonOk->setAutoDefault(true);
242   buttonOk->setDefault(true);
243   buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
244   buttonApply->setAutoDefault(true);
245   buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
246   buttonCancel->setAutoDefault(true);
247   buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
248   buttonHelp->setAutoDefault(true);
249
250   GroupButtonsLayout->addWidget(buttonOk);
251   GroupButtonsLayout->addSpacing(10);
252   GroupButtonsLayout->addWidget(buttonApply);
253   GroupButtonsLayout->addSpacing(10);
254   GroupButtonsLayout->addStretch();
255   GroupButtonsLayout->addWidget(buttonCancel);
256   GroupButtonsLayout->addWidget(buttonHelp);
257
258   /***************************************************************/
259   SMESHGUI_RotationDlgLayout->addWidget(GroupConstructors);
260   SMESHGUI_RotationDlgLayout->addWidget(GroupArguments);
261   SMESHGUI_RotationDlgLayout->addWidget(GroupButtons);
262
263   /* Initialisations */
264   SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
265   SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
266   SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
267   SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
268   SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
269   SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
270
271   SpinBox_Angle->RangeStepAndValidator(-360.0, +360.0, 5.0, "angle_precision");
272
273   myConstructorId = 0;
274   RadioButton1->setChecked(true);
275
276   mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
277
278   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
279
280   // Costruction of the logical filter
281   SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (SMESH::MESHorSUBMESH);
282   SMESH_TypeFilter* aSmeshGroupFilter    = new SMESH_TypeFilter (SMESH::GROUP);
283
284   QList<SUIT_SelectionFilter*> aListOfFilters;
285   if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
286   if (aSmeshGroupFilter)    aListOfFilters.append(aSmeshGroupFilter);
287
288   myMeshOrSubMeshOrGroupFilter =
289     new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
290
291   myHelpFileName = "rotation_page.html";
292
293   Init();
294
295   /* signals and slots connections */
296   connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
297   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
298   connect(buttonApply, SIGNAL(clicked()),  this, SLOT(ClickOnApply()));
299   connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
300
301   connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
302   connect(SelectPointButton, SIGNAL (clicked()),    this, SLOT(SetEditCurrentArgument()));
303   connect(SelectVectorButton, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
304
305   connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
306   connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
307   connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
308
309   connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
310   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),   this, SLOT(SelectionIntoArgument()));
311   /* to close dialog if study change */
312   connect(mySMESHGUI,       SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject()));
313   connect(LineEditElements, SIGNAL(textChanged(const QString&)),    SLOT(onTextChange(const QString&)));
314   connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                  SLOT(onSelectMesh(bool)));
315   connect(ActionGroup,      SIGNAL(buttonClicked(int)),             SLOT(onActionClicked(int)));
316
317   connect(SpinBox_X,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
318   connect(SpinBox_Y,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
319   connect(SpinBox_Z,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
320   connect(SpinBox_DX,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
321   connect(SpinBox_DY,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
322   connect(SpinBox_DZ,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
323   connect(SpinBox_Angle,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
324
325   //To Connect preview check box
326   connectPreviewControl();
327
328   onActionClicked(MOVE_ELEMS_BUTTON);
329 }
330
331 //=================================================================================
332 // function : ~SMESHGUI_RotationDlg()
333 // purpose  : Destroys the object and frees any allocated resources
334 //=================================================================================
335 SMESHGUI_RotationDlg::~SMESHGUI_RotationDlg()
336 {
337   if ( myFilterDlg ) {
338     myFilterDlg->setParent( 0 );
339     delete myFilterDlg;
340     myFilterDlg = 0;
341   }
342 }
343
344 //=================================================================================
345 // function : Init()
346 // purpose  :
347 //=================================================================================
348 void SMESHGUI_RotationDlg::Init (bool ResetControls)
349 {
350   myBusy = false;
351   myMeshes.clear();
352   myObjects.clear();
353   myObjectsNames.clear();
354
355   myEditCurrentArgument = (QWidget*)LineEditElements;
356   LineEditElements->setFocus();
357   myElementsId = "";
358   myNbOkElements = 0;
359
360   buttonOk->setEnabled(false);
361   buttonApply->setEnabled(false);
362
363   myActor = 0;
364
365   if (ResetControls) {
366     SpinBox_X->SetValue(0.0);
367     SpinBox_Y->SetValue(0.0);
368     SpinBox_Z->SetValue(0.0);
369     SpinBox_DX->SetValue(0.0);
370     SpinBox_DY->SetValue(0.0);
371     SpinBox_DZ->SetValue(0.0);
372
373     SpinBox_Angle->SetValue(45);
374
375     ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
376     CheckBoxMesh->setChecked(false);
377     myPreviewCheckBox->setChecked(false);
378     onDisplaySimulation(false);
379
380 //     MakeGroupsCheck->setChecked(false);
381 //     MakeGroupsCheck->setEnabled(false);
382 //    onSelectMesh(false);
383   }
384
385   onSelectMesh(CheckBoxMesh->isChecked());
386 }
387
388 //=================================================================================
389 // function : ClickOnApply()
390 // purpose  :
391 //=================================================================================
392 bool SMESHGUI_RotationDlg::ClickOnApply()
393 {
394   if (mySMESHGUI->isActiveStudyLocked())
395     return false;
396
397   if( !isValid() )
398     return false;
399
400   if (myNbOkElements && IsAxisOk()) {
401     QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
402
403     SMESH::long_array_var anElementsId = new SMESH::long_array;
404
405     anElementsId->length(aListElementsId.count());
406     for (int i = 0; i < aListElementsId.count(); i++)
407       anElementsId[i] = aListElementsId[i].toInt();
408
409     SMESH::AxisStruct anAxis;
410
411     anAxis.x =  SpinBox_X->GetValue();
412     anAxis.y =  SpinBox_Y->GetValue();
413     anAxis.z =  SpinBox_Z->GetValue();;
414     anAxis.vx = SpinBox_DX->GetValue();
415     anAxis.vy = SpinBox_DY->GetValue();
416     anAxis.vz = SpinBox_DZ->GetValue();
417
418     double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.;
419
420     QStringList aParameters;
421     aParameters << SpinBox_X->text();
422     aParameters << SpinBox_Y->text();
423     aParameters << SpinBox_Z->text();
424     aParameters << SpinBox_DX->text();
425     aParameters << SpinBox_DY->text();
426     aParameters << SpinBox_DZ->text();
427     aParameters << SpinBox_Angle->text();
428
429     int actionButton = ActionGroup->checkedId();
430     bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
431     QStringList anEntryList;
432     try {
433       SUIT_OverrideCursor aWaitCursor;
434
435       switch ( actionButton ) {
436       case MOVE_ELEMS_BUTTON:
437         if(CheckBoxMesh->isChecked()) {
438           for ( int i = 0; i < myObjects.count(); i++ ) {
439             SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
440             myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
441             aMeshEditor->RotateObject(myObjects[i], anAxis, anAngle, false);
442           }
443         }
444         else {
445           SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
446           myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
447           aMeshEditor->Rotate(anElementsId, anAxis, anAngle, false);
448         }
449         break;
450       case COPY_ELEMS_BUTTON:
451         if ( makeGroups ) {
452           SMESH::ListOfGroups_var groups;
453           if(CheckBoxMesh->isChecked()) {
454             for ( int i = 0; i < myObjects.count(); i++ ) {
455               SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
456               myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
457               groups = aMeshEditor->RotateObjectMakeGroups(myObjects[i], anAxis, anAngle);
458             }
459           }
460           else {
461             SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
462             myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
463             groups = aMeshEditor->RotateMakeGroups(anElementsId, anAxis, anAngle);
464           }
465         }
466         else {
467           if(CheckBoxMesh->isChecked()) {
468             for ( int i = 0; i < myObjects.count(); i++ ) {
469               SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
470               myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
471               aMeshEditor->RotateObject(myObjects[i], anAxis, anAngle, true);
472             }
473           }
474           else {
475             SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
476             myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
477             aMeshEditor->Rotate(anElementsId, anAxis, anAngle, true);
478           }
479         }
480         break;
481       case MAKE_MESH_BUTTON: {
482         SMESH::SMESH_Mesh_var mesh;
483         if (CheckBoxMesh->isChecked()) {
484           for ( int i = 0; i < myObjects.count(); i++ ) {
485             QString aName = SMESH::UniqueMeshName( LineEditNewMesh->text().replace( "*", myObjectsNames[i] ) );
486             SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
487             myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
488             mesh = aMeshEditor->RotateObjectMakeMesh(myObjects[i], anAxis, anAngle, makeGroups,
489                                                      aName.toLatin1().data());
490             if (!mesh->_is_nil()) {
491               if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
492                 anEntryList.append( aSObject->GetID().c_str() );
493             }
494           }
495         }
496         else {
497           SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
498           myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
499           mesh = aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups,
500                                              LineEditNewMesh->text().toLatin1().data());
501           if (!mesh->_is_nil()) {
502             if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
503               anEntryList.append( aSObject->GetID().c_str() );
504           }
505         }
506         break;
507       }
508       }
509     } catch (...) {
510     }
511
512     for ( int i = 0; i < myObjects.count(); i++ ) {
513       SMESH_Actor* actor = SMESH::FindActorByObject( myObjects[i] );
514       if ( actor ) SMESH::Update( actor->getIO(), true );
515     }
516    
517     if ( ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) ||
518          actionButton == MAKE_MESH_BUTTON ) {
519       mySMESHGUI->updateObjBrowser(true); // new groups may appear
520       if( LightApp_Application* anApp =
521           dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
522         anApp->browseObjects( anEntryList, isApplyAndClose() );
523     }
524     Init(false);
525     SelectionIntoArgument();
526
527     SMESHGUI::Modified();
528   }
529
530   return true;
531 }
532
533 //=================================================================================
534 // function : ClickOnOk()
535 // purpose  :
536 //=================================================================================
537 void SMESHGUI_RotationDlg::ClickOnOk()
538 {
539   setIsApplyAndClose( true );
540   if( ClickOnApply() )
541     reject();
542 }
543
544 //=================================================================================
545 // function : reject()
546 // purpose  :
547 //=================================================================================
548 void SMESHGUI_RotationDlg::reject()
549 {
550   disconnect(mySelectionMgr, 0, this, 0);
551   mySelectionMgr->clearFilters();
552   //mySelectionMgr->clearSelected();
553   if (SMESH::GetCurrentVtkView()) {
554     SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
555     SMESH::SetPointRepresentation(false);
556   }
557   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
558     aViewWindow->SetSelectionMode(ActorSelection);
559   mySMESHGUI->ResetState();
560   QDialog::reject();
561 }
562
563 //=================================================================================
564 // function : ClickOnHelp()
565 // purpose  :
566 //=================================================================================
567 void SMESHGUI_RotationDlg::ClickOnHelp()
568 {
569   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
570   if (app)
571     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
572   else {
573     QString platform;
574 #ifdef WIN32
575     platform = "winapplication";
576 #else
577     platform = "application";
578 #endif
579     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
580                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
581                              arg(app->resourceMgr()->stringValue("ExternalBrowser",
582                                                                  platform)).
583                              arg(myHelpFileName));
584   }
585 }
586
587 //=======================================================================
588 // function : onTextChange()
589 // purpose  :
590 //=======================================================================
591 void SMESHGUI_RotationDlg::onTextChange (const QString& theNewText)
592 {
593   QLineEdit* send = (QLineEdit*)sender();
594
595   if (myBusy) return;
596   myBusy = true;
597
598   if (send == LineEditElements)
599     myNbOkElements = 0;
600
601   buttonOk->setEnabled(false);
602   buttonApply->setEnabled(false);
603
604   // hilight entered elements
605   SMDS_Mesh* aMesh = 0;
606   if (myActor)
607     aMesh = myActor->GetObject()->GetMesh();
608
609   if (aMesh) {
610     if (send == LineEditElements) {
611       Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
612
613       TColStd_MapOfInteger newIndices;
614
615       QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
616       for (int i = 0; i < aListId.count(); i++) {
617         const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
618         if (e)
619           newIndices.Add(e->GetID());
620         myNbOkElements++;
621       }
622
623       mySelector->AddOrRemoveIndex( anIO, newIndices, false );
624       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
625         aViewWindow->highlight( anIO, true, true );
626
627       myElementsId = theNewText;
628     }
629   }
630
631   if (myNbOkElements && IsAxisOk()) {
632     buttonOk->setEnabled(true);
633     buttonApply->setEnabled(true);
634   }
635
636   myBusy = false;
637 }
638
639 //=================================================================================
640 // function : SelectionIntoArgument()
641 // purpose  : Called when selection as changed or other case
642 //=================================================================================
643 void SMESHGUI_RotationDlg::SelectionIntoArgument()
644 {
645   if (myBusy) return;
646
647   // clear
648   myActor = 0;
649   QString aString = "";
650   onDisplaySimulation(false);
651
652   myBusy = true;
653   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
654     LineEditElements->setText(aString);
655     myNbOkElements = 0;
656     buttonOk->setEnabled(false);
657     buttonApply->setEnabled(false);
658   }
659   myBusy = false;
660
661   if (!GroupButtons->isEnabled()) // inactive
662     return;
663
664   // get selected mesh
665   SALOME_ListIO aList;
666   mySelectionMgr->selectedObjects(aList);
667
668   int nbSel = aList.Extent();
669   if (nbSel < 1)
670     return;
671
672   int aNbUnits = 0;
673
674   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
675     myElementsId = "";
676     myObjects.clear();
677     myObjectsNames.clear();
678     myMeshes.clear();
679
680     for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
681       Handle(SALOME_InteractiveObject) IO = it.Value();
682       SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( IO );
683       if ( aMesh->_is_nil() )
684         return;
685       
686       myActor = SMESH::FindActorByObject( aMesh );
687       if ( !myActor )
688         myActor = SMESH::FindActorByEntry( IO->getEntry() );
689       if ( !myActor && !CheckBoxMesh->isChecked() )
690         return;
691       
692       if ( !SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO )->_is_nil() ) {
693         if ( _PTR(Study) aStudy = SMESH::GetActiveStudyDocument() ) {
694           _PTR(SObject) obj = aStudy->FindObjectID( qPrintable( QString( IO->getEntry() ) ) );
695           _PTR(GenericAttribute) anAttr;
696           if ( obj && obj->FindAttribute( anAttr, "AttributeName" ) ) {
697             _PTR(AttributeName) aNameAttr( anAttr );
698             myObjects << SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
699             myObjectsNames << aNameAttr->Value().c_str();
700             myMeshes << aMesh;
701           }
702         }
703       }
704     }
705
706     // MakeGroups is available if there are groups and "Copy"
707     int aNbGroups = 0;
708     for ( int i = 0; i < myMeshes.count(); i++ )
709       aNbGroups += myMeshes[i]->NbGroups();
710     if ( aNbGroups == 0 ) {
711       MakeGroupsCheck->setChecked(false);
712       MakeGroupsCheck->setEnabled(false);
713     }
714     else if ( ActionGroup->checkedId() != MOVE_ELEMS_BUTTON ) {
715       MakeGroupsCheck->setEnabled(true);
716     }
717     if (CheckBoxMesh->isChecked()) {
718       SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
719
720       if ( myMeshes.isEmpty() )
721         return;
722       // get IDs from mesh
723         /*
724           SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
725           if (!aSMDSMesh)
726           return;
727
728           for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++) {
729           const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
730           if (e) {
731             myElementsId += QString(" %1").arg(i);
732             aNbUnits++;
733           }
734         }
735       } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
736       // get submesh
737         SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
738
739         // get IDs from submesh
740         SMESH::long_array_var anElementsIds = new SMESH::long_array;
741         anElementsIds = aSubMesh->GetElementsId();
742         for (int i = 0; i < anElementsIds->length(); i++) {
743         myElementsId += QString(" %1").arg(anElementsIds[i]);
744           }
745         aNbUnits = anElementsIds->length();
746       } else { // GROUP
747         // get smesh group
748         SMESH::SMESH_GroupBase_var aGroup =
749         SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
750         if (aGroup->_is_nil())
751         return;
752
753           // get IDs from smesh group
754         SMESH::long_array_var anElementsIds = new SMESH::long_array;
755         anElementsIds = aGroup->GetListOfID();
756         for (int i = 0; i < anElementsIds->length(); i++) {
757         myElementsId += QString(" %1").arg(anElementsIds[i]);
758           }
759         aNbUnits = anElementsIds->length();
760         }
761         */
762       } else {
763       aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, aList.First(), aString);
764       myElementsId = aString;
765       if (aNbUnits < 1)
766         return;
767       }
768
769     myNbOkElements = true;
770
771   } else {
772     Handle(SALOME_InteractiveObject) IO = aList.First();
773     if ((SMESH::GetMeshByIO(IO))->_is_nil())
774       return;
775       
776     SMESH_Actor* anActor = SMESH::FindActorByObject(SMESH::GetMeshByIO(IO));
777     if (!anActor)
778       anActor = SMESH::FindActorByEntry(IO->getEntry());
779     if (!anActor && !CheckBoxMesh->isChecked())
780       return;
781       
782     aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
783     if (aNbUnits != 1)
784       return;
785
786     SMDS_Mesh* aMesh =  anActor->GetObject()->GetMesh();
787     if (!aMesh)
788       return;
789
790     const SMDS_MeshNode * n = aMesh->FindNode(aString.toInt());
791     if (!n)
792       return;
793
794     double x = n->X();
795     double y = n->Y();
796     double z = n->Z();
797
798     if (myEditCurrentArgument == (QWidget*)SpinBox_X) {
799       SpinBox_X->SetValue(x);
800       SpinBox_Y->SetValue(y);
801       SpinBox_Z->SetValue(z);
802     } else if (myEditCurrentArgument == (QWidget*)SpinBox_DX) {
803       SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
804       SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
805       SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
806     }
807   }
808
809   myBusy = true;
810   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
811     LineEditElements->setText(aString);
812     LineEditElements->repaint();
813     LineEditElements->setEnabled(false); // to update lineedit IPAL 19809
814     LineEditElements->setEnabled(true);
815     setNewMeshName();
816   }
817   myBusy = false;
818
819   // OK
820   if (myNbOkElements && IsAxisOk()) {
821     buttonOk->setEnabled(true);
822     buttonApply->setEnabled(true);
823   }
824   onDisplaySimulation(true);
825 }
826
827 //=================================================================================
828 // function : SetEditCurrentArgument()
829 // purpose  :
830 //=================================================================================
831 void SMESHGUI_RotationDlg::SetEditCurrentArgument()
832 {
833   QPushButton* send = (QPushButton*)sender();
834
835   disconnect(mySelectionMgr, 0, this, 0);
836   mySelectionMgr->clearSelected();
837   mySelectionMgr->clearFilters();
838
839   switch (myConstructorId) {
840   case 0: /* default constructor */
841     {
842       SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
843       if (send == SelectElementsButton) {
844         myEditCurrentArgument = (QWidget*)LineEditElements;
845         SMESH::SetPointRepresentation(false);
846         if (CheckBoxMesh->isChecked()) {
847           if ( aViewWindow )
848             aViewWindow->SetSelectionMode(ActorSelection);
849           mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
850         } else {
851           if ( aViewWindow )
852             aViewWindow->SetSelectionMode( CellSelection );
853         }
854       } else if (send == SelectPointButton) {
855         myEditCurrentArgument = (QWidget*)SpinBox_X;
856         SMESH::SetPointRepresentation(true);
857         if ( aViewWindow )
858           aViewWindow->SetSelectionMode( NodeSelection );
859       } else if (send == SelectVectorButton) {
860         myEditCurrentArgument = (QWidget*)SpinBox_DX;
861         SMESH::SetPointRepresentation(true);
862         if ( aViewWindow )
863           aViewWindow->SetSelectionMode( NodeSelection );
864       }
865       break;
866     }
867
868   }
869
870   myEditCurrentArgument->setFocus();
871   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
872   SelectionIntoArgument();
873 }
874
875 //=================================================================================
876 // function : DeactivateActiveDialog()
877 // purpose  :
878 //=================================================================================
879 void SMESHGUI_RotationDlg::DeactivateActiveDialog()
880 {
881   if (GroupConstructors->isEnabled()) {
882     GroupConstructors->setEnabled(false);
883     GroupArguments->setEnabled(false);
884     GroupButtons->setEnabled(false);
885     mySMESHGUI->ResetState();
886     mySMESHGUI->SetActiveDialogBox(0);
887   }
888 }
889
890 //=================================================================================
891 // function : ActivateThisDialog()
892 // purpose  :
893 //=================================================================================
894 void SMESHGUI_RotationDlg::ActivateThisDialog()
895 {
896   /* Emit a signal to deactivate the active dialog */
897   mySMESHGUI->EmitSignalDeactivateDialog();
898   GroupConstructors->setEnabled(true);
899   GroupArguments->setEnabled(true);
900   GroupButtons->setEnabled(true);
901
902   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
903
904   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
905     aViewWindow->SetSelectionMode( CellSelection );
906   SelectionIntoArgument();
907 }
908
909 //=================================================================================
910 // function : enterEvent()
911 // purpose  :
912 //=================================================================================
913 void SMESHGUI_RotationDlg::enterEvent (QEvent*)
914 {
915   if (!GroupConstructors->isEnabled())
916     ActivateThisDialog();
917 }
918
919 //=================================================================================
920 // function : onSelectMesh()
921 // purpose  :
922 //=================================================================================
923 void SMESHGUI_RotationDlg::onSelectMesh (bool toSelectMesh)
924 {
925   if (toSelectMesh)
926     TextLabelElements->setText(tr("SMESH_NAME"));
927   else
928     TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
929   myFilterBtn->setEnabled(!toSelectMesh);
930
931   if (myEditCurrentArgument != LineEditElements) {
932     LineEditElements->clear();
933     return;
934   }
935
936   mySelectionMgr->clearFilters();
937   SMESH::SetPointRepresentation(false);
938
939   if (toSelectMesh) {
940     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
941       aViewWindow->SetSelectionMode(ActorSelection);
942     mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
943     LineEditElements->setReadOnly(true);
944     LineEditElements->setValidator(0);
945   } else {
946     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
947       aViewWindow->SetSelectionMode( CellSelection );
948     LineEditElements->setReadOnly(false);
949     LineEditElements->setValidator(myIdValidator);
950     onTextChange(LineEditElements->text());
951     hidePreview();
952   }
953
954   SelectionIntoArgument();
955 }
956
957 //=================================================================================
958 // function : IsAxisOk()
959 // purpose  :
960 //=================================================================================
961 bool SMESHGUI_RotationDlg::IsAxisOk()
962 {
963   return (SpinBox_DX->GetValue() != 0 ||
964           SpinBox_DY->GetValue() != 0 ||
965           SpinBox_DZ->GetValue() != 0);
966 }
967
968 //=================================================================================
969 // function : onVectorChanged()
970 // purpose  :
971 //=================================================================================
972 void SMESHGUI_RotationDlg::onVectorChanged()
973 {
974   if (IsAxisOk()) {
975     buttonOk->setEnabled(true);
976     buttonApply->setEnabled(true);
977   } else {
978     buttonOk->setEnabled(false);
979     buttonApply->setEnabled(false);
980   }
981 }
982
983
984 //=======================================================================
985 //function : onActionClicked
986 //purpose  : slot called when an action type changed
987 //=======================================================================
988
989 void SMESHGUI_RotationDlg::onActionClicked(int button)
990 {
991   int aNbGroups = 0;
992   for ( int i = 0; i < myMeshes.count(); i++ )
993     aNbGroups += myMeshes[i]->NbGroups();
994
995   switch ( button ) {
996   case MOVE_ELEMS_BUTTON:
997     MakeGroupsCheck->setEnabled(false);
998     LineEditNewMesh->setEnabled(false);
999     break;
1000   case COPY_ELEMS_BUTTON:
1001     LineEditNewMesh->setEnabled(false);
1002     MakeGroupsCheck->setText( tr("SMESH_MAKE_GROUPS"));
1003     MakeGroupsCheck->setEnabled( myMeshes.isEmpty() || aNbGroups > 0 );
1004     break;
1005   case MAKE_MESH_BUTTON:
1006     LineEditNewMesh->setEnabled(true);
1007     MakeGroupsCheck->setText( tr("SMESH_COPY_GROUPS"));
1008     MakeGroupsCheck->setEnabled( myMeshes.isEmpty() || aNbGroups > 0 );
1009     break;
1010   }
1011   setNewMeshName();
1012   toDisplaySimulation();
1013 }
1014
1015 //=======================================================================
1016 //function : setNewMeshName
1017 //purpose  : update contents of LineEditNewMesh
1018 //=======================================================================
1019
1020 void SMESHGUI_RotationDlg::setNewMeshName()
1021 {
1022   LineEditNewMesh->setText("");
1023   if ( LineEditNewMesh->isEnabled() && !myMeshes.isEmpty() ) {
1024     QString name;
1025     if ( CheckBoxMesh->isChecked() ) {
1026       name = myMeshes.count() > 1 ? "*" : LineEditElements->text();
1027     }
1028     else {
1029       _PTR(SObject) meshSO = SMESH::FindSObject( myMeshes[0] );
1030       name = meshSO->GetName().c_str();
1031     }
1032     if ( !name.isEmpty() )
1033       LineEditNewMesh->setText( SMESH::UniqueMeshName( name, "rotated"));
1034   }
1035 }
1036
1037 //=================================================================================
1038 // function : keyPressEvent()
1039 // purpose  :
1040 //=================================================================================
1041 void SMESHGUI_RotationDlg::keyPressEvent( QKeyEvent* e )
1042 {
1043   QDialog::keyPressEvent( e );
1044   if ( e->isAccepted() )
1045     return;
1046
1047   if ( e->key() == Qt::Key_F1 ) {
1048     e->accept();
1049     ClickOnHelp();
1050   }
1051 }
1052
1053 //=================================================================================
1054 // function : setFilters()
1055 // purpose  : SLOT. Called when "Filter" button pressed.
1056 //=================================================================================
1057 void SMESHGUI_RotationDlg::setFilters()
1058 {
1059   if ( myMeshes.isEmpty() ) {
1060     SUIT_MessageBox::critical(this,
1061                               tr("SMESH_ERROR"),
1062                               tr("NO_MESH_SELECTED"));
1063    return;
1064   }
1065   if ( !myFilterDlg )
1066     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
1067
1068   myFilterDlg->SetSelection();
1069   myFilterDlg->SetMesh( myMeshes[0] );
1070   myFilterDlg->SetSourceWg( LineEditElements );
1071
1072   myFilterDlg->show();
1073 }
1074
1075 //=================================================================================
1076 // function : isValid
1077 // purpose  :
1078 //=================================================================================
1079 bool SMESHGUI_RotationDlg::isValid()
1080 {
1081   bool ok = true;
1082   QString msg;
1083
1084   ok = SpinBox_X->isValid( msg, true ) && ok;
1085   ok = SpinBox_Y->isValid( msg, true ) && ok;
1086   ok = SpinBox_Z->isValid( msg, true ) && ok;
1087   ok = SpinBox_DX->isValid( msg, true ) && ok;
1088   ok = SpinBox_DY->isValid( msg, true ) && ok;
1089   ok = SpinBox_DZ->isValid( msg, true ) && ok;
1090   ok = SpinBox_Angle->isValid( msg, true ) && ok;
1091
1092   if( !ok ) {
1093     QString str( tr( "SMESH_INCORRECT_INPUT" ) );
1094     if ( !msg.isEmpty() )
1095       str += "\n" + msg;
1096     SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
1097     return false;
1098   }
1099   return true;
1100 }
1101
1102
1103 //=================================================================================
1104 // function : onDisplaySimulation
1105 // purpose  : Show/Hide preview
1106 //=================================================================================
1107 void SMESHGUI_RotationDlg::onDisplaySimulation( bool toDisplayPreview ) {
1108   if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
1109     if(myNbOkElements && isValid() && IsAxisOk()) {
1110       QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
1111       SMESH::long_array_var anElementsId = new SMESH::long_array;
1112       
1113       anElementsId->length(aListElementsId.count());
1114       for (int i = 0; i < aListElementsId.count(); i++)
1115         anElementsId[i] = aListElementsId[i].toInt();
1116       
1117       SMESH::AxisStruct anAxis;
1118       
1119       anAxis.x =  SpinBox_X->GetValue();
1120       anAxis.y =  SpinBox_Y->GetValue();
1121       anAxis.z =  SpinBox_Z->GetValue();;
1122       anAxis.vx = SpinBox_DX->GetValue();
1123       anAxis.vy = SpinBox_DY->GetValue();
1124       anAxis.vz = SpinBox_DZ->GetValue();
1125       double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.;
1126       
1127       try {
1128         SUIT_OverrideCursor aWaitCursor;
1129         bool copy = ( ActionGroup->checkedId() == COPY_ELEMS_BUTTON  ||
1130                       ActionGroup->checkedId() == MAKE_MESH_BUTTON );
1131         QList<SMESH::MeshPreviewStruct_var> aMeshPreviewStruct;
1132         if(CheckBoxMesh->isChecked())
1133           for ( int i = 0; i < myObjects.count(); i++ ) {
1134             SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditPreviewer();
1135             aMeshEditor->RotateObject(myObjects[i], anAxis, anAngle, copy);
1136             aMeshPreviewStruct << aMeshEditor->GetPreviewData();
1137           }
1138         else {
1139           SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditPreviewer();
1140           aMeshEditor->Rotate(anElementsId, anAxis, anAngle, copy);
1141           aMeshPreviewStruct << aMeshEditor->GetPreviewData();
1142         }
1143         setSimulationPreview( aMeshPreviewStruct );
1144       } catch (...) {
1145         hidePreview();
1146       }
1147     }
1148     else {
1149       hidePreview();
1150     }
1151   } else {
1152     hidePreview();
1153   }
1154 }