Salome HOME
Preparation of intermediate revision
[modules/geom.git] / src / TransformationGUI / TransformationGUI_MultiRotationDlg.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_MultiRotationDlg.cxx
24 // Author : Damien COQUERET, Open CASCADE S.A.S.
25 //
26 #include "TransformationGUI_MultiRotationDlg.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 <SalomeApp_Notebook.h>
36 #include <LightApp_SelectionMgr.h>
37
38 // OCCT Includes
39 #include <TopoDS_Shape.hxx>
40 #include <TopoDS_Edge.hxx>
41 #include <TopoDS.hxx>
42 #include <TopExp.hxx>
43 #include <TColStd_IndexedMapOfInteger.hxx>
44 #include <TopTools_IndexedMapOfShape.hxx>
45
46 #include <GEOMImpl_Types.hxx>
47
48 //=================================================================================
49 // class    : TransformationGUI_MultiRotationDlg()
50 // purpose  : Constructs a TransformationGUI_MultiRotationDlg which is a child of 'parent', with the
51 //            name 'name' and widget flags set to 'f'.
52 //            The dialog will by default be modeless, unless you set 'modal' to
53 //            TRUE to construct a modal dialog.
54 //=================================================================================
55 TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
56 (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
57   : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
58     myInitial(true)
59 {
60   SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
61   QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTIROTATION_SIMPLE")));
62   QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTIROTATION_DOUBLE")));
63   QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
64
65   setWindowTitle(tr("GEOM_MULTIROTATION_TITLE"));
66
67   /***************************************************************/
68   mainFrame()->GroupConstructors->setTitle(tr("GEOM_MULTIROTATION"));
69   mainFrame()->RadioButton1->setIcon(image0);
70   mainFrame()->RadioButton2->setIcon(image1);
71   mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
72   mainFrame()->RadioButton3->close();
73
74   GroupPoints = new DlgRef_2Sel1SpinInt(centralWidget());
75   GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_SIMPLE"));
76   GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
77   GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
78   GroupPoints->TextLabel3->setText(tr("GEOM_NB_TIMES"));
79   GroupPoints->PushButton1->setIcon(image2);
80   GroupPoints->PushButton2->setIcon(image2);
81   GroupPoints->LineEdit1->setReadOnly(true);
82   GroupPoints->LineEdit2->setReadOnly(true);
83
84   GroupDimensions = new DlgRef_2Sel4Spin1Check(centralWidget());
85   GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_DOUBLE"));
86   GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
87   GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR"));
88   GroupDimensions->TextLabel3->setText(tr("GEOM_ANGLE"));
89   GroupDimensions->TextLabel4->setText(tr("GEOM_NB_TIMES"));
90   GroupDimensions->TextLabel5->setText(tr("GEOM_STEP"));
91   GroupDimensions->TextLabel6->setText(tr("GEOM_NB_TIMES"));
92   GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE"));
93   GroupDimensions->PushButton1->setIcon(image2);
94   GroupDimensions->PushButton2->setIcon(image2);
95   GroupDimensions->LineEdit1->setReadOnly(true);
96   GroupDimensions->LineEdit2->setReadOnly(true);
97
98   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
99   layout->setMargin(0); layout->setSpacing(6);
100   layout->addWidget(GroupPoints);
101   layout->addWidget(GroupDimensions);
102   /***************************************************************/
103
104   setHelpFileName("multi_rotation_operation_page.html");
105
106   Init();
107 }
108
109 //=================================================================================
110 // function : ~TransformationGUI_MultiRotationDlg()
111 // purpose  : Destroys the object and frees any allocated resources
112 //=================================================================================
113 TransformationGUI_MultiRotationDlg::~TransformationGUI_MultiRotationDlg()
114 {
115   // no need to delete child widgets, Qt does it all for us
116 }
117
118 //=================================================================================
119 // function : Init()
120 // purpose  :
121 //=================================================================================
122 void TransformationGUI_MultiRotationDlg::Init()
123 {
124   // Get setting of step value from file configuration
125   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
126   double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
127
128   int SpecificStep1 = 5;
129   int SpecificStep2 = 1;
130   // min, max, step and decimals for spin boxes & initial values
131   initSpinBox(GroupPoints->SpinBox_DX, 1, 999, SpecificStep2);
132   GroupPoints->SpinBox_DX->setValue(myNbTimes1);
133
134   initSpinBox(GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, 10); // VSR: TODO: DBL_DIGITS_DISPLAY
135   initSpinBox(GroupDimensions->SpinBox_DY1, 1, 999, SpecificStep2);
136   initSpinBox(GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY
137   initSpinBox(GroupDimensions->SpinBox_DY2, 1, 999, SpecificStep2);
138   GroupDimensions->SpinBox_DX1->setValue(myAng);
139   GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
140   GroupDimensions->SpinBox_DX2->setValue(myStep);
141   GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
142
143   // init variables
144   myAng = 45.0;
145   myStep = 50.0;
146   myNbTimes1 = myNbTimes2 = 2;
147
148   GroupPoints->LineEdit1->setText("");
149   GroupPoints->LineEdit2->setText("");
150
151   GroupDimensions->LineEdit1->setText("");
152   GroupDimensions->LineEdit2->setText("");
153
154   myBase = myVector = GEOM::GEOM_Object::_nil();
155
156   // signals and slots connections
157   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
158   connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
159
160   connect(this,          SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
161
162   connect(GroupPoints->PushButton1,     SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
163   connect(GroupPoints->PushButton2,     SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
164   connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
165   connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
166
167   connect(GroupPoints->LineEdit1,     SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
168   connect(GroupPoints->LineEdit2,     SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
169   connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
170   connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
171
172   connect(GroupPoints->SpinBox_DX,      SIGNAL(valueChanged(int)),    this, SLOT(ValueChangedInSpinBox(int)));
173   connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
174   connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(int)),    this, SLOT(ValueChangedInSpinBox(int)));
175   connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
176   connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(int)),    this, SLOT(ValueChangedInSpinBox(int)));
177
178   connect(GroupDimensions->SpinBox_DX1,SIGNAL(textChanged( const QString& )),
179           this, SLOT(TextValueChangedInSpinBox( const QString& )));
180
181   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
182
183   connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle()));
184
185   initName(tr("GEOM_MULTIROTATION"));
186
187   ConstructorsClicked(0);
188 }
189
190 //=================================================================================
191 // function : SetDoubleSpinBoxStep()
192 // purpose  : Double spin box management
193 //=================================================================================
194 void TransformationGUI_MultiRotationDlg::SetDoubleSpinBoxStep (double step)
195 {
196   GroupPoints->SpinBox_DX->setSingleStep((int)step);
197   GroupDimensions->SpinBox_DX1->setSingleStep(step);
198   GroupDimensions->SpinBox_DY1->setSingleStep((int)step);
199   GroupDimensions->SpinBox_DX2->setSingleStep(step);
200   GroupDimensions->SpinBox_DY2->setSingleStep((int)step);
201 }
202
203 //=================================================================================
204 // function : ConstructorsClicked()
205 // purpose  : Radio button management
206 //=================================================================================
207 void TransformationGUI_MultiRotationDlg::ConstructorsClicked (int constructorId)
208 {
209   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
210
211   switch (constructorId) {
212   case 0: // Rotate simple
213     {
214       GroupDimensions->hide();
215       GroupPoints->show();
216
217       GroupPoints->LineEdit1->setText("");
218       GroupPoints->LineEdit2->setText("");
219       myBase = myVector = GEOM::GEOM_Object::_nil();
220
221       GroupPoints->SpinBox_DX->setValue(myNbTimes1);
222
223       GroupPoints->PushButton1->click();
224     }
225     break;
226   case 1: // Rotate double
227     {
228       GroupPoints->hide();
229       GroupDimensions->show();
230
231       GroupDimensions->LineEdit1->setText("");
232       GroupDimensions->LineEdit2->setText("");
233       myBase = myVector = GEOM::GEOM_Object::_nil();
234
235       GroupDimensions->SpinBox_DX1->setValue(myAng);
236       GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
237       GroupDimensions->SpinBox_DX2->setValue(myStep);
238       GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
239
240       GroupDimensions->PushButton1->click();
241     }
242     break;
243   }
244
245   qApp->processEvents();
246   updateGeometry();
247   resize(minimumSizeHint());
248
249   if (myInitial) {
250     myInitial = false;
251     SelectionIntoArgument();
252   }
253   else {
254     displayPreview();
255   }
256 }
257
258 //=================================================================================
259 // function : ClickOnOk()
260 // purpose  :
261 //=================================================================================
262 void TransformationGUI_MultiRotationDlg::ClickOnOk()
263 {
264   if (ClickOnApply())
265     ClickOnCancel();
266 }
267
268 //=================================================================================
269 // function : ClickOnApply()
270 // purpose  :
271 //=================================================================================
272 bool TransformationGUI_MultiRotationDlg::ClickOnApply()
273 {
274   if (!onAccept())
275     return false;
276
277   initName();
278   // activate selection and connect selection manager
279   ConstructorsClicked(getConstructorId());
280   return true;
281 }
282
283 //=================================================================================
284 // function : SelectionIntoArgument()
285 // purpose  : Called when selection is changed or on dialog initialization or activation
286 //=================================================================================
287 void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
288 {
289   erasePreview();
290   myEditCurrentArgument->setText("");
291
292   if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
293       myEditCurrentArgument == GroupDimensions->LineEdit1)
294     myBase = GEOM::GEOM_Object::_nil();
295   else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
296            myEditCurrentArgument == GroupDimensions->LineEdit2)
297     myVector = GEOM::GEOM_Object::_nil();
298
299   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
300   SALOME_ListIO aSelList;
301   aSelMgr->selectedObjects(aSelList);
302
303   if (aSelList.Extent() != 1)
304     return;
305
306   // nbSel == 1
307   Standard_Boolean testResult = Standard_False;;
308   GEOM::GEOM_Object_var aSelectedObject =
309     GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
310
311   if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject))
312     return;
313
314   QString aName = GEOMBase::GetName(aSelectedObject);
315
316   if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
317       myEditCurrentArgument == GroupDimensions->LineEdit1)
318     myBase = aSelectedObject;
319   else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
320            myEditCurrentArgument == GroupDimensions->LineEdit2) {
321     TopoDS_Shape aShape;
322
323     if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
324       TColStd_IndexedMapOfInteger aMap;
325       aSelMgr->GetIndexes(aSelList.First(), aMap);
326       if (aMap.Extent() == 1) {
327         int anIndex = aMap(1);
328         aName += QString(":edge_%1").arg(anIndex);
329
330         //Find SubShape Object in Father
331         GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
332
333         if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
334           GEOM::GEOM_IShapesOperations_var aShapesOp =
335             getGeomEngine()->GetIShapesOperations(getStudyId());
336           myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
337         }
338         else {
339           myVector = aFindedObject; // get existing object
340         }
341       }
342       else {
343         if (aShape.ShapeType() != TopAbs_EDGE) {
344           aSelectedObject = GEOM::GEOM_Object::_nil();
345           aName = "";
346         }
347         myVector = aSelectedObject;
348       }
349     }
350   }
351   myEditCurrentArgument->setText(aName);
352
353   if (myEditCurrentArgument == GroupPoints->LineEdit1) {
354     if (!myBase->_is_nil() && myVector->_is_nil())
355       GroupPoints->PushButton2->click();
356   }
357   else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
358     if (!myVector->_is_nil() && myBase->_is_nil())
359       GroupPoints->PushButton1->click();
360   }
361   else if (myEditCurrentArgument == GroupDimensions->LineEdit1) {
362     if (!myBase->_is_nil() && myVector->_is_nil())
363       GroupDimensions->PushButton2->click();
364   }
365   else if (myEditCurrentArgument == GroupDimensions->LineEdit2) {
366     if (!myVector->_is_nil() && myBase->_is_nil())
367       GroupDimensions->PushButton1->click();
368   }
369
370   // clear selection
371   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
372   myGeomGUI->getApp()->selectionMgr()->clearSelected();
373   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
374           this, SLOT(SelectionIntoArgument()));
375
376   displayPreview();
377 }
378
379 //=================================================================================
380 // function : SetEditCurrentArgument()
381 // purpose  :
382 //=================================================================================
383 void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
384 {
385   QPushButton* send = (QPushButton*)sender();
386
387   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
388   globalSelection(GEOM_ALLSHAPES);
389
390   if (send == GroupPoints->PushButton1) {
391     myEditCurrentArgument = GroupPoints->LineEdit1;
392
393     GroupPoints->PushButton2->setDown(false);
394     GroupPoints->LineEdit2->setEnabled(false);
395   }
396   else if (send == GroupPoints->PushButton2) {
397     myEditCurrentArgument = GroupPoints->LineEdit2;
398
399     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
400
401     GroupPoints->PushButton1->setDown(false);
402     GroupPoints->LineEdit1->setEnabled(false);
403   }
404   else if (send == GroupDimensions->PushButton1) {
405     myEditCurrentArgument = GroupDimensions->LineEdit1;
406
407     GroupDimensions->PushButton2->setDown(false);
408     GroupDimensions->LineEdit2->setEnabled(false);
409   }
410   else if (send == GroupDimensions->PushButton2) {
411     myEditCurrentArgument = GroupDimensions->LineEdit2;
412
413     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
414
415     GroupDimensions->PushButton1->setDown(false);
416     GroupDimensions->LineEdit1->setEnabled(false);
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_MultiRotationDlg::LineEditReturnPressed()
436 {
437   QLineEdit* send = (QLineEdit*)sender();
438   if (send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
439       send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2) {
440     myEditCurrentArgument = send;
441     GEOMBase_Skeleton::LineEditReturnPressed();
442   }
443 }
444
445 //=================================================================================
446 // function : ActivateThisDialog()
447 // purpose  :
448 //=================================================================================
449 void TransformationGUI_MultiRotationDlg::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_MultiRotationDlg::enterEvent (QEvent*)
463 {
464   if (!mainFrame()->GroupConstructors->isEnabled())
465     ActivateThisDialog();
466 }
467
468 //=================================================================================
469 // function : TextValueChangedInSpinBox()
470 // purpose  :
471 //=================================================================================
472 void TransformationGUI_MultiRotationDlg::TextValueChangedInSpinBox(const QString& s){
473   bool isDigit;
474   s.toDouble(&isDigit);
475   if(!isDigit)
476     GroupDimensions->CheckButton1->setChecked(false);
477   GroupDimensions->CheckButton1->setEnabled(isDigit);
478 }
479
480 //=================================================================================
481 // function : ValueChangedInSpinBox()
482 // purpose  :
483 //=================================================================================
484 void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox (double newValue)
485 {
486   QObject* send = (QObject*)sender();
487
488   if (send == GroupDimensions->SpinBox_DX1)
489     myAng = newValue;
490   else if (send == GroupDimensions->SpinBox_DX2)
491     myStep = newValue;
492
493   displayPreview();
494 }
495
496 //=================================================================================
497 // function : ValueChangedInSpinBox()
498 // purpose  :
499 //=================================================================================
500 void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox (int newValue)
501 {
502   QObject* send = (QObject*)sender();
503
504   if (send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1)
505     myNbTimes1 = newValue;
506   else if (send == GroupDimensions->SpinBox_DY2)
507     myNbTimes2 = newValue;
508
509   displayPreview();
510 }
511
512 //=================================================================================
513 // function : ReverseAngle()
514 // purpose  : 'state' not used here
515 //=================================================================================
516 void TransformationGUI_MultiRotationDlg::ReverseAngle()
517 {
518   myAng = -myAng;
519
520   int aConstructorId = getConstructorId();
521
522   if (aConstructorId == 1)
523     GroupDimensions->SpinBox_DX1->setValue(myAng);
524
525   displayPreview();
526 }
527
528 //=================================================================================
529 // function : createOperation
530 // purpose  :
531 //=================================================================================
532 GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation()
533 {
534   return getGeomEngine()->GetITransformOperations(getStudyId());
535 }
536
537 //=================================================================================
538 // function : isValid
539 // purpose  :
540 //=================================================================================
541 bool TransformationGUI_MultiRotationDlg::isValid (QString& msg)
542 {
543   bool ok = true;
544   switch(getConstructorId()){
545   case 0:
546     ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
547     break;
548   case 1:                                           
549     ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok;
550     ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok;
551     ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok;
552     ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok;        
553     break;
554   }
555   return !(myBase->_is_nil() || myVector->_is_nil()) && ok;
556 }
557
558 //=================================================================================
559 // function : execute
560 // purpose  :
561 //=================================================================================
562 bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects)
563 {
564   bool res = false;
565
566   GEOM::GEOM_Object_var anObj;
567   QStringList aParameters;
568
569   GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
570
571   switch (getConstructorId()) {
572   case 0:
573     if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) {
574       anObj = anOper->MultiRotate1D(myBase, myVector, myNbTimes1);
575       if(!IsPreview())
576         aParameters<<GroupPoints->SpinBox_DX->text();
577       res = true;
578     }
579     break;
580   case 1:
581     if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) {
582       anObj = anOper->MultiRotate2D(myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2);
583       if(!IsPreview()) {
584         aParameters<<GroupDimensions->SpinBox_DX1->text();
585         aParameters<<GroupDimensions->SpinBox_DY1->text();
586         aParameters<<GroupDimensions->SpinBox_DX2->text();
587         aParameters<<GroupDimensions->SpinBox_DY2->text();
588       }
589       res = true;
590     }
591     break;
592   }
593
594   if (!anObj->_is_nil()) {
595     if(!IsPreview())
596       myNoteBook->setParameters(anObj, aParameters);
597     objects.push_back(anObj._retn());
598   }
599
600   return res;
601 }
602
603 //=================================================================================
604 // function : addSubshapeToStudy
605 // purpose  : virtual method to add new SubObjects if local selection
606 //=================================================================================
607 void TransformationGUI_MultiRotationDlg::addSubshapesToStudy()
608 {
609   QMap<QString, GEOM::GEOM_Object_var> objMap;
610
611   switch (getConstructorId()) {
612   case 0:
613     objMap[GroupPoints->LineEdit2->text()] = myVector;
614     break;
615   case 1:
616     objMap[GroupDimensions->LineEdit2->text()] = myVector;
617     break;
618   }
619   addSubshapesToFather(objMap);
620 }