]> SALOME platform Git repositories - modules/geom.git/blob - src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx
Salome HOME
Issue 0020580: improved validation in integer and double spin boxes, possibility...
[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_2Sel1SpinInt(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   int SpecificStep1 = 5;
128   int SpecificStep2 = 1;
129   // min, max, step and decimals for spin boxes & initial values
130   initSpinBox(GroupPoints->SpinBox_DX, 1, 999, SpecificStep2);
131   GroupPoints->SpinBox_DX->setValue(myNbTimes1);
132
133   initSpinBox(GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, "angle_precision" );
134   initSpinBox(GroupDimensions->SpinBox_DY1, 1, 999, SpecificStep2);
135   initSpinBox(GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step,"length_precision" );
136   initSpinBox(GroupDimensions->SpinBox_DY2, 1, 999, SpecificStep2);
137   GroupDimensions->SpinBox_DX1->setValue(myAng);
138   GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
139   GroupDimensions->SpinBox_DX2->setValue(myStep);
140   GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
141
142   // init variables
143   myAng = 45.0;
144   myStep = 50.0;
145   myNbTimes1 = myNbTimes2 = 2;
146
147   GroupPoints->LineEdit1->setText("");
148   GroupPoints->LineEdit2->setText("");
149
150   GroupDimensions->LineEdit1->setText("");
151   GroupDimensions->LineEdit2->setText("");
152
153   myBase = myVector = GEOM::GEOM_Object::_nil();
154
155   // signals and slots connections
156   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
157   connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
158
159   connect(this,          SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
160
161   connect(GroupPoints->PushButton1,     SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
162   connect(GroupPoints->PushButton2,     SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
163   connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
164   connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
165
166   connect(GroupPoints->LineEdit1,     SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
167   connect(GroupPoints->LineEdit2,     SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
168   connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
169   connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
170
171   connect(GroupPoints->SpinBox_DX,      SIGNAL(valueChanged(int)),    this, SLOT(ValueChangedInSpinBox(int)));
172   connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
173   connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(int)),    this, SLOT(ValueChangedInSpinBox(int)));
174   connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
175   connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(int)),    this, SLOT(ValueChangedInSpinBox(int)));
176
177   connect(GroupDimensions->SpinBox_DX1,SIGNAL(textChanged( const QString& )),
178           this, SLOT(TextValueChangedInSpinBox( const QString& )));
179
180   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
181
182   connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle()));
183
184   initName(tr("GEOM_MULTIROTATION"));
185
186   ConstructorsClicked(0);
187 }
188
189 //=================================================================================
190 // function : SetDoubleSpinBoxStep()
191 // purpose  : Double spin box management
192 //=================================================================================
193 void TransformationGUI_MultiRotationDlg::SetDoubleSpinBoxStep (double step)
194 {
195   GroupDimensions->SpinBox_DX2->setSingleStep(step);
196   
197   // san: Commented so as not to override specific step settings
198   //GroupPoints->SpinBox_DX->setSingleStep((int)step);
199   //GroupDimensions->SpinBox_DX1->setSingleStep(step);
200   //GroupDimensions->SpinBox_DY1->setSingleStep((int)step);
201   //GroupDimensions->SpinBox_DY2->setSingleStep((int)step);
202 }
203
204 //=================================================================================
205 // function : ConstructorsClicked()
206 // purpose  : Radio button management
207 //=================================================================================
208 void TransformationGUI_MultiRotationDlg::ConstructorsClicked (int constructorId)
209 {
210   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
211
212   switch (constructorId) {
213   case 0: // Rotate simple
214     {
215       GroupDimensions->hide();
216       GroupPoints->show();
217
218       GroupPoints->LineEdit1->setText("");
219       GroupPoints->LineEdit2->setText("");
220       myBase = myVector = GEOM::GEOM_Object::_nil();
221
222       GroupPoints->SpinBox_DX->setValue(myNbTimes1);
223
224       GroupPoints->PushButton1->click();
225     }
226     break;
227   case 1: // Rotate double
228     {
229       GroupPoints->hide();
230       GroupDimensions->show();
231
232       GroupDimensions->LineEdit1->setText("");
233       GroupDimensions->LineEdit2->setText("");
234       myBase = myVector = GEOM::GEOM_Object::_nil();
235
236       GroupDimensions->SpinBox_DX1->setValue(myAng);
237       GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
238       GroupDimensions->SpinBox_DX2->setValue(myStep);
239       GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
240
241       GroupDimensions->PushButton1->click();
242     }
243     break;
244   }
245
246   qApp->processEvents();
247   updateGeometry();
248   resize(minimumSizeHint());
249
250   if (myInitial) {
251     myInitial = false;
252     SelectionIntoArgument();
253   }
254   else {
255     displayPreview();
256   }
257 }
258
259 //=================================================================================
260 // function : ClickOnOk()
261 // purpose  :
262 //=================================================================================
263 void TransformationGUI_MultiRotationDlg::ClickOnOk()
264 {
265   if (ClickOnApply())
266     ClickOnCancel();
267 }
268
269 //=================================================================================
270 // function : ClickOnApply()
271 // purpose  :
272 //=================================================================================
273 bool TransformationGUI_MultiRotationDlg::ClickOnApply()
274 {
275   if (!onAccept())
276     return false;
277
278   initName();
279   // activate selection and connect selection manager
280   ConstructorsClicked(getConstructorId());
281   return true;
282 }
283
284 //=================================================================================
285 // function : SelectionIntoArgument()
286 // purpose  : Called when selection is changed or on dialog initialization or activation
287 //=================================================================================
288 void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
289 {
290   erasePreview();
291   myEditCurrentArgument->setText("");
292
293   if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
294       myEditCurrentArgument == GroupDimensions->LineEdit1)
295     myBase = GEOM::GEOM_Object::_nil();
296   else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
297            myEditCurrentArgument == GroupDimensions->LineEdit2)
298     myVector = GEOM::GEOM_Object::_nil();
299
300   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
301   SALOME_ListIO aSelList;
302   aSelMgr->selectedObjects(aSelList);
303
304   if (aSelList.Extent() != 1)
305     return;
306
307   // nbSel == 1
308   Standard_Boolean testResult = Standard_False;;
309   GEOM::GEOM_Object_var aSelectedObject =
310     GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
311
312   if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject))
313     return;
314
315   QString aName = GEOMBase::GetName(aSelectedObject);
316
317   if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
318       myEditCurrentArgument == GroupDimensions->LineEdit1)
319     myBase = aSelectedObject;
320   else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
321            myEditCurrentArgument == GroupDimensions->LineEdit2) {
322     TopoDS_Shape aShape;
323
324     if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
325       TColStd_IndexedMapOfInteger aMap;
326       aSelMgr->GetIndexes(aSelList.First(), aMap);
327       if (aMap.Extent() == 1) {
328         int anIndex = aMap(1);
329         aName += QString(":edge_%1").arg(anIndex);
330
331         //Find SubShape Object in Father
332         GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
333
334         if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
335           GEOM::GEOM_IShapesOperations_var aShapesOp =
336             getGeomEngine()->GetIShapesOperations(getStudyId());
337           myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
338         }
339         else {
340           myVector = aFindedObject; // get existing object
341         }
342       }
343       else {
344         if (aShape.ShapeType() != TopAbs_EDGE) {
345           aSelectedObject = GEOM::GEOM_Object::_nil();
346           aName = "";
347         }
348         myVector = aSelectedObject;
349       }
350     }
351   }
352   myEditCurrentArgument->setText(aName);
353
354   if (myEditCurrentArgument == GroupPoints->LineEdit1) {
355     if (!myBase->_is_nil() && myVector->_is_nil())
356       GroupPoints->PushButton2->click();
357   }
358   else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
359     if (!myVector->_is_nil() && myBase->_is_nil())
360       GroupPoints->PushButton1->click();
361   }
362   else if (myEditCurrentArgument == GroupDimensions->LineEdit1) {
363     if (!myBase->_is_nil() && myVector->_is_nil())
364       GroupDimensions->PushButton2->click();
365   }
366   else if (myEditCurrentArgument == GroupDimensions->LineEdit2) {
367     if (!myVector->_is_nil() && myBase->_is_nil())
368       GroupDimensions->PushButton1->click();
369   }
370
371   // clear selection
372   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
373   myGeomGUI->getApp()->selectionMgr()->clearSelected();
374   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
375           this, SLOT(SelectionIntoArgument()));
376
377   displayPreview();
378 }
379
380 //=================================================================================
381 // function : SetEditCurrentArgument()
382 // purpose  :
383 //=================================================================================
384 void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
385 {
386   QPushButton* send = (QPushButton*)sender();
387
388   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
389   globalSelection(GEOM_ALLSHAPES);
390
391   if (send == GroupPoints->PushButton1) {
392     myEditCurrentArgument = GroupPoints->LineEdit1;
393
394     GroupPoints->PushButton2->setDown(false);
395     GroupPoints->LineEdit2->setEnabled(false);
396   }
397   else if (send == GroupPoints->PushButton2) {
398     myEditCurrentArgument = GroupPoints->LineEdit2;
399
400     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
401
402     GroupPoints->PushButton1->setDown(false);
403     GroupPoints->LineEdit1->setEnabled(false);
404   }
405   else if (send == GroupDimensions->PushButton1) {
406     myEditCurrentArgument = GroupDimensions->LineEdit1;
407
408     GroupDimensions->PushButton2->setDown(false);
409     GroupDimensions->LineEdit2->setEnabled(false);
410   }
411   else if (send == GroupDimensions->PushButton2) {
412     myEditCurrentArgument = GroupDimensions->LineEdit2;
413
414     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
415
416     GroupDimensions->PushButton1->setDown(false);
417     GroupDimensions->LineEdit1->setEnabled(false);
418   }
419   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
420           this, SLOT(SelectionIntoArgument()));
421
422   // enable line edit
423   myEditCurrentArgument->setEnabled(true);
424   myEditCurrentArgument->setFocus();
425   // after setFocus(), because it will be setDown(false) when loses focus
426   send->setDown(true);
427
428   // seems we need it only to avoid preview disappearing, caused by selection mode change
429   displayPreview();
430 }
431
432 //=================================================================================
433 // function : LineEditReturnPressed()
434 // purpose  :
435 //=================================================================================
436 void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
437 {
438   QLineEdit* send = (QLineEdit*)sender();
439   if (send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
440       send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2) {
441     myEditCurrentArgument = send;
442     GEOMBase_Skeleton::LineEditReturnPressed();
443   }
444 }
445
446 //=================================================================================
447 // function : ActivateThisDialog()
448 // purpose  :
449 //=================================================================================
450 void TransformationGUI_MultiRotationDlg::ActivateThisDialog()
451 {
452   GEOMBase_Skeleton::ActivateThisDialog();
453   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
454            this, SLOT( SelectionIntoArgument() ) );
455
456   ConstructorsClicked( getConstructorId() );
457 }
458
459 //=================================================================================
460 // function : enterEvent()
461 // purpose  :
462 //=================================================================================
463 void TransformationGUI_MultiRotationDlg::enterEvent (QEvent*)
464 {
465   if (!mainFrame()->GroupConstructors->isEnabled())
466     ActivateThisDialog();
467 }
468
469 //=================================================================================
470 // function : TextValueChangedInSpinBox()
471 // purpose  :
472 //=================================================================================
473 void TransformationGUI_MultiRotationDlg::TextValueChangedInSpinBox(const QString& s){
474   bool isDigit;
475   s.toDouble(&isDigit);
476   if(!isDigit)
477     GroupDimensions->CheckButton1->setChecked(false);
478   GroupDimensions->CheckButton1->setEnabled(isDigit);
479 }
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 == GroupDimensions->SpinBox_DX1)
490     myAng = newValue;
491   else if (send == GroupDimensions->SpinBox_DX2)
492     myStep = newValue;
493
494   displayPreview();
495 }
496
497 //=================================================================================
498 // function : ValueChangedInSpinBox()
499 // purpose  :
500 //=================================================================================
501 void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox (int newValue)
502 {
503   QObject* send = (QObject*)sender();
504
505   if (send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1)
506     myNbTimes1 = newValue;
507   else if (send == GroupDimensions->SpinBox_DY2)
508     myNbTimes2 = newValue;
509
510   displayPreview();
511 }
512
513 //=================================================================================
514 // function : ReverseAngle()
515 // purpose  : 'state' not used here
516 //=================================================================================
517 void TransformationGUI_MultiRotationDlg::ReverseAngle()
518 {
519   myAng = -myAng;
520
521   int aConstructorId = getConstructorId();
522
523   if (aConstructorId == 1)
524     GroupDimensions->SpinBox_DX1->setValue(myAng);
525
526   displayPreview();
527 }
528
529 //=================================================================================
530 // function : createOperation
531 // purpose  :
532 //=================================================================================
533 GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation()
534 {
535   return getGeomEngine()->GetITransformOperations(getStudyId());
536 }
537
538 //=================================================================================
539 // function : isValid
540 // purpose  :
541 //=================================================================================
542 bool TransformationGUI_MultiRotationDlg::isValid (QString& msg)
543 {
544   bool ok = true;
545   switch(getConstructorId()){
546   case 0:
547     ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
548     break;
549   case 1:                                           
550     ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok;
551     ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok;
552     ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok;
553     ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok;        
554     break;
555   }
556   return !(myBase->_is_nil() || myVector->_is_nil()) && ok;
557 }
558
559 //=================================================================================
560 // function : execute
561 // purpose  :
562 //=================================================================================
563 bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects)
564 {
565   bool res = false;
566
567   GEOM::GEOM_Object_var anObj;
568   QStringList aParameters;
569
570   GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
571
572   switch (getConstructorId()) {
573   case 0:
574     if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) {
575       anObj = anOper->MultiRotate1D(myBase, myVector, myNbTimes1);
576       if(!IsPreview())
577         aParameters<<GroupPoints->SpinBox_DX->text();
578       res = true;
579     }
580     break;
581   case 1:
582     if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) {
583       anObj = anOper->MultiRotate2D(myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2);
584       if(!IsPreview()) {
585         aParameters<<GroupDimensions->SpinBox_DX1->text();
586         aParameters<<GroupDimensions->SpinBox_DY1->text();
587         aParameters<<GroupDimensions->SpinBox_DX2->text();
588         aParameters<<GroupDimensions->SpinBox_DY2->text();
589       }
590       res = true;
591     }
592     break;
593   }
594
595   if (!anObj->_is_nil()) {
596     if(!IsPreview())
597       anObj->SetParameters(aParameters.join(":").toLatin1().constData());
598     objects.push_back(anObj._retn());
599   }
600
601   return res;
602 }
603
604 //=================================================================================
605 // function : addSubshapeToStudy
606 // purpose  : virtual method to add new SubObjects if local selection
607 //=================================================================================
608 void TransformationGUI_MultiRotationDlg::addSubshapesToStudy()
609 {
610   QMap<QString, GEOM::GEOM_Object_var> objMap;
611
612   switch (getConstructorId()) {
613   case 0:
614     objMap[GroupPoints->LineEdit2->text()] = myVector;
615     break;
616   case 1:
617     objMap[GroupDimensions->LineEdit2->text()] = myVector;
618     break;
619   }
620   addSubshapesToFather(objMap);
621 }