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