Salome HOME
corrections for improvement 0019827: EDF 736 GEOM
[modules/geom.git] / src / TransformationGUI / TransformationGUI_PositionDlg.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 // File   : TransformationGUI_PositionDlg.cxx
23 // Author : Damien COQUERET, Open CASCADE S.A.S.
24 //
25
26 #include "TransformationGUI_PositionDlg.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 #include <TColStd_IndexedMapOfInteger.hxx>
37
38 // OCCT Includes
39 #include <TColStd_MapOfInteger.hxx>
40
41 #include <GEOMImpl_Types.hxx>
42
43 //=================================================================================
44 // class    : TransformationGUI_PositionDlg()
45 // purpose  : Constructs a TransformationGUI_PositionDlg which is a child of 'parent', with the
46 //            name 'name' and widget flags set to 'f'.
47 //            The dialog will by default be modeless, unless you set 'modal' to
48 //            TRUE to construct a modal dialog.
49 //=================================================================================
50 TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
51 (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
52   : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
53     myInitial(true)
54 {
55   SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
56   QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POSITION")));
57   QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POSITION2")));
58   QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POSITION3")));
59   QPixmap imageselect (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
60
61   setWindowTitle(tr("GEOM_POSITION_TITLE"));
62
63   /***************************************************************/
64   mainFrame()->GroupConstructors->setTitle(tr("GEOM_POSITION"));
65   mainFrame()->RadioButton1->setIcon(image0);
66   mainFrame()->RadioButton2->setIcon(image1);
67   mainFrame()->RadioButton3->setIcon(image2);
68
69   Group1 = new DlgRef_4Sel1Spin2Check(centralWidget());
70   Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
71   Group1->TextLabel1->setText(tr("GEOM_OBJECTS"));
72   Group1->TextLabel2->setText(tr("GEOM_START_LCS"));
73   Group1->TextLabel3->setText(tr("GEOM_DISTANCE"));
74   Group1->TextLabel4->setText(tr("GEOM_END_LCS"));
75   Group1->TextLabel5->setText(tr("GEOM_PATH_OBJECT"));
76   Group1->PushButton1->setIcon(imageselect);
77   Group1->PushButton2->setIcon(imageselect);
78   Group1->PushButton4->setIcon(imageselect);
79   Group1->PushButton5->setIcon(imageselect);
80   Group1->CheckButton1->setText(tr("GEOM_CREATE_COPY"));
81   Group1->CheckButton2->setText(tr("SELECT_UNPUBLISHED_EDGES"));
82
83   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
84   layout->setMargin(0); layout->setSpacing(6);
85   layout->addWidget(Group1);
86   /***************************************************************/
87
88   setHelpFileName("modify_location_operation_page.html");
89
90   // Activate Create a Copy mode
91   Group1->CheckButton1->setChecked(true);
92   Group1->CheckButton1->setChecked(false);
93   CreateCopyModeChanged(true);
94
95   Init();
96 }
97
98 //=================================================================================
99 // function : ~TransformationGUI_PositionDlg()
100 // purpose  : Destroys the object and frees any allocated resources
101 //=================================================================================
102 TransformationGUI_PositionDlg::~TransformationGUI_PositionDlg()
103 {
104   // no need to delete child widgets, Qt does it all for us
105 }
106
107 //=================================================================================
108 // function : Init()
109 // purpose  :
110 //=================================================================================
111 void TransformationGUI_PositionDlg::Init()
112 {
113   // init variables
114   Group1->LineEdit1->setReadOnly(true);
115   Group1->LineEdit2->setReadOnly(true);
116   Group1->LineEdit4->setReadOnly(true);
117   Group1->LineEdit5->setReadOnly(true);
118
119   Group1->LineEdit1->setText("");
120   Group1->LineEdit2->setText("");
121   Group1->LineEdit4->setText("");
122   Group1->LineEdit5->setText("");
123
124   initSpinBox(Group1->SpinBox_DX, 0, 1, 0.05, 6); // VSR:TODO : DBL_DIGITS_DISPLAY
125   Group1->SpinBox_DX->setValue(1);
126
127   Group1->CheckButton2->setEnabled(false);
128
129   myStartLCS = myEndLCS = GEOM::GEOM_Object::_nil();
130
131   mainFrame()->GroupBoxPublish->show();
132
133   // signals and slots connections
134   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
135   connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
136
137   connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
138
139   connect(Group1->PushButton1, SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
140   connect(Group1->PushButton2, SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
141   connect(Group1->PushButton4, SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
142   connect(Group1->PushButton5, SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
143
144   connect(Group1->LineEdit1,   SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
145   connect(Group1->LineEdit2,   SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
146   connect(Group1->LineEdit4,   SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
147   connect(Group1->LineEdit5,   SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
148
149   connect(Group1->CheckButton1,   SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
150   connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
151
152   connect(Group1->CheckButton2,   SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked()));
153
154   initName(tr("GEOM_POSITION"));
155
156   ConstructorsClicked(0);
157 }
158
159 //=================================================================================
160 // function : ConstructorsClicked()
161 // purpose  : Radio button management
162 //=================================================================================
163 void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId)
164 {
165   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
166
167   Group1->LineEdit2->clear();
168   Group1->LineEdit4->clear();
169   Group1->LineEdit5->clear();
170   myStartLCS = GEOM::GEOM_Object::_nil();
171   myEndLCS = GEOM::GEOM_Object::_nil();
172   myPath = GEOM::GEOM_Object::_nil();
173
174   switch (constructorId) {
175   case 0:
176     {
177       Group1->LineEdit2->hide();
178       Group1->TextLabel2->hide();
179       Group1->PushButton2->hide();
180
181       Group1->LineEdit5->hide();
182       Group1->TextLabel5->hide();
183       Group1->PushButton5->hide();
184
185       Group1->SpinBox_DX->hide();
186       Group1->TextLabel3->hide();
187
188       Group1->LineEdit4->show();
189       Group1->TextLabel4->show();
190       Group1->PushButton4->show();
191
192       Group1->PushButton1->click();
193
194       Group1->CheckButton2->hide();
195     }
196     break;
197   case 1:
198     {
199       Group1->LineEdit2->show();
200       Group1->TextLabel2->show();
201       Group1->PushButton2->show();
202
203       Group1->LineEdit5->hide();
204       Group1->TextLabel5->hide();
205       Group1->PushButton5->hide();
206
207       Group1->SpinBox_DX->hide();
208       Group1->TextLabel3->hide();
209
210       Group1->PushButton1->click();
211
212       Group1->CheckButton2->hide();
213     }
214     break;
215   case 2:
216     {
217       Group1->LineEdit4->hide();
218       Group1->TextLabel4->hide();
219       Group1->PushButton4->hide();
220
221       Group1->LineEdit2->hide();
222       Group1->TextLabel2->hide();
223       Group1->PushButton2->hide();
224
225       Group1->LineEdit5->show();
226       Group1->TextLabel5->show();
227       Group1->PushButton5->show();
228
229       Group1->SpinBox_DX->show();
230       Group1->TextLabel3->show();
231
232       Group1->PushButton1->click();
233
234       Group1->CheckButton2->show();
235     }
236     break;
237   }
238
239   qApp->processEvents();
240   updateGeometry();
241   resize(minimumSize());
242
243   if (myInitial) {
244     myInitial = false;
245     SelectionIntoArgument();
246   }
247   else {
248     displayPreview();
249   }
250 }
251
252 //=================================================================================
253 // function : SelectionBittonClicked()
254 // purpose  : Selection type Radio button management
255 //=================================================================================
256 void TransformationGUI_PositionDlg::SelectionTypeButtonClicked()
257 {
258   if ( Group1->CheckButton2->isChecked() ) {
259     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
260   } else {
261     TColStd_MapOfInteger aMap;
262     aMap.Add(GEOM_WIRE);
263     aMap.Add(GEOM_LINE);
264     globalSelection(aMap);
265   }
266 }
267
268 //=================================================================================
269 // function : ValueChangedInSpinBox()
270 // purpose  :
271 //=================================================================================
272 void TransformationGUI_PositionDlg::ValueChangedInSpinBox()
273 {
274   displayPreview();
275 }
276
277 //=================================================================================
278 // function : ClickOnOk()
279 // purpose  :
280 //=================================================================================
281 void TransformationGUI_PositionDlg::ClickOnOk()
282 {
283   if (ClickOnApply())
284     ClickOnCancel();
285 }
286
287 //=================================================================================
288 // function : ClickOnApply()
289 // purpose  :
290 //=================================================================================
291 bool TransformationGUI_PositionDlg::ClickOnApply()
292 {
293   if (!onAccept(Group1->CheckButton1->isChecked()))
294     return false;
295
296   initName();
297   // activate selection and connect selection manager
298   ConstructorsClicked(getConstructorId());
299   return true;
300 }
301
302 //=================================================================================
303 // function : SelectionIntoArgument()
304 // purpose  : Called when selection is changed or on dialog initialization or activation
305 //=================================================================================
306 void TransformationGUI_PositionDlg::SelectionIntoArgument()
307 {
308   erasePreview();
309   myEditCurrentArgument->setText("");
310
311   if (myEditCurrentArgument == Group1->LineEdit1)
312     myObjects.length(0);
313   else if (myEditCurrentArgument == Group1->LineEdit2)
314     myStartLCS = GEOM::GEOM_Object::_nil();
315   else if (myEditCurrentArgument == Group1->LineEdit4)
316     myEndLCS = GEOM::GEOM_Object::_nil();
317   else if (myEditCurrentArgument == Group1->LineEdit5)
318     myPath = GEOM::GEOM_Object::_nil();
319
320   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
321   SALOME_ListIO aSelList;
322   aSelMgr->selectedObjects(aSelList);
323
324   QString aName;
325
326   if (myEditCurrentArgument == Group1->LineEdit1) {
327     int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
328     if (aNbSel < 1)
329       return;
330
331     GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
332     if (!myObjects.length())
333       return;
334     else
335       myEditCurrentArgument->setText(aName);
336   }
337   else if (myEditCurrentArgument == Group1->LineEdit2) {
338     if (aSelList.Extent() != 1)
339       return;
340
341     // nbSel == 1
342     Standard_Boolean testResult = Standard_False;
343     myStartLCS = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
344     if (!testResult || CORBA::is_nil(myStartLCS))
345       return;
346
347     aName = GEOMBase::GetName(myStartLCS);
348     myEditCurrentArgument->setText(aName);
349
350     if (!myStartLCS->_is_nil() && myEndLCS->_is_nil())
351       Group1->PushButton4->click();
352   }
353   else if (myEditCurrentArgument == Group1->LineEdit4) {
354     myEndLCS = GEOM::GEOM_Object::_nil();
355     if (aSelList.Extent() != 1)
356       return;
357
358     Standard_Boolean testResult = Standard_False;
359     myEndLCS = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
360     if (!testResult || CORBA::is_nil(myEndLCS))
361       return;
362
363     aName = GEOMBase::GetName(myEndLCS);
364     myEditCurrentArgument->setText(aName);
365
366     if (!myEndLCS->_is_nil() && !myObjects.length() && getConstructorId() != 2)
367       Group1->PushButton1->click();
368     else if (getConstructorId() == 2 && !myObjects.length())
369       Group1->PushButton5->click();
370   }
371   else if (myEditCurrentArgument == Group1->LineEdit5) {
372     myPath = GEOM::GEOM_Object::_nil();
373     if (aSelList.Extent() != 1)
374       return;
375
376     Standard_Boolean testResult = Standard_False;
377     GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
378     if (!testResult || aSelectedObject->_is_nil())
379       return;
380
381     aName = GEOMBase::GetName(myPath);
382     // Local Selection
383     TopoDS_Shape S;
384     if (!GEOMBase::GetShape(aSelectedObject, S))
385       return;
386     
387     TColStd_IndexedMapOfInteger aMap;
388     aSelMgr->GetIndexes(aSelList.First(), aMap);
389     aName = GEOMBase::GetName(aSelectedObject);
390     if (aMap.Extent() == 1) {
391       int anIndex = aMap(1);
392       aName.append(":edge_" + QString::number(anIndex));
393       
394       //Find SubShape Object in Father
395       GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
396       
397       if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
398         GEOM::GEOM_IShapesOperations_var aShapesOp =
399           getGeomEngine()->GetIShapesOperations(getStudyId());
400         aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
401       }
402       else { // get Object from study
403         aSelectedObject = aFindedObject;
404       }
405     }
406     else {
407       if (S.ShapeType() != TopAbs_EDGE && S.ShapeType() != TopAbs_WIRE) {
408         aSelectedObject = GEOM::GEOM_Object::_nil();
409         aName = "";
410         return;
411       }
412     }
413     
414     myEditCurrentArgument->setText(aName);
415     myPath = aSelectedObject;
416   }
417
418   // clear selection
419   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
420   myGeomGUI->getApp()->selectionMgr()->clearSelected();
421   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
422           this, SLOT(SelectionIntoArgument()));
423
424   displayPreview();
425 }
426
427 //=================================================================================
428 // function : SetEditCurrentArgument()
429 // purpose  :
430 //=================================================================================
431 void TransformationGUI_PositionDlg::SetEditCurrentArgument()
432 {
433   QPushButton* send = (QPushButton*)sender();
434
435   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
436   if (send == Group1->PushButton1) {
437     myEditCurrentArgument = Group1->LineEdit1;
438
439     globalSelection();
440
441     Group1->PushButton2->setDown(false);
442     Group1->PushButton4->setDown(false);
443     Group1->PushButton5->setDown(false);
444     Group1->LineEdit2->setEnabled(false);
445     Group1->LineEdit4->setEnabled(false);
446     Group1->LineEdit5->setEnabled(false);
447
448     Group1->CheckButton2->setEnabled(false);
449   }
450   else if (send == Group1->PushButton2) {
451     myEditCurrentArgument = Group1->LineEdit2;
452
453     TColStd_MapOfInteger aMap;
454     aMap.Add(GEOM_PLANE);
455     aMap.Add(GEOM_MARKER);
456     globalSelection(aMap);
457
458     Group1->PushButton1->setDown(false);
459     Group1->PushButton4->setDown(false);
460     Group1->PushButton5->setDown(false);
461     Group1->LineEdit1->setEnabled(false);
462     Group1->LineEdit4->setEnabled(false);
463     Group1->LineEdit5->setEnabled(false);
464
465     Group1->CheckButton2->setEnabled(false);
466   }
467   else if (send == Group1->PushButton4) {
468     myEditCurrentArgument = Group1->LineEdit4;
469
470     TColStd_MapOfInteger aMap;
471     aMap.Add(GEOM_PLANE);
472     aMap.Add(GEOM_MARKER);
473     globalSelection(aMap);
474
475     Group1->PushButton1->setDown(false);
476     Group1->PushButton2->setDown(false);
477     Group1->PushButton5->setDown(false);
478     Group1->LineEdit1->setEnabled(false);
479     Group1->LineEdit2->setEnabled(false);
480     Group1->LineEdit5->setEnabled(false);
481
482     Group1->CheckButton2->setEnabled(false);
483   }
484   else if (send == Group1->PushButton5) {
485     myEditCurrentArgument = Group1->LineEdit5;
486
487     Group1->CheckButton2->setEnabled(true);
488
489     if ( Group1->CheckButton2->isChecked() ) {
490       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
491     } else {
492       TColStd_MapOfInteger aMap;
493       aMap.Add(GEOM_WIRE);
494       aMap.Add(GEOM_LINE);
495       globalSelection(aMap);
496     }
497
498     Group1->PushButton1->setDown(false);
499     Group1->PushButton2->setDown(false);
500     Group1->PushButton4->setDown(false);
501     Group1->LineEdit1->setEnabled(false);
502     Group1->LineEdit2->setEnabled(false);
503     Group1->LineEdit4->setEnabled(false);
504   }
505   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
506           this, SLOT(SelectionIntoArgument()));
507
508   // enable line edit
509   myEditCurrentArgument->setEnabled(true);
510   myEditCurrentArgument->setFocus();
511   // after setFocus(), because it will be setDown(false) when loses focus
512   send->setDown(true);
513
514   // seems we need it only to avoid preview disappearing, caused by selection mode change
515   displayPreview();
516 }
517
518 //=================================================================================
519 // function : LineEditReturnPressed()
520 // purpose  :
521 //=================================================================================
522 void TransformationGUI_PositionDlg::LineEditReturnPressed()
523 {
524   QLineEdit* send = (QLineEdit*)sender();
525   if (send == Group1->LineEdit1 ||
526       send == Group1->LineEdit2 ||
527       send == Group1->LineEdit4 ||
528       send == Group1->LineEdit5 ) {
529     myEditCurrentArgument = send;
530     GEOMBase_Skeleton::LineEditReturnPressed();
531   }
532
533   if (send == Group1->LineEdit5)
534     Group1->CheckButton2->setEnabled(true);
535   else
536     Group1->CheckButton2->setEnabled(false);
537 }
538
539 //=================================================================================
540 // function : ActivateThisDialog()
541 // purpose  :
542 //=================================================================================
543 void TransformationGUI_PositionDlg::ActivateThisDialog()
544 {
545   GEOMBase_Skeleton::ActivateThisDialog();
546
547   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
548            this, SLOT( SelectionIntoArgument() ) );
549
550   ConstructorsClicked( getConstructorId() );
551 }
552
553 //=================================================================================
554 // function : enterEvent()
555 // purpose  : when mouse enter onto the QWidget
556 //=================================================================================
557 void TransformationGUI_PositionDlg::enterEvent (QEvent*)
558 {
559   if (!mainFrame()->GroupConstructors->isEnabled())
560     ActivateThisDialog();
561 }
562
563 //=================================================================================
564 // function : createOperation
565 // purpose  :
566 //=================================================================================
567 GEOM::GEOM_IOperations_ptr TransformationGUI_PositionDlg::createOperation()
568 {
569   return getGeomEngine()->GetITransformOperations(getStudyId());
570 }
571
572 //=================================================================================
573 // function : isValid
574 // purpose  :
575 //=================================================================================
576 bool TransformationGUI_PositionDlg::isValid (QString& /*msg*/)
577 {
578   bool res;
579   if (getConstructorId() == 0)
580     res = !(myObjects.length() == 0 || myEndLCS->_is_nil());
581   else if ( getConstructorId() == 1 )
582     res = !(myObjects.length() == 0 || myStartLCS->_is_nil() || myEndLCS->_is_nil());
583   else if ( getConstructorId() == 2 )
584     res = !(myObjects.length() == 0 || myPath->_is_nil());
585
586   return res;
587 }
588
589 //=================================================================================
590 // function : execute
591 // purpose  :
592 //=================================================================================
593 bool TransformationGUI_PositionDlg::execute (ObjectList& objects)
594 {
595   bool res = false;
596   bool toCreateCopy = IsPreview() || Group1->CheckButton1->isChecked();
597   GEOM::GEOM_Object_var anObj;
598
599   switch (getConstructorId()) {
600   case 0:
601     {
602       for (int i = 0; i < myObjects.length(); i++) {
603         if (toCreateCopy)
604           anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
605             PositionShapeCopy(myObjects[i], myObjects[i], myEndLCS);
606         else
607           anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
608             PositionShape(myObjects[i], myObjects[i], myEndLCS);
609
610         if (!anObj->_is_nil())
611           objects.push_back(anObj._retn());
612       }
613       res = true;
614       break;
615     }
616   case 1:
617     {
618       for (int i = 0; i < myObjects.length(); i++) {
619         if (toCreateCopy)
620           anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
621             PositionShapeCopy(myObjects[i], myStartLCS, myEndLCS);
622         else
623           anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
624             PositionShape(myObjects[i], myStartLCS, myEndLCS);
625         if (!anObj->_is_nil())
626           objects.push_back(anObj._retn());
627       }
628       res = true;
629       break;
630     }
631   case 2:
632     {
633       double aDistance = Group1->SpinBox_DX->value();
634       for (int i = 0; i < myObjects.length(); i++) {
635         anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
636           PositionAlongPath(myObjects[i], myPath, aDistance, toCreateCopy);
637         if (!anObj->_is_nil())
638           objects.push_back(anObj._retn());
639       }
640       res = true;
641       break;
642     }
643   }
644
645   return res;
646 }
647
648 //=================================================================================
649 // function : restoreSubShapes
650 // purpose  :
651 //=================================================================================
652 void TransformationGUI_PositionDlg::restoreSubShapes (SALOMEDS::Study_ptr   theStudy,
653                                                       SALOMEDS::SObject_ptr theSObject)
654 {
655   if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
656     // empty list of arguments means that all arguments should be restored
657     getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
658                                         /*theFindMethod=*/GEOM::FSM_Transformed,
659                                         /*theInheritFirstArg=*/true);
660   }
661 }
662
663 //=================================================================================
664 // function :  CreateCopyModeChanged()
665 // purpose  :
666 //=================================================================================
667 void TransformationGUI_PositionDlg::CreateCopyModeChanged (bool isCreateCopy)
668 {
669   mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
670 }
671
672 //=================================================================================
673 // function : addSubshapeToStudy
674 // purpose  : virtual method to add new SubObjects if local selection
675 //=================================================================================
676 void TransformationGUI_PositionDlg::addSubshapesToStudy()
677 {
678   QMap<QString, GEOM::GEOM_Object_var> objMap;
679
680   objMap[Group1->LineEdit5->text()] = myPath;
681
682   addSubshapesToFather(objMap);
683 }