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