]> SALOME platform Git repositories - modules/geom.git/blob - src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx
Salome HOME
e4c81518b93c8e3a4799f741adc95d19a15c71f0
[modules/geom.git] / src / TransformationGUI / TransformationGUI_MultiTranslationDlg.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // GEOM GEOMGUI : GUI for Geometry component
23 // File   : TransformationGUI_MultiTranslationDlg.cxx
24 // Author : Damien COQUERET, Open CASCADE S.A.S.
25 //
26 #include "TransformationGUI_MultiTranslationDlg.h"
27
28 #include <DlgRef.h>
29 #include <GeometryGUI.h>
30 #include <GEOMBase.h>
31
32 #include <SUIT_Session.h>
33 #include <SUIT_ResourceMgr.h>
34 #include <SalomeApp_Application.h>
35 #include <LightApp_SelectionMgr.h>
36
37 // OCCT Includes
38 #include <TopoDS_Shape.hxx>
39 #include <TopoDS_Edge.hxx>
40 #include <TopoDS.hxx>
41 #include <TopExp.hxx>
42 #include <TColStd_IndexedMapOfInteger.hxx>
43 #include <TopTools_IndexedMapOfShape.hxx>
44
45 #include <GEOMImpl_Types.hxx>
46
47 //=================================================================================
48 // class    : TransformationGUI_MultiTranslationDlg()
49 // purpose  : Constructs a TransformationGUI_MultiTranslationDlg which is a child of 'parent', with the
50 //            name 'name' and widget flags set to 'f'.
51 //            The dialog will by default be modeless, unless you set 'modal' to
52 //            TRUE to construct a modal dialog.
53 //=================================================================================
54 TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg
55 (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
56   : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
57     myInitial(true)
58 {
59   SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
60   QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTITRANSLATION_SIMPLE")));
61   QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTITRANSLATION_DOUBLE")));
62   QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
63
64   setWindowTitle(tr("GEOM_MULTITRANSLATION_TITLE"));
65
66   /***************************************************************/
67   mainFrame()->GroupConstructors->setTitle(tr("GEOM_MULTITRANSLATION"));
68   mainFrame()->RadioButton1->setIcon(image0);
69   mainFrame()->RadioButton2->setIcon(image1);
70   mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
71   mainFrame()->RadioButton3->close();
72
73   GroupPoints = new DlgRef_2Sel2Spin1Check(centralWidget());
74   GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_SIMPLE"));
75   GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
76   GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR_U"));
77   GroupPoints->TextLabel3->setText(tr("GEOM_STEP_U"));
78   GroupPoints->TextLabel4->setText(tr("GEOM_NB_TIMES_U"));
79   GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE_U"));
80   GroupPoints->PushButton1->setIcon(image2);
81   GroupPoints->PushButton2->setIcon(image2);
82   GroupPoints->LineEdit1->setReadOnly(true);
83   GroupPoints->LineEdit2->setReadOnly(true);
84
85   GroupDimensions = new DlgRef_3Sel4Spin2Check(centralWidget());
86   GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_DOUBLE"));
87   GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
88   GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR_U"));
89   GroupDimensions->TextLabel3->setText(tr("GEOM_VECTOR_V"));
90   GroupDimensions->TextLabel4->setText(tr("GEOM_STEP_U"));
91   GroupDimensions->TextLabel5->setText(tr("GEOM_NB_TIMES_U"));
92   GroupDimensions->TextLabel6->setText(tr("GEOM_STEP_V"));
93   GroupDimensions->TextLabel7->setText(tr("GEOM_NB_TIMES_V"));
94   GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE_U"));
95   GroupDimensions->CheckButton2->setText(tr("GEOM_REVERSE_V"));
96   GroupDimensions->PushButton1->setIcon(image2);
97   GroupDimensions->PushButton2->setIcon(image2);
98   GroupDimensions->PushButton3->setIcon(image2);
99   GroupDimensions->LineEdit1->setReadOnly(true);
100   GroupDimensions->LineEdit2->setReadOnly(true);
101   GroupDimensions->LineEdit3->setReadOnly(true);
102
103   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
104   layout->setMargin(0); layout->setSpacing(6);
105   layout->addWidget(GroupPoints);
106   layout->addWidget(GroupDimensions);
107   /***************************************************************/
108
109   setHelpFileName("multi_translation_operation_page.html");
110
111   Init();
112 }
113
114 //=================================================================================
115 // function : ~TransformationGUI_MultiTranslationDlg()
116 // purpose  : Destroys the object and frees any allocated resources
117 //=================================================================================
118 TransformationGUI_MultiTranslationDlg::~TransformationGUI_MultiTranslationDlg()
119 {
120   // no need to delete child widgets, Qt does it all for us
121 }
122
123 //=================================================================================
124 // function : Init()
125 // purpose  :
126 //=================================================================================
127 void TransformationGUI_MultiTranslationDlg::Init()
128 {
129   // Get setting of step value from file configuration
130   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
131   double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
132
133   double SpecificStep = 1;
134   // min, max, step and decimals for spin boxes & initial values
135   initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY
136   initSpinBox(GroupPoints->SpinBox_DY, 1, 999, SpecificStep, 10);
137   GroupPoints->SpinBox_DX->setValue(myStepU);
138   GroupPoints->SpinBox_DY->setValue(myNbTimesU);
139   GroupPoints->SpinBox_DY->setDecimals(0);
140
141   initSpinBox(GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY
142   initSpinBox(GroupDimensions->SpinBox_DY1, 1, 999, SpecificStep, 10);
143   initSpinBox(GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY
144   initSpinBox(GroupDimensions->SpinBox_DY2, 1, 999, SpecificStep, 10);
145   GroupDimensions->SpinBox_DX1->setValue(myStepU);
146   GroupDimensions->SpinBox_DY1->setValue(myNbTimesU);
147   GroupDimensions->SpinBox_DX2->setValue(myStepV);
148   GroupDimensions->SpinBox_DY2->setValue(myNbTimesV);
149   GroupDimensions->SpinBox_DY1->setDecimals(0);
150   GroupDimensions->SpinBox_DY2->setDecimals(0);
151
152   // init variables
153   myStepU = myStepV = 50.0;
154   myNbTimesU = myNbTimesV = 2;
155
156   GroupPoints->LineEdit1->setText("");
157   GroupPoints->LineEdit2->setText("");
158
159   GroupDimensions->LineEdit1->setText("");
160   GroupDimensions->LineEdit2->setText("");
161   GroupDimensions->LineEdit3->setText("");
162
163   myBase = myVectorU = myVectorV = GEOM::GEOM_Object::_nil();
164
165   // signals and slots connections
166   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
167   connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
168
169   connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
170
171   connect(GroupPoints->PushButton1,     SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
172   connect(GroupPoints->PushButton2,     SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
173   connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
174   connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
175   connect(GroupDimensions->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
176
177   connect(GroupPoints->LineEdit1,     SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
178   connect(GroupPoints->LineEdit2,     SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
179   connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
180   connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
181   connect(GroupDimensions->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
182
183   connect(GroupPoints->SpinBox_DX,      SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
184   connect(GroupPoints->SpinBox_DY,      SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
185   connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
186   connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
187   connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
188   connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
189
190   connect(GroupPoints->SpinBox_DX,      SIGNAL(textChanged(const QString& )), 
191           this, SLOT(TextValueChangedInSpinBox(const QString& )));
192   connect(GroupDimensions->SpinBox_DX1, SIGNAL(textChanged(const QString& )), 
193           this, SLOT(TextValueChangedInSpinBox(const QString& )));
194   connect(GroupDimensions->SpinBox_DX2, SIGNAL(textChanged(const QString& )), 
195           this, SLOT(TextValueChangedInSpinBox(const QString& )));
196   
197   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
198
199   connect(GroupPoints->CheckButton1,     SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
200   connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
201   connect(GroupDimensions->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(ReverseStepV()));
202
203   initName(tr("GEOM_MULTITRANSLATION"));
204
205   ConstructorsClicked(0);
206 }
207
208 //=================================================================================
209 // function : SetDoubleSpinBoxStep()
210 // purpose  : Double spin box management
211 //=================================================================================
212 void TransformationGUI_MultiTranslationDlg::SetDoubleSpinBoxStep (double step)
213 {
214   GroupPoints->SpinBox_DX->setSingleStep(step);
215   GroupPoints->SpinBox_DY->setSingleStep(step);
216   GroupDimensions->SpinBox_DX1->setSingleStep(step);
217   GroupDimensions->SpinBox_DY1->setSingleStep(step);
218   GroupDimensions->SpinBox_DX2->setSingleStep(step);
219   GroupDimensions->SpinBox_DY2->setSingleStep(step);
220 }
221
222 //=================================================================================
223 // function : ConstructorsClicked()
224 // purpose  : Radio button management
225 //=================================================================================
226 void TransformationGUI_MultiTranslationDlg::ConstructorsClicked (int constructorId)
227 {
228   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
229
230   switch (constructorId) {
231   case 0: // Translate simple
232     {
233       GroupDimensions->hide();
234       GroupPoints->show();
235
236       GroupPoints->LineEdit1->setText("");
237       GroupPoints->LineEdit2->setText("");
238       myBase = myVectorU = GEOM::GEOM_Object::_nil();
239
240       GroupPoints->SpinBox_DX->setValue(myStepU);
241       GroupPoints->SpinBox_DY->setValue(myNbTimesU);
242
243       GroupPoints->PushButton1->click();
244       break;
245     }
246   case 1: // Translate double
247     {
248       GroupPoints->hide();
249       GroupDimensions->show();
250
251       GroupDimensions->LineEdit1->setText("");
252       GroupDimensions->LineEdit2->setText("");
253       GroupDimensions->LineEdit3->setText("");
254       myBase = myVectorU = myVectorV = GEOM::GEOM_Object::_nil();
255
256       GroupDimensions->SpinBox_DX1->setValue(myStepU);
257       GroupDimensions->SpinBox_DY1->setValue(myNbTimesU);
258       GroupDimensions->SpinBox_DX2->setValue(myStepV);
259       GroupDimensions->SpinBox_DY2->setValue(myNbTimesV);
260
261       GroupDimensions->PushButton1->click();
262       break;
263     }
264   }
265
266   qApp->processEvents();
267   updateGeometry();
268   resize(minimumSizeHint());
269
270   if (myInitial) {
271     myInitial = false;
272     SelectionIntoArgument();
273   }
274   else {
275     displayPreview();
276   }
277 }
278
279 //=================================================================================
280 // function : ClickOnOk()
281 // purpose  :
282 //=================================================================================
283 void TransformationGUI_MultiTranslationDlg::ClickOnOk()
284 {
285   if (ClickOnApply())
286     ClickOnCancel();
287 }
288
289 //=================================================================================
290 // function : ClickOnApply()
291 // purpose  :
292 //=================================================================================
293 bool TransformationGUI_MultiTranslationDlg::ClickOnApply()
294 {
295   if (!onAccept())
296     return false;
297
298   initName();
299   // activate selection and connect selection manager
300   ConstructorsClicked(getConstructorId());
301   return true;
302 }
303
304 //=================================================================================
305 // function : SelectionIntoArgument()
306 // purpose  : Called when selection is changed or on dialog initialization or activation
307 //=================================================================================
308 void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
309 {
310   erasePreview();
311   myEditCurrentArgument->setText("");
312
313   if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
314       myEditCurrentArgument == GroupDimensions->LineEdit1)
315     myBase = GEOM::GEOM_Object::_nil();
316   else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
317            myEditCurrentArgument == GroupDimensions->LineEdit2)
318     myVectorU = GEOM::GEOM_Object::_nil();
319   else if (myEditCurrentArgument == GroupDimensions->LineEdit3)
320     myVectorV = GEOM::GEOM_Object::_nil();
321
322   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
323   SALOME_ListIO aSelList;
324   aSelMgr->selectedObjects(aSelList);
325
326   if (aSelList.Extent() != 1)
327     return;
328
329   // nbSel == 1
330   Standard_Boolean testResult = Standard_False;;
331   GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
332
333   if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject))
334     return;
335
336   QString aName = GEOMBase::GetName(aSelectedObject);
337
338   if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
339       myEditCurrentArgument == GroupDimensions->LineEdit1)
340     myBase = aSelectedObject;
341   else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
342            myEditCurrentArgument == GroupDimensions->LineEdit2 ||
343            myEditCurrentArgument == GroupDimensions->LineEdit3) {
344     TopoDS_Shape aShape;
345
346     if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
347       TColStd_IndexedMapOfInteger aMap;
348       aSelMgr->GetIndexes(aSelList.First(), aMap);
349       if (aMap.Extent() == 1) {
350         int anIndex = aMap(1);
351         aName += QString(":edge_%1").arg(anIndex);
352
353         //Find SubShape Object in Father
354         GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
355
356         if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
357           GEOM::GEOM_IShapesOperations_var aShapesOp =
358             getGeomEngine()->GetIShapesOperations(getStudyId());
359           if (myEditCurrentArgument == GroupDimensions->LineEdit3)
360             myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex);
361           else
362             myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex);
363         }
364         else {
365           if (myEditCurrentArgument == GroupDimensions->LineEdit3)
366             myVectorV = aFindedObject;
367           else
368             myVectorU = aFindedObject;
369         }
370       }
371       else {
372         if (aShape.ShapeType() != TopAbs_EDGE) {
373           aSelectedObject = GEOM::GEOM_Object::_nil();
374           aName = "";
375         }
376         if (myEditCurrentArgument == GroupDimensions->LineEdit3)
377           myVectorV = aSelectedObject;
378         else
379           myVectorU = aSelectedObject;
380       }
381     }
382   }
383   myEditCurrentArgument->setText(aName);
384
385   if (myEditCurrentArgument == GroupPoints->LineEdit1) {
386     if (!myBase->_is_nil() && myVectorU->_is_nil())
387       GroupPoints->PushButton2->click();
388   }
389   else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
390     if (!myVectorU->_is_nil() && myBase->_is_nil())
391       GroupPoints->PushButton1->click();
392   }
393   else if (myEditCurrentArgument == GroupDimensions->LineEdit1) {
394     if (!myBase->_is_nil() && myVectorU->_is_nil())
395       GroupDimensions->PushButton2->click();
396   }
397   else if (myEditCurrentArgument == GroupDimensions->LineEdit2) {
398     if (!myVectorU->_is_nil() && myVectorV->_is_nil())
399       GroupDimensions->PushButton3->click();
400   }
401   else if (myEditCurrentArgument == GroupDimensions->LineEdit3) {
402     if (!myVectorV->_is_nil() && myBase->_is_nil())
403       GroupDimensions->PushButton1->click();
404   }
405
406   // clear selection
407   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
408   myGeomGUI->getApp()->selectionMgr()->clearSelected();
409   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
410           this, SLOT(SelectionIntoArgument()));
411
412   displayPreview();
413 }
414
415 //=================================================================================
416 // function : SetEditCurrentArgument()
417 // purpose  :
418 //=================================================================================
419 void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
420 {
421   QPushButton* send = (QPushButton*)sender();
422
423   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
424   globalSelection(GEOM_ALLSHAPES);
425
426   if (send == GroupPoints->PushButton1) {
427     myEditCurrentArgument = GroupPoints->LineEdit1;
428
429     GroupPoints->PushButton2->setDown(false);
430     GroupPoints->LineEdit2->setEnabled(false);
431   }
432   else if (send == GroupPoints->PushButton2) {
433     myEditCurrentArgument = GroupPoints->LineEdit2;
434
435     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
436
437     GroupPoints->PushButton1->setDown(false);
438     GroupPoints->LineEdit1->setEnabled(false);
439   }
440   else if (send == GroupDimensions->PushButton1) {
441     myEditCurrentArgument = GroupDimensions->LineEdit1;
442
443     GroupDimensions->PushButton2->setDown(false);
444     GroupDimensions->PushButton3->setDown(false);
445     GroupDimensions->LineEdit2->setEnabled(false);
446     GroupDimensions->LineEdit3->setEnabled(false);
447   }
448   else if (send == GroupDimensions->PushButton2) {
449     myEditCurrentArgument = GroupDimensions->LineEdit2;
450
451     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
452
453     GroupDimensions->PushButton1->setDown(false);
454     GroupDimensions->PushButton3->setDown(false);
455     GroupDimensions->LineEdit1->setEnabled(false);
456     GroupDimensions->LineEdit3->setEnabled(false);
457   }
458   else if (send == GroupDimensions->PushButton3) {
459     myEditCurrentArgument = GroupDimensions->LineEdit3;
460
461     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
462
463     GroupDimensions->PushButton1->setDown(false);
464     GroupDimensions->PushButton2->setDown(false);
465     GroupDimensions->LineEdit1->setEnabled(false);
466     GroupDimensions->LineEdit2->setEnabled(false);
467   }
468   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
469           this, SLOT(SelectionIntoArgument()));
470
471   // enable line edit
472   myEditCurrentArgument->setEnabled(true);
473   myEditCurrentArgument->setFocus();
474   // after setFocus(), because it will be setDown(false) when loses focus
475   send->setDown(true);
476
477   // seems we need it only to avoid preview disappearing, caused by selection mode change
478   displayPreview();
479 }
480
481 //=================================================================================
482 // function : LineEditReturnPressed()
483 // purpose  :
484 //=================================================================================
485 void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
486 {
487   QLineEdit* send = (QLineEdit*)sender();
488   if (send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
489       send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 ||
490       send == GroupDimensions->LineEdit3) {
491     myEditCurrentArgument = send;
492     GEOMBase_Skeleton::LineEditReturnPressed();
493   }
494 }
495
496 //=================================================================================
497 // function : ActivateThisDialog()
498 // purpose  :
499 //=================================================================================
500 void TransformationGUI_MultiTranslationDlg::ActivateThisDialog()
501 {
502   GEOMBase_Skeleton::ActivateThisDialog();
503   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
504            this, SLOT( SelectionIntoArgument() ) );
505
506   ConstructorsClicked( getConstructorId() );
507 }
508
509 //=================================================================================
510 // function : enterEvent()
511 // purpose  :
512 //=================================================================================
513 void TransformationGUI_MultiTranslationDlg::enterEvent (QEvent*)
514 {
515   if (!mainFrame()->GroupConstructors->isEnabled())
516     ActivateThisDialog();
517 }
518
519 //=================================================================================
520 // function : TextValueChangedInSpinBox
521 // purpose  :
522 //=================================================================================
523 void TransformationGUI_MultiTranslationDlg::TextValueChangedInSpinBox( const QString& s)
524 {
525   QObject* send = (QObject*)sender();
526   bool isDigit = true;
527   
528   switch (getConstructorId()) {
529   case 0: 
530     GroupPoints->SpinBox_DX->text().toDouble(&isDigit);
531     if(!isDigit){
532       GroupPoints->CheckButton1->setChecked(false);
533     }
534     GroupPoints->CheckButton1->setEnabled(isDigit);
535     break;
536   case 1: 
537     if (send == GroupDimensions->SpinBox_DX1) {
538       GroupDimensions->SpinBox_DX1->text().toDouble(&isDigit);
539       if(!isDigit) 
540         GroupDimensions->CheckButton1->setChecked(false);
541       GroupDimensions->CheckButton1->setEnabled(isDigit);
542     }
543     else if(send == GroupDimensions->SpinBox_DX2){
544       GroupDimensions->SpinBox_DX2->text().toDouble(&isDigit);
545       if(!isDigit) 
546         GroupDimensions->CheckButton2->setChecked(false);
547       GroupDimensions->CheckButton2->setEnabled(isDigit);
548     }
549     break;
550   }
551 }
552
553 //=================================================================================
554 // function : ValueChangedInSpinBox()
555 // purpose  :
556 //=================================================================================
557 void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox (double newValue)
558 {
559   QObject* send = (QObject*)sender();
560   switch (getConstructorId()) {
561   case 0:
562     if (send == GroupPoints->SpinBox_DX)
563       myStepU = newValue;
564     else if (send == GroupPoints->SpinBox_DY)
565       myNbTimesU = (int)newValue;
566     break;
567   case 1:
568     if (send == GroupDimensions->SpinBox_DX1)
569       myStepU = newValue;
570     else if (send == GroupDimensions->SpinBox_DY1)
571       myNbTimesU = (int)newValue;
572     else if (send == GroupDimensions->SpinBox_DX2)
573       myStepV = newValue;
574     else if (send == GroupDimensions->SpinBox_DY2)
575       myNbTimesV = (int)newValue;
576     break;
577   }
578
579   displayPreview();
580 }
581
582 //=================================================================================
583 // function : ReverseStepU()
584 // purpose  : 'state' not used here
585 //=================================================================================
586 void TransformationGUI_MultiTranslationDlg::ReverseStepU()
587 {
588   myStepU = -myStepU;
589
590   int aConstructorId = getConstructorId();
591
592   if (aConstructorId == 0)
593     GroupPoints->SpinBox_DX->setValue(myStepU);
594   else if (aConstructorId == 1)
595     GroupDimensions->SpinBox_DX1->setValue(myStepU);
596
597   displayPreview();
598 }
599
600 //=================================================================================
601 // function : ReverseStepV
602 // purpose  : 'state' not used here
603 //=================================================================================
604 void TransformationGUI_MultiTranslationDlg::ReverseStepV()
605 {
606   myStepV = -myStepV;
607
608   GroupDimensions->SpinBox_DX2->setValue(myStepV);
609
610   displayPreview();
611 }
612
613 //=================================================================================
614 // function : createOperation
615 // purpose  :
616 //=================================================================================
617 GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperation()
618 {
619   return getGeomEngine()->GetITransformOperations(getStudyId());
620 }
621
622 //=================================================================================
623 // function : isValid
624 // purpose  :
625 //=================================================================================
626 bool TransformationGUI_MultiTranslationDlg::isValid (QString& msg)
627 {
628   int aConstructorId = getConstructorId();
629   
630   if (aConstructorId == 0) {
631     bool ok = true;
632     ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
633     ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
634     return !(myBase->_is_nil() || myVectorU->_is_nil()) && ok;
635   }
636   else if (aConstructorId == 1) {
637     bool ok = true;
638     ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok;
639     ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok;
640     ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok;
641     ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok;
642     return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil()) && ok;
643   }
644   return 0;
645 }
646
647 //=================================================================================
648 // function : execute
649 // purpose  :
650 //=================================================================================
651 bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
652 {
653   bool res = false;
654
655   GEOM::GEOM_Object_var anObj;
656
657   QStringList aParameters;
658
659   switch (getConstructorId()) {
660   case 0:
661     if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU)) {
662       anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
663         MultiTranslate1D(myBase, myVectorU, myStepU, myNbTimesU);
664       if(!IsPreview()) {
665         aParameters<<GroupPoints->SpinBox_DX->text();
666         aParameters<<GroupPoints->SpinBox_DY->text();
667       }
668       res = true;
669     }
670     break;
671   case 1:
672     if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU) &&
673         !CORBA::is_nil(myVectorV)) {
674       anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
675         MultiTranslate2D(myBase, myVectorU, myStepU, myNbTimesU,
676                           myVectorV, myStepV, myNbTimesV);
677       if(!IsPreview()) {
678         aParameters<<GroupDimensions->SpinBox_DX1->text();
679         aParameters<<GroupDimensions->SpinBox_DY1->text();
680         aParameters<<GroupDimensions->SpinBox_DX2->text();
681         aParameters<<GroupDimensions->SpinBox_DY2->text();
682       }
683       res = true;
684     }
685     break;
686   }
687
688   if (!anObj->_is_nil()) {
689     if(!IsPreview())
690       anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
691     objects.push_back(anObj._retn());
692   }
693
694   return res;
695 }
696
697 //=================================================================================
698 // function : addSubshapeToStudy
699 // purpose  : virtual method to add new SubObjects if local selection
700 //=================================================================================
701 void TransformationGUI_MultiTranslationDlg::addSubshapesToStudy()
702 {
703   QMap<QString, GEOM::GEOM_Object_var> objMap;
704
705   switch (getConstructorId()) {
706   case 0:
707     objMap[GroupPoints->LineEdit2->text()] = myVectorU;
708     break;
709   case 1:
710     objMap[GroupDimensions->LineEdit2->text()] = myVectorU;
711     objMap[GroupDimensions->LineEdit3->text()] = myVectorV;
712     break;
713   }
714   addSubshapesToFather(objMap);
715 }