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