]> SALOME platform Git repositories - modules/geom.git/blob - src/TransformationGUI/TransformationGUI_TranslationDlg.cxx
Salome HOME
Update copyright information
[modules/geom.git] / src / TransformationGUI / TransformationGUI_TranslationDlg.cxx
1 //  GEOM GEOMGUI : GUI for Geometry component
2 //
3 //  Copyright (C) 2003  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 //
23 //
24 //  File   : TransformationGUI_TranslationDlg.cxx
25 //  Author : Lucien PIGNOLONI
26 //  Module : GEOM
27 //  $Header$
28
29 #include "TransformationGUI_TranslationDlg.h"
30
31 #include "SUIT_Desktop.h"
32 #include "SUIT_Session.h"
33 #include "SalomeApp_Application.h"
34 #include "LightApp_SelectionMgr.h"
35
36 #include <TopoDS_Shape.hxx>
37 #include <TopoDS_Edge.hxx>
38 #include <TopoDS.hxx>
39 #include <TopExp.hxx>
40 #include <TColStd_IndexedMapOfInteger.hxx>
41 #include <TopTools_IndexedMapOfShape.hxx>
42
43 #include <qlabel.h>
44 #include <qcheckbox.h>
45 #include <qapplication.h>
46
47 #include "GEOMImpl_Types.hxx"
48
49 #include "utilities.h"
50
51 using namespace std;
52
53 //=================================================================================
54 // class    : TransformationGUI_TranslationDlg()
55 // purpose  : Constructs a TransformationGUI_TranslationDlg which is a child of 'parent', with the
56 //            name 'name' and widget flags set to 'f'.
57 //            The dialog will by default be modeless, unless you set 'modal' to
58 //            TRUE to construct a modal dialog.
59 //=================================================================================
60 TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg
61   (GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl)
62   : GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
63                       WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
64 {
65   SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
66   QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_DXYZ")));
67   QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_POINTS")));
68   QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_VECTOR")));
69   QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
70
71   setCaption(tr("GEOM_TRANSLATION_TITLE"));
72
73   /***************************************************************/
74   GroupConstructors->setTitle(tr("GEOM_TRANSLATION"));
75   RadioButton1->setPixmap(image0);
76   RadioButton2->setPixmap(image1);
77   RadioButton3->setPixmap(image2);
78
79   RadioButton1->setChecked(true);
80
81   GroupPoints = new DlgRef_3Sel3Spin2Check(this, "GroupPoints");
82   GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
83   GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
84   GroupPoints->TextLabel3->setText(tr("GEOM_POINT_I").arg("2"));
85   GroupPoints->TextLabel4->setText(tr("GEOM_DX"));
86   GroupPoints->TextLabel5->setText(tr("GEOM_DY"));
87   GroupPoints->TextLabel6->setText(tr("GEOM_DZ"));
88   GroupPoints->PushButton1->setPixmap(image3);
89   GroupPoints->PushButton2->setPixmap(image3);
90   GroupPoints->PushButton3->setPixmap(image3);
91   GroupPoints->CheckBox1->setText(tr("Activate Distance"));
92   GroupPoints->CheckBox2->setText(tr("GEOM_CREATE_COPY"));
93
94   Layout1->addWidget(GroupPoints, 2, 0);
95   /***************************************************************/
96
97   setHelpFileName("translation_operation_page.html");
98
99   Init();
100 }
101
102
103 //=================================================================================
104 // function : ~TransformationGUI_TranslationDlg()
105 // purpose  : Destroys the object and frees any allocated resources
106 //=================================================================================
107 TransformationGUI_TranslationDlg::~TransformationGUI_TranslationDlg()
108 {
109   // no need to delete child widgets, Qt does it all for us
110 }
111
112
113 //=================================================================================
114 // function : Init()
115 // purpose  :
116 //=================================================================================
117 void TransformationGUI_TranslationDlg::Init()
118 {
119   /* init variables */
120   myEditCurrentArgument = GroupPoints->LineEdit1;
121   GroupPoints->LineEdit1->setReadOnly(true);
122   GroupPoints->LineEdit2->setReadOnly(true);
123   GroupPoints->LineEdit3->setReadOnly(true);
124
125   myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
126
127   // Activate Create a Copy mode
128   GroupPoints->CheckBox2->setChecked(true);
129   CreateCopyModeChanged(true);
130
131   GroupBoxPublish->show();
132
133   /* Get setting of step value from file configuration */
134   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
135   double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
136
137   /* min, max, step and decimals for spin boxes & initial values */
138   GroupPoints->SpinBox1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
139   GroupPoints->SpinBox2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
140   GroupPoints->SpinBox3->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
141
142   GroupPoints->SpinBox1->SetValue(0.0);
143   GroupPoints->SpinBox2->SetValue(0.0);
144   GroupPoints->SpinBox3->SetValue(0.0);
145
146   /* signals and slots connections */
147   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
148   connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
149   connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
150
151   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
152   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
153   connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
154
155   connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); //@ Delete ?
156
157   connect(GroupPoints->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
158   connect(GroupPoints->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
159   connect(GroupPoints->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
160
161   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox1, SLOT(SetStep(double)));
162   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox2, SLOT(SetStep(double)));
163   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox3, SLOT(SetStep(double)));
164
165   connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(ActivateDistanceChanged(bool)));
166   connect(GroupPoints->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
167
168   connect(myGeomGUI->getApp()->selectionMgr(),
169           SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
170
171   initName( tr( "GEOM_TRANSLATION" ) );
172
173   ConstructorsClicked( 0 );
174
175 }
176
177
178 //=================================================================================
179 // function : ConstructorsClicked()
180 // purpose  : Radio button management
181 //=================================================================================
182 void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId)
183 {
184   erasePreview();
185   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
186
187   myEditCurrentArgument = GroupPoints->LineEdit1;
188   globalSelection();
189
190   switch (constructorId)
191     {
192     case 0: /* translation an object by dx, dy, dz */
193       {
194         GroupPoints->ShowRows(1,2,false);
195         GroupPoints->TextLabel6->setText(tr("GEOM_DZ"));
196         GroupPoints->CheckBox1->hide();
197         resize(0,0);
198         GroupPoints->ShowRows(3,5,true);
199         GroupPoints->SpinBox3->setEnabled(true);
200         break;
201       }
202     case 1: /* translation an object by 2 points */
203       {
204         GroupPoints->ShowRows(3,5,false);
205         GroupPoints->CheckBox1->hide();
206         GroupPoints->TextLabel6->setText(tr("GEOM_DZ"));
207         resize(0,0);
208         GroupPoints->ShowRows(0,2,true);
209         GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("1"));
210         GroupPoints->LineEdit2->clear();
211         GroupPoints->LineEdit3->clear();
212         GroupPoints->SpinBox3->setEnabled(true);
213         myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
214         break;
215       }
216     case 2: /* translation an object by vector */
217       {
218         GroupPoints->CheckBox1->show();
219         GroupPoints->TextLabel6->setText(tr("GEOM_DISTANCE"));
220         GroupPoints->ShowRows(2,4,false);
221         GroupPoints->SpinBox3->SetValue(0.0);
222         GroupPoints->SpinBox3->setEnabled(false);
223         resize(0,0);
224         GroupPoints->ShowRows(0,1,true);
225         GroupPoints->ShowRows(5,5,true);
226         GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
227         GroupPoints->LineEdit2->clear();
228         myVector = GEOM::GEOM_Object::_nil();
229         ActivateDistanceChanged(GroupPoints->CheckBox1->isChecked());
230         break;
231       }
232     }
233
234   myEditCurrentArgument->setFocus();
235   connect(myGeomGUI->getApp()->selectionMgr(),
236           SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
237
238   qApp->processEvents();
239   updateGeometry();
240   resize(minimumSize());
241 }
242
243
244 //=================================================================================
245 // function : ClickOnOk()
246 // purpose  :
247 //=================================================================================
248 void TransformationGUI_TranslationDlg::ClickOnOk()
249 {
250   if ( ClickOnApply() )
251     ClickOnCancel();
252 }
253
254
255 //=================================================================================
256 // function : ClickOnApply()
257 // purpose  :
258 //=================================================================================
259 bool TransformationGUI_TranslationDlg::ClickOnApply()
260 {
261   if ( !onAccept(GroupPoints->CheckBox2->isChecked()) )
262     return false;
263
264   initName();
265   return true;
266 }
267
268
269 //=================================================================================
270 // function : SelectionIntoArgument()
271 // purpose  : Called when selection as changed or other case
272 //=================================================================================
273 void TransformationGUI_TranslationDlg::SelectionIntoArgument()
274 {
275   myEditCurrentArgument->setText("");
276   QString aName;
277
278   if (myEditCurrentArgument == GroupPoints->LineEdit1)
279   {
280     int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName);
281
282     if (aNbSel < 1)
283     {
284       myObjects.length(0);
285       return;
286     }
287     GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects);
288     if (!myObjects.length())
289       return;
290   }
291   else
292   {
293     if (IObjectCount() != 1) {
294       if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
295         myPoint1 = GEOM::GEOM_Object::_nil();
296       else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
297         myVector = GEOM::GEOM_Object::_nil();
298       else if (myEditCurrentArgument == GroupPoints->LineEdit3)
299         myPoint2 = GEOM::GEOM_Object::_nil();
300       return;
301     }
302
303     Standard_Boolean testResult = Standard_False;
304     GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
305
306     if (!testResult || CORBA::is_nil( aSelectedObject ))
307       return;
308
309     TopoDS_Shape aShape;
310     aName = GEOMBase::GetName( aSelectedObject );
311     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
312     {
313       TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
314       if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
315         aNeedType = TopAbs_EDGE;
316
317       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
318       TColStd_IndexedMapOfInteger aMap;
319       aSelMgr->GetIndexes( firstIObject(), aMap );
320       if ( aMap.Extent() == 1 )
321       {
322         int anIndex = aMap( 1 );
323         if (aNeedType == TopAbs_EDGE)
324           aName += QString(":edge_%1").arg(anIndex);
325         else
326           aName += QString(":vertex_%1").arg(anIndex);
327
328         //Find SubShape Object in Father
329         GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
330
331         if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
332           GEOM::GEOM_IShapesOperations_var aShapesOp =
333             getGeomEngine()->GetIShapesOperations( getStudyId() );
334           aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
335         }
336         else
337           aSelectedObject = aFindedObject;
338       }
339       else // Global Selection
340       {
341         if (aShape.ShapeType() != aNeedType) {
342           aSelectedObject = GEOM::GEOM_Object::_nil();
343           aName = "";
344         }
345       }
346     }
347
348     if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
349       myPoint1 = aSelectedObject;
350     else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
351       myVector = aSelectedObject;
352     else if (myEditCurrentArgument == GroupPoints->LineEdit3)
353       myPoint2 = aSelectedObject;
354   }
355
356   myEditCurrentArgument->setText( aName );
357   displayPreview();
358 }
359
360
361 //=================================================================================
362 // function : LineEditReturnPressed()
363 // purpose  :
364 //=================================================================================
365 void TransformationGUI_TranslationDlg::LineEditReturnPressed()
366 {
367   QLineEdit* send = (QLineEdit*)sender();
368   if (send == GroupPoints->LineEdit1)
369   {
370     myEditCurrentArgument = send;
371     GEOMBase_Skeleton::LineEditReturnPressed();
372   }
373 }
374
375
376 //=================================================================================
377 // function : SetEditCurrentArgument()
378 // purpose  :
379 //=================================================================================
380 void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
381 {
382   QPushButton* send = (QPushButton*)sender();
383   globalSelection();
384
385   if (send == GroupPoints->PushButton1) {
386     myEditCurrentArgument = GroupPoints->LineEdit1;
387   }
388   else if (send == GroupPoints->PushButton2) {
389     myEditCurrentArgument = GroupPoints->LineEdit2;
390     if (getConstructorId() == 1)
391       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
392     else
393       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
394   }
395   else if (send == GroupPoints->PushButton3) {
396     myEditCurrentArgument = GroupPoints->LineEdit3;
397     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
398   }
399
400   myEditCurrentArgument->setFocus();
401   SelectionIntoArgument();
402 }
403
404
405 //=================================================================================
406 // function : ActivateThisDialog()
407 // purpose  :
408 //=================================================================================
409 void TransformationGUI_TranslationDlg::ActivateThisDialog()
410 {
411   GEOMBase_Skeleton::ActivateThisDialog();
412
413   connect(myGeomGUI->getApp()->selectionMgr(),
414           SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
415
416   ConstructorsClicked( getConstructorId() );
417 }
418
419
420 //=================================================================================
421 // function : enterEvent()
422 // purpose  :
423 //=================================================================================
424 void TransformationGUI_TranslationDlg::enterEvent(QEvent* e)
425 {
426   if (!GroupConstructors->isEnabled())
427     ActivateThisDialog();
428 }
429
430
431 //=================================================================================
432 // function : ValueChangedInSpinBox()
433 // purpose  :
434 //=================================================================================
435 void TransformationGUI_TranslationDlg::ValueChangedInSpinBox()
436 {
437   displayPreview();
438 }
439
440
441 //=================================================================================
442 // function : createOperation
443 // purpose  :
444 //=================================================================================
445 GEOM::GEOM_IOperations_ptr  TransformationGUI_TranslationDlg::createOperation()
446 {
447   return getGeomEngine()->GetITransformOperations( getStudyId() );
448 }
449
450
451 //=================================================================================
452 // function : isValid
453 // purpose  :
454 //=================================================================================
455 bool  TransformationGUI_TranslationDlg::isValid( QString& msg )
456 {
457   int aConstructorId = getConstructorId();
458
459   switch (aConstructorId)
460     {
461     case 0:
462       {
463         Handle(SALOME_InteractiveObject) IO = firstIObject();
464         Standard_Boolean testResult;
465         GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( IO, testResult );
466         if ( !testResult || anObject->_is_nil() )
467           return false;
468
469         return !(myObjects.length() == 0 );
470         break;
471       }
472     case 1:
473       {
474         return !(myObjects.length() == 0 || myPoint1->_is_nil() || myPoint2->_is_nil() );
475         break;
476       }
477     case 2:
478       {
479         return !(myObjects.length() == 0 || myVector->_is_nil());
480         break;
481       }
482     default: return false;
483     }
484 }
485
486 //=================================================================================
487 // function : execute
488 // purpose  :
489 //=================================================================================
490 bool TransformationGUI_TranslationDlg::execute( ObjectList& objects )
491 {
492   bool res = false;
493   bool toCreateCopy = IsPreview() || GroupPoints->CheckBox2->isChecked();
494
495   GEOM::GEOM_Object_var anObj;
496
497   switch ( getConstructorId() )
498     {
499     case 0:
500       {
501         double dx = GroupPoints->SpinBox1->GetValue();
502         double dy = GroupPoints->SpinBox2->GetValue();
503         double dz = GroupPoints->SpinBox3->GetValue();
504         
505         if (toCreateCopy)
506           for (int i = 0; i < myObjects.length(); i++)
507             {
508               myCurrObject = myObjects[i];
509               anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
510                 TranslateDXDYDZCopy( myObjects[i], dx, dy, dz );
511               if ( !anObj->_is_nil() )
512                 objects.push_back( anObj._retn() );
513             }
514         else
515           for (int i = 0; i < myObjects.length(); i++)
516             {
517               myCurrObject = myObjects[i];
518               anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
519                 TranslateDXDYDZ( myObjects[i], dx, dy, dz );
520               if ( !anObj->_is_nil() )
521                 objects.push_back( anObj._retn() );
522             }
523         res = true;
524         break;
525       }
526     case 1:
527       {
528         if (toCreateCopy)
529           for (int i = 0; i < myObjects.length(); i++)
530             {
531               myCurrObject = myObjects[i];
532               anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
533                 TranslateTwoPointsCopy( myObjects[i], myPoint1, myPoint2 );
534               if ( !anObj->_is_nil() )
535                 objects.push_back( anObj._retn() );
536             }
537         else
538           for (int i = 0; i < myObjects.length(); i++)
539             {
540               myCurrObject = myObjects[i];
541               anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
542                 TranslateTwoPoints( myObjects[i], myPoint1, myPoint2 ); 
543               if ( !anObj->_is_nil() )
544                 objects.push_back( anObj._retn() );
545             }
546         res = true;
547         break;
548       }
549     case 2:
550       {
551         bool byDistance = GroupPoints->CheckBox1->isChecked();
552         if (byDistance) {
553           double aDistance = GroupPoints->SpinBox3->GetValue();
554           for (int i = 0; i < myObjects.length(); i++) {
555             myCurrObject = myObjects[i];
556             anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
557               TranslateVectorDistance( myObjects[i], myVector, aDistance, toCreateCopy );
558             if ( !anObj->_is_nil() )
559               objects.push_back( anObj._retn() );
560           }
561         }
562         else {
563           if (toCreateCopy)
564             for (int i = 0; i < myObjects.length(); i++)
565               {
566                 myCurrObject = myObjects[i];
567                 anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
568                   TranslateVectorCopy( myObjects[i], myVector );
569                 if ( !anObj->_is_nil() )
570                   objects.push_back( anObj._retn() );
571                 
572               }
573           else
574             for (int i = 0; i < myObjects.length(); i++)
575               {
576                 myCurrObject = myObjects[i];
577                 anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
578                   TranslateVector( myObjects[i], myVector );
579                 if ( !anObj->_is_nil() )
580                   objects.push_back( anObj._retn() );
581               }
582         }
583         res = true;
584         break;
585       }
586     }
587   return res;
588 }
589
590 //=================================================================================
591 // function : restoreSubShapes
592 // purpose  :
593 //=================================================================================
594 void TransformationGUI_TranslationDlg::restoreSubShapes (SALOMEDS::Study_ptr   theStudy,
595                                                          SALOMEDS::SObject_ptr theSObject)
596 {
597   if (CheckBoxRestoreSS->isChecked()) {
598     // we pass here the first operation argument (object) through the list of arguments
599     // because the rotation operation place its arguments in the data structure in another order,
600     // and we need to point the first argument directly
601     GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO;
602     anArgs->length(1);
603     anArgs[0] = myCurrObject;
604     getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
605                                         /*theFindMethod=*/GEOM::FSM_Transformed,
606                                         /*theInheritFirstArg=*/true);
607   }
608 }
609
610 //=================================================================================
611 // function :  CreateCopyModeChanged()
612 // purpose  :
613 //=================================================================================
614 void TransformationGUI_TranslationDlg::CreateCopyModeChanged(bool isCreateCopy)
615 {
616   GroupBoxName->setEnabled(isCreateCopy);
617 }
618
619 //=================================================================================
620 // function :  ActivateDistanceChanged()
621 // purpose  :
622 //=================================================================================
623 void TransformationGUI_TranslationDlg::ActivateDistanceChanged(bool theEnable)
624 {
625   GroupPoints->SpinBox3->setEnabled(theEnable);
626   displayPreview();
627 }
628
629 //=================================================================================
630 // function : addSubshapeToStudy
631 // purpose  : virtual method to add new SubObjects if local selection
632 //=================================================================================
633 void TransformationGUI_TranslationDlg::addSubshapesToStudy()
634 {
635   bool toCreateCopy = IsPreview() || GroupPoints->CheckBox2->isChecked();
636   if (toCreateCopy) {
637     QMap<QString, GEOM::GEOM_Object_var> objMap;
638
639     switch (getConstructorId())
640       {
641       case 0:
642         return;
643       case 1:
644         objMap[GroupPoints->LineEdit2->text()] = myPoint1;
645         objMap[GroupPoints->LineEdit3->text()] = myPoint2;
646         break;
647       case 2:
648         objMap[GroupPoints->LineEdit2->text()] = myVector;
649         break;
650       }
651     addSubshapesToFather( objMap );
652   }
653 }