Salome HOME
Merge from V6_3_BR 06/06/2011
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_TranslationDlg.cxx
1 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : SMESHGUI_TranslationDlg.cxx
23 //  Author : Michael ZORIN, Open CASCADE S.A.S.
24 //  SMESH includes
25
26 #include "SMESHGUI_TranslationDlg.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_ResourceMgr.h>
45 #include <SUIT_Session.h>
46 #include <SUIT_MessageBox.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_SObject.hxx>
58
59 // OCCT includes
60 #include <TColStd_MapOfInteger.hxx>
61
62 // Qt includes
63 #include <QApplication>
64 #include <QButtonGroup>
65 #include <QGroupBox>
66 #include <QLabel>
67 #include <QLineEdit>
68 #include <QPushButton>
69 #include <QRadioButton>
70 #include <QCheckBox>
71 #include <QHBoxLayout>
72 #include <QVBoxLayout>
73 #include <QGridLayout>
74 #include <QSpinBox>
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 /*!
85   \class BusyLocker
86   \brief Simple 'busy state' flag locker.
87   \internal
88 */
89
90 class BusyLocker
91 {
92 public:
93   //! Constructor. Sets passed boolean flag to \c true.
94   BusyLocker( bool& busy ) : myBusy( busy ) { myBusy = true; }
95   //! Destructor. Clear external boolean flag passed as parameter to the constructor to \c false.
96   ~BusyLocker() { myBusy = false; }
97 private:
98   bool& myBusy; //! External 'busy state' boolean flag
99 };
100
101 #define SPACING 6
102 #define MARGIN  11
103
104 //To disable automatic genericobj management, the following line should be commented.
105 //Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
106 #define WITHGENERICOBJ
107
108 //=================================================================================
109 // class    : SMESHGUI_TranslationDlg()
110 // purpose  :
111 //=================================================================================
112 SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule ) : 
113   SMESHGUI_PreviewDlg( theModule ),
114   mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
115   myFilterDlg(0),
116   mySelectedObject(SMESH::SMESH_IDSource::_nil())
117 {
118   QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_POINTS")));
119   QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_VECTOR")));
120   QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
121
122   setModal(false);
123   setAttribute(Qt::WA_DeleteOnClose, true);
124   setWindowTitle(tr("SMESH_TRANSLATION"));
125   setSizeGripEnabled(true);
126
127   QVBoxLayout* SMESHGUI_TranslationDlgLayout = new QVBoxLayout(this);
128   SMESHGUI_TranslationDlgLayout->setSpacing(SPACING);
129   SMESHGUI_TranslationDlgLayout->setMargin(MARGIN);
130
131   /***************************************************************/
132   ConstructorsBox = new QGroupBox(tr("SMESH_TRANSLATION"), this);
133   GroupConstructors = new QButtonGroup(this);
134   QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
135   ConstructorsBoxLayout->setSpacing(SPACING);
136   ConstructorsBoxLayout->setMargin(MARGIN);
137
138   RadioButton1= new QRadioButton(ConstructorsBox);
139   RadioButton1->setIcon(image0);
140   RadioButton2= new QRadioButton(ConstructorsBox);
141   RadioButton2->setIcon(image1);
142
143   ConstructorsBoxLayout->addWidget(RadioButton1);
144   ConstructorsBoxLayout->addWidget(RadioButton2);
145   GroupConstructors->addButton(RadioButton1, 0);
146   GroupConstructors->addButton(RadioButton2, 1);
147
148   /***************************************************************/
149   GroupArguments = new QGroupBox(tr("SMESH_ARGUMENTS"), this);
150   QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
151   GroupArgumentsLayout->setSpacing(SPACING);
152   GroupArgumentsLayout->setMargin(MARGIN);
153
154   myIdValidator = new SMESHGUI_IdValidator(this);
155
156   // Controls for elements selection
157   TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
158   SelectElementsButton = new QPushButton(GroupArguments);
159   SelectElementsButton->setIcon(image2);
160   LineEditElements = new QLineEdit(GroupArguments);
161   LineEditElements->setValidator(myIdValidator);
162   LineEditElements->setMaxLength(-1);
163   myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
164   connect(myFilterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
165
166   // Control for the whole mesh selection
167   CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
168
169   // Controls for vector and points selection
170   TextLabel1 = new QLabel(GroupArguments);
171   SelectButton1 = new QPushButton(GroupArguments);
172   SelectButton1->setIcon(image2);
173
174   TextLabel1_1 = new QLabel(GroupArguments);
175   SpinBox1_1 = new SMESHGUI_SpinBox(GroupArguments);
176   TextLabel1_2 = new QLabel(GroupArguments);
177   SpinBox1_2 = new SMESHGUI_SpinBox(GroupArguments);
178   TextLabel1_3 = new QLabel(GroupArguments);
179   SpinBox1_3 = new SMESHGUI_SpinBox(GroupArguments);
180
181   TextLabel2 = new QLabel(tr("SMESH_POINT_2"), GroupArguments);
182   SelectButton2  = new QPushButton(GroupArguments);
183   SelectButton2->setIcon(image2);
184
185   TextLabel2_1 = new QLabel(tr("SMESH_X"), GroupArguments);
186   SpinBox2_1 = new SMESHGUI_SpinBox(GroupArguments);
187   TextLabel2_2 = new QLabel(tr("SMESH_Y"), GroupArguments);
188   SpinBox2_2 = new SMESHGUI_SpinBox(GroupArguments);
189   TextLabel2_3 = new QLabel(tr("SMESH_Z"), GroupArguments);
190   SpinBox2_3 = new SMESHGUI_SpinBox(GroupArguments);
191
192   // switch of action type
193   ActionBox = new QGroupBox(GroupArguments);
194   ActionGroup = new QButtonGroup(GroupArguments);
195   QVBoxLayout* ActionBoxLayout = new QVBoxLayout(ActionBox);
196   ActionBoxLayout->addSpacing(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   MakeGroupsCheck->setChecked(false);
213
214   // Name of a mesh to create
215   LineEditNewMesh = new QLineEdit(GroupArguments);
216
217   //Preview check box
218   myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
219
220   // layout
221   GroupArgumentsLayout->addWidget(TextLabelElements,    0, 0);
222   GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
223   GroupArgumentsLayout->addWidget(LineEditElements,     0, 2, 1, 5);
224   GroupArgumentsLayout->addWidget(myFilterBtn,          0, 7);
225   GroupArgumentsLayout->addWidget(CheckBoxMesh,         1, 0, 1, 8);
226   GroupArgumentsLayout->addWidget(TextLabel1,           2, 0);
227   GroupArgumentsLayout->addWidget(SelectButton1,        2, 1);
228   GroupArgumentsLayout->addWidget(TextLabel1_1,         2, 2);
229   GroupArgumentsLayout->addWidget(SpinBox1_1,           2, 3);
230   GroupArgumentsLayout->addWidget(TextLabel1_2,         2, 4);
231   GroupArgumentsLayout->addWidget(SpinBox1_2,           2, 5);
232   GroupArgumentsLayout->addWidget(TextLabel1_3,         2, 6);
233   GroupArgumentsLayout->addWidget(SpinBox1_3,           2, 7);
234   GroupArgumentsLayout->addWidget(TextLabel2,           3, 0);
235   GroupArgumentsLayout->addWidget(SelectButton2,        3, 1);
236   GroupArgumentsLayout->addWidget(TextLabel2_1,         3, 2);
237   GroupArgumentsLayout->addWidget(SpinBox2_1,           3, 3);
238   GroupArgumentsLayout->addWidget(TextLabel2_2,         3, 4);
239   GroupArgumentsLayout->addWidget(SpinBox2_2,           3, 5);
240   GroupArgumentsLayout->addWidget(TextLabel2_3,         3, 6);
241   GroupArgumentsLayout->addWidget(SpinBox2_3,           3, 7);
242   GroupArgumentsLayout->addWidget(ActionBox,            4, 0, 3, 4);
243   GroupArgumentsLayout->addWidget(MakeGroupsCheck,      5, 5, 1, 4);
244   GroupArgumentsLayout->addWidget(LineEditNewMesh,      6, 5, 1, 4);
245   GroupArgumentsLayout->addWidget(myPreviewCheckBox,    7, 0);
246
247   /***************************************************************/
248   GroupButtons = new QGroupBox(this);
249   QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
250   GroupButtonsLayout->setSpacing(SPACING);
251   GroupButtonsLayout->setMargin(MARGIN);
252
253   buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
254   buttonOk->setAutoDefault(true);
255   buttonOk->setDefault(true);
256   buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
257   buttonApply->setAutoDefault(true);
258   buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
259   buttonCancel->setAutoDefault(true);
260   buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
261   buttonHelp->setAutoDefault(true);
262
263   GroupButtonsLayout->addWidget(buttonOk);
264   GroupButtonsLayout->addSpacing(10);
265   GroupButtonsLayout->addWidget(buttonApply);
266   GroupButtonsLayout->addSpacing(10);
267   GroupButtonsLayout->addStretch();
268   GroupButtonsLayout->addWidget(buttonCancel);
269   GroupButtonsLayout->addWidget(buttonHelp);
270
271   /***************************************************************/
272   SMESHGUI_TranslationDlgLayout->addWidget(ConstructorsBox);
273   SMESHGUI_TranslationDlgLayout->addWidget(GroupArguments);
274   SMESHGUI_TranslationDlgLayout->addWidget(GroupButtons);
275
276   /* Initialisations */
277   SpinBox1_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
278   SpinBox1_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
279   SpinBox1_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
280   SpinBox2_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
281   SpinBox2_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
282   SpinBox2_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
283
284   RadioButton1->setChecked(true);
285
286   mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
287
288   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
289
290   // Costruction of the logical filter
291   SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
292   SMESH_TypeFilter* aSmeshGroupFilter    = new SMESH_TypeFilter (GROUP);
293
294   QList<SUIT_SelectionFilter*> aListOfFilters;
295   if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
296   if (aSmeshGroupFilter)    aListOfFilters.append(aSmeshGroupFilter);
297
298   myMeshOrSubMeshOrGroupFilter =
299     new SMESH_LogicalFilter(aListOfFilters, SMESH_LogicalFilter::LO_OR);
300
301   myHelpFileName = "translation_page.html";
302
303   Init();
304
305   /* signals and slots connections */
306   connect(buttonOk,     SIGNAL(clicked()), this, SLOT(ClickOnOk()));
307   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
308   connect(buttonApply,  SIGNAL(clicked()), this, SLOT(ClickOnApply()));
309   connect(buttonHelp,   SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
310   connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int)));
311
312   connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
313   connect(SelectButton1,        SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
314   connect(SelectButton2,        SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
315
316   connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
317   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),   this, SLOT(SelectionIntoArgument()));
318   /* to close dialog if study change */
319   connect(mySMESHGUI,       SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
320   connect(LineEditElements, SIGNAL(textChanged(const QString&)),    SLOT(onTextChange(const QString&)));
321   connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                  SLOT(onSelectMesh(bool)));
322   connect(ActionGroup,      SIGNAL(buttonClicked(int)),             SLOT(onActionClicked(int)));
323
324   connect(SpinBox1_1,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
325   connect(SpinBox1_2,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
326   connect(SpinBox1_3,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
327
328   connect(SpinBox2_1,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
329   connect(SpinBox2_2,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
330   connect(SpinBox2_3,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
331   connect(SpinBox2_3,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
332
333   
334   //To Connect preview check box
335   connectPreviewControl();
336
337   ConstructorsClicked(0);
338   SelectionIntoArgument();
339   onActionClicked(MOVE_ELEMS_BUTTON);
340 }
341
342 //=================================================================================
343 // function : ~SMESHGUI_TranslationDlg()
344 // purpose  : Destroys the object and frees any allocated resources
345 //=================================================================================
346 SMESHGUI_TranslationDlg::~SMESHGUI_TranslationDlg()
347 {
348   if ( myFilterDlg ) {
349     myFilterDlg->setParent( 0 );
350     delete myFilterDlg;
351     myFilterDlg = 0;
352   }
353 }
354
355 //=================================================================================
356 // function : Init()
357 // purpose  :
358 //=================================================================================
359 void SMESHGUI_TranslationDlg::Init (bool ResetControls)
360 {
361   myBusy = false;
362
363   myEditCurrentArgument = 0;
364   LineEditElements->clear();
365   myElementsId = "";
366   myNbOkElements = 0;
367
368   buttonOk->setEnabled(false);
369   buttonApply->setEnabled(false);
370
371   myActor = 0;
372   myMesh = SMESH::SMESH_Mesh::_nil();
373
374   if (ResetControls) {
375     SpinBox1_1->SetValue(0.0);
376     SpinBox1_2->SetValue(0.0);
377     SpinBox1_3->SetValue(0.0);
378     SpinBox2_1->SetValue(0.0);
379     SpinBox2_2->SetValue(0.0);
380     SpinBox2_3->SetValue(0.0);
381
382     ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
383     CheckBoxMesh->setChecked(false);
384 //     MakeGroupsCheck->setChecked(false);
385 //     MakeGroupsCheck->setEnabled(false);
386     myPreviewCheckBox->setChecked(false);
387     onDisplaySimulation(false);
388     onSelectMesh(false);
389   }
390 }
391
392 //=================================================================================
393 // function : ConstructorsClicked()
394 // purpose  : Radio button management
395 //=================================================================================
396 void SMESHGUI_TranslationDlg::ConstructorsClicked (int constructorId)
397 {
398   disconnect(mySelectionMgr, 0, this, 0);
399
400   switch (constructorId) {
401   case 0:
402     {
403       TextLabel1->setText(tr("SMESH_POINT_1"));
404       TextLabel1_1->setText(tr("SMESH_X"));
405       TextLabel1_2->setText(tr("SMESH_Y"));
406       TextLabel1_3->setText(tr("SMESH_Z"));
407
408       SelectButton1->show();
409       TextLabel2->show();
410       SelectButton2->show();
411       TextLabel2_1->show();
412       SpinBox2_1->show();
413       TextLabel2_2->show();
414       SpinBox2_2->show();
415       TextLabel2_3->show();
416       SpinBox2_3->show();
417       break;
418     }
419   case 1:
420     {
421       TextLabel1->setText(tr("SMESH_VECTOR"));
422       TextLabel1_1->setText(tr("SMESH_DX"));
423       TextLabel1_2->setText(tr("SMESH_DY"));
424       TextLabel1_3->setText(tr("SMESH_DZ"));
425
426       SelectButton1->hide();
427       TextLabel2->hide();
428       SelectButton2->hide();
429       TextLabel2_1->hide();
430       SpinBox2_1->hide();
431       TextLabel2_2->hide();
432       SpinBox2_2->hide();
433       TextLabel2_3->hide();
434       SpinBox2_3->hide();
435       break;
436     }
437   }
438
439   if (myEditCurrentArgument != (QWidget*)LineEditElements) {
440     SMESH::SetPointRepresentation(false);
441     if (!CheckBoxMesh->isChecked())
442       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
443         aViewWindow->SetSelectionMode( CellSelection );
444   }
445
446   myEditCurrentArgument = (QWidget*)LineEditElements;
447   LineEditElements->setFocus();
448
449   if (CheckBoxMesh->isChecked())
450     onSelectMesh(true);
451
452   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
453
454   onDisplaySimulation(true);
455
456   QApplication::instance()->processEvents();
457   updateGeometry();
458   resize(100,100);
459 }
460
461 //=================================================================================
462 // function : ClickOnApply()
463 // purpose  :
464 //=================================================================================
465 bool SMESHGUI_TranslationDlg::ClickOnApply()
466 {
467   if (mySMESHGUI->isActiveStudyLocked())
468     return false;
469
470   if( !isValid() )
471     return false;
472
473   if (myNbOkElements) {
474     QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
475
476     SMESH::long_array_var anElementsId = new SMESH::long_array;
477
478     anElementsId->length(aListElementsId.count());
479     for (int i = 0; i < aListElementsId.count(); i++)
480       anElementsId[i] = aListElementsId[i].toInt();
481
482     SMESH::DirStruct aVector;
483     if (GetConstructorId() == 0) {
484       aVector.PS.x = SpinBox2_1->GetValue() - SpinBox1_1->GetValue();
485       aVector.PS.y = SpinBox2_2->GetValue() - SpinBox1_2->GetValue();
486       aVector.PS.z = SpinBox2_3->GetValue() - SpinBox1_3->GetValue();
487     } else if (GetConstructorId() == 1) {
488       aVector.PS.x = SpinBox1_1->GetValue();
489       aVector.PS.y = SpinBox1_2->GetValue();
490       aVector.PS.z = SpinBox1_3->GetValue();
491     }
492
493     QStringList aParameters;
494     aParameters << SpinBox1_1->text();
495     if (GetConstructorId() == 0)
496       aParameters << SpinBox2_1->text();
497     aParameters << SpinBox1_2->text();
498     if (GetConstructorId() == 0)
499       aParameters << SpinBox2_2->text();
500     aParameters << SpinBox1_3->text();
501     if (GetConstructorId() == 0)
502       aParameters << SpinBox2_3->text();
503
504     int actionButton = ActionGroup->checkedId();
505     bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
506     QStringList anEntryList;
507     try {
508       SUIT_OverrideCursor aWaitCursor;
509       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
510       switch ( actionButton ) {
511       case MOVE_ELEMS_BUTTON:
512         if(CheckBoxMesh->isChecked())
513           aMeshEditor->TranslateObject(mySelectedObject, aVector, false);
514         else
515           aMeshEditor->Translate(anElementsId, aVector, false);
516         if( !myMesh->_is_nil())
517           myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
518         break;
519       case COPY_ELEMS_BUTTON:
520         if ( makeGroups ) {
521           SMESH::ListOfGroups_var groups;
522           if(CheckBoxMesh->isChecked())
523             groups = aMeshEditor->TranslateObjectMakeGroups(mySelectedObject,aVector);
524           else
525             groups = aMeshEditor->TranslateMakeGroups(anElementsId, aVector);
526         }
527         else {
528           if(CheckBoxMesh->isChecked())
529             aMeshEditor->TranslateObject(mySelectedObject, aVector, true);
530           else
531             aMeshEditor->Translate(anElementsId, aVector, true);
532         }
533         if( !myMesh->_is_nil())
534           myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
535         break;
536       case MAKE_MESH_BUTTON:
537         SMESH::SMESH_Mesh_var mesh;
538         if (CheckBoxMesh->isChecked())
539           mesh = aMeshEditor->TranslateObjectMakeMesh(mySelectedObject, aVector, makeGroups,
540                                                       LineEditNewMesh->text().toLatin1().data());
541         else
542           mesh = aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups,
543                                                 LineEditNewMesh->text().toLatin1().data());
544         if (!mesh->_is_nil()) {
545           mesh->SetParameters(aParameters.join(":").toLatin1().constData());
546           if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
547             anEntryList.append( aSObject->GetID().c_str() );
548 #ifdef WITHGENERICOBJ
549           // obj has been published in study. Its refcount has been incremented.
550           // It is safe to decrement its refcount
551           // so that it will be destroyed when the entry in study will be removed
552           mesh->UnRegister();
553 #endif
554         }
555       }
556     } catch (...) {
557     }
558
559     SMESH::UpdateView();
560     if ( ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) ||
561          actionButton == MAKE_MESH_BUTTON ) {
562       mySMESHGUI->updateObjBrowser(true); // new groups may appear
563       if( LightApp_Application* anApp =
564           dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
565         anApp->browseObjects( anEntryList, isApplyAndClose() );
566     }
567       
568     Init(false);
569     ConstructorsClicked(GetConstructorId());
570     mySelectedObject = SMESH::SMESH_IDSource::_nil();
571     SelectionIntoArgument();
572
573     SMESHGUI::Modified();
574   }
575
576   return true;
577 }
578
579 //=================================================================================
580 // function : ClickOnOk()
581 // purpose  :
582 //=================================================================================
583 void SMESHGUI_TranslationDlg::ClickOnOk()
584 {
585   setIsApplyAndClose( true );
586   if( ClickOnApply() )
587     ClickOnCancel();
588 }
589
590 //=================================================================================
591 // function : ClickOnCancel()
592 // purpose  :
593 //=================================================================================
594 void SMESHGUI_TranslationDlg::ClickOnCancel()
595 {
596   disconnect(mySelectionMgr, 0, this, 0);
597   mySelectionMgr->clearFilters();
598   //mySelectionMgr->clearSelected();
599   if (SMESH::GetCurrentVtkView()) {
600     SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
601     SMESH::SetPointRepresentation(false);
602   }
603   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
604     aViewWindow->SetSelectionMode( ActorSelection );
605   mySMESHGUI->ResetState();
606   reject();
607 }
608
609 //=================================================================================
610 // function : ClickOnHelp()
611 // purpose  :
612 //=================================================================================
613 void SMESHGUI_TranslationDlg::ClickOnHelp()
614 {
615   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
616   if (app)
617     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
618   else {
619     QString platform;
620 #ifdef WIN32
621     platform = "winapplication";
622 #else
623     platform = "application";
624 #endif
625     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
626                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
627                              arg(app->resourceMgr()->stringValue("ExternalBrowser",
628                                                                  platform)).
629                              arg(myHelpFileName));
630   }
631 }
632
633 //=======================================================================
634 // function : onTextChange()
635 // purpose  :
636 //=======================================================================
637 void SMESHGUI_TranslationDlg::onTextChange (const QString& theNewText)
638 {
639   QLineEdit* send = (QLineEdit*)sender();
640
641   if (myBusy) return;
642   BusyLocker lock( myBusy );
643
644   if (send == LineEditElements)
645     myNbOkElements = 0;
646
647   buttonOk->setEnabled(false);
648   buttonApply->setEnabled(false);
649
650   // hilight entered elements
651   SMDS_Mesh* aMesh = 0;
652   if (myActor)
653     aMesh = myActor->GetObject()->GetMesh();
654
655   if (aMesh) {
656     Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
657
658     TColStd_MapOfInteger newIndices;
659
660     QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
661
662     if (send == LineEditElements) {
663       for (int i = 0; i < aListId.count(); i++) {
664         const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
665         if (e)
666           newIndices.Add(e->GetID());
667         myNbOkElements++;
668       }
669     }
670
671     mySelector->AddOrRemoveIndex( anIO, newIndices, false );
672     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
673       aViewWindow->highlight( anIO, true, true );
674
675     myElementsId = theNewText;
676   }
677
678   if (myNbOkElements) {
679     buttonOk->setEnabled(true);
680     buttonApply->setEnabled(true);
681   }
682 }
683
684 //=================================================================================
685 // function : SelectionIntoArgument()
686 // purpose  : Called when selection as changed or other case
687 //=================================================================================
688 void SMESHGUI_TranslationDlg::SelectionIntoArgument()
689 {
690   if (myBusy) return;
691   BusyLocker lock( myBusy );
692   // clear
693   myActor = 0;
694   QString aString = "";
695
696   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
697     LineEditElements->setText(aString);
698     myNbOkElements = 0;
699     buttonOk->setEnabled(false);
700     buttonApply->setEnabled(false);
701   }
702
703   if (!GroupButtons->isEnabled()) // inactive
704     return;
705
706   // get selected mesh
707   SALOME_ListIO aList;
708   mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
709
710   int nbSel = aList.Extent();
711   if (nbSel != 1)
712     return;
713
714   Handle(SALOME_InteractiveObject) IO = aList.First();
715   myMesh = SMESH::GetMeshByIO(IO);
716   if (myMesh->_is_nil())
717     return;
718
719   myActor = SMESH::FindActorByObject(myMesh);
720   if (!myActor)
721     myActor = SMESH::FindActorByEntry(IO->getEntry());
722
723   if (!myActor && !CheckBoxMesh->isChecked())
724       return;
725
726   int aNbUnits = 0;
727
728   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
729     myElementsId = "";
730
731     // MakeGroups is available if there are groups and "Copy"
732     if ( myMesh->NbGroups() == 0 ) {
733       MakeGroupsCheck->setChecked(false);
734       MakeGroupsCheck->setEnabled(false);
735     }
736     else if ( ActionGroup->checkedId() != MOVE_ELEMS_BUTTON ) {
737       MakeGroupsCheck->setEnabled(true);
738     }
739
740     if (CheckBoxMesh->isChecked()) {
741       SMESH::GetNameOfSelectedIObjects( mySelectionMgr, aString );
742
743       if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil()) { //MESH, SUBMESH, OR GROUP
744         mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
745       }
746       else
747         return;
748         // get IDs from mesh
749         /*
750         SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
751         if (!aSMDSMesh)
752           return;
753
754         for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++) {
755           const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
756           if (e) {
757             myElementsId += QString(" %1").arg(i);
758             aNbUnits++;
759           }
760         }
761       } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
762         // get submesh
763         SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
764
765         // get IDs from submesh
766         SMESH::long_array_var anElementsIds = new SMESH::long_array;
767         anElementsIds = aSubMesh->GetElementsId();
768         for (int i = 0; i < anElementsIds->length(); i++) {
769           myElementsId += QString(" %1").arg(anElementsIds[i]);
770         }
771         aNbUnits = anElementsIds->length();
772       } else { // GROUP
773         // get smesh group
774         SMESH::SMESH_GroupBase_var aGroup =
775           SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
776         if (aGroup->_is_nil())
777           return;
778
779         // get IDs from smesh group
780         SMESH::long_array_var anElementsIds = new SMESH::long_array;
781         anElementsIds = aGroup->GetListOfID();
782         for (int i = 0; i < anElementsIds->length(); i++) {
783           myElementsId += QString(" %1").arg(anElementsIds[i]);
784         }
785         aNbUnits = anElementsIds->length();
786       }
787         */
788     } else {
789       aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
790       myElementsId = aString;
791       if (aNbUnits < 1)
792         return;
793     }
794
795     myNbOkElements = true;
796   } else {
797     aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
798     if (aNbUnits != 1)
799       return;
800
801     SMDS_Mesh* aMesh =  myActor->GetObject()->GetMesh();
802     if (!aMesh)
803       return;
804
805     const SMDS_MeshNode * n = aMesh->FindNode(aString.toInt());
806     if (!n)
807       return;
808
809     double x = n->X();
810     double y = n->Y();
811     double z = n->Z();
812
813     if (myEditCurrentArgument == (QWidget*)SpinBox1_1) {
814       SpinBox1_1->SetValue(x);
815       SpinBox1_2->SetValue(y);
816       SpinBox1_3->SetValue(z);
817     } else if (myEditCurrentArgument == (QWidget*)SpinBox2_1) {
818       SpinBox2_1->SetValue(x);
819       SpinBox2_2->SetValue(y);
820       SpinBox2_3->SetValue(z);
821     }
822   }
823
824   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
825     LineEditElements->setText(aString);
826     LineEditElements->repaint();
827     LineEditElements->setEnabled(false); // to fully update lineedit IPAL 19809
828     LineEditElements->setEnabled(true);
829     setNewMeshName();
830   }
831
832   // OK
833   if (myNbOkElements) {
834     buttonOk->setEnabled(true);
835     buttonApply->setEnabled(true);
836   }
837   onDisplaySimulation(true);
838 }
839
840 //=================================================================================
841 // function : SetEditCurrentArgument()
842 // purpose  :
843 //=================================================================================
844 void SMESHGUI_TranslationDlg::SetEditCurrentArgument()
845 {
846   QPushButton* send = (QPushButton*)sender();
847
848   disconnect(mySelectionMgr, 0, this, 0);
849   mySelectionMgr->clearSelected();
850   mySelectionMgr->clearFilters();
851   
852   if (send == SelectElementsButton) {
853     myEditCurrentArgument = (QWidget*)LineEditElements;
854     SMESH::SetPointRepresentation(false);
855     if (CheckBoxMesh->isChecked()) {
856       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
857         aViewWindow->SetSelectionMode( ActorSelection );
858       mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
859     } else {
860
861       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
862         aViewWindow->SetSelectionMode( CellSelection );
863     }
864   } else if (send == SelectButton1) {
865     myEditCurrentArgument = (QWidget*)SpinBox1_1;
866     SMESH::SetPointRepresentation(true);
867
868     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
869       aViewWindow->SetSelectionMode( NodeSelection );
870   } else if (send == SelectButton2) {
871     myEditCurrentArgument = (QWidget*)SpinBox2_1;
872     SMESH::SetPointRepresentation(true);
873
874     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
875       aViewWindow->SetSelectionMode( NodeSelection );
876   }
877
878   myEditCurrentArgument->setFocus();
879   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
880   SelectionIntoArgument();
881 }
882
883 //=================================================================================
884 // function : DeactivateActiveDialog()
885 // purpose  :
886 //=================================================================================
887 void SMESHGUI_TranslationDlg::DeactivateActiveDialog()
888 {
889   if (ConstructorsBox->isEnabled()) {
890     ConstructorsBox->setEnabled(false);
891     GroupArguments->setEnabled(false);
892     GroupButtons->setEnabled(false);
893     mySMESHGUI->ResetState();
894     mySMESHGUI->SetActiveDialogBox(0);
895   }
896 }
897
898 //=================================================================================
899 // function : ActivateThisDialog()
900 // purpose  :
901 //=================================================================================
902 void SMESHGUI_TranslationDlg::ActivateThisDialog()
903 {
904   /* Emit a signal to deactivate the active dialog */
905   mySMESHGUI->EmitSignalDeactivateDialog();
906   ConstructorsBox->setEnabled(true);
907   GroupArguments->setEnabled(true);
908   GroupButtons->setEnabled(true);
909
910   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
911
912   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
913     aViewWindow->SetSelectionMode( CellSelection );
914
915   SelectionIntoArgument();
916 }
917
918 //=================================================================================
919 // function : enterEvent()
920 // purpose  :
921 //=================================================================================
922 void SMESHGUI_TranslationDlg::enterEvent (QEvent*)
923 {
924   if (!ConstructorsBox->isEnabled())
925     ActivateThisDialog();
926 }
927
928 //=================================================================================
929 // function : closeEvent()
930 // purpose  :
931 //=================================================================================
932 void SMESHGUI_TranslationDlg::closeEvent (QCloseEvent*)
933 {
934   /* same than click on cancel button */
935   ClickOnCancel();
936 }
937
938 //=======================================================================
939 //function : hideEvent
940 //purpose  : caused by ESC key
941 //=======================================================================
942 void SMESHGUI_TranslationDlg::hideEvent (QHideEvent*)
943 {
944   if (!isMinimized())
945     ClickOnCancel();
946 }
947
948 //=======================================================================
949 //function : onSelectMesh
950 //purpose  :
951 //=======================================================================
952 void SMESHGUI_TranslationDlg::onSelectMesh (bool toSelectMesh)
953 {
954   if (toSelectMesh)
955     TextLabelElements->setText(tr("SMESH_NAME"));
956   else
957     TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
958   myFilterBtn->setEnabled(!toSelectMesh);
959
960   if (myEditCurrentArgument != LineEditElements) {
961     LineEditElements->clear();
962     return;
963   }
964
965   mySelectionMgr->clearFilters();
966   SMESH::SetPointRepresentation(false);
967
968   if (toSelectMesh) {
969     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
970       aViewWindow->SetSelectionMode( ActorSelection );
971     mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
972     LineEditElements->setReadOnly(true);
973     LineEditElements->setValidator(0);
974   } else {
975     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
976       aViewWindow->SetSelectionMode( CellSelection );
977     LineEditElements->setReadOnly(false);
978     LineEditElements->setValidator(myIdValidator);
979     onTextChange(LineEditElements->text());
980     hidePreview();
981   }
982
983   SelectionIntoArgument();
984 }
985
986 //=======================================================================
987 //function : onActionClicked
988 //purpose  : slot called when an action type changed
989 //=======================================================================
990
991 void SMESHGUI_TranslationDlg::onActionClicked(int button)
992 {
993   switch ( button ) {
994   case MOVE_ELEMS_BUTTON:
995     MakeGroupsCheck->setEnabled(false);
996     LineEditNewMesh->setEnabled(false);
997     break;
998   case COPY_ELEMS_BUTTON:
999     LineEditNewMesh->setEnabled(false);
1000     MakeGroupsCheck->setText( tr("SMESH_MAKE_GROUPS"));
1001     if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
1002       MakeGroupsCheck->setEnabled(true);
1003     else
1004       MakeGroupsCheck->setEnabled(false);
1005     break;
1006   case MAKE_MESH_BUTTON:
1007     LineEditNewMesh->setEnabled(true);
1008     MakeGroupsCheck->setText( tr("SMESH_COPY_GROUPS"));
1009     if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
1010       MakeGroupsCheck->setEnabled(true);
1011     else
1012       MakeGroupsCheck->setEnabled(false);
1013     break;
1014   }
1015   setNewMeshName();
1016   toDisplaySimulation();
1017 }
1018
1019 //=======================================================================
1020 //function : setNewMeshName
1021 //purpose  : update contents of LineEditNewMesh
1022 //=======================================================================
1023
1024 void SMESHGUI_TranslationDlg::setNewMeshName()
1025 {
1026   LineEditNewMesh->setText("");
1027   if ( LineEditNewMesh->isEnabled() && !myMesh->_is_nil() ) {
1028     QString name;
1029     if ( CheckBoxMesh->isChecked() ) {
1030       name = LineEditElements->text();
1031     }
1032     else {
1033       _PTR(SObject) meshSO = SMESH::FindSObject( myMesh );
1034       name = meshSO->GetName().c_str();
1035     }
1036     if ( !name.isEmpty() )
1037       LineEditNewMesh->setText( SMESH::UniqueMeshName( name, "translated"));
1038   }
1039 }
1040
1041 //=================================================================================
1042 // function : GetConstructorId()
1043 // purpose  :
1044 //=================================================================================
1045 int SMESHGUI_TranslationDlg::GetConstructorId()
1046 {
1047   return GroupConstructors->checkedId();
1048 }
1049
1050 //=================================================================================
1051 // function : keyPressEvent()
1052 // purpose  :
1053 //=================================================================================
1054 void SMESHGUI_TranslationDlg::keyPressEvent( QKeyEvent* e )
1055 {
1056   QDialog::keyPressEvent( e );
1057   if ( e->isAccepted() )
1058     return;
1059
1060   if ( e->key() == Qt::Key_F1 ) {
1061     e->accept();
1062     ClickOnHelp();
1063   }
1064 }
1065
1066 //=================================================================================
1067 // function : setFilters()
1068 // purpose  : SLOT. Called when "Filter" button pressed.
1069 //=================================================================================
1070 void SMESHGUI_TranslationDlg::setFilters()
1071 {
1072   if(myMesh->_is_nil()) {
1073     SUIT_MessageBox::critical(this,
1074                               tr("SMESH_ERROR"),
1075                               tr("NO_MESH_SELECTED"));
1076    return;
1077   }
1078   if ( !myFilterDlg )
1079     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
1080
1081   myFilterDlg->SetSelection();
1082   myFilterDlg->SetMesh( myMesh );
1083   myFilterDlg->SetSourceWg( LineEditElements );
1084
1085   myFilterDlg->show();
1086 }
1087
1088 //=================================================================================
1089 // function : isValid
1090 // purpose  :
1091 //=================================================================================
1092 bool SMESHGUI_TranslationDlg::isValid()
1093 {
1094   bool ok = true;
1095   QString msg;
1096
1097   ok = SpinBox1_1->isValid( msg, true ) && ok;
1098   ok = SpinBox1_2->isValid( msg, true ) && ok;
1099   ok = SpinBox1_3->isValid( msg, true ) && ok;
1100   if (GetConstructorId() == 0) {
1101     ok = SpinBox2_1->isValid( msg, true ) && ok;
1102     ok = SpinBox2_2->isValid( msg, true ) && ok;
1103     ok = SpinBox2_3->isValid( msg, true ) && ok;
1104   }
1105
1106   if( !ok ) {
1107     QString str( tr( "SMESH_INCORRECT_INPUT" ) );
1108     if ( !msg.isEmpty() )
1109       str += "\n" + msg;
1110     SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
1111     return false;
1112   }
1113   return true;
1114 }
1115
1116 //=================================================================================
1117 // function : onDisplaySimulation
1118 // purpose  : Show/Hide preview
1119 //=================================================================================
1120 void SMESHGUI_TranslationDlg::onDisplaySimulation( bool toDisplayPreview ) {
1121   if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
1122     
1123     if (isValid() && myNbOkElements) {
1124       QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
1125       
1126       SMESH::long_array_var anElementsId = new SMESH::long_array;
1127
1128       anElementsId->length(aListElementsId.count());
1129       for (int i = 0; i < aListElementsId.count(); i++)
1130         anElementsId[i] = aListElementsId[i].toInt();
1131
1132       SMESH::DirStruct aVector;
1133       if (GetConstructorId() == 0) {
1134         aVector.PS.x = SpinBox2_1->GetValue() - SpinBox1_1->GetValue();
1135         aVector.PS.y = SpinBox2_2->GetValue() - SpinBox1_2->GetValue();
1136         aVector.PS.z = SpinBox2_3->GetValue() - SpinBox1_3->GetValue();
1137       } else if (GetConstructorId() == 1) {
1138         aVector.PS.x = SpinBox1_1->GetValue();
1139         aVector.PS.y = SpinBox1_2->GetValue();
1140         aVector.PS.z = SpinBox1_3->GetValue();
1141       }
1142
1143       try {
1144         bool copy = ( ActionGroup->checkedId() == COPY_ELEMS_BUTTON ||
1145                       ActionGroup->checkedId() == MAKE_MESH_BUTTON );
1146         SUIT_OverrideCursor aWaitCursor;
1147         SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
1148         if(CheckBoxMesh->isChecked())
1149           aMeshEditor->TranslateObject(mySelectedObject, aVector, copy);
1150         else
1151           aMeshEditor->Translate(anElementsId, aVector, copy);
1152         
1153         SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
1154         mySimulation->SetData(aMeshPreviewStruct._retn());      
1155       } catch (...) {
1156         
1157       }
1158     }
1159     else {
1160       hidePreview();
1161     }
1162   } else {
1163     hidePreview();
1164   }
1165 }