]> SALOME platform Git repositories - modules/geom.git/blob - src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx
Salome HOME
SALOME PAL V1_4_1
[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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : TransformationGUI_MultiTranslationDlg.cxx
25 //  Author : Damien COQUERET
26 //  Module : GEOM
27 //  $Header$
28
29 using namespace std;
30 #include "TransformationGUI_MultiTranslationDlg.h"
31
32 #include <gp_Lin.hxx>
33 #include <BRepBuilderAPI_MakeVertex.hxx>
34 #include <BRepBuilderAPI_Transform.hxx>
35 #include <BRepAdaptor_Curve.hxx>
36 #include <BRep_Builder.hxx>
37 #include <BRepGProp.hxx>
38 #include <GProp_GProps.hxx>
39 #include <TopoDS_Compound.hxx>
40 #include "QAD_Config.h"
41
42 //=================================================================================
43 // class    : TransformationGUI_MultiTranslationDlg()
44 // purpose  : Constructs a TransformationGUI_MultiTranslationDlg which is a child of 'parent', with the 
45 //            name 'name' and widget flags set to 'f'.
46 //            The dialog will by default be modeless, unless you set 'modal' to
47 //            TRUE to construct a modal dialog.
48 //=================================================================================
49 TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg(QWidget* parent,  const char* name, TransformationGUI* theTransformationGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
50   :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
51 {
52   QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MULTITRANSLATION_SIMPLE")));
53   QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MULTITRANSLATION_DOUBLE")));
54   QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
55
56   setCaption(tr("GEOM_MULTITRANSLATION_TITLE"));
57
58   /***************************************************************/
59   GroupConstructors->setTitle(tr("GEOM_MULTITRANSLATION"));
60   RadioButton1->setPixmap(image0);
61   RadioButton2->setPixmap(image1);
62   RadioButton3->close(TRUE);
63
64   GroupPoints = new DlgRef_2Sel2Spin1Check(this, "GroupPoints");
65   GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_SIMPLE"));
66   GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
67   GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR_U"));
68   GroupPoints->TextLabel3->setText(tr("GEOM_STEP_U"));
69   GroupPoints->TextLabel4->setText(tr("GEOM_NB_TIMES_U"));
70   GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE_U"));
71   GroupPoints->PushButton1->setPixmap(image2);
72   GroupPoints->PushButton2->setPixmap(image2);
73
74   GroupDimensions = new DlgRef_3Sel4Spin2Check(this, "GroupDimensions");
75   GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_DOUBLE"));
76   GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
77   GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR_U"));
78   GroupDimensions->TextLabel3->setText(tr("GEOM_VECTOR_V"));
79   GroupDimensions->TextLabel4->setText(tr("GEOM_STEP_U"));
80   GroupDimensions->TextLabel5->setText(tr("GEOM_NB_TIMES_U"));
81   GroupDimensions->TextLabel6->setText(tr("GEOM_STEP_V"));
82   GroupDimensions->TextLabel7->setText(tr("GEOM_NB_TIMES_V"));
83   GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE_U"));
84   GroupDimensions->CheckButton2->setText(tr("GEOM_REVERSE_V"));
85   GroupDimensions->PushButton1->setPixmap(image2);
86   GroupDimensions->PushButton2->setPixmap(image2);
87   GroupDimensions->PushButton3->setPixmap(image2);
88
89   Layout1->addWidget(GroupPoints, 1, 0);
90   Layout1->addWidget(GroupDimensions, 1, 0);
91   /***************************************************************/
92
93   /* Initialisations */
94   myTransformationGUI = theTransformationGUI;
95   Init();
96 }
97
98
99 //=================================================================================
100 // function : ~TransformationGUI_MultiTranslationDlg()
101 // purpose  : Destroys the object and frees any allocated resources
102 //=================================================================================
103 TransformationGUI_MultiTranslationDlg::~TransformationGUI_MultiTranslationDlg()
104 {
105   // no need to delete child widgets, Qt does it all for us
106 }
107
108
109 //=================================================================================
110 // function : Init()
111 // purpose  :
112 //=================================================================================
113 void TransformationGUI_MultiTranslationDlg::Init()
114 {
115   /* init variables */
116   myConstructorId = 0;
117   myEditCurrentArgument = GroupPoints->LineEdit1;
118
119   myStep1 = 50.0;
120   myStep2 = 50.0;
121   myNbTimes1 = 2;
122   myNbTimes2 = 2;
123   myOkBase = myOkDir1 = myOkDir2 = false;
124
125   myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom);
126
127   /* Get setting of step value from file configuration */
128   QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
129   step = St.toDouble();
130
131   double SpecificStep = 1;
132   /* min, max, step and decimals for spin boxes & initial values */
133   GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3);
134   GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3);
135   GroupPoints->SpinBox_DX->SetValue(myStep1);
136   GroupPoints->SpinBox_DY->SetValue(myNbTimes1);
137
138   GroupDimensions->SpinBox_DX1->RangeStepAndValidator(-999.999, 999.999, step, 3);
139   GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3);
140   GroupDimensions->SpinBox_DX2->RangeStepAndValidator(-999.999, 999.999, step, 3);
141   GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3);
142   GroupDimensions->SpinBox_DX1->SetValue(myStep1);
143   GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1);
144   GroupDimensions->SpinBox_DX2->SetValue(myStep2);
145   GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2);
146
147   /* signals and slots connections */
148   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
149   connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
150   connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
151
152   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
153   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
154   connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
155   connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
156   connect(GroupDimensions->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
157
158   connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
159   connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
160   connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
161   connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
162   connect(GroupDimensions->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
163
164   connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
165   connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
166   connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
167   connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
168   connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
169   connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
170
171   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
172   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double)));
173   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX1, SLOT(SetStep(double)));
174   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY1, SLOT(SetStep(double)));
175   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX2, SLOT(SetStep(double)));
176   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double)));
177
178   connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseAngle1(int)));
179   connect(GroupDimensions->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseAngle1(int)));
180   connect(GroupDimensions->CheckButton2, SIGNAL(stateChanged(int)), this, SLOT(ReverseAngle2(int)));
181   
182   connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
183
184   /* displays Dialog */
185   GroupDimensions->hide();
186   GroupPoints->show();
187   this->show();
188
189   return;
190 }
191
192
193 //=================================================================================
194 // function : ConstructorsClicked()
195 // purpose  : Radio button management
196 //=================================================================================
197 void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId)
198 {
199   myConstructorId = constructorId;
200   mySelection->ClearFilters();
201   myGeomBase->EraseSimulationShape();
202   mySimulationTopoDs.Nullify();
203   disconnect(mySelection, 0, this, 0);
204   myStep1 = 50.0;
205   myStep2 = 50.0;
206   myNbTimes1 = 2;
207   myNbTimes2 = 2;
208   myOkBase = myOkDir1 = myOkDir2  = false;
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(myStep1);
223         GroupPoints->SpinBox_DY->SetValue(myNbTimes1);
224
225         /* filter for next selection */
226         connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
227         break;
228       }
229     case 1: /* Translate double */
230       {
231         GroupPoints->hide();
232         resize(0, 0);
233         GroupDimensions->show();
234
235         myEditCurrentArgument = GroupDimensions->LineEdit1;
236         GroupDimensions->LineEdit1->setText("");
237         GroupDimensions->LineEdit2->setText("");
238         GroupDimensions->LineEdit3->setText("");
239
240         GroupDimensions->SpinBox_DX1->SetValue(myStep1);
241         GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1);
242         GroupDimensions->SpinBox_DX2->SetValue(myStep2);
243         GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2);
244
245         /* filter for next selection */
246         connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
247         break;
248       }
249     }
250   return;
251 }
252
253
254 //=================================================================================
255 // function : ClickOnOk()
256 // purpose  :
257 //=================================================================================
258 void TransformationGUI_MultiTranslationDlg::ClickOnOk()
259 {
260   this->ClickOnApply();
261   ClickOnCancel();
262   return;
263 }
264
265
266 //=================================================================================
267 // function : ClickOnApply()
268 // purpose  :
269 //=================================================================================
270 void TransformationGUI_MultiTranslationDlg::ClickOnApply()
271 {
272   buttonApply->setFocus();
273   QAD_Application::getDesktop()->putInfo(tr(""));
274   if (mySimulationTopoDs.IsNull())
275     return;
276   myGeomBase->EraseSimulationShape();
277   mySimulationTopoDs.Nullify();
278
279   if(myConstructorId == 0) {
280     if(myOkBase && myOkDir1)
281       myTransformationGUI->MakeMultiTranslation1DAndDisplay(myGeomShape, myDir1, myStep1, myNbTimes1);
282   }
283   else if(myConstructorId == 1) {
284     if(myOkBase && myOkDir1 && myOkDir2)
285       myTransformationGUI->MakeMultiTranslation2DAndDisplay(myGeomShape, myDir1, myStep1, myNbTimes1, myDir2, myStep2, myNbTimes2);
286   }
287   return;
288 }
289
290
291 //=================================================================================
292 // function : SelectionIntoArgument()
293 // purpose  : Called when selection as changed or other case
294 //=================================================================================
295 void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
296 {
297   myGeomBase->EraseSimulationShape();
298   mySimulationTopoDs.Nullify();
299   myEditCurrentArgument->setText("");
300   QString aString = ""; /* name of selection */
301
302   int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
303   if(nbSel != 1) {
304     if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1)
305       myOkBase = false;
306     else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2)
307       myOkDir1 = false;
308     else if(myEditCurrentArgument == GroupDimensions->LineEdit3)
309       myOkDir2 = false;
310     return;
311   }
312
313   // nbSel == 1
314   TopoDS_Shape S; 
315   Standard_Boolean testResult;
316   Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
317   if(!myGeomBase->GetTopoFromSelection(mySelection, S))
318     return;
319
320   switch(myConstructorId)
321     {
322     case 0 :
323       {
324         if(myEditCurrentArgument == GroupPoints->LineEdit1) {
325           myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
326           if(!testResult)
327             return;
328           myEditCurrentArgument->setText(aString);
329           myBase = S;
330           myOkBase = true;
331         }    
332         else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
333           BRepAdaptor_Curve curv(TopoDS::Edge(S));
334           myDir1 = curv.Line().Direction();
335           myEditCurrentArgument->setText(aString);
336           myOkDir1 = true;
337         }
338
339         if(myOkBase && myOkDir1)
340           this->MakeMultiTranslationSimulationAndDisplay();
341         break;
342       }
343     case 1 :
344       { 
345         if(myEditCurrentArgument == GroupDimensions->LineEdit1) {
346           myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
347           if(!testResult)
348             return;
349           myEditCurrentArgument->setText(aString);
350           myBase = S;
351           myOkBase = true;
352         }    
353         else if(myEditCurrentArgument == GroupDimensions->LineEdit2) {
354           BRepAdaptor_Curve curv(TopoDS::Edge(S));
355           myDir1 = curv.Line().Direction();
356           myEditCurrentArgument->setText(aString);
357           myOkDir1 = true;
358         }
359         else if(myEditCurrentArgument == GroupDimensions->LineEdit3) {
360           BRepAdaptor_Curve curv(TopoDS::Edge(S));
361           myDir2 = curv.Line().Direction();
362           myEditCurrentArgument->setText(aString);
363           myOkDir2 = true;
364         }
365
366         if(myOkBase && myOkDir1 && myOkDir2)
367           this->MakeMultiTranslationSimulationAndDisplay();
368         break;
369       }
370     }
371   return;
372 }
373
374
375 //=================================================================================
376 // function : SetEditCurrentArgument()
377 // purpose  :
378 //=================================================================================
379 void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
380 {
381   QPushButton* send = (QPushButton*)sender();
382   mySelection->ClearFilters();
383
384   if(send == GroupPoints->PushButton1) {
385     GroupPoints->LineEdit1->setFocus();
386     myEditCurrentArgument = GroupPoints->LineEdit1;
387   }
388   else if(send == GroupPoints->PushButton2) {
389     GroupPoints->LineEdit2->setFocus();
390     myEditCurrentArgument = GroupPoints->LineEdit2;
391     mySelection->AddFilter(myEdgeFilter);
392   }
393   else if(send == GroupDimensions->PushButton1) {
394     GroupDimensions->LineEdit1->setFocus();
395     myEditCurrentArgument = GroupDimensions->LineEdit1;
396   }
397   else if(send == GroupDimensions->PushButton2) {
398     GroupDimensions->LineEdit2->setFocus();
399     myEditCurrentArgument = GroupDimensions->LineEdit2;
400     mySelection->AddFilter(myEdgeFilter);
401   }
402   else if(send == GroupDimensions->PushButton3) {
403     GroupDimensions->LineEdit3->setFocus();
404     myEditCurrentArgument = GroupDimensions->LineEdit3;
405     mySelection->AddFilter(myEdgeFilter);
406   }
407   this->SelectionIntoArgument();
408
409   return;
410 }
411
412
413 //=================================================================================
414 // function : LineEditReturnPressed()
415 // purpose  :
416 //=================================================================================
417 void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
418 {
419   QLineEdit* send = (QLineEdit*)sender();
420   if(send == GroupPoints->LineEdit1)
421     myEditCurrentArgument = GroupPoints->LineEdit1;
422   else if (send == GroupPoints->LineEdit2)
423     myEditCurrentArgument = GroupPoints->LineEdit2;
424   else if (send == GroupDimensions->LineEdit1)
425     myEditCurrentArgument = GroupDimensions->LineEdit1;
426   else if (send == GroupDimensions->LineEdit2)
427     myEditCurrentArgument = GroupDimensions->LineEdit2;
428   else if (send == GroupDimensions->LineEdit3)
429     myEditCurrentArgument = GroupDimensions->LineEdit3;
430   else
431     return;
432
433   GEOMBase_Skeleton::LineEditReturnPressed();
434   return;
435 }
436
437
438 //=================================================================================
439 // function : ActivateThisDialog()
440 // purpose  :
441 //=================================================================================
442 void TransformationGUI_MultiTranslationDlg::ActivateThisDialog()
443 {
444   GEOMBase_Skeleton::ActivateThisDialog();
445   connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
446
447   if(myConstructorId == 0) {
448     GroupPoints->LineEdit1->setFocus();
449     myEditCurrentArgument = GroupPoints->LineEdit1;
450   }
451   else if(myConstructorId == 1) {
452     GroupDimensions->LineEdit1->setFocus();
453     myEditCurrentArgument = GroupDimensions->LineEdit1;
454   }
455
456   if(!mySimulationTopoDs.IsNull())
457     myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
458   return;
459 }
460
461
462 //=================================================================================
463 // function : enterEvent()
464 // purpose  :
465 //=================================================================================
466 void TransformationGUI_MultiTranslationDlg::enterEvent(QEvent* e)
467 {
468   if (GroupConstructors->isEnabled())
469     return;
470   this->ActivateThisDialog();
471   return;
472 }
473
474
475 //=================================================================================
476 // function : ValueChangedInSpinBox()
477 // purpose  :
478 //=================================================================================
479 void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValue)
480 {
481   myGeomBase->EraseSimulationShape();
482   mySimulationTopoDs.Nullify();
483   QObject* send = (QObject*)sender();
484
485   switch(myConstructorId)
486     {
487     case 0 :
488       { 
489         if(send == GroupPoints->SpinBox_DX)
490           myStep1 = newValue;
491         else if(send == GroupPoints->SpinBox_DY)
492           myNbTimes1 = (int)newValue;
493         if(myOkBase && myOkDir1)
494           this->MakeMultiTranslationSimulationAndDisplay();
495         break;
496       }
497     case 1 :
498       { 
499         if(send == GroupDimensions->SpinBox_DX1)
500           myStep1 = newValue;
501         else if(send == GroupDimensions->SpinBox_DY1)
502           myNbTimes1 = (int)newValue;
503         else if(send == GroupDimensions->SpinBox_DX2)
504           myStep2 = newValue;
505         else if(send == GroupDimensions->SpinBox_DY2)
506           myNbTimes2 = (int)newValue;
507         if(myOkBase && myOkDir1 && myOkDir2)
508           this->MakeMultiTranslationSimulationAndDisplay();
509         break;
510       }
511     }
512   return;
513 }
514
515
516 //=================================================================================
517 // function : ReverseAngle1()
518 // purpose  : 'state' not used here
519 //=================================================================================
520 void TransformationGUI_MultiTranslationDlg::ReverseAngle1(int state)
521 {
522   myStep1 = -myStep1;
523   if(myConstructorId == 0) {
524     GroupPoints->SpinBox_DX->SetValue(myStep1);
525     if(myOkBase && myOkDir1)
526       this->MakeMultiTranslationSimulationAndDisplay();
527   }
528   else if(myConstructorId == 1) {
529     GroupDimensions->SpinBox_DX1->SetValue(myStep1);
530     if(myOkBase && myOkDir1 && myOkDir2)
531       this->MakeMultiTranslationSimulationAndDisplay();
532   }
533   return;
534 }
535
536
537 //=================================================================================
538 // function : ReverseAngle2()
539 // purpose  : 'state' not used here
540 //=================================================================================
541 void TransformationGUI_MultiTranslationDlg::ReverseAngle2(int state)
542 {
543   myStep2 = -myStep2;
544   GroupDimensions->SpinBox_DX2->SetValue(myStep2);
545   if(myOkBase && myOkDir1 && myOkDir2)
546     MakeMultiTranslationSimulationAndDisplay();
547   return;
548 }
549
550
551 //=================================================================================
552 // function : MakeMultiTranslationSimulationAndDisplay()
553 // purpose  :
554 //=================================================================================
555 void TransformationGUI_MultiTranslationDlg::MakeMultiTranslationSimulationAndDisplay() 
556 {
557   myGeomBase->EraseSimulationShape();
558   mySimulationTopoDs.Nullify();
559
560   int i, j;
561   Standard_Real DX, DY, DZ;
562   gp_Trsf theTransformation;
563   GProp_GProps System;
564   TopoDS_Compound compound;
565
566   BRep_Builder B;
567   B.MakeCompound(compound);
568     
569   try {
570     BRepGProp::LinearProperties(myBase, System);
571     gp_Pnt myPoint = System.CentreOfMass();
572     TopoDS_Shape S = BRepBuilderAPI_MakeVertex(myPoint).Shape();
573
574     switch (myConstructorId)
575       {
576       case 0 :
577         { 
578           gp_Vec Vec(myDir1);
579           Vec.Normalize();
580
581           for(i = 0; i < myNbTimes1; i++) {
582             DX = i * myStep1 * Vec.X();
583             DY = i * myStep1 * Vec.Y();
584             DZ = i * myStep1 * Vec.Z();
585             myVec.SetCoord(DX, DY, DZ);
586             
587             theTransformation.SetTranslation(myVec);
588             BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False);
589             B.Add(compound, myBRepTransformation.Shape());
590           }
591           mySimulationTopoDs = compound;
592           myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
593           break;
594         }
595       case 1 :
596         {       
597           gp_Vec Vec1(myDir1);
598           Vec1.Normalize();
599           gp_Vec Vec2(myDir2);
600           Vec2.Normalize();
601
602           for(i = 0; i < myNbTimes1; i++) {
603             for(j = 0; j < myNbTimes2; j++) {
604               DX = i * myStep1 * Vec1.X() + j * myStep2 * Vec2.X();
605               DY = i * myStep1 * Vec1.Y() + j * myStep2 * Vec2.Y();
606               DZ = i * myStep1 * Vec1.Z() + j * myStep2 * Vec2.Z();
607               myVec.SetCoord(DX, DY, DZ);
608               
609               theTransformation.SetTranslation(myVec);
610               BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False);
611               B.Add(compound, myBRepTransformation.Shape());
612             }
613           }
614           mySimulationTopoDs = compound;
615           myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
616           break;
617         }
618       }
619   }
620   catch(Standard_Failure) {
621     MESSAGE("Exception catched in MakeMultitranslationSimulationAndDisplay");
622     return;
623   }
624   return;
625 }