Salome HOME
Update copyright information
[modules/geom.git] / src / TransformationGUI / TransformationGUI_RotationDlg.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_RotationDlg.cxx
24 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
25 //
26 #include "TransformationGUI_RotationDlg.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_RotationDlg()
49 // purpose  : Constructs a TransformationGUI_RotationDlg 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_RotationDlg::TransformationGUI_RotationDlg
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_ROTATION")));
61   QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
62   QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_ROTATION_THREE_POINTS")));
63
64   setWindowTitle(tr("GEOM_ROTATION_TITLE"));
65
66   /***************************************************************/
67   mainFrame()->GroupConstructors->setTitle(tr("GEOM_ROTATION"));
68   mainFrame()->RadioButton1->setIcon(image0);
69   mainFrame()->RadioButton2->setIcon(image2);
70   mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
71   mainFrame()->RadioButton3->close();
72
73   GroupPoints = new DlgRef_4Sel1Spin2Check(centralWidget());
74   GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
75   GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
76   GroupPoints->TextLabel2->setText(tr("GEOM_AXIS"));
77   GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE"));
78   GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg(1));
79   GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg(2));
80
81   GroupPoints->LineEdit1->setReadOnly(true);
82   GroupPoints->LineEdit2->setReadOnly(true);
83   GroupPoints->LineEdit4->setReadOnly(true);
84   GroupPoints->LineEdit5->setReadOnly(true);
85   GroupPoints->PushButton1->setIcon(image1);
86   GroupPoints->PushButton2->setIcon(image1);
87   GroupPoints->PushButton4->setIcon(image1);
88   GroupPoints->PushButton5->setIcon(image1);
89   GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY"));
90   GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE"));
91
92   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
93   layout->setMargin(0); layout->setSpacing(6);
94   layout->addWidget(GroupPoints);
95   /***************************************************************/
96
97   setHelpFileName("rotation_operation_page.html");
98
99   // Activate Create a Copy mode
100   GroupPoints->CheckButton1->setChecked(true);
101   CreateCopyModeChanged(true);
102
103   Init();
104 }
105
106 //=================================================================================
107 // function : ~TransformationGUI_RotationDlg()
108 // purpose  : Destroys the object and frees any allocated resources
109 //=================================================================================
110 TransformationGUI_RotationDlg::~TransformationGUI_RotationDlg()
111 {
112   // no need to delete child widgets, Qt does it all for us
113 }
114
115 //=================================================================================
116 // function : Init()
117 // purpose  :
118 //=================================================================================
119 void TransformationGUI_RotationDlg::Init()
120 {
121   double anAngle = 0;
122   double SpecificStep = 5;
123
124   // min, max, step and decimals for spin boxes & initial values
125   initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
126   GroupPoints->SpinBox_DX->setValue(anAngle);
127
128   // init variables
129   GroupPoints->LineEdit1->setText("");
130   GroupPoints->LineEdit2->setText("");
131   GroupPoints->LineEdit4->setText("");
132   GroupPoints->LineEdit5->setText("");
133
134   myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
135
136   mainFrame()->GroupBoxPublish->show();
137
138   // signals and slots connections
139   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
140   connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
141
142   connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
143
144   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
145   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
146   connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
147   connect(GroupPoints->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
148
149   connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
150   connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
151
152   connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
153
154   connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
155   connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
156
157   initName(tr("GEOM_ROTATION"));
158
159   ConstructorsClicked(0);
160 }
161
162 //=================================================================================
163 // function : ConstructorsClicked()
164 // purpose  : Radio button management
165 //=================================================================================
166 void TransformationGUI_RotationDlg::ConstructorsClicked (int constructorId)
167 {
168   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
169
170   switch (constructorId) {
171   case 0: // rotation an object angle and axis
172     {
173       GroupPoints->ShowRows(2, 3, false);
174       GroupPoints->TextLabel2->setText(tr("GEOM_AXIS"));
175       GroupPoints->LineEdit2->clear();
176       GroupPoints->ShowRows(4, 4, true);
177
178       myAxis = GEOM::GEOM_Object::_nil();
179
180       GroupPoints->PushButton1->click();
181     }
182     break;
183   case 1: // rotation an object by 3 points
184     {
185       GroupPoints->ShowRows(4, 4, false);
186       GroupPoints->ShowRows(2, 3, true);
187       GroupPoints->TextLabel2->setText(tr("GEOM_CENTRAL_POINT"));
188       GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg(1));
189       GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg(2));
190
191       GroupPoints->LineEdit2->clear();
192       GroupPoints->LineEdit4->clear();
193       GroupPoints->LineEdit5->clear();
194
195       myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
196
197       GroupPoints->PushButton1->click();
198     }
199     break;
200   }
201
202   qApp->processEvents();
203   updateGeometry();
204   resize(minimumSize());
205
206   if (myInitial) {
207     myInitial = false;
208     SelectionIntoArgument();
209   }
210   else {
211     displayPreview();
212   }
213 }
214
215 //=================================================================================
216 // function : ClickOnOk()
217 // purpose  :
218 //=================================================================================
219 void TransformationGUI_RotationDlg::ClickOnOk()
220 {
221   if (ClickOnApply())
222     ClickOnCancel();
223 }
224
225 //=================================================================================
226 // function : ClickOnApply()
227 // purpose  :
228 //=================================================================================
229 bool TransformationGUI_RotationDlg::ClickOnApply()
230 {
231   if (!onAccept(GroupPoints->CheckButton1->isChecked()))
232     return false;
233
234   initName();
235   // activate selection and connect selection manager
236   ConstructorsClicked(getConstructorId());
237   return true;
238 }
239
240 //=================================================================================
241 // function : SelectionIntoArgument()
242 // purpose  : Called when selection is changed or on dialog initialization or activation
243 //=================================================================================
244 void TransformationGUI_RotationDlg::SelectionIntoArgument()
245 {
246   erasePreview();
247   myEditCurrentArgument->setText("");
248
249   if (myEditCurrentArgument == GroupPoints->LineEdit1)
250     myObjects.length(0);
251   else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
252     myAxis = GEOM::GEOM_Object::_nil();
253   else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
254     myCentPoint = GEOM::GEOM_Object::_nil();
255   else if (myEditCurrentArgument == GroupPoints->LineEdit4)
256     myPoint1 = GEOM::GEOM_Object::_nil();
257   else if (myEditCurrentArgument == GroupPoints->LineEdit5)
258     myPoint2 = GEOM::GEOM_Object::_nil();
259
260   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
261   SALOME_ListIO aSelList;
262   aSelMgr->selectedObjects(aSelList);
263
264   QString aName;
265
266   if (myEditCurrentArgument == GroupPoints->LineEdit1) {
267     int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
268     if (aNbSel < 1)
269       return;
270
271     GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
272     if (!myObjects.length())
273       return;
274     else
275       myEditCurrentArgument->setText(aName);
276   }
277   else {
278     if (aSelList.Extent() != 1)
279       return;
280
281     // nbSel == 1
282     Standard_Boolean testResult = Standard_False;
283     GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
284
285     if (!testResult || CORBA::is_nil(aSelectedObject))
286       return;
287
288     aName = GEOMBase::GetName(aSelectedObject);
289
290     // Get Selected object if selected subshape
291     TopoDS_Shape aShape;
292     if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
293     {
294       TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
295       if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
296         aNeedType = TopAbs_EDGE;
297
298       TColStd_IndexedMapOfInteger aMap;
299       aSelMgr->GetIndexes(aSelList.First(), aMap);
300       if (aMap.Extent() == 1)
301       {
302         int anIndex = aMap(1);
303         if (aNeedType == TopAbs_EDGE)
304           aName += QString(":edge_%1").arg(anIndex);
305         else
306           aName += QString(":vertex_%1").arg(anIndex);
307
308         //Find SubShape Object in Father
309         GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
310
311         if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
312           GEOM::GEOM_IShapesOperations_var aShapesOp =
313             getGeomEngine()->GetIShapesOperations(getStudyId());
314           aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
315         }
316         else {
317           aSelectedObject = aFindedObject; // get Object from study
318         }
319       }
320       else // Global Selection
321       {
322         if (aShape.ShapeType() != aNeedType) {
323           aSelectedObject = GEOM::GEOM_Object::_nil();
324           aName = "";
325         }
326       }
327     }
328
329     myEditCurrentArgument->setText(aName);
330
331     if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) {
332       myAxis = aSelectedObject;
333       if (!myAxis->_is_nil() && !myObjects.length())
334         GroupPoints->PushButton1->click();
335     }
336     else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) {
337       myCentPoint = aSelectedObject;
338       if (!myCentPoint->_is_nil() && myPoint1->_is_nil())
339         GroupPoints->PushButton4->click();
340     }
341     else if (myEditCurrentArgument == GroupPoints->LineEdit4) {
342       myPoint1 = aSelectedObject;
343       if (!myPoint1->_is_nil() && myPoint2->_is_nil())
344         GroupPoints->PushButton5->click();
345     }
346     else if (myEditCurrentArgument == GroupPoints->LineEdit5) {
347       myPoint2 = aSelectedObject;
348       if (!myPoint2->_is_nil() && !myObjects.length())
349         GroupPoints->PushButton1->click();
350     }
351   }
352
353   // clear selection
354   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
355   myGeomGUI->getApp()->selectionMgr()->clearSelected();
356   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
357           this, SLOT(SelectionIntoArgument()));
358
359   displayPreview();
360 }
361
362 //=================================================================================
363 // function : SetEditCurrentArgument()
364 // purpose  :
365 //=================================================================================
366 void TransformationGUI_RotationDlg::SetEditCurrentArgument()
367 {
368   QPushButton* send = (QPushButton*)sender();
369
370   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
371   globalSelection();
372
373   if (send == GroupPoints->PushButton1) {
374     myEditCurrentArgument = GroupPoints->LineEdit1;
375
376     GroupPoints->PushButton2->setDown(false);
377     GroupPoints->LineEdit2->setEnabled(false);
378   }
379   else if (send == GroupPoints->PushButton2) {
380     myEditCurrentArgument = GroupPoints->LineEdit2;
381
382     GroupPoints->PushButton1->setDown(false);
383     GroupPoints->PushButton4->setDown(false);
384     GroupPoints->PushButton5->setDown(false);
385     GroupPoints->LineEdit1->setEnabled(false);
386     GroupPoints->LineEdit4->setEnabled(false);
387     GroupPoints->LineEdit5->setEnabled(false);
388
389     if (getConstructorId() == 0)
390       localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
391     else
392       localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
393   }
394   else if (send == GroupPoints->PushButton4) {
395     myEditCurrentArgument = GroupPoints->LineEdit4;
396
397     GroupPoints->PushButton1->setDown(false);
398     GroupPoints->PushButton2->setDown(false);
399     GroupPoints->PushButton5->setDown(false);
400     GroupPoints->LineEdit1->setEnabled(false);
401     GroupPoints->LineEdit2->setEnabled(false);
402     GroupPoints->LineEdit5->setEnabled(false);
403
404     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
405   }
406   else if (send == GroupPoints->PushButton5) {
407     myEditCurrentArgument = GroupPoints->LineEdit5;
408
409     GroupPoints->PushButton1->setDown(false);
410     GroupPoints->PushButton2->setDown(false);
411     GroupPoints->PushButton4->setDown(false);
412     GroupPoints->LineEdit1->setEnabled(false);
413     GroupPoints->LineEdit2->setEnabled(false);
414     GroupPoints->LineEdit4->setEnabled(false);
415
416     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
417   }
418   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
419           this, SLOT(SelectionIntoArgument()));
420
421   // enable line edit
422   myEditCurrentArgument->setEnabled(true);
423   myEditCurrentArgument->setFocus();
424   // after setFocus(), because it will be setDown(false) when loses focus
425   send->setDown(true);
426
427   // seems we need it only to avoid preview disappearing, caused by selection mode change
428   displayPreview();
429 }
430
431 //=================================================================================
432 // function : LineEditReturnPressed()
433 // purpose  :
434 //=================================================================================
435 void TransformationGUI_RotationDlg::LineEditReturnPressed()
436 {
437   QLineEdit* send = (QLineEdit*)sender();
438   if (send == GroupPoints->LineEdit1 ||
439       send == GroupPoints->LineEdit2) {
440     myEditCurrentArgument = send;
441     GEOMBase_Skeleton::LineEditReturnPressed();
442   }
443 }
444
445 //=================================================================================
446 // function : ActivateThisDialog()
447 // purpose  :
448 //=================================================================================
449 void TransformationGUI_RotationDlg::ActivateThisDialog()
450 {
451   GEOMBase_Skeleton::ActivateThisDialog();
452   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
453            this, SLOT( SelectionIntoArgument() ) );
454
455   ConstructorsClicked( getConstructorId() );
456 }
457
458 //=================================================================================
459 // function : enterEvent()
460 // purpose  :
461 //=================================================================================
462 void TransformationGUI_RotationDlg::enterEvent (QEvent*)
463 {
464   if (!mainFrame()->GroupConstructors->isEnabled())
465     ActivateThisDialog();
466 }
467
468 //=================================================================================
469 // function : ValueChangedInSpinBox()
470 // purpose  :
471 //=================================================================================
472 void TransformationGUI_RotationDlg::ValueChangedInSpinBox()
473 {
474   displayPreview();
475 }
476
477 //=================================================================================
478 // function : createOperation
479 // purpose  :
480 //=================================================================================
481 GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation()
482 {
483   return getGeomEngine()->GetITransformOperations(getStudyId());
484 }
485
486 //=================================================================================
487 // function : isValid
488 // purpose  :
489 //=================================================================================
490 bool TransformationGUI_RotationDlg::isValid (QString& /*msg*/)
491 {
492   if (myObjects.length() < 1) return false;
493
494   switch (getConstructorId()) {
495   case 0:
496     return !(myAxis->_is_nil());
497     break;
498   case 1:
499     return !(myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil());
500     break;
501   default:
502     break;
503   }
504   return false;
505 }
506
507 //=================================================================================
508 // function : execute
509 // purpose  :
510 //=================================================================================
511 bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
512 {
513   bool res = false;
514   bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
515
516   GEOM::GEOM_Object_var anObj;
517
518   switch (getConstructorId()) {
519   case 0:
520     {
521       if (toCreateCopy) {
522         for (int i = 0; i < myObjects.length(); i++) {
523           myCurrObject = myObjects[i];
524           anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
525             RotateCopy(myObjects[i], myAxis, GetAngle() * PI180);
526           if (!anObj->_is_nil())
527             objects.push_back(anObj._retn());
528         }
529       }
530       else {
531         for (int i = 0; i < myObjects.length(); i++) {
532           myCurrObject = myObjects[i];
533           anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
534             Rotate(myObjects[i], myAxis, GetAngle() * PI180);
535           if (!anObj->_is_nil())
536             objects.push_back(anObj._retn());
537         }
538       }
539       res = true;
540       break;
541     }
542   case 1:
543     {
544       if (toCreateCopy) {
545         for (int i = 0; i < myObjects.length(); i++) {
546           myCurrObject = myObjects[i];
547           anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
548             RotateThreePointsCopy(myObjects[i], myCentPoint, myPoint1, myPoint2);
549           if (!anObj->_is_nil())
550             objects.push_back(anObj._retn());
551         }
552       }
553       else {
554         for (int i = 0; i < myObjects.length(); i++) {
555           myCurrObject = myObjects[i];
556           anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
557             RotateThreePoints(myObjects[i], myCentPoint, myPoint1, myPoint2);
558           if (!anObj->_is_nil())
559             objects.push_back(anObj._retn());
560         }
561       }
562       res = true;
563       break;
564     }
565   }
566
567   return res;
568 }
569
570 //=================================================================================
571 // function : restoreSubShapes
572 // purpose  :
573 //=================================================================================
574 void TransformationGUI_RotationDlg::restoreSubShapes (SALOMEDS::Study_ptr   theStudy,
575                                                       SALOMEDS::SObject_ptr theSObject)
576 {
577   if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
578     // we pass here the first operation argument (object) through the list of arguments
579     // because the rotation operation place its arguments in the data structure in another order,
580     // and we need to point the first argument directly
581     GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO;
582     anArgs->length(1);
583     anArgs[0] = myCurrObject;
584     getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
585                                         /*theFindMethod=*/GEOM::FSM_Transformed,
586                                         /*theInheritFirstArg=*/true);
587   }
588 }
589
590 //=================================================================================
591 // function : GetAngle()
592 // purpose  :
593 //=================================================================================
594 double TransformationGUI_RotationDlg::GetAngle() const
595 {
596   return GroupPoints->SpinBox_DX->value();
597 }
598
599 //=================================================================================
600 // function :  CreateCopyModeChanged()
601 // purpose  :
602 //=================================================================================
603 void TransformationGUI_RotationDlg::CreateCopyModeChanged (bool isCreateCopy)
604 {
605   mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
606 }
607
608 //=================================================================================
609 // function :  onReverse()
610 // purpose  :
611 //=================================================================================
612 void TransformationGUI_RotationDlg::onReverse()
613 {
614   double anOldValue = GroupPoints->SpinBox_DX->value();
615   GroupPoints->SpinBox_DX->setValue(-anOldValue);
616 }
617
618 //=================================================================================
619 // function : addSubshapesToStudy
620 // purpose  : virtual method to add new SubObjects if local selection
621 //=================================================================================
622 void TransformationGUI_RotationDlg::addSubshapesToStudy()
623 {
624   bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
625   if (toCreateCopy) {
626     QMap<QString, GEOM::GEOM_Object_var> objMap;
627     switch (getConstructorId()) {
628     case 0:
629       objMap[GroupPoints->LineEdit2->text()] = myAxis;
630       break;
631     case 1:
632       objMap[GroupPoints->LineEdit2->text()] = myCentPoint;
633       objMap[GroupPoints->LineEdit4->text()] = myPoint1;
634       objMap[GroupPoints->LineEdit5->text()] = myPoint2;
635       break;
636     }
637     addSubshapesToFather(objMap);
638   }
639 }