Salome HOME
Merge branch V7_3_1_BR
[modules/geom.git] / src / AdvancedGUI / AdvancedGUI_PipeTShapeDlg.cxx
1 // Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "AdvancedGUI_PipeTShapeDlg.h"
21
22 #include <DlgRef.h>
23 #include <GeometryGUI.h>
24 #include <GEOMBase.h>
25
26 #include <SUIT_Session.h>
27 #include <SUIT_ResourceMgr.h>
28 #include <SUIT_OverrideCursor.h>
29 #include <LightApp_SelectionMgr.h>
30 #include <SalomeApp_Application.h>
31 #include <SalomeApp_Tools.h>
32
33 // OCCT Includes
34 #include <BRep_Tool.hxx>
35 #include <TopTools_IndexedMapOfShape.hxx>
36 #include <TopoDS_Shape.hxx>
37 #include <TopoDS.hxx>
38 #include <TopExp.hxx>
39 #include <TColStd_IndexedMapOfInteger.hxx>
40 #include <gp_Pnt.hxx>
41
42 #include <QTabWidget>
43
44 #include <GEOMImpl_Types.hxx>
45
46 //=================================================================================
47 // Constructor
48 //=================================================================================
49 AdvancedGUI_PipeTShapeDlg::AdvancedGUI_PipeTShapeDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
50   : GEOMBase_Skeleton(theGeometryGUI, parent, false)
51 {
52   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
53   //QPixmap imageOp  = aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PIPETSHAPE"));
54   QPixmap imageSel = aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"));
55   QPixmap imageImp = aResMgr->loadPixmap("GEOM", tr("ICO_PIPETSHAPE_IMPORT"));
56   imagePipeTShape  = aResMgr->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
57   imageReduction   = aResMgr->loadPixmap("GEOM", tr("IMG_PIPETSHAPE_SECT"));
58
59   setWindowTitle(tr("GEOM_PIPE_TSHAPE_TITLE"));
60
61   /***************************************************************/
62   mainFrame()->GroupConstructors->setAttribute(Qt::WA_DeleteOnClose);
63   mainFrame()->GroupConstructors->close();
64
65   QTabWidget* aTabWidget = new QTabWidget (centralWidget());
66
67   QGridLayout* myMainLayout = new QGridLayout (centralWidget());
68   myMainLayout->setMargin(0);
69   myMainLayout->setSpacing(6);
70
71   // Main parameters
72   QGroupBox* GroupMain = new QGroupBox();
73   QGridLayout* layoutGroupMain = new QGridLayout (GroupMain);
74
75   MainTubeGroupParams = new DlgRef_3Spin();
76   MainTubeGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_MPIPE"));
77   MainTubeGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
78   MainTubeGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_W"));
79   MainTubeGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_L"));
80   MainTubeGroupParams->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); // ??
81
82   IncidentTubeGroupParams = new DlgRef_3Spin();
83   IncidentTubeGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_IPIPE"));
84   IncidentTubeGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
85   IncidentTubeGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_W"));
86   IncidentTubeGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_L"));
87
88   ChamferGroupParams = new DlgRef_2Spin();
89   ChamferGroupParams->GroupBox1->setCheckable(true);
90   ChamferGroupParams->GroupBox1->setChecked(false);
91   ChamferGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_CHAMFER"));
92   ChamferGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_CHAMFER_H"));
93   ChamferGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_CHAMFER_W"));
94
95   FilletGroupParams = new DlgRef_1Spin();
96   FilletGroupParams->GroupBox1->setCheckable(true);
97   FilletGroupParams->GroupBox1->setChecked(false);
98   FilletGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_FILLET"));
99   FilletGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
100
101   HexMeshCheckBox = new QCheckBox();
102   HexMeshCheckBox->setText(tr("GEOM_PIPE_TSHAPE_HEX"));
103   HexMeshCheckBox->setChecked(true);
104
105   LabelImgPipeTShape = new QLabel();
106   LabelImgPipeTShape->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
107   LabelImgPipeTShape->setAlignment(Qt::AlignCenter);
108   LabelImgPipeTShape->setMinimumSize(300, 300);
109
110   layoutGroupMain->addWidget(MainTubeGroupParams, 0, 0, 1, 1);
111   layoutGroupMain->addWidget(IncidentTubeGroupParams, 1, 0, 1, 1);
112   layoutGroupMain->addWidget(ChamferGroupParams, 2, 0, 1, 1);
113   layoutGroupMain->addWidget(FilletGroupParams, 3, 0, 1, 1);
114   layoutGroupMain->addWidget(HexMeshCheckBox, 4, 0, 1, 1);
115
116   layoutGroupMain->addWidget(LabelImgPipeTShape, 0, 1, 5, 1);
117   layoutGroupMain->setColumnStretch(1, 1); // stretch of column 0 is supposed 0 by default
118
119   // Thickness reduction parameters
120   QGroupBox* GroupReduct = new QGroupBox();
121   QGridLayout* layoutGroupReduct = new QGridLayout (GroupReduct);
122
123   LReductionGroupParams = new AdvancedGUI_4Spin();
124   LReductionGroupParams->GroupBox1->setCheckable(true);
125   LReductionGroupParams->GroupBox1->setChecked(false);
126   LReductionGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_LEFT_TR"));
127   LReductionGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_TR_R").arg("L"));
128   LReductionGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_TR_W").arg("L"));
129   LReductionGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_TR_L_TRANS").arg("L"));
130   LReductionGroupParams->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_TR_L_THIN").arg("L"));
131
132   RReductionGroupParams = new AdvancedGUI_4Spin();
133   RReductionGroupParams->GroupBox1->setCheckable(true);
134   RReductionGroupParams->GroupBox1->setChecked(false);
135   RReductionGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_RIGHT_TR"));
136   RReductionGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_TR_R").arg("R"));
137   RReductionGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_TR_W").arg("R"));
138   RReductionGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_TR_L_TRANS").arg("R"));
139   RReductionGroupParams->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_TR_L_THIN").arg("R"));
140
141   IReductionGroupParams = new AdvancedGUI_4Spin();
142   IReductionGroupParams->GroupBox1->setCheckable(true);
143   IReductionGroupParams->GroupBox1->setChecked(false);
144   IReductionGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_INCI_TR"));
145   IReductionGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_TR_R").arg("I"));
146   IReductionGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_TR_W").arg("I"));
147   IReductionGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_TR_L_TRANS").arg("I"));
148   IReductionGroupParams->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_TR_L_THIN").arg("I"));
149
150   LabelImgReduction = new QLabel();
151   LabelImgReduction->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
152   LabelImgReduction->setAlignment(Qt::AlignCenter);
153   LabelImgReduction->setMinimumSize(300, 300);
154
155   layoutGroupReduct->addWidget(LReductionGroupParams->GroupBox1, 0, 0, 1, 1);
156   layoutGroupReduct->addWidget(RReductionGroupParams->GroupBox1, 1, 0, 1, 1);
157   layoutGroupReduct->addWidget(IReductionGroupParams->GroupBox1, 2, 0, 1, 1);
158
159   layoutGroupReduct->addWidget(LabelImgReduction, 0, 1, 3, 1);
160   layoutGroupReduct->setColumnStretch(1, 1); // stretch of column 0 is supposed 0 by default
161
162   // Position parameters
163   QGroupBox* GroupPos = new QGroupBox();
164   QVBoxLayout* layoutGroupPos = new QVBoxLayout (GroupPos);
165
166   JunctionPointsSel = new DlgRef_6Sel();
167   JunctionPointsSel->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_POSITION"));
168   JunctionPointsSel->GroupBox1->setCheckable(true);
169   JunctionPointsSel->GroupBox1->setChecked(false);
170   JunctionPointsSel->PushButton1->setIcon(imageSel);
171   JunctionPointsSel->LineEdit1->setReadOnly(true);
172   JunctionPointsSel->LineEdit1->setText("");
173   JunctionPointsSel->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P1"));
174
175   JunctionPointsSel->PushButton2->setIcon(imageSel);
176   JunctionPointsSel->LineEdit2->setReadOnly(true);
177   JunctionPointsSel->LineEdit2->setText("");
178   JunctionPointsSel->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P2"));
179
180   JunctionPointsSel->PushButton3->setIcon(imageSel);
181   JunctionPointsSel->LineEdit3->setReadOnly(true);
182   JunctionPointsSel->LineEdit3->setText("");
183   JunctionPointsSel->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P3"));
184
185   JunctionPointsSel->PushButton4->setIcon(imageImp);
186   JunctionPointsSel->LineEdit4->setReadOnly(true);
187   JunctionPointsSel->LineEdit4->setText("");
188   JunctionPointsSel->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L1"));
189
190   JunctionPointsSel->PushButton5->setIcon(imageImp);
191   JunctionPointsSel->LineEdit5->setReadOnly(true);
192   JunctionPointsSel->LineEdit5->setText("");
193   JunctionPointsSel->TextLabel5->setText(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L2"));
194
195   JunctionPointsSel->PushButton6->setAttribute(Qt::WA_DeleteOnClose);
196   JunctionPointsSel->PushButton6->close();
197   JunctionPointsSel->LineEdit6->setAttribute(Qt::WA_DeleteOnClose);
198   JunctionPointsSel->LineEdit6->close();
199   JunctionPointsSel->TextLabel6->setAttribute(Qt::WA_DeleteOnClose);
200   JunctionPointsSel->TextLabel6->close();
201
202   layoutGroupPos->addWidget(JunctionPointsSel);
203   layoutGroupPos->addStretch();
204
205   //aTabWidget->addTab(GroupMain, imageOp, tr("GEOM_PIPETSHAPE_GROUPMAIN"));
206   aTabWidget->addTab(GroupMain, tr("GEOM_PIPETSHAPE_GROUPMAIN"));
207   aTabWidget->addTab(GroupReduct, tr("GEOM_PIPETSHAPE_GROUPREDUCT"));
208   aTabWidget->addTab(GroupPos, tr("GEOM_PIPETSHAPE_GROUPPOS"));
209
210   myMainLayout->addWidget(aTabWidget, 0, 0, 1, 1);
211   connect(aTabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
212   /***************************************************************/
213
214   setHelpFileName("create_pipetshape_page.html");
215
216   Init();
217 }
218
219 //=================================================================================
220 // Destructor
221 //=================================================================================
222 AdvancedGUI_PipeTShapeDlg::~AdvancedGUI_PipeTShapeDlg() {
223   // no need to delete child widgets, Qt does it all for us
224 }
225
226 //=================================================================================
227 // function : Init()
228 // purpose  :
229 //=================================================================================
230 void AdvancedGUI_PipeTShapeDlg::Init()
231 {
232   // Get setting of step value from file configuration
233   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
234   double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
235   double minValue = Precision::Approximation();
236
237   myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
238   myOkPoint1 = myOkPoint2 = myOkPoint3 = false;
239
240   pipeTShapeGroupObjects.clear();
241
242   // min, max, step and decimals for spin boxes
243   initSpinBox(MainTubeGroupParams->SpinBox_DX, minValue, COORD_MAX, step, "length_precision");
244   initSpinBox(MainTubeGroupParams->SpinBox_DY, minValue, COORD_MAX, step, "length_precision");
245   initSpinBox(MainTubeGroupParams->SpinBox_DZ, minValue, COORD_MAX, step, "length_precision");
246   initSpinBox(IncidentTubeGroupParams->SpinBox_DX, minValue, COORD_MAX, step, "length_precision");
247   initSpinBox(IncidentTubeGroupParams->SpinBox_DY, minValue, COORD_MAX, step, "length_precision");
248   initSpinBox(IncidentTubeGroupParams->SpinBox_DZ, minValue, COORD_MAX, step, "length_precision");
249   initSpinBox(ChamferGroupParams->SpinBox_DX, minValue, COORD_MAX, step, "length_precision");
250   initSpinBox(ChamferGroupParams->SpinBox_DY, minValue, COORD_MAX, step, "length_precision");
251   initSpinBox(FilletGroupParams->SpinBox_DX, minValue, COORD_MAX, step, "length_precision");
252
253   initSpinBox(LReductionGroupParams->SpinBox1, minValue, COORD_MAX, step, "length_precision");
254   initSpinBox(LReductionGroupParams->SpinBox2, minValue, COORD_MAX, step, "length_precision");
255   initSpinBox(LReductionGroupParams->SpinBox3, minValue, COORD_MAX, step, "length_precision");
256   initSpinBox(LReductionGroupParams->SpinBox4, 0.,       COORD_MAX, step, "length_precision");
257
258   initSpinBox(RReductionGroupParams->SpinBox1, minValue, COORD_MAX, step, "length_precision");
259   initSpinBox(RReductionGroupParams->SpinBox2, minValue, COORD_MAX, step, "length_precision");
260   initSpinBox(RReductionGroupParams->SpinBox3, minValue, COORD_MAX, step, "length_precision");
261   initSpinBox(RReductionGroupParams->SpinBox4, 0.,       COORD_MAX, step, "length_precision");
262
263   initSpinBox(IReductionGroupParams->SpinBox1, minValue, COORD_MAX, step, "length_precision");
264   initSpinBox(IReductionGroupParams->SpinBox2, minValue, COORD_MAX, step, "length_precision");
265   initSpinBox(IReductionGroupParams->SpinBox3, minValue, COORD_MAX, step, "length_precision");
266   initSpinBox(IReductionGroupParams->SpinBox4, 0.,       COORD_MAX, step, "length_precision");
267
268   // init variables
269   MainTubeGroupParams->SpinBox_DX->setValue(80);
270   MainTubeGroupParams->SpinBox_DY->setValue(20);
271   MainTubeGroupParams->SpinBox_DZ->setValue(200);
272   IncidentTubeGroupParams->SpinBox_DX->setValue(50);
273   IncidentTubeGroupParams->SpinBox_DY->setValue(20);
274   IncidentTubeGroupParams->SpinBox_DZ->setValue(200);
275   ChamferGroupParams->SpinBox_DX->setValue(20);
276   ChamferGroupParams->SpinBox_DY->setValue(10);
277   FilletGroupParams->SpinBox_DX->setValue(20);
278
279   LReductionGroupParams->SpinBox1->setValue(60);
280   LReductionGroupParams->SpinBox2->setValue(30);
281   LReductionGroupParams->SpinBox3->setValue(40);
282   LReductionGroupParams->SpinBox4->setValue(20);
283
284   RReductionGroupParams->SpinBox1->setValue(60);
285   RReductionGroupParams->SpinBox2->setValue(30);
286   RReductionGroupParams->SpinBox3->setValue(40);
287   RReductionGroupParams->SpinBox4->setValue(20);
288
289   IReductionGroupParams->SpinBox1->setValue(40);
290   IReductionGroupParams->SpinBox2->setValue(10);
291   IReductionGroupParams->SpinBox3->setValue(30);
292   IReductionGroupParams->SpinBox4->setValue(15);
293
294   CssNormal = QString("QDoubleSpinBox {");
295   CssNormal.append(MainTubeGroupParams->SpinBox_DZ->styleSheet());
296   CssNormal.append("}");
297   CssNormal.append("\nQPushButton {");
298   CssNormal.append(JunctionPointsSel->PushButton4->styleSheet());
299   CssNormal.append("}");
300   CssAcceptable = "QDoubleSpinBox, QPushButton {background-color: rgb(85, 170, 127)}";
301   CssRefused = "QDoubleSpinBox, QPushButton {background-color: rgb(255, 0, 0)}";
302
303   showOnlyPreviewControl();
304
305   // Signal/slot connections
306   connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
307   connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
308   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
309   //connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
310   // ValueChangedInSpinBox
311   connect(MainTubeGroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
312   connect(MainTubeGroupParams->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
313   connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
314   connect(IncidentTubeGroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
315   connect(IncidentTubeGroupParams->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
316   connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
317   connect(ChamferGroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
318   connect(ChamferGroupParams->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
319   connect(FilletGroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
320   // ChamferOrFillet
321   connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
322   connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
323   // Thickness reduction:
324   //   Left
325   connect(LReductionGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(processPreview()));
326   connect(LReductionGroupParams->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
327   connect(LReductionGroupParams->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
328   connect(LReductionGroupParams->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
329   connect(LReductionGroupParams->SpinBox4, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
330   //   Right
331   connect(RReductionGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(processPreview()));
332   connect(RReductionGroupParams->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
333   connect(RReductionGroupParams->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
334   connect(RReductionGroupParams->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
335   connect(RReductionGroupParams->SpinBox4, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
336   //   Incident pipe
337   connect(IReductionGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(processPreview()));
338   connect(IReductionGroupParams->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
339   connect(IReductionGroupParams->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
340   connect(IReductionGroupParams->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
341   connect(IReductionGroupParams->SpinBox4, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
342   // Position
343   connect(JunctionPointsSel->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(SetPosition(bool)));
344   connect(JunctionPointsSel->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
345   connect(JunctionPointsSel->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
346   connect(JunctionPointsSel->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
347   // ApplyNewDimensions
348   connect(JunctionPointsSel->PushButton4, SIGNAL(clicked()), this, SLOT(ApplyNewDimensions()));
349   connect(JunctionPointsSel->PushButton5, SIGNAL(clicked()), this, SLOT(ApplyNewDimensions()));
350   connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(UpdatePicture(QWidget*, QWidget*)));
351   //@@ put additional signal/slot connections here @@//
352
353   initName(tr("GEOM_PIPE_TSHAPE"));
354
355   qApp->processEvents();
356   updateGeometry();
357   resize(minimumSizeHint());
358
359   updateLabelImgPipeTShape();
360   LabelImgReduction->setPixmap(imageReduction.scaled(LabelImgReduction->size(),
361                                                      Qt::KeepAspectRatio,
362                                                      Qt::SmoothTransformation));
363   processPreview();
364 }
365
366 //=================================================================================
367 // function : currentChanged()
368 // purpose  : Tab widget management
369 //=================================================================================
370 void AdvancedGUI_PipeTShapeDlg::currentChanged (int tabId)
371 {
372   if (tabId == 0 || tabId == 1)
373     resizeEvent(NULL);
374 }
375
376 //=================================================================================
377 // function : ApplyNewDimensions()
378 // purpose  :
379 //=================================================================================
380 void AdvancedGUI_PipeTShapeDlg::ApplyNewDimensions()
381 {
382   QPushButton* send = (QPushButton*) sender();
383
384   bool ok = false;
385   double newVal;
386   if (send == JunctionPointsSel->PushButton4) {
387     if (!JunctionPointsSel->LineEdit4->text().isEmpty()) {
388       newVal = JunctionPointsSel->LineEdit4->text().toDouble(&ok);
389       if (ok) {
390         disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0);
391         MainTubeGroupParams->SpinBox_DZ->setValue(newVal);
392         connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
393         MainTubeGroupParams->SpinBox_DZ->setToolTip("");
394         MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
395         CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
396         processPreview();
397       }
398     }
399   }
400   else if (send == JunctionPointsSel->PushButton5) {
401     if (!JunctionPointsSel->LineEdit5->text().isEmpty()) {
402       newVal = JunctionPointsSel->LineEdit5->text().toDouble(&ok);
403       if (ok) {
404         disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0);
405         IncidentTubeGroupParams->SpinBox_DZ->setValue(newVal);
406         connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
407         IncidentTubeGroupParams->SpinBox_DZ->setToolTip("");
408         IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
409         CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
410         processPreview();
411       }
412     }
413   }
414 }
415
416 //=================================================================================
417 // function : UpdatePicture()
418 // purpose  :
419 //=================================================================================
420 void AdvancedGUI_PipeTShapeDlg::UpdatePicture (QWidget* old, QWidget* now)
421 {
422   if (ChamferGroupParams->GroupBox1->isChecked())
423     if (now == MainTubeGroupParams->SpinBox_DX)
424       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_R1"));
425     else if (now == MainTubeGroupParams->SpinBox_DY)
426       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W1"));
427     else if (now == MainTubeGroupParams->SpinBox_DZ)
428       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_L1"));
429     else if (now == IncidentTubeGroupParams->SpinBox_DX)
430       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_R2"));
431     else if (now == IncidentTubeGroupParams->SpinBox_DY)
432       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W2"));
433     else if (now == IncidentTubeGroupParams->SpinBox_DZ)
434       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_L2"));
435     else if (now == ChamferGroupParams->SpinBox_DX)
436       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_H"));
437     else if (now == ChamferGroupParams->SpinBox_DY)
438       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W"));
439     else
440       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER"));
441   else if (FilletGroupParams->GroupBox1->isChecked())
442     if (now == MainTubeGroupParams->SpinBox_DX)
443       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_R1"));
444     else if (now == MainTubeGroupParams->SpinBox_DY)
445       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_W1"));
446     else if (now == MainTubeGroupParams->SpinBox_DZ)
447       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_L1"));
448     else if (now == IncidentTubeGroupParams->SpinBox_DX)
449       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_R2"));
450     else if (now == IncidentTubeGroupParams->SpinBox_DY)
451       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_W2"));
452     else if (now == IncidentTubeGroupParams->SpinBox_DZ)
453       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_L2"));
454     else if (now == FilletGroupParams->SpinBox_DX)
455       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_RF"));
456     else
457       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET"));
458   else
459     if (now == MainTubeGroupParams->SpinBox_DX)
460       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_R1"));
461     else if (now == MainTubeGroupParams->SpinBox_DY)
462       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_W1"));
463     else if (now == MainTubeGroupParams->SpinBox_DZ)
464       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_L1"));
465     else if (now == IncidentTubeGroupParams->SpinBox_DX)
466       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_R2"));
467     else if (now == IncidentTubeGroupParams->SpinBox_DY)
468       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_W2"));
469     else if (now == IncidentTubeGroupParams->SpinBox_DZ)
470       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_L2"));
471     else
472       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
473
474   updateLabelImgPipeTShape();
475 }
476
477 //=================================================================================
478 // function : SetPosition()
479 // purpose  :
480 //=================================================================================
481 void AdvancedGUI_PipeTShapeDlg::SetPosition (bool isChecked)
482 {
483   if (isChecked) {
484     erasePreview();
485     JunctionPointsSel->LineEdit4->setText("");
486     JunctionPointsSel->LineEdit5->setText("");
487     //connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(
488     //SelectionIntoArgument()));
489     JunctionPointsSel->PushButton1->click();
490     SelectionIntoArgument();
491   }
492   else {
493     disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
494     JunctionPointsSel->LineEdit4->setText("");
495     JunctionPointsSel->LineEdit5->setText("");
496     processPreview();
497   }
498 }
499
500 //=================================================================================
501 // function : ValueChangedInSpinBox()
502 // purpose  :
503 //=================================================================================
504 void AdvancedGUI_PipeTShapeDlg::ValueChangedInSpinBox (double newValue)
505 {
506   if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3)
507     CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
508   processPreview();
509 }
510
511 //=================================================================================
512 // function : SelectionIntoArgument()
513 // purpose  : Called when selection as changed or other case
514 //=================================================================================
515 void AdvancedGUI_PipeTShapeDlg::SelectionIntoArgument()
516 {
517   erasePreview();
518   //myEditCurrentArgument->setText("");
519
520   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
521   SALOME_ListIO aSelList;
522   aSelMgr->selectedObjects(aSelList);
523
524   if (aSelList.Extent() != 1) {
525     if (myEditCurrentArgument == JunctionPointsSel->LineEdit1)
526       myOkPoint1 = false;
527     else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2)
528       myOkPoint2 = false;
529     else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3)
530       myOkPoint3 = false;
531     return;
532     myEditCurrentArgument->setText("");
533   }
534
535   // nbSel == 1
536   if (aSelList.Extent() == 1) {
537     Handle(SALOME_InteractiveObject) anIO = aSelList.First();
538     GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO);
539     if (!CORBA::is_nil(aSelectedObject)) {
540       QString aName = GEOMBase::GetName(aSelectedObject);
541       TopoDS_Shape aShape;
542       if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
543
544         TColStd_IndexedMapOfInteger aMap;
545         aSelMgr->GetIndexes(anIO, aMap);
546         if (aMap.Extent() == 1) { // Local Selection
547           int anIndex = aMap(1);
548           aName += QString(":vertex_%1").arg(anIndex);
549
550           //Find SubShape Object in Father
551           GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
552
553           if (aFindedObject->_is_nil()) { // Object not found in study
554             GEOM::GEOM_IShapesOperations_var aShapesOp =
555               getGeomEngine()->GetIShapesOperations(getStudyId());
556             aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
557           }
558           else {
559             aSelectedObject = aFindedObject; // get Object from study
560           }
561           GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE);
562         } else { // Global Selection
563           if (aShape.ShapeType() != TopAbs_VERTEX) {
564             aSelectedObject = GEOM::GEOM_Object::_nil();
565             aName = "";
566           }
567         }
568       }
569
570       if (aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX) {
571         return;
572       }
573       myEditCurrentArgument->setText(aName);
574       if (myEditCurrentArgument == JunctionPointsSel->LineEdit1) {
575         myPoint1 = aSelectedObject;
576         myOkPoint1 = true;
577         if (!myOkPoint2)
578           JunctionPointsSel->PushButton2->click();
579       } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2) {
580         myPoint2 = aSelectedObject;
581         myOkPoint2 = true;
582         if (!myOkPoint3)
583           JunctionPointsSel->PushButton3->click();
584       } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3) {
585         myPoint3 = aSelectedObject;
586         myOkPoint3 = true;
587         if (!myOkPoint1)
588           JunctionPointsSel->PushButton1->click();
589       }
590     }
591   }
592
593   if (myOkPoint1 && myOkPoint2 && myOkPoint3) {
594     CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
595     processPreview();
596   }
597 }
598
599 //=================================================================================
600 // function : SetEditCurrentArgument()
601 // purpose  :
602 //=================================================================================
603 void AdvancedGUI_PipeTShapeDlg::SetEditCurrentArgument()
604 {
605   QPushButton* send = (QPushButton*) sender();
606
607   if (send == JunctionPointsSel->PushButton1) {
608     myEditCurrentArgument = JunctionPointsSel->LineEdit1;
609     JunctionPointsSel->PushButton2->setDown(false);
610     JunctionPointsSel->LineEdit2->setEnabled(false);
611     JunctionPointsSel->PushButton3->setDown(false);
612     JunctionPointsSel->LineEdit3->setEnabled(false);
613   }
614   else if (send == JunctionPointsSel->PushButton2) {
615     myEditCurrentArgument = JunctionPointsSel->LineEdit2;
616     JunctionPointsSel->PushButton1->setDown(false);
617     JunctionPointsSel->LineEdit1->setEnabled(false);
618     JunctionPointsSel->PushButton3->setDown(false);
619     JunctionPointsSel->LineEdit3->setEnabled(false);
620   }
621   else if (send == JunctionPointsSel->PushButton3) {
622     myEditCurrentArgument = JunctionPointsSel->LineEdit3;
623     JunctionPointsSel->PushButton1->setDown(false);
624     JunctionPointsSel->LineEdit1->setEnabled(false);
625     JunctionPointsSel->PushButton2->setDown(false);
626     JunctionPointsSel->LineEdit2->setEnabled(false);
627   }
628
629   // enable line edit
630   myEditCurrentArgument->setEnabled(true);
631   myEditCurrentArgument->setFocus();
632   myEditCurrentArgument->setText("");
633   // after setFocus(), because it will be setDown(false) when loses focus
634   send->setDown(true);
635
636   JunctionPointsSel->LineEdit4->setText("");
637   JunctionPointsSel->LineEdit5->setText("");
638
639   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
640   //globalSelection(GEOM_POINT);
641   globalSelection(); // close local contexts, if any
642   localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
643   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
644           this, SLOT(SelectionIntoArgument()));
645 }
646
647 //=================================================================================
648 // function : SetDoubleSpinBoxStep()
649 // purpose  : Double spin box management
650 //=================================================================================
651 void AdvancedGUI_PipeTShapeDlg::SetDoubleSpinBoxStep (double step)
652 {
653   MainTubeGroupParams->SpinBox_DX->setSingleStep(step);
654   MainTubeGroupParams->SpinBox_DY->setSingleStep(step);
655   MainTubeGroupParams->SpinBox_DZ->setSingleStep(step);
656   IncidentTubeGroupParams->SpinBox_DX->setSingleStep(step);
657   IncidentTubeGroupParams->SpinBox_DY->setSingleStep(step);
658   IncidentTubeGroupParams->SpinBox_DZ->setSingleStep(step);
659   ChamferGroupParams->SpinBox_DX->setSingleStep(step);
660   ChamferGroupParams->SpinBox_DY->setSingleStep(step);
661   FilletGroupParams->SpinBox_DX->setSingleStep(step);
662
663   LReductionGroupParams->SpinBox1->setSingleStep(step);
664   LReductionGroupParams->SpinBox2->setSingleStep(step);
665   LReductionGroupParams->SpinBox3->setSingleStep(step);
666   LReductionGroupParams->SpinBox4->setSingleStep(step);
667
668   RReductionGroupParams->SpinBox1->setSingleStep(step);
669   RReductionGroupParams->SpinBox2->setSingleStep(step);
670   RReductionGroupParams->SpinBox3->setSingleStep(step);
671   RReductionGroupParams->SpinBox4->setSingleStep(step);
672
673   IReductionGroupParams->SpinBox1->setSingleStep(step);
674   IReductionGroupParams->SpinBox2->setSingleStep(step);
675   IReductionGroupParams->SpinBox3->setSingleStep(step);
676   IReductionGroupParams->SpinBox4->setSingleStep(step);
677 }
678
679 //=================================================================================
680 // function : ClickOnOk()
681 // purpose  :
682 //=================================================================================
683 void AdvancedGUI_PipeTShapeDlg::ClickOnOk()
684 {
685   setIsApplyAndClose( true );
686   if (ClickOnApply())
687     ClickOnCancel();
688 }
689
690 //=================================================================================
691 // function : ClickOnApply()
692 // purpose  :
693 //=================================================================================
694 bool AdvancedGUI_PipeTShapeDlg::ClickOnApply()
695 {
696   if (!onAccept())
697     return false;
698
699   initName();
700
701   if (!isApplyAndClose())
702     processPreview();
703   return true;
704 }
705
706 //=================================================================================
707 // function : ActivateThisDialog()
708 // purpose  :
709 //=================================================================================
710 void AdvancedGUI_PipeTShapeDlg::ActivateThisDialog()
711 {
712   GEOMBase_Skeleton::ActivateThisDialog();
713   //globalSelection( GEOM_POINT);
714   //connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(
715   //        currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
716   if (myOkPoint1 && myOkPoint2 && myOkPoint3)
717     CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
718   processPreview();
719 }
720
721 //=================================================================================
722 // function : enterEvent [REDEFINED]
723 // purpose  :
724 //=================================================================================
725 void AdvancedGUI_PipeTShapeDlg::enterEvent (QEvent*)
726 {
727   if (!mainFrame()->GroupButtons->isEnabled())
728     ActivateThisDialog();
729 }
730
731 //=================================================================================
732 // function : resizeEvent [REDEFINED]
733 // purpose  :
734 //=================================================================================
735 void AdvancedGUI_PipeTShapeDlg::resizeEvent (QResizeEvent */*event*/)
736 {
737   QSize scaledSize1 = imagePipeTShape.size();
738   scaledSize1.scale(LabelImgPipeTShape->size(), Qt::KeepAspectRatio);
739   if (!LabelImgPipeTShape->pixmap() || scaledSize1 != LabelImgPipeTShape->pixmap()->size())
740     updateLabelImgPipeTShape();
741
742   QSize scaledSize2 = imageReduction.size();
743   scaledSize2.scale(LabelImgReduction->size(), Qt::KeepAspectRatio);
744   if (!LabelImgReduction->pixmap() || scaledSize2 != LabelImgReduction->pixmap()->size())
745     LabelImgReduction->setPixmap(imageReduction.scaled(LabelImgReduction->size(),
746                                                        Qt::KeepAspectRatio,
747                                                        Qt::SmoothTransformation));
748 }
749
750 //=================================================================================
751 // function : updateLabelImgPipeTShape
752 // purpose  :
753 //=================================================================================
754 void AdvancedGUI_PipeTShapeDlg::updateLabelImgPipeTShape()
755 {
756   LabelImgPipeTShape->setPixmap(imagePipeTShape.scaled(LabelImgPipeTShape->size(),
757                                                        Qt::KeepAspectRatio,
758                                                        Qt::SmoothTransformation));
759 }
760
761 //=================================================================================
762 // function : ChamferOrFillet()
763 // purpose  :
764 //=================================================================================
765 void AdvancedGUI_PipeTShapeDlg::ChamferOrFillet (bool)
766 {
767   QGroupBox* send = (QGroupBox*) sender();
768
769   if (send == ChamferGroupParams->GroupBox1) {
770     if (send->isChecked()) {
771       disconnect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0);
772       FilletGroupParams->GroupBox1->setChecked(false);
773       connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
774       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER"));
775     }
776     else
777       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
778
779     updateLabelImgPipeTShape();
780     if (myOkPoint1 && myOkPoint2 && myOkPoint3)
781       CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
782     processPreview();
783   }
784   else if (send == FilletGroupParams->GroupBox1) {
785     if (send->isChecked()) {
786       disconnect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0);
787       ChamferGroupParams->GroupBox1->setChecked(!send->isChecked());
788       connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
789       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET"));
790     }
791     else
792       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
793
794     updateLabelImgPipeTShape();
795     if (myOkPoint1 && myOkPoint2 && myOkPoint3)
796       CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
797     processPreview();
798   }
799 }
800
801 //=================================================================================
802 // function : DisplayPreview()
803 // purpose  :
804 //=================================================================================
805 void AdvancedGUI_PipeTShapeDlg::DisplayPreview (const bool activate, const bool update,
806                                                 const bool toRemoveFromEngine, const double lineWidth,
807                                                 const int displayMode, const int color)
808 {
809   QString msg;
810   if (!isValid(msg)) {
811     erasePreview(update);
812     return;
813   }
814
815   erasePreview(false);
816
817   try {
818     SUIT_OverrideCursor wc;
819     ObjectList objects;
820     bool hexMeshState = HexMeshCheckBox->isChecked();
821     HexMeshCheckBox->setChecked(false);
822     if (!executeNoCheck(objects) || !getOperation()->IsDone()) {
823       wc.suspend();
824     }
825     else {
826       ObjectList::iterator it = objects.begin();
827       GEOM::GEOM_Object_var obj = *it;
828       displayPreview(obj, true, activate, false, lineWidth, displayMode, color);
829       if (toRemoveFromEngine)
830         obj->UnRegister();
831     }
832     HexMeshCheckBox->setChecked(hexMeshState);
833   } catch (const SALOME::SALOME_Exception& e) {
834     SalomeApp_Tools::QtCatchCorbaException(e);
835   }
836
837   if (update)
838     updateViewer();
839 }
840
841 //=================================================================================
842 // function : createOperation
843 // purpose  :
844 //=================================================================================
845 GEOM::GEOM_IOperations_ptr AdvancedGUI_PipeTShapeDlg::createOperation()
846 {
847   //return getGeomEngine()->GetIAdvancedOperations(getStudyId());
848   return getGeomEngine()->GetPluginOperations(getStudyId(), "AdvancedEngine");
849 }
850
851 //=================================================================================
852 // function : isValid
853 // purpose  :
854 //=================================================================================
855 bool AdvancedGUI_PipeTShapeDlg::isValid (QString& msg)
856 {
857   bool ok = true;
858
859   ok = MainTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
860   ok = MainTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
861   ok = MainTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
862   ok = IncidentTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
863   ok = IncidentTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
864   ok = IncidentTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
865   ok = ChamferGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
866   ok = ChamferGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
867   ok = FilletGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
868
869   if (LReductionGroupParams->GroupBox1->isChecked()) {
870     ok = LReductionGroupParams->SpinBox1->isValid(msg, !IsPreview()) && ok;
871     ok = LReductionGroupParams->SpinBox2->isValid(msg, !IsPreview()) && ok;
872     ok = LReductionGroupParams->SpinBox3->isValid(msg, !IsPreview()) && ok;
873     ok = LReductionGroupParams->SpinBox4->isValid(msg, !IsPreview()) && ok;
874     if(MainTubeGroupParams->SpinBox_DX->value() == LReductionGroupParams->SpinBox1->value()) {
875       msg += tr("GEOM_PIPETSHAPE_ERR_EQUAL_RADII_L") + "\n";
876       ok = false;
877     }
878     if(MainTubeGroupParams->SpinBox_DX->value() + MainTubeGroupParams->SpinBox_DY->value() ==
879        LReductionGroupParams->SpinBox1->value() + LReductionGroupParams->SpinBox2->value()) {
880       msg += tr("GEOM_PIPETSHAPE_ERR_EQUAL_EXT_RADII_L") + "\n";
881       ok = false;
882     }
883   }
884   if (RReductionGroupParams->GroupBox1->isChecked()) {
885     ok = RReductionGroupParams->SpinBox1->isValid(msg, !IsPreview()) && ok;
886     ok = RReductionGroupParams->SpinBox2->isValid(msg, !IsPreview()) && ok;
887     ok = RReductionGroupParams->SpinBox3->isValid(msg, !IsPreview()) && ok;
888     ok = RReductionGroupParams->SpinBox4->isValid(msg, !IsPreview()) && ok;
889     if(MainTubeGroupParams->SpinBox_DX->value() == RReductionGroupParams->SpinBox1->value()) {
890       msg += tr("GEOM_PIPETSHAPE_ERR_EQUAL_RADII_R") + "\n";
891       ok = false;
892     }
893     if(MainTubeGroupParams->SpinBox_DX->value() + MainTubeGroupParams->SpinBox_DY->value() ==
894        RReductionGroupParams->SpinBox1->value() + RReductionGroupParams->SpinBox2->value()) {
895       msg += tr("GEOM_PIPETSHAPE_ERR_EQUAL_EXT_RADII_R") + "\n";
896       ok = false;
897     }
898   }
899   if (IReductionGroupParams->GroupBox1->isChecked()) {
900     ok = IReductionGroupParams->SpinBox1->isValid(msg, !IsPreview()) && ok;
901     ok = IReductionGroupParams->SpinBox2->isValid(msg, !IsPreview()) && ok;
902     ok = IReductionGroupParams->SpinBox3->isValid(msg, !IsPreview()) && ok;
903     ok = IReductionGroupParams->SpinBox4->isValid(msg, !IsPreview()) && ok;
904     if(IncidentTubeGroupParams->SpinBox_DX->value() == IReductionGroupParams->SpinBox1->value()) {
905       msg += tr("GEOM_PIPETSHAPE_ERR_EQUAL_RADII_I") + "\n";
906       ok = false;
907     }
908     if(IncidentTubeGroupParams->SpinBox_DX->value() + IncidentTubeGroupParams->SpinBox_DY->value() ==
909        IReductionGroupParams->SpinBox1->value() + IReductionGroupParams->SpinBox2->value()) {
910       msg += tr("GEOM_PIPETSHAPE_ERR_EQUAL_EXT_RADII_I") + "\n";
911       ok = false;
912     }
913   }
914
915   ok = fabs(MainTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
916   ok = fabs(MainTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
917   ok = fabs(MainTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok;
918   ok = fabs(IncidentTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
919   ok = fabs(IncidentTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
920   ok = fabs(IncidentTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok;
921   ok = fabs(ChamferGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
922   ok = fabs(ChamferGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
923   ok = fabs(FilletGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
924
925   if (JunctionPointsSel->GroupBox1->isChecked())
926     ok = myOkPoint1 && myOkPoint2 && myOkPoint3 && ok;
927
928   return ok;
929 }
930
931 //=================================================================================
932 // function : CheckCompatiblePosition()
933 // purpose  :
934 //=================================================================================
935 bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition
936      (GEOM::GEOM_Object_var theP1, GEOM::GEOM_Object_var theP2, GEOM::GEOM_Object_var theP3,
937       double theTolerance)
938 {
939   MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
940   IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
941   JunctionPointsSel->PushButton4->setStyleSheet(CssNormal);
942   JunctionPointsSel->PushButton5->setStyleSheet(CssNormal);
943
944   CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
945   CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
946
947   JunctionPointsSel->LineEdit4->setText("");
948   JunctionPointsSel->LineEdit5->setText("");
949
950   MainTubeGroupParams->SpinBox_DZ->setToolTip("");
951   IncidentTubeGroupParams->SpinBox_DZ->setToolTip("");
952
953   TopoDS_Shape aShape;
954   gp_Pnt P1, P2, P3;
955   if ( GEOMBase::GetShape( theP1, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
956     P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
957   else
958     return false;
959
960   if ( GEOMBase::GetShape( theP2, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
961     P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
962   else
963     return false;
964
965   if ( GEOMBase::GetShape( theP3, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
966     P3 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
967   else
968     return false;
969
970   double d12 = P1.Distance(P2);
971   double d13 = P1.Distance(P3);
972   double d23 = P2.Distance(P3);
973
974   if (Abs(d12) <= Precision::Confusion()) {
975     //SetErrorCode("Junctions points P1 and P2 are identical");
976     return false;
977   }
978   if (Abs(d13) <= Precision::Confusion()) {
979     //SetErrorCode("Junctions points P1 and P3 are identical");
980     return false;
981   }
982   if (Abs(d23) <= Precision::Confusion()) {
983     //SetErrorCode("Junctions points P2 and P3 are identical");
984     return false;
985   }
986
987   long double newL1 = 0.5 * d12;
988   long double newL2 = sqrt(pow(d13,2)-pow(newL1,2));
989
990   JunctionPointsSel->LineEdit4->setText(QString::number(newL1,'f',7));
991   JunctionPointsSel->LineEdit5->setText(QString::number(newL2,'f',7));
992
993   if (fabs(newL1 - theL1) > Precision::Approximation()) {
994     if ((newL1 * (1 - theTolerance) - theL1 <= Precision::Approximation()) &&
995         (newL1 * (1 + theTolerance) - theL1 >= Precision::Approximation())) {
996       disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0);
997       MainTubeGroupParams->SpinBox_DZ->setValue(newL1);
998       connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged(double)),
999               this, SLOT(ValueChangedInSpinBox(double)));
1000       MainTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
1001       MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable);
1002       JunctionPointsSel->PushButton4->setStyleSheet(CssAcceptable);
1003     }
1004     else {
1005       MainTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
1006       MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused);
1007       JunctionPointsSel->PushButton4->setStyleSheet(CssRefused);
1008     }
1009   }
1010   else {
1011     MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
1012     JunctionPointsSel->PushButton4->setStyleSheet(CssNormal);
1013   }
1014
1015   if (fabs(newL2 - theL2) > Precision::Approximation()) {
1016     if ((newL2 * (1 - theTolerance) - theL2 <= Precision::Approximation()) &&
1017         (newL2 * (1 + theTolerance) - theL2 >= Precision::Approximation())) {
1018       disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0);
1019       IncidentTubeGroupParams->SpinBox_DZ->setValue(newL2);
1020       connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
1021       IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
1022       IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable);
1023       JunctionPointsSel->PushButton5->setStyleSheet(CssAcceptable);
1024     }
1025     else {
1026       IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
1027       IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused);
1028       JunctionPointsSel->PushButton5->setStyleSheet(CssRefused);
1029     }
1030   }
1031   else {
1032     IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
1033     JunctionPointsSel->PushButton5->setStyleSheet(CssNormal);
1034   }
1035
1036   return true;
1037 }
1038
1039 //=================================================================================
1040 // function : execute
1041 // purpose  :
1042 //=================================================================================
1043 bool AdvancedGUI_PipeTShapeDlg::execute (ObjectList& objects)
1044 {
1045   if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3)
1046     CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
1047
1048   return executeNoCheck(objects);
1049 }
1050
1051 //=================================================================================
1052 // function : executeNoCheck
1053 // purpose  :
1054 //=================================================================================
1055 bool AdvancedGUI_PipeTShapeDlg::executeNoCheck (ObjectList& objects)
1056 {
1057   bool res = false;
1058
1059   //   GEOM::GEOM_Object_var anObj;
1060   GEOM::ListOfGO_var anObj;
1061
1062   GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation());
1063
1064   //@@ retrieve input values from the widgets here @@//
1065   CORBA::Double theR1 = MainTubeGroupParams->SpinBox_DX->value();
1066   CORBA::Double theW1 = MainTubeGroupParams->SpinBox_DY->value();
1067   CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
1068   CORBA::Double theR2 = IncidentTubeGroupParams->SpinBox_DX->value();
1069   CORBA::Double theW2 = IncidentTubeGroupParams->SpinBox_DY->value();
1070   CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
1071   CORBA::Double theH = ChamferGroupParams->SpinBox_DX->value();
1072   CORBA::Double theW = ChamferGroupParams->SpinBox_DY->value();
1073   CORBA::Double theRF = FilletGroupParams->SpinBox_DX->value();
1074   CORBA::Boolean theHexMesh = HexMeshCheckBox->isChecked();
1075
1076   // Thickness reductions
1077   CORBA::Double theRL = 0., theWL = 0., theLtransL = 0., theLthinL = 0.;
1078   CORBA::Double theRR = 0., theWR = 0., theLtransR = 0., theLthinR = 0.;
1079   CORBA::Double theRI = 0., theWI = 0., theLtransI = 0., theLthinI = 0.;
1080
1081   if (LReductionGroupParams->GroupBox1->isChecked()) {
1082     theRL = LReductionGroupParams->SpinBox1->value();
1083     theWL = LReductionGroupParams->SpinBox2->value();
1084     theLtransL = LReductionGroupParams->SpinBox3->value();
1085     theLthinL = LReductionGroupParams->SpinBox4->value();
1086   }
1087   if (RReductionGroupParams->GroupBox1->isChecked()) {
1088     theRR = RReductionGroupParams->SpinBox1->value();
1089     theWR = RReductionGroupParams->SpinBox2->value();
1090     theLtransR = RReductionGroupParams->SpinBox3->value();
1091     theLthinR = RReductionGroupParams->SpinBox4->value();
1092   }
1093   if (IReductionGroupParams->GroupBox1->isChecked()) {
1094     theRI = IReductionGroupParams->SpinBox1->value();
1095     theWI = IReductionGroupParams->SpinBox2->value();
1096     theLtransI = IReductionGroupParams->SpinBox3->value();
1097     theLthinI = IReductionGroupParams->SpinBox4->value();
1098   }
1099
1100   //if (JunctionPointsSel->GroupBox1->isChecked()) {
1101   //  CheckCompatiblePosition(theL1, theL2, myPoint1, myPoint2, myPoint3, 0.01);
1102   //  theL1 = MainTubeGroupParams->SpinBox_DZ->value();
1103   //  theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
1104   //}
1105
1106   // call engine function
1107   if (ChamferGroupParams->GroupBox1->isChecked()) {
1108     if (JunctionPointsSel->GroupBox1->isChecked())
1109       anObj = anOper->MakePipeTShapeTRChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
1110                                                           theRL, theWL, theLtransL, theLthinL,
1111                                                           theRR, theWR, theLtransR, theLthinR,
1112                                                           theRI, theWI, theLtransI, theLthinI,
1113                                                           theH, theW, theHexMesh, myPoint1, myPoint2, myPoint3);
1114     else
1115       anObj = anOper->MakePipeTShapeTRChamfer(theR1, theW1, theL1, theR2, theW2, theL2,
1116                                               theRL, theWL, theLtransL, theLthinL,
1117                                               theRR, theWR, theLtransR, theLthinR,
1118                                               theRI, theWI, theLtransI, theLthinI,
1119                                               theH, theW, theHexMesh);
1120   }
1121   else if (FilletGroupParams->GroupBox1->isChecked()) {
1122     if (JunctionPointsSel->GroupBox1->isChecked())
1123       anObj = anOper->MakePipeTShapeTRFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
1124                                                          theRL, theWL, theLtransL, theLthinL,
1125                                                          theRR, theWR, theLtransR, theLthinR,
1126                                                          theRI, theWI, theLtransI, theLthinI,
1127                                                          theRF, theHexMesh, myPoint1, myPoint2, myPoint3);
1128     else
1129       anObj = anOper->MakePipeTShapeTRFillet(theR1, theW1, theL1, theR2, theW2, theL2,
1130                                              theRL, theWL, theLtransL, theLthinL,
1131                                              theRR, theWR, theLtransR, theLthinR,
1132                                              theRI, theWI, theLtransI, theLthinI,
1133                                              theRF, theHexMesh);
1134   }
1135   else {
1136     if (JunctionPointsSel->GroupBox1->isChecked())
1137       anObj = anOper->MakePipeTShapeTRWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
1138                                                    theRL, theWL, theLtransL, theLthinL,
1139                                                    theRR, theWR, theLtransR, theLthinR,
1140                                                    theRI, theWI, theLtransI, theLthinI,
1141                                                    theHexMesh, myPoint1, myPoint2, myPoint3);
1142     else
1143       anObj = anOper->MakePipeTShapeTR(theR1, theW1, theL1, theR2, theW2, theL2,
1144                                        theRL, theWL, theLtransL, theLthinL,
1145                                        theRR, theWR, theLtransR, theLthinR,
1146                                        theRI, theWI, theLtransI, theLthinI,
1147                                        theHexMesh);
1148   }
1149
1150   res = anObj->length();
1151   if (!res)
1152     return false;
1153
1154   //res = !anObj->_is_nil();
1155   if (res && !IsPreview()) {
1156     QStringList aParameters;
1157     //@@ put stringified input parameters to the string list here to store in the data model for notebook @@//
1158     aParameters << MainTubeGroupParams->SpinBox_DX->text(); // R1 parameter
1159     aParameters << MainTubeGroupParams->SpinBox_DY->text(); // W1 parameter
1160     aParameters << MainTubeGroupParams->SpinBox_DZ->text(); // L1 parameter
1161     aParameters << IncidentTubeGroupParams->SpinBox_DX->text(); // R2 parameter
1162     aParameters << IncidentTubeGroupParams->SpinBox_DY->text(); // W2 parameter
1163     aParameters << IncidentTubeGroupParams->SpinBox_DZ->text(); // L2 parameter
1164
1165     if (ChamferGroupParams->GroupBox1->isChecked()) { // Chamfer parameter
1166       aParameters << ChamferGroupParams->SpinBox_DX->text(); // H parameter
1167       aParameters << ChamferGroupParams->SpinBox_DY->text(); // W parameter
1168     }
1169     if (FilletGroupParams->GroupBox1->isChecked()) // Fillet parameter
1170       aParameters << FilletGroupParams->SpinBox_DX->text(); // RF parameter
1171
1172     // Thickness reductions
1173     if (LReductionGroupParams->GroupBox1->isChecked()) {
1174       aParameters << LReductionGroupParams->SpinBox1->text();
1175       aParameters << LReductionGroupParams->SpinBox2->text();
1176       aParameters << LReductionGroupParams->SpinBox3->text();
1177       aParameters << LReductionGroupParams->SpinBox4->text();
1178     }
1179     else {
1180       aParameters << "0" << "0" << "0" << "0";
1181     }
1182     if (RReductionGroupParams->GroupBox1->isChecked()) {
1183       aParameters << RReductionGroupParams->SpinBox1->text();
1184       aParameters << RReductionGroupParams->SpinBox2->text();
1185       aParameters << RReductionGroupParams->SpinBox3->text();
1186       aParameters << RReductionGroupParams->SpinBox4->text();
1187     }
1188     else {
1189       aParameters << "0" << "0" << "0" << "0";
1190     }
1191     if (IReductionGroupParams->GroupBox1->isChecked()) {
1192       aParameters << IReductionGroupParams->SpinBox1->text();
1193       aParameters << IReductionGroupParams->SpinBox2->text();
1194       aParameters << IReductionGroupParams->SpinBox3->text();
1195       aParameters << IReductionGroupParams->SpinBox4->text();
1196     }
1197     else {
1198       aParameters << "0" << "0" << "0" << "0";
1199     }
1200
1201     if (aParameters.count() > 0)
1202       anObj[0]->SetParameters(aParameters.join(":").toLatin1().constData());
1203   }
1204
1205   objects.push_back(anObj[0]._retn());
1206   pipeTShapeGroupObjects.clear();
1207   for (int i = 1, n = anObj->length(); i < n; i++) {
1208     pipeTShapeGroupObjects.push_back(anObj[i]._retn());
1209   }
1210
1211   return objects.size() > 0;
1212 }
1213
1214 //=================================================================================
1215 // function : restoreSubShapes
1216 // purpose  :
1217 //=================================================================================
1218 void AdvancedGUI_PipeTShapeDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
1219                                                   SALOMEDS::SObject_ptr theSObject)
1220 {
1221   SALOMEDS::GenericAttribute_var anAttr;
1222   if (!theSObject->FindAttribute(anAttr, "AttributeIOR"))
1223     return;
1224
1225   SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
1226   CORBA::String_var anIORso = anAttrIOR->Value();
1227
1228   // get Object from SObject
1229   GEOM::GEOM_Object_var theFather =
1230     GEOM::GEOM_Object::_narrow(myGeomGUI->getApp()->orb()->string_to_object(anIORso));
1231   if (CORBA::is_nil(theFather))
1232     return;
1233
1234   ObjectList::iterator it = pipeTShapeGroupObjects.begin();
1235
1236   for (int i = 0; it != pipeTShapeGroupObjects.end(); it++, i++) {
1237     getGeomEngine()->AddInStudy(theStudy, (*it), tr((*it)->GetName()).toStdString().c_str(), theFather);
1238   }
1239 }
1240
1241 //=================================================================================
1242 // function : processPreview()
1243 // purpose  : Display preview if CheckBoxPreview is checked
1244 //=================================================================================
1245 void AdvancedGUI_PipeTShapeDlg::processPreview()
1246 {
1247   if (mainFrame()->CheckBoxPreview->isChecked())
1248     DisplayPreview();
1249   else
1250     erasePreview(true);
1251 }
1252
1253 //=================================================================================
1254 // function : AdvancedGUI_4Spin
1255 // purpose  :
1256 //=================================================================================
1257 AdvancedGUI_4Spin::AdvancedGUI_4Spin()
1258 {
1259   GroupBox1 = new QGroupBox ();
1260
1261   gridLayout1 = new QGridLayout (GroupBox1);
1262   gridLayout1->setSpacing(6);
1263   gridLayout1->setContentsMargins(11, 11, 11, 11);
1264   gridLayout1->setHorizontalSpacing(6);
1265   gridLayout1->setVerticalSpacing(6);
1266   gridLayout1->setContentsMargins(9, 9, 9, 9);
1267
1268   TextLabel1 = new QLabel (GroupBox1);
1269   TextLabel2 = new QLabel (GroupBox1);
1270   TextLabel3 = new QLabel (GroupBox1);
1271   TextLabel4 = new QLabel (GroupBox1);
1272
1273   SpinBox1 = new SalomeApp_DoubleSpinBox (GroupBox1);
1274   SpinBox2 = new SalomeApp_DoubleSpinBox (GroupBox1);
1275   SpinBox3 = new SalomeApp_DoubleSpinBox (GroupBox1);
1276   SpinBox4 = new SalomeApp_DoubleSpinBox (GroupBox1);
1277
1278   SpinBox1->setMinimumWidth(60);
1279   SpinBox2->setMinimumWidth(60);
1280   SpinBox3->setMinimumWidth(60);
1281   SpinBox4->setMinimumWidth(60);
1282
1283   gridLayout1->addWidget(TextLabel1, 0, 0, 1, 1);
1284   gridLayout1->addWidget(TextLabel2, 1, 0, 1, 1);
1285   gridLayout1->addWidget(TextLabel3, 2, 0, 1, 1);
1286   gridLayout1->addWidget(TextLabel4, 3, 0, 1, 1);
1287
1288   gridLayout1->addWidget(SpinBox1, 0, 1, 1, 1);
1289   gridLayout1->addWidget(SpinBox2, 1, 1, 1, 1);
1290   gridLayout1->addWidget(SpinBox3, 2, 1, 1, 1);
1291   gridLayout1->addWidget(SpinBox4, 3, 1, 1, 1);
1292 }
1293
1294 //=================================================================================
1295 // function : ~AdvancedGUI_4Spin()
1296 // purpose  : Destroys the object and frees any allocated resources
1297 //=================================================================================
1298 AdvancedGUI_4Spin::~AdvancedGUI_4Spin()
1299 {
1300   // no need to delete child widgets, Qt does it all for us
1301 }