Salome HOME
updated copyright message
[modules/geom.git] / src / PrimitiveGUI / PrimitiveGUI_CylinderDlg.cxx
1 // Copyright (C) 2007-2023  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, or (at your option) any later version.
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 // GEOM GEOMGUI : GUI for Geometry component
24 // File   : PrimitiveGUI_CylinderDlg.cxx
25 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
26 //
27 #include "PrimitiveGUI_CylinderDlg.h"
28
29 #include <DlgRef.h>
30 #include <GeometryGUI.h>
31 #include <GEOMBase.h>
32
33 #include <SUIT_Session.h>
34 #include <SUIT_ResourceMgr.h>
35 #include <SalomeApp_Application.h>
36 #include <LightApp_SelectionMgr.h>
37
38 // OCCT Includes
39 #include <TopoDS_Shape.hxx>
40 #include <TopoDS_Edge.hxx>
41 #include <TopoDS.hxx>
42 #include <TopExp.hxx>
43 #include <TColStd_IndexedMapOfInteger.hxx>
44 #include <TopTools_IndexedMapOfShape.hxx>
45
46 #include <GEOMImpl_Types.hxx>
47
48 //=================================================================================
49 // class    : PrimitiveGUI_CylinderDlg()
50 // purpose  : Constructs a PrimitiveGUI_CylinderDlg which is a child of 'parent', with the
51 //            name 'name' and widget flags set to 'f'.
52 //            The dialog will by default be modeless, unless you set 'modal' to
53 //            TRUE to construct a modal dialog.
54 //=================================================================================
55 PrimitiveGUI_CylinderDlg::PrimitiveGUI_CylinderDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
56                                                     bool modal, Qt::WindowFlags fl)
57   : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
58     myInitial(true)
59 {
60   QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_CYLINDER_PV")));
61   QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_CYLINDER_DXYZ")));
62   QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
63
64   setWindowTitle(tr("GEOM_CYLINDER_TITLE"));
65
66   /***************************************************************/
67   mainFrame()->GroupConstructors->setTitle(tr("GEOM_CYLINDER"));
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_2Sel3Spin1Check(centralWidget());
74   GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
75   GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT"));
76   GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
77   GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS"));
78   GroupPoints->TextLabel4->setText(tr("GEOM_HEIGHT"));
79   GroupPoints->TextLabel5->setText(tr("GEOM_ANGLE"));
80   GroupPoints->checkBox->setText(tr(""));
81   GroupPoints->PushButton1->setIcon(image2);
82   GroupPoints->PushButton2->setIcon(image2);
83   GroupPoints->SpinBox_DZ->setDisabled(true);
84
85   GroupDimensions = new DlgRef_3Spin1CheckCyl(centralWidget());
86   GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
87   GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS"));
88   GroupDimensions->TextLabel2->setText(tr("GEOM_HEIGHT"));
89   GroupDimensions->TextLabel3->setText(tr("GEOM_ANGLE"));
90   GroupDimensions->checkBox->setText(tr(""));
91   GroupDimensions->SpinBox_DZ->setDisabled(true);
92
93   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
94   layout->setMargin(0); layout->setSpacing(6);
95   layout->addWidget(GroupPoints);
96   layout->addWidget(GroupDimensions);
97   /***************************************************************/
98
99   setHelpFileName("create_cylinder_page.html");
100
101   Init();
102 }
103
104 //=================================================================================
105 // function : ~PrimitiveGUI_CylinderDlg()
106 // purpose  : Destroys the object and frees any allocated resources
107 //=================================================================================
108 PrimitiveGUI_CylinderDlg::~PrimitiveGUI_CylinderDlg()
109 {
110   // no need to delete child widgets, Qt does it all for us
111 }
112
113 //=================================================================================
114 // function : Init()
115 // purpose  :
116 //=================================================================================
117 void PrimitiveGUI_CylinderDlg::Init()
118 {
119   // Get setting of step value from file configuration
120   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
121   double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
122
123   // min, max, step and decimals for spin boxes & initial values
124   double SpecificStep = 5;
125   initSpinBox(GroupPoints->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" );
126   initSpinBox(GroupPoints->SpinBox_DY, 0.00001, COORD_MAX, step, "length_precision" );
127   initSpinBox(GroupPoints->SpinBox_DZ, 0., 360., SpecificStep, "angle_precision" );
128
129   initSpinBox(GroupDimensions->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" );
130   initSpinBox(GroupDimensions->SpinBox_DY, 0.00001, COORD_MAX, step, "length_precision" );
131   initSpinBox(GroupDimensions->SpinBox_DZ, 0., 360., SpecificStep, "angle_precision" );
132
133   // init variables
134   myEditCurrentArgument = GroupPoints->LineEdit1;
135   GroupPoints->LineEdit1->setReadOnly(true);
136   GroupPoints->LineEdit2->setReadOnly(true);
137
138   GroupPoints->LineEdit1->setText("");
139   GroupPoints->LineEdit2->setText("");
140   myPoint.nullify();
141   myDir.nullify();
142
143   double aRadius(100.0), aHeight(300.0), aAngle(270.);
144   GroupPoints->SpinBox_DX->setValue(aRadius);
145   GroupPoints->SpinBox_DY->setValue(aHeight);
146   GroupPoints->SpinBox_DZ->setValue(aAngle);
147   GroupDimensions->SpinBox_DX->setValue(aRadius);
148   GroupDimensions->SpinBox_DY->setValue(aHeight);
149   GroupDimensions->SpinBox_DZ->setValue(aAngle);
150
151   // signals and slots connections
152   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
153   connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
154
155   connect(this,          SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
156
157   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
158   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
159
160   connect(GroupPoints->SpinBox_DX,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
161   connect(GroupPoints->SpinBox_DY,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
162   connect(GroupPoints->SpinBox_DZ,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
163   connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
164   connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
165   connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
166
167   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
168   
169   connect(GroupPoints->checkBox,     SIGNAL(toggled(bool)), this, SLOT(ActivateAngle()));
170   connect(GroupDimensions->checkBox, SIGNAL(toggled(bool)), this, SLOT(ActivateAngle()));
171   
172   initName(tr("GEOM_CYLINDER"));
173
174   setConstructorId(1); // simplest constructor
175   ConstructorsClicked(1);
176 }
177
178 //=================================================================================
179 // function : SetDoubleSpinBoxStep()
180 // purpose  : Double spin box management
181 //=================================================================================
182 void PrimitiveGUI_CylinderDlg::SetDoubleSpinBoxStep (double step)
183 {
184   GroupPoints->SpinBox_DX->setSingleStep(step);
185   GroupPoints->SpinBox_DY->setSingleStep(step);
186   GroupDimensions->SpinBox_DX->setSingleStep(step);
187   GroupDimensions->SpinBox_DY->setSingleStep(step);
188 }
189
190 //=================================================================================
191 // function : ConstructorsClicked()
192 // purpose  : Radio button management
193 //=================================================================================
194 void PrimitiveGUI_CylinderDlg::ConstructorsClicked (int constructorId)
195 {
196   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
197
198   switch (constructorId) {
199   case 0:
200     {
201       GroupDimensions->hide();
202       GroupPoints->show();
203
204       GroupPoints->PushButton1->click();
205       break;
206     }
207   case 1:
208     {
209       GroupPoints->hide();
210       GroupDimensions->show();
211       disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
212       globalSelection(); // close local contexts, if any
213       break;
214     }
215   }
216
217   qApp->processEvents();
218   updateGeometry();
219   resize(minimumSizeHint());
220   SelectionIntoArgument();
221   
222   displayPreview(true);
223 }
224
225 //=================================================================================
226 // function : ClickOnOk()
227 // purpose  :
228 //=================================================================================
229 void PrimitiveGUI_CylinderDlg::ClickOnOk()
230 {
231   setIsApplyAndClose( true );
232   if (ClickOnApply())
233     ClickOnCancel();
234 }
235
236 //=================================================================================
237 // function : ClickOnApply()
238 // purpose  :
239 //=================================================================================
240 bool PrimitiveGUI_CylinderDlg::ClickOnApply()
241 {
242   if (!onAccept())
243     return false;
244
245   initName();
246   // activate selection and connect selection manager
247   ConstructorsClicked(getConstructorId());
248   return true;
249 }
250
251 //=================================================================================
252 // function : SelectionIntoArgument()
253 // purpose  : Called when selection is changed or on dialog initialization or activation
254 //=================================================================================
255 void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
256 {
257   if (getConstructorId() != 0)
258     return;
259
260   erasePreview();
261   myEditCurrentArgument->setText("");
262
263   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
264   SALOME_ListIO aSelList;
265   aSelMgr->selectedObjects(aSelList);
266
267   if (aSelList.Extent() != 1) {
268     if (myEditCurrentArgument == GroupPoints->LineEdit1)
269       myPoint.nullify();
270     else if (myEditCurrentArgument == GroupPoints->LineEdit2)
271       myDir.nullify();
272     return;
273   }
274
275   TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupPoints->LineEdit2 ? TopAbs_EDGE : TopAbs_VERTEX;
276   GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
277   TopoDS_Shape aShape;
278   if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
279     QString aName = GEOMBase::GetName( aSelectedObject.get() );
280
281     myEditCurrentArgument->setText(aName);
282     
283     if (myEditCurrentArgument == GroupPoints->LineEdit1) {
284       myPoint = aSelectedObject;
285       if (myPoint && !myDir)
286         GroupPoints->PushButton2->click();
287     }
288     else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
289       myDir = aSelectedObject;
290       if (myDir && !myPoint)
291         GroupPoints->PushButton1->click();
292     }
293     // clear selection
294     if ((myDir && !myPoint) || (myPoint && !myDir)) {
295       disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
296       myGeomGUI->getApp()->selectionMgr()->clearSelected();
297       connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
298               this, SLOT(SelectionIntoArgument()));
299     }
300   }
301   displayPreview(true);
302 }
303
304 //=================================================================================
305 // function : SetEditCurrentArgument()
306 // purpose  :
307 //=================================================================================
308 void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument()
309 {
310   QPushButton* send = (QPushButton*)sender();
311
312   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
313   if (send == GroupPoints->PushButton1) {
314     myEditCurrentArgument = GroupPoints->LineEdit1;
315
316     GroupPoints->PushButton2->setDown(false);
317     GroupPoints->LineEdit2->setEnabled(false);
318
319     globalSelection(GEOM_POINT); // to break previous local selection
320     localSelection(TopAbs_VERTEX);
321   }
322   else if (send == GroupPoints->PushButton2) {
323     myEditCurrentArgument = GroupPoints->LineEdit2;
324
325     GroupPoints->PushButton1->setDown(false);
326     GroupPoints->LineEdit1->setEnabled(false);
327
328     globalSelection(GEOM_LINE);  // to break previous local selection
329     localSelection(TopAbs_EDGE);
330   }
331   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
332           this, SLOT(SelectionIntoArgument()));
333
334   // enable line edit
335   myEditCurrentArgument->setEnabled(true);
336   myEditCurrentArgument->setFocus();
337   // after setFocus(), because it will be setDown(false) when loses focus
338   send->setDown(true);
339
340   // seems we need it only to avoid preview disappearing, caused by selection mode change
341   displayPreview(true);
342 }
343
344 //=================================================================================
345 // function : ActivateThisDialog()
346 // purpose  :
347 //=================================================================================
348 void PrimitiveGUI_CylinderDlg::ActivateThisDialog()
349 {
350   GEOMBase_Skeleton::ActivateThisDialog();
351
352   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
353            this, SLOT( SelectionIntoArgument() ) );
354
355   ConstructorsClicked( getConstructorId() );
356 }
357
358 //=================================================================================
359 // function : enterEvent()
360 // purpose  :
361 //=================================================================================
362 void PrimitiveGUI_CylinderDlg::enterEvent (QEvent*)
363 {
364   if (!mainFrame()->GroupConstructors->isEnabled())
365     ActivateThisDialog();
366 }
367
368 //=================================================================================
369 // function : ValueChangedInSpinBox()
370 // purpose  :
371 //=================================================================================
372 void PrimitiveGUI_CylinderDlg::ValueChangedInSpinBox()
373 {
374   QString msg;
375   if (!isValid(msg)) {
376     erasePreview();
377     return;
378   }
379   displayPreview(true);
380 }
381
382 //=================================================================================
383 // function : createOperation
384 // purpose  :
385 //=================================================================================
386 GEOM::GEOM_IOperations_ptr PrimitiveGUI_CylinderDlg::createOperation()
387 {
388   return getGeomEngine()->GetI3DPrimOperations();
389 }
390
391 //=================================================================================
392 // function : isValid
393 // purpose  :
394 //=================================================================================
395 bool PrimitiveGUI_CylinderDlg::isValid (QString& msg)
396 {
397   bool ok = false;
398   if( getConstructorId() == 0 )
399   {
400     ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) &&
401          GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) &&
402          ( !GroupPoints->checkBox->isChecked() || GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) ) &&
403          myPoint && myDir;
404     if ( GroupPoints->checkBox->isChecked() && 
405          ( GroupPoints->SpinBox_DZ->value() <= 0. || GroupPoints->SpinBox_DZ->value() >= 360. ) ) {
406       msg += tr("GEOM_CYLINDER_ANGLE_ERR") + "\n";
407       ok = false;
408     }
409   }
410   else if( getConstructorId() == 1 )
411   {
412     ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
413          GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) &&
414          ( !GroupDimensions->checkBox->isChecked() || GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) );
415     if ( GroupDimensions->checkBox->isChecked() &&
416          ( GroupDimensions->SpinBox_DZ->value() <= 0. || GroupDimensions->SpinBox_DZ->value() >= 360. ) ) {
417       msg += tr("GEOM_CYLINDER_ANGLE_ERR") + "\n";
418       ok = false;
419     }
420   }
421   ok = qAbs( getHeight() ) > Precision::Confusion() && ok;
422   ok = qAbs( getRadius() ) > Precision::Confusion() && ok;
423   return ok;
424 }
425
426 //=================================================================================
427 // function : execute
428 // purpose  :
429 //=================================================================================
430 bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
431 {
432   bool res = false;
433   
434   GEOM::GEOM_Object_var anObj;
435
436   GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
437
438   switch (getConstructorId()) {
439   case 0:
440     if ( myPoint && myDir ) {
441       if ( GroupPoints->checkBox->isChecked() ) {
442         anObj = anOper->MakeCylinderPntVecRHA(myPoint.get(), myDir.get(), getRadius(), getHeight(), getAngle()*M_PI/180.);
443         if (!anObj->_is_nil() && !IsPreview())
444         {
445           QStringList aParameters;
446           aParameters << GroupPoints->SpinBox_DX->text();
447           aParameters << GroupPoints->SpinBox_DY->text();
448           aParameters << GroupPoints->SpinBox_DZ->text();
449           anObj->SetParameters(aParameters.join(":").toUtf8().constData());
450         }
451         res = true;
452       }
453       else {
454         anObj = anOper->MakeCylinderPntVecRH(myPoint.get(), myDir.get(), getRadius(), getHeight());
455         if (!anObj->_is_nil() && !IsPreview())
456         {
457           QStringList aParameters;
458           aParameters << GroupPoints->SpinBox_DX->text();
459           aParameters << GroupPoints->SpinBox_DY->text();
460           anObj->SetParameters(aParameters.join(":").toUtf8().constData());
461         }
462         res = true;
463       }
464     }
465     break;
466   case 1:
467     if ( GroupDimensions->checkBox->isChecked() ) {
468       anObj = anOper->MakeCylinderRHA(getRadius(), getHeight(), getAngle()*M_PI/180.);
469       if (!anObj->_is_nil() && !IsPreview())
470       {
471         QStringList aParameters;
472         aParameters << GroupDimensions->SpinBox_DX->text();
473         aParameters << GroupDimensions->SpinBox_DY->text();
474         aParameters << GroupDimensions->SpinBox_DZ->text();
475         anObj->SetParameters(aParameters.join(":").toUtf8().constData());
476       }
477       res = true;
478     }
479     else {
480       anObj = anOper->MakeCylinderRH(getRadius(), getHeight());
481       if (!anObj->_is_nil() && !IsPreview())
482       {
483         QStringList aParameters;
484         aParameters << GroupDimensions->SpinBox_DX->text();
485         aParameters << GroupDimensions->SpinBox_DY->text();
486         anObj->SetParameters(aParameters.join(":").toUtf8().constData());
487       }
488       res = true;
489     }
490     break;
491   }
492
493   if (!anObj->_is_nil())
494     objects.push_back(anObj._retn());
495
496   return res;
497 }
498
499 //=================================================================================
500 // function : getRadius()
501 // purpose  :
502 //=================================================================================
503 double PrimitiveGUI_CylinderDlg::getRadius() const
504 {
505   int aConstructorId = getConstructorId();
506   if (aConstructorId == 0)
507     return GroupPoints->SpinBox_DX->value();
508   else if (aConstructorId == 1)
509     return GroupDimensions->SpinBox_DX->value();
510   return 0;
511 }
512
513 //=================================================================================
514 // function : getHeight()
515 // purpose  :
516 //=================================================================================
517 double PrimitiveGUI_CylinderDlg::getHeight() const
518 {
519   int aConstructorId = getConstructorId();
520   if (aConstructorId == 0)
521     return GroupPoints->SpinBox_DY->value();
522   else if (aConstructorId == 1)
523     return GroupDimensions->SpinBox_DY->value();
524   return 0;
525 }
526
527 //=================================================================================
528 // function : getAngle()
529 // purpose  :
530 //=================================================================================
531 double PrimitiveGUI_CylinderDlg::getAngle() const
532 {
533   int aConstructorId = getConstructorId();
534   if (aConstructorId == 0)
535     return GroupPoints->SpinBox_DZ->value();
536   else if (aConstructorId == 1)
537     return GroupDimensions->SpinBox_DZ->value();
538   return 0;
539 }
540
541 //=================================================================================
542 // function : addSubshapeToStudy
543 // purpose  : virtual method to add new SubObjects if local selection
544 //=================================================================================
545 void PrimitiveGUI_CylinderDlg::addSubshapesToStudy()
546 {
547   if ( getConstructorId() == 0 ) {
548     GEOMBase::PublishSubObject( myPoint.get() );
549     GEOMBase::PublishSubObject( myDir.get() );
550   }
551 }
552
553 //=================================================================================
554 // function : getSourceObjects
555 // purpose  : virtual method to get source objects
556 //=================================================================================
557 QList<GEOM::GeomObjPtr> PrimitiveGUI_CylinderDlg::getSourceObjects()
558 {
559   QList<GEOM::GeomObjPtr> res;
560   res << myPoint << myDir;
561   return res;
562 }
563
564 //=================================================================================
565 // function :  ActivateAngle()
566 // purpose  : enable the 
567 //=================================================================================
568 void PrimitiveGUI_CylinderDlg::ActivateAngle()
569 {
570   int aConstructorId = getConstructorId();
571   if (aConstructorId == 0){
572     GroupPoints->SpinBox_DZ->setEnabled( GroupPoints->checkBox->isChecked() );
573     processPreview();
574   }
575   else if (aConstructorId == 1){
576     GroupDimensions->SpinBox_DZ->setEnabled( GroupDimensions->checkBox->isChecked() );
577     processPreview();
578   }
579 }