]> SALOME platform Git repositories - modules/geom.git/blob - src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx
Salome HOME
NPAL 18378
[modules/geom.git] / src / TransformationGUI / TransformationGUI_MultiTranslationDlg.cxx
1 //  GEOM GEOMGUI : GUI for Geometry component
2 //
3 //  Copyright (C) 2003  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 //
23 //
24 //  File   : TransformationGUI_MultiTranslationDlg.cxx
25 //  Author : Damien COQUERET
26 //  Module : GEOM
27 //  $Header$
28
29 #include "TransformationGUI_MultiTranslationDlg.h"
30
31 #include "SUIT_Desktop.h"
32 #include "SUIT_Session.h"
33 #include "SalomeApp_Application.h"
34 #include "LightApp_SelectionMgr.h"
35
36 #include <TopoDS_Shape.hxx>
37 #include <TopoDS_Edge.hxx>
38 #include <TopoDS.hxx>
39 #include <TopExp.hxx>
40 #include <TColStd_IndexedMapOfInteger.hxx>
41 #include <TopTools_IndexedMapOfShape.hxx>
42
43 #include <qlabel.h>
44
45 #include "GEOMImpl_Types.hxx"
46
47 #include <qcheckbox.h>
48
49 #include "utilities.h"
50
51 using namespace std;
52
53 //=================================================================================
54 // class    : TransformationGUI_MultiTranslationDlg()
55 // purpose  : Constructs a TransformationGUI_MultiTranslationDlg which is a child of 'parent', with the
56 //            name 'name' and widget flags set to 'f'.
57 //            The dialog will by default be modeless, unless you set 'modal' to
58 //            TRUE to construct a modal dialog.
59 //=================================================================================
60 TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg
61   (GeometryGUI* theGeometryGUI, QWidget* parent,  const char* name, bool modal, WFlags fl)
62   :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
63                      WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
64 {
65   SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
66   QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTITRANSLATION_SIMPLE")));
67   QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTITRANSLATION_DOUBLE")));
68   QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
69
70   setCaption(tr("GEOM_MULTITRANSLATION_TITLE"));
71
72   /***************************************************************/
73   GroupConstructors->setTitle(tr("GEOM_MULTITRANSLATION"));
74   RadioButton1->setPixmap(image0);
75   RadioButton2->setPixmap(image1);
76   RadioButton3->close(TRUE);
77
78   GroupPoints = new DlgRef_2Sel2Spin1Check(this, "GroupPoints");
79   GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_SIMPLE"));
80   GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
81   GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR_U"));
82   GroupPoints->TextLabel3->setText(tr("GEOM_STEP_U"));
83   GroupPoints->TextLabel4->setText(tr("GEOM_NB_TIMES_U"));
84   GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE_U"));
85   GroupPoints->PushButton1->setPixmap(image2);
86   GroupPoints->PushButton2->setPixmap(image2);
87   GroupPoints->LineEdit1->setReadOnly(true);
88   GroupPoints->LineEdit2->setReadOnly(true);
89
90   GroupDimensions = new DlgRef_3Sel4Spin2Check(this, "GroupDimensions");
91   GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_DOUBLE"));
92   GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
93   GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR_U"));
94   GroupDimensions->TextLabel3->setText(tr("GEOM_VECTOR_V"));
95   GroupDimensions->TextLabel4->setText(tr("GEOM_STEP_U"));
96   GroupDimensions->TextLabel5->setText(tr("GEOM_NB_TIMES_U"));
97   GroupDimensions->TextLabel6->setText(tr("GEOM_STEP_V"));
98   GroupDimensions->TextLabel7->setText(tr("GEOM_NB_TIMES_V"));
99   GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE_U"));
100   GroupDimensions->CheckButton2->setText(tr("GEOM_REVERSE_V"));
101   GroupDimensions->PushButton1->setPixmap(image2);
102   GroupDimensions->PushButton2->setPixmap(image2);
103   GroupDimensions->PushButton3->setPixmap(image2);
104   GroupDimensions->LineEdit1->setReadOnly(true);
105   GroupDimensions->LineEdit2->setReadOnly(true);
106   GroupDimensions->LineEdit3->setReadOnly(true);
107
108   Layout1->addWidget(GroupPoints, 2, 0);
109   Layout1->addWidget(GroupDimensions, 2, 0);
110   /***************************************************************/
111
112   setHelpFileName("multi_translation.htm");
113
114   Init();
115 }
116
117
118 //=================================================================================
119 // function : ~TransformationGUI_MultiTranslationDlg()
120 // purpose  : Destroys the object and frees any allocated resources
121 //=================================================================================
122 TransformationGUI_MultiTranslationDlg::~TransformationGUI_MultiTranslationDlg()
123 {
124   // no need to delete child widgets, Qt does it all for us
125 }
126
127
128 //=================================================================================
129 // function : Init()
130 // purpose  :
131 //=================================================================================
132 void TransformationGUI_MultiTranslationDlg::Init()
133 {
134   /* Get setting of step value from file configuration */
135   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
136   double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
137
138   double SpecificStep = 1;
139   /* min, max, step and decimals for spin boxes & initial values */
140   GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
141   GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 10);
142   GroupPoints->SpinBox_DX->SetValue(myStepU);
143   GroupPoints->SpinBox_DY->SetValue(myNbTimesU);
144
145   GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
146   GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 10);
147   GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
148   GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 10);
149   GroupDimensions->SpinBox_DX1->SetValue(myStepU);
150   GroupDimensions->SpinBox_DY1->SetValue(myNbTimesU);
151   GroupDimensions->SpinBox_DX2->SetValue(myStepV);
152   GroupDimensions->SpinBox_DY2->SetValue(myNbTimesV);
153
154   /* signals and slots connections */
155   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
156   connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
157   connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
158
159   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
160   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
161   connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
162   connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
163   connect(GroupDimensions->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
164
165   connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
166   connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
167   connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
168   connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
169   connect(GroupDimensions->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
170
171   connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
172   connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
173   connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
174   connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
175   connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
176   connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
177
178   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
179   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double)));
180   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX1, SLOT(SetStep(double)));
181   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY1, SLOT(SetStep(double)));
182   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX2, SLOT(SetStep(double)));
183   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double)));
184
185   connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
186   connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
187   connect(GroupDimensions->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(ReverseStepV()));
188
189   connect(myGeomGUI->getApp()->selectionMgr(),
190           SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
191
192   initName( tr( "GEOM_MULTITRANSLATION" ) );
193   ConstructorsClicked( 0 );
194 }
195
196
197 //=================================================================================
198 // function : ConstructorsClicked()
199 // purpose  : Radio button management
200 //=================================================================================
201 void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId)
202 {
203   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
204
205   myStepU = myStepV = 50.0;
206   myNbTimesU = myNbTimesV = 2;
207
208   globalSelection( GEOM_ALLSHAPES );
209
210   switch (constructorId)
211     {
212     case 0: /* Translate simple */
213       {
214         GroupDimensions->hide();
215         resize(0, 0);
216         GroupPoints->show();
217
218         myEditCurrentArgument = GroupPoints->LineEdit1;
219         GroupPoints->LineEdit1->setText("");
220         GroupPoints->LineEdit2->setText("");
221
222         GroupPoints->SpinBox_DX->SetValue(myStepU);
223         GroupPoints->SpinBox_DY->SetValue(myNbTimesU);
224         
225         break;
226       }
227     case 1: /* Translate double */
228       {
229         GroupPoints->hide();
230         resize(0, 0);
231         GroupDimensions->show();
232
233         myEditCurrentArgument = GroupDimensions->LineEdit1;
234         GroupDimensions->LineEdit1->setText("");
235         GroupDimensions->LineEdit2->setText("");
236         GroupDimensions->LineEdit3->setText("");
237
238         GroupDimensions->SpinBox_DX1->SetValue(myStepU);
239         GroupDimensions->SpinBox_DY1->SetValue(myNbTimesU);
240         GroupDimensions->SpinBox_DX2->SetValue(myStepV);
241         GroupDimensions->SpinBox_DY2->SetValue(myNbTimesV);
242         
243         myVectorV = GEOM::GEOM_Object::_nil();
244         break;
245       }
246     }
247
248   myEditCurrentArgument->setFocus();
249   myBase = myVectorU = GEOM::GEOM_Object::_nil();
250   connect(myGeomGUI->getApp()->selectionMgr(),
251           SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
252 }
253
254
255 //=================================================================================
256 // function : ClickOnOk()
257 // purpose  :
258 //=================================================================================
259 void TransformationGUI_MultiTranslationDlg::ClickOnOk()
260 {
261   if ( ClickOnApply() )
262     ClickOnCancel();
263 }
264
265
266 //=================================================================================
267 // function : ClickOnApply()
268 // purpose  :
269 //=================================================================================
270 bool TransformationGUI_MultiTranslationDlg::ClickOnApply()
271 {
272   if ( !onAccept() )
273     return false;
274
275   initName();
276   ConstructorsClicked( getConstructorId() );
277   return true;
278 }
279
280
281 //=================================================================================
282 // function : SelectionIntoArgument()
283 // purpose  : Called when selection as changed or other case
284 //=================================================================================
285 void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
286 {
287   myEditCurrentArgument->setText("");
288
289   if (IObjectCount() != 1) {
290     if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
291         myEditCurrentArgument == GroupDimensions->LineEdit1)
292       myBase = GEOM::GEOM_Object::_nil();
293     else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
294              myEditCurrentArgument == GroupDimensions->LineEdit2)
295       myVectorU = GEOM::GEOM_Object::_nil();
296     else if (myEditCurrentArgument == GroupDimensions->LineEdit3)
297       myVectorV = GEOM::GEOM_Object::_nil();
298     return;
299   }
300
301   // nbSel == 1
302   Standard_Boolean testResult = Standard_False;;
303   GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
304
305   if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) )
306     return;
307
308   QString aName = GEOMBase::GetName( aSelectedObject );
309
310   if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
311       myEditCurrentArgument == GroupDimensions->LineEdit1)
312     myBase = aSelectedObject;
313   else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
314            myEditCurrentArgument == GroupDimensions->LineEdit2 ||
315            myEditCurrentArgument == GroupDimensions->LineEdit3 ) {
316     if ( testResult && !aSelectedObject->_is_nil() )
317         {
318           TopoDS_Shape aShape;
319           
320           if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
321             {
322               LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
323               TColStd_IndexedMapOfInteger aMap;
324               aSelMgr->GetIndexes( firstIObject(), aMap );
325                 if ( aMap.Extent() == 1 )
326                   {
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                       if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
337                         myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex);
338                       else
339                         myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex);
340                     }
341                     else {
342                       if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
343                         myVectorV = aFindedObject;
344                       else
345                         myVectorU = aFindedObject;
346                     }
347                   }
348                 else {
349                   if (aShape.ShapeType() != TopAbs_EDGE) {
350                     aSelectedObject = GEOM::GEOM_Object::_nil();
351                     aName = "";
352                   }
353                   if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
354                     myVectorV = aSelectedObject;
355                   else
356                     myVectorU = aSelectedObject;
357                 }
358             }
359         }
360     }
361
362   myEditCurrentArgument->setText( aName );
363
364   displayPreview();     
365 }
366
367
368 //=================================================================================
369 // function : SetEditCurrentArgument()
370 // purpose  :
371 //=================================================================================
372 void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
373 {
374   QPushButton* send = (QPushButton*)sender();
375   globalSelection( GEOM_ALLSHAPES );
376
377   if(send == GroupPoints->PushButton1) {
378     myEditCurrentArgument = GroupPoints->LineEdit1;
379   }
380   else if(send == GroupPoints->PushButton2) {
381     myEditCurrentArgument = GroupPoints->LineEdit2;
382     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
383   }
384   else if(send == GroupDimensions->PushButton1) {
385     myEditCurrentArgument = GroupDimensions->LineEdit1;
386   }
387   else if(send == GroupDimensions->PushButton2) {
388     myEditCurrentArgument = GroupDimensions->LineEdit2;
389     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
390   }
391   else if(send == GroupDimensions->PushButton3) {
392     myEditCurrentArgument = GroupDimensions->LineEdit3;
393     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
394   }
395
396   myEditCurrentArgument->setFocus();
397   SelectionIntoArgument();
398 }
399
400
401 //=================================================================================
402 // function : LineEditReturnPressed()
403 // purpose  :
404 //=================================================================================
405 void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
406 {
407   QLineEdit* send = (QLineEdit*)sender();
408   if(send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
409      send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 ||
410                                        send == GroupDimensions->LineEdit3)
411     {
412       myEditCurrentArgument = send;
413       GEOMBase_Skeleton::LineEditReturnPressed();
414     }
415 }
416
417
418 //=================================================================================
419 // function : ActivateThisDialog()
420 // purpose  :
421 //=================================================================================
422 void TransformationGUI_MultiTranslationDlg::ActivateThisDialog()
423 {
424   GEOMBase_Skeleton::ActivateThisDialog();
425   connect(myGeomGUI->getApp()->selectionMgr(),
426           SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
427
428   ConstructorsClicked( getConstructorId() );
429 }
430
431
432 //=================================================================================
433 // function : enterEvent()
434 // purpose  :
435 //=================================================================================
436 void TransformationGUI_MultiTranslationDlg::enterEvent(QEvent* e)
437 {
438   if(!GroupConstructors->isEnabled())
439     ActivateThisDialog();
440 }
441
442
443 //=================================================================================
444 // function : ValueChangedInSpinBox()
445 // purpose  :
446 //=================================================================================
447 void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValue)
448 {
449   QObject* send = (QObject*)sender();
450
451   switch(getConstructorId())
452     {
453     case 0 :
454       { 
455         if(send == GroupPoints->SpinBox_DX)
456           myStepU = newValue;
457         else if(send == GroupPoints->SpinBox_DY)
458           myNbTimesU = (int)newValue;
459         break;
460       }
461     case 1 :
462       { 
463         if(send == GroupDimensions->SpinBox_DX1)
464           myStepU = newValue;
465         else if(send == GroupDimensions->SpinBox_DY1)
466           myNbTimesU = (int)newValue;
467         else if(send == GroupDimensions->SpinBox_DX2)
468           myStepV = newValue;
469         else if(send == GroupDimensions->SpinBox_DY2)
470           myNbTimesV = (int)newValue;
471         break;
472       }
473     }
474
475   displayPreview();
476 }
477
478
479 //=================================================================================
480 // function : ReverseStepU()
481 // purpose  : 'state' not used here
482 //=================================================================================
483 void TransformationGUI_MultiTranslationDlg::ReverseStepU()
484 {
485   myStepU = -myStepU;
486
487   int aConstructorId = getConstructorId();
488
489   if(aConstructorId == 0)
490     GroupPoints->SpinBox_DX->SetValue(myStepU);
491   else if(aConstructorId == 1)
492     GroupDimensions->SpinBox_DX1->SetValue(myStepU);
493
494   displayPreview();
495 }
496
497
498 //=================================================================================
499 // function : ReverseStepV
500 // purpose  : 'state' not used here
501 //=================================================================================
502 void TransformationGUI_MultiTranslationDlg::ReverseStepV()
503 {
504   myStepV = -myStepV;
505
506   GroupDimensions->SpinBox_DX2->SetValue(myStepV);
507
508   displayPreview();
509 }
510
511
512 //=================================================================================
513 // function : createOperation
514 // purpose  :
515 //=================================================================================
516 GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperation()
517 {
518   return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() );
519 }
520
521
522 //=================================================================================
523 // function : isValid
524 // purpose  :
525 //=================================================================================
526 bool TransformationGUI_MultiTranslationDlg::isValid( QString& msg )
527 {
528   int aConstructorId = getConstructorId();
529
530   if(aConstructorId == 0)
531     return !(myBase->_is_nil() || myVectorU->_is_nil());
532   else if(aConstructorId == 1)
533     return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil());
534   return 0;
535 }
536
537 //=================================================================================
538 // function : execute
539 // purpose  :
540 //=================================================================================
541 bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects )
542 {
543   bool res = false;
544
545   GEOM::GEOM_Object_var anObj;
546
547   switch ( getConstructorId() )
548     {
549     case 0 :
550       {
551         if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) ) {
552           anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate1D( myBase, myVectorU, myStepU, myNbTimesU );
553           res = true;
554         }
555         break;
556       }
557     case 1 :
558       {
559         if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) && !CORBA::is_nil( myVectorV ) )
560           {
561             anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate2D( myBase, myVectorU, myStepU, myNbTimesU,
562                                                                                                           myVectorV, myStepV, myNbTimesV );
563             res = true;
564           }
565         break;
566       }
567     }
568
569   if ( !anObj->_is_nil() )
570     objects.push_back( anObj._retn() );
571
572   return res;
573 }
574
575
576 //=================================================================================
577 // function : closeEvent
578 // purpose  :
579 //=================================================================================
580 void  TransformationGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e )
581 {
582   // myGeomGUI->SetState( -1 );
583   GEOMBase_Skeleton::closeEvent( e );
584 }
585
586 //=================================================================================
587 // function : addSubshapeToStudy
588 // purpose  : virtual method to add new SubObjects if local selection
589 //=================================================================================
590 void TransformationGUI_MultiTranslationDlg::addSubshapesToStudy()
591 {
592   QMap<QString, GEOM::GEOM_Object_var> objMap;
593   
594   switch (getConstructorId())
595     {
596     case 0:
597       objMap[GroupPoints->LineEdit2->text()] = myVectorU;
598       break;
599     case 1:
600       objMap[GroupDimensions->LineEdit2->text()] = myVectorU;
601       objMap[GroupDimensions->LineEdit3->text()] = myVectorV;
602       break;
603     }
604   addSubshapesToFather( objMap );
605 }