1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "AdvancedGUI_PipeTShapeDlg.h"
23 #include <GeometryGUI.h>
26 #include <SUIT_Session.h>
27 #include <SUIT_ResourceMgr.h>
28 #include <SUIT_OverrideCursor.h>
29 #include <SalomeApp_Application.h>
30 #include <SalomeApp_Tools.h>
31 #include <LightApp_SelectionMgr.h>
34 #include <TopoDS_Shape.hxx>
37 #include <TColStd_IndexedMapOfInteger.hxx>
38 #include <TopTools_IndexedMapOfShape.hxx>
40 #include <BRep_Tool.hxx>
42 #include <GEOMImpl_Types.hxx>
44 //=================================================================================
46 //=================================================================================
47 AdvancedGUI_PipeTShapeDlg::AdvancedGUI_PipeTShapeDlg(GeometryGUI* theGeometryGUI, QWidget* parent) :
48 GEOMBase_Skeleton(theGeometryGUI, parent, false) {
49 QPixmap imageOp(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPETSHAPE")));
50 QPixmap imageSel(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
51 imageImp = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICO_PIPETSHAPE_IMPORT"));
52 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
54 setWindowTitle(tr("GEOM_PIPE_TSHAPE_TITLE"));
56 /***************************************************************/
57 mainFrame()->GroupConstructors->setTitle(tr("GEOM_PIPE_TSHAPE"));
58 mainFrame()->RadioButton1->setIcon(imageOp);
59 mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
60 mainFrame()->RadioButton2->close();
61 mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
62 mainFrame()->RadioButton3->close();
64 QGridLayout* myMainLayout = new QGridLayout(centralWidget());
65 myMainLayout->setMargin(0);
66 myMainLayout->setSpacing(6);
68 tshapeScreenShotLabel = new QLabel();
69 tshapeScreenShotLabel->setSizePolicy(QSizePolicy::Expanding,
70 QSizePolicy::Expanding);
71 tshapeScreenShotLabel->setAlignment(Qt::AlignCenter);
72 tshapeScreenShotLabel->setMinimumSize(100, 100);
74 MainTubeGroupParams = new DlgRef_3Spin();
75 MainTubeGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_MPIPE"));
76 MainTubeGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
77 MainTubeGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_W"));
78 MainTubeGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_L"));
80 IncidentTubeGroupParams = new DlgRef_3Spin();
81 IncidentTubeGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_IPIPE"));
82 IncidentTubeGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
83 IncidentTubeGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_W"));
84 IncidentTubeGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_L"));
86 ChamferGroupParams = new DlgRef_2Spin();
87 ChamferGroupParams->GroupBox1->setCheckable(true);
88 ChamferGroupParams->GroupBox1->setChecked(false);
89 ChamferGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_CHAMFER"));
90 ChamferGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_CHAMFER_H"));
91 ChamferGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_CHAMFER_W"));
93 FilletGroupParams = new DlgRef_1Spin();
94 FilletGroupParams->GroupBox1->setCheckable(true);
95 FilletGroupParams->GroupBox1->setChecked(false);
96 FilletGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_FILLET"));
97 FilletGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
99 HexMeshCheckBox = new QCheckBox();
100 HexMeshCheckBox->setText(tr("GEOM_PIPE_TSHAPE_HEX"));
101 HexMeshCheckBox->setChecked(true);
103 JunctionPointsSel = new DlgRef_6Sel();
104 JunctionPointsSel->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_POSITION"));
105 JunctionPointsSel->GroupBox1->setCheckable(true);
106 JunctionPointsSel->GroupBox1->setChecked(false);
107 JunctionPointsSel->PushButton1->setIcon(imageSel);
108 JunctionPointsSel->LineEdit1->setReadOnly(true);
109 JunctionPointsSel->LineEdit1->setText("");
110 JunctionPointsSel->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P1"));
112 JunctionPointsSel->PushButton2->setIcon(imageSel);
113 JunctionPointsSel->LineEdit2->setReadOnly(true);
114 JunctionPointsSel->LineEdit2->setText("");
115 JunctionPointsSel->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P2"));
117 JunctionPointsSel->PushButton3->setIcon(imageSel);
118 JunctionPointsSel->LineEdit3->setReadOnly(true);
119 JunctionPointsSel->LineEdit3->setText("");
120 JunctionPointsSel->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P3"));
122 JunctionPointsSel->PushButton4->setIcon(imageImp);
123 JunctionPointsSel->LineEdit4->setReadOnly(true);
124 JunctionPointsSel->LineEdit4->setText("");
125 JunctionPointsSel->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L1"));
127 JunctionPointsSel->PushButton5->setIcon(imageImp);
128 JunctionPointsSel->LineEdit5->setReadOnly(true);
129 JunctionPointsSel->LineEdit5->setText("");
130 JunctionPointsSel->TextLabel5->setText(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L2"));
132 JunctionPointsSel->PushButton6->setAttribute(Qt::WA_DeleteOnClose);
133 JunctionPointsSel->PushButton6->close();
134 JunctionPointsSel->LineEdit6->setAttribute(Qt::WA_DeleteOnClose);
135 JunctionPointsSel->LineEdit6->close();
136 JunctionPointsSel->TextLabel6->setAttribute(Qt::WA_DeleteOnClose);
137 JunctionPointsSel->TextLabel6->close();
139 // 1st row, height = 1, colspan = 3
140 int rowPict = 0, colPict = 0, rowspanPict = 1, colspanPict = 3;
141 // 2nd row, height = 4, col 1
142 int rowMain = rowspanPict, colMain = 0, rowspanMain = 2, colspanMain = 1;
143 int rowCham = rowspanPict + rowspanMain, colCham = 0, rowspanCham = 2, colspanCham = 1;
144 // 2nd row, height = 4, col 2
145 int rowInc = rowspanPict, colInc = 1, rowspanInc = 2, colspanInc = 1;
146 int rowFill = rowspanPict + rowspanInc, colFill = 1, rowspanFill = 1, colspanFill = 1;
147 int rowHex = rowspanPict + rowspanInc + rowspanFill, colHex = 1, rowspanHex = 1, colspanHex = 1;
148 // 2nd row, height = 4, col 3
149 int rowNewPosVal = rowspanPict, colNewPosVal = 2, rowspanNewPosVal = 4, colspanNewPosVal = 1;
151 myMainLayout->addWidget(tshapeScreenShotLabel, rowPict, colPict, rowspanPict, colspanPict);
153 myMainLayout->addWidget(MainTubeGroupParams, rowMain, colMain, rowspanMain, colspanMain);
154 myMainLayout->addWidget(FilletGroupParams, rowFill, colFill, rowspanFill, colspanFill);
155 myMainLayout->addWidget(HexMeshCheckBox, rowHex, colHex, rowspanHex, colspanHex);
157 myMainLayout->addWidget(IncidentTubeGroupParams, rowInc, colInc, rowspanInc, colspanInc);
158 myMainLayout->addWidget(ChamferGroupParams, rowCham, colCham, rowspanCham, colspanCham);
160 myMainLayout->addWidget(JunctionPointsSel, rowNewPosVal, colNewPosVal, rowspanNewPosVal, colspanNewPosVal);
161 /***************************************************************/
163 setHelpFileName("create_pipetshape_page.html");
168 //=================================================================================
170 //=================================================================================
171 AdvancedGUI_PipeTShapeDlg::~AdvancedGUI_PipeTShapeDlg() {
172 // no need to delete child widgets, Qt does it all for us
175 //=================================================================================
178 //=================================================================================
179 void AdvancedGUI_PipeTShapeDlg::Init() {
180 // Get setting of step value from file configuration
181 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
182 double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
184 myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
185 myOkPoint1 = myOkPoint2 = myOkPoint3 = false;
187 pipeTShapeGroupObjects.clear();
189 // min, max, step and decimals for spin boxes
190 initSpinBox(MainTubeGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision");
191 initSpinBox(MainTubeGroupParams->SpinBox_DY, Precision::Approximation(), COORD_MAX, step, "length_precision");
192 initSpinBox(MainTubeGroupParams->SpinBox_DZ, Precision::Approximation(), COORD_MAX, step, "length_precision");
193 initSpinBox(IncidentTubeGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision");
194 initSpinBox(IncidentTubeGroupParams->SpinBox_DY, Precision::Approximation(), COORD_MAX, step, "length_precision");
195 initSpinBox(IncidentTubeGroupParams->SpinBox_DZ, Precision::Approximation(), COORD_MAX, step, "length_precision");
196 initSpinBox(ChamferGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision");
197 initSpinBox(ChamferGroupParams->SpinBox_DY, Precision::Approximation(), COORD_MAX, step, "length_precision");
198 initSpinBox(FilletGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision");
201 MainTubeGroupParams->SpinBox_DX->setValue(80);
202 MainTubeGroupParams->SpinBox_DY->setValue(20);
203 MainTubeGroupParams->SpinBox_DZ->setValue(200);
204 IncidentTubeGroupParams->SpinBox_DX->setValue(50);
205 IncidentTubeGroupParams->SpinBox_DY->setValue(20);
206 IncidentTubeGroupParams->SpinBox_DZ->setValue(200);
207 ChamferGroupParams->SpinBox_DX->setValue(20);
208 ChamferGroupParams->SpinBox_DY->setValue(10);
209 FilletGroupParams->SpinBox_DX->setValue(20);
211 CssNormal = QString("QDoubleSpinBox {");
212 CssNormal.append(MainTubeGroupParams->SpinBox_DZ->styleSheet());
213 CssNormal.append("}");
214 CssNormal.append("\nQPushButton {");
215 CssNormal.append(JunctionPointsSel->PushButton4->styleSheet());
216 CssNormal.append("}");
217 CssAcceptable = "QDoubleSpinBox, QPushButton {background-color: rgb(85, 170, 127)}";
218 CssRefused = "QDoubleSpinBox, QPushButton {background-color: rgb(255, 0, 0)}";
220 // Signal/slot connections
221 connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
222 connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
223 connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
224 // ValueChangedInSpinBox
225 connect(MainTubeGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
226 connect(MainTubeGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
227 connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
228 connect(IncidentTubeGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
229 connect(IncidentTubeGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
230 connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
231 connect(ChamferGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
232 connect(ChamferGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
233 connect(FilletGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
235 connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
236 connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
238 // connect(PreviewPushButton, SIGNAL(clicked()), this, SLOT(DisplayPreview()));
240 connect(JunctionPointsSel->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(SetPosition(bool)));
241 connect(JunctionPointsSel->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
242 connect(JunctionPointsSel->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
243 connect(JunctionPointsSel->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
244 // ApplyNewDimensions
245 connect(JunctionPointsSel->PushButton4, SIGNAL(clicked()), this, SLOT(ApplyNewDimensions()));
246 connect(JunctionPointsSel->PushButton5, SIGNAL(clicked()), this, SLOT(ApplyNewDimensions()));
247 connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(UpdatePicture(QWidget*, QWidget*)));
248 //@@ put additional signal/slot connections here @@//
250 initName(tr("GEOM_PIPE_TSHAPE"));
251 updateTshapeScreenshotLabel();
255 //=================================================================================
256 // function : ApplyNewDimensions()
258 //=================================================================================
259 void AdvancedGUI_PipeTShapeDlg::ApplyNewDimensions() {
260 QPushButton* send = (QPushButton*) sender();
264 if (send == JunctionPointsSel->PushButton4) {
265 if (!JunctionPointsSel->LineEdit4->text().isEmpty()) {
266 newVal = JunctionPointsSel->LineEdit4->text().toDouble(&ok);
268 disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0);
269 MainTubeGroupParams->SpinBox_DZ->setValue(newVal);
270 connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
271 MainTubeGroupParams->SpinBox_DZ->setToolTip("");
272 MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
273 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
278 else if (send == JunctionPointsSel->PushButton5) {
279 if (!JunctionPointsSel->LineEdit5->text().isEmpty()) {
280 newVal = JunctionPointsSel->LineEdit5->text().toDouble(&ok);
282 disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0);
283 IncidentTubeGroupParams->SpinBox_DZ->setValue(newVal);
284 connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
285 IncidentTubeGroupParams->SpinBox_DZ->setToolTip("");
286 IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
287 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
294 //=================================================================================
295 // function : UpdatePicture()
297 //=================================================================================
298 void AdvancedGUI_PipeTShapeDlg::UpdatePicture(QWidget* old, QWidget* now) {
300 if (ChamferGroupParams->GroupBox1->isChecked())
301 if (now == MainTubeGroupParams->SpinBox_DX)
302 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_R1"));
303 else if (now == MainTubeGroupParams->SpinBox_DY)
304 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W1"));
305 else if (now == MainTubeGroupParams->SpinBox_DZ)
306 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_L1"));
307 else if (now == IncidentTubeGroupParams->SpinBox_DX)
308 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_R2"));
309 else if (now == IncidentTubeGroupParams->SpinBox_DY)
310 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W2"));
311 else if (now == IncidentTubeGroupParams->SpinBox_DZ)
312 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_L2"));
313 else if (now == ChamferGroupParams->SpinBox_DX)
314 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_H"));
315 else if (now == ChamferGroupParams->SpinBox_DY)
316 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W"));
318 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER"));
319 else if (FilletGroupParams->GroupBox1->isChecked())
320 if (now == MainTubeGroupParams->SpinBox_DX)
321 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_R1"));
322 else if (now == MainTubeGroupParams->SpinBox_DY)
323 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_W1"));
324 else if (now == MainTubeGroupParams->SpinBox_DZ)
325 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_L1"));
326 else if (now == IncidentTubeGroupParams->SpinBox_DX)
327 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_R2"));
328 else if (now == IncidentTubeGroupParams->SpinBox_DY)
329 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_W2"));
330 else if (now == IncidentTubeGroupParams->SpinBox_DZ)
331 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_L2"));
332 else if (now == FilletGroupParams->SpinBox_DX)
333 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_RF"));
335 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET"));
337 if (now == MainTubeGroupParams->SpinBox_DX)
338 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_R1"));
339 else if (now == MainTubeGroupParams->SpinBox_DY)
340 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_W1"));
341 else if (now == MainTubeGroupParams->SpinBox_DZ)
342 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_L1"));
343 else if (now == IncidentTubeGroupParams->SpinBox_DX)
344 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_R2"));
345 else if (now == IncidentTubeGroupParams->SpinBox_DY)
346 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_W2"));
347 else if (now == IncidentTubeGroupParams->SpinBox_DZ)
348 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_L2"));
350 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
352 updateTshapeScreenshotLabel();
355 //=================================================================================
356 // function : SetPosition()
358 //=================================================================================
359 void AdvancedGUI_PipeTShapeDlg::SetPosition(bool isChecked) {
362 JunctionPointsSel->LineEdit4->setText("");
363 JunctionPointsSel->LineEdit5->setText("");
364 // connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(
365 // SelectionIntoArgument()));
366 JunctionPointsSel->PushButton1->click();
367 SelectionIntoArgument();
369 disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
370 JunctionPointsSel->LineEdit4->setText("");
371 JunctionPointsSel->LineEdit5->setText("");
376 //=================================================================================
377 // function : ValueChangedInSpinBox()
379 //=================================================================================
380 void AdvancedGUI_PipeTShapeDlg::ValueChangedInSpinBox(double newValue)
382 if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3)
383 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
387 //=================================================================================
388 // function : SelectionIntoArgument()
389 // purpose : Called when selection as changed or other case
390 //=================================================================================
391 void AdvancedGUI_PipeTShapeDlg::SelectionIntoArgument() {
394 // myEditCurrentArgument->setText("");
396 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
397 SALOME_ListIO aSelList;
398 aSelMgr->selectedObjects(aSelList);
400 if (aSelList.Extent() != 1) {
401 if (myEditCurrentArgument == JunctionPointsSel->LineEdit1)
403 else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2)
405 else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3)
408 myEditCurrentArgument->setText("");
412 if (aSelList.Extent() == 1) {
413 Handle(SALOME_InteractiveObject) anIO = aSelList.First();
414 GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO);
415 if (!CORBA::is_nil(aSelectedObject)) {
416 QString aName = GEOMBase::GetName(aSelectedObject);
418 if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
420 TColStd_IndexedMapOfInteger aMap;
421 aSelMgr->GetIndexes(anIO, aMap);
422 if (aMap.Extent() == 1) { // Local Selection
423 int anIndex = aMap(1);
424 aName += QString(":vertex_%1").arg(anIndex);
426 //Find SubShape Object in Father
427 GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
429 if (aFindedObject->_is_nil()) { // Object not found in study
430 GEOM::GEOM_IShapesOperations_var aShapesOp =
431 getGeomEngine()->GetIShapesOperations(getStudyId());
432 aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
434 aSelectedObject = aFindedObject; // get Object from study
436 GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE);
437 } else { // Global Selection
438 if (aShape.ShapeType() != TopAbs_VERTEX) {
439 aSelectedObject = GEOM::GEOM_Object::_nil();
445 if (aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX) {
448 myEditCurrentArgument->setText(aName);
449 if (myEditCurrentArgument == JunctionPointsSel->LineEdit1) {
450 myPoint1 = aSelectedObject;
453 JunctionPointsSel->PushButton2->click();
454 } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2) {
455 myPoint2 = aSelectedObject;
458 JunctionPointsSel->PushButton3->click();
459 } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3) {
460 myPoint3 = aSelectedObject;
463 JunctionPointsSel->PushButton1->click();
468 if (myOkPoint1 && myOkPoint2 && myOkPoint3) {
469 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
473 // GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First());
474 // if (aSelectedObject->_is_nil())
477 // myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
479 // // clear selection
480 // disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
481 // myGeomGUI->getApp()->selectionMgr()->clearSelected();
482 // connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
484 // if (myEditCurrentArgument == JunctionPointsSel->LineEdit1) {
485 // myPoint1 = aSelectedObject;
486 // myOkPoint1 = true;
488 // JunctionPointsSel->PushButton2->click();
489 // // P2GroupParams->PushButton1->click();
490 // } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2) {
491 // // } else if (myEditCurrentArgument == P2GroupParams->LineEdit1) {
492 // myPoint2 = aSelectedObject;
493 // myOkPoint2 = true;
495 // JunctionPointsSel->PushButton3->click();
496 // // P3GroupParams->PushButton1->click();
497 // } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3) {
498 // // } else if (myEditCurrentArgument == P3GroupParams->LineEdit1) {
499 // myPoint3 = aSelectedObject;
500 // myOkPoint3 = true;
502 // JunctionPointsSel->PushButton1->click();
506 //=================================================================================
507 // function : SetEditCurrentArgument()
509 //=================================================================================
510 void AdvancedGUI_PipeTShapeDlg::SetEditCurrentArgument() {
511 QPushButton* send = (QPushButton*) sender();
513 if (send == JunctionPointsSel->PushButton1) {
514 myEditCurrentArgument = JunctionPointsSel->LineEdit1;
515 JunctionPointsSel->PushButton2->setDown(false);
516 JunctionPointsSel->LineEdit2->setEnabled(false);
517 JunctionPointsSel->PushButton3->setDown(false);
518 JunctionPointsSel->LineEdit3->setEnabled(false);
519 } else if (send == JunctionPointsSel->PushButton2) {
520 myEditCurrentArgument = JunctionPointsSel->LineEdit2;
521 JunctionPointsSel->PushButton1->setDown(false);
522 JunctionPointsSel->LineEdit1->setEnabled(false);
523 JunctionPointsSel->PushButton3->setDown(false);
524 JunctionPointsSel->LineEdit3->setEnabled(false);
525 } else if (send == JunctionPointsSel->PushButton3) {
526 myEditCurrentArgument = JunctionPointsSel->LineEdit3;
527 JunctionPointsSel->PushButton1->setDown(false);
528 JunctionPointsSel->LineEdit1->setEnabled(false);
529 JunctionPointsSel->PushButton2->setDown(false);
530 JunctionPointsSel->LineEdit2->setEnabled(false);
534 myEditCurrentArgument->setEnabled(true);
535 myEditCurrentArgument->setFocus();
536 myEditCurrentArgument->setText("");
537 // after setFocus(), because it will be setDown(false) when loses focus
540 JunctionPointsSel->LineEdit4->setText("");
541 JunctionPointsSel->LineEdit5->setText("");
543 disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
544 // globalSelection(GEOM_POINT);
545 globalSelection(); // close local contexts, if any
546 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
547 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
550 //=================================================================================
551 // function : SetDoubleSpinBoxStep()
552 // purpose : Double spin box management
553 //=================================================================================
554 void AdvancedGUI_PipeTShapeDlg::SetDoubleSpinBoxStep(double step) {
555 MainTubeGroupParams->SpinBox_DX->setSingleStep(step);
556 MainTubeGroupParams->SpinBox_DY->setSingleStep(step);
557 MainTubeGroupParams->SpinBox_DZ->setSingleStep(step);
558 IncidentTubeGroupParams->SpinBox_DX->setSingleStep(step);
559 IncidentTubeGroupParams->SpinBox_DY->setSingleStep(step);
560 IncidentTubeGroupParams->SpinBox_DZ->setSingleStep(step);
561 ChamferGroupParams->SpinBox_DX->setSingleStep(step);
562 ChamferGroupParams->SpinBox_DY->setSingleStep(step);
563 FilletGroupParams->SpinBox_DX->setSingleStep(step);
566 //=================================================================================
567 // function : ClickOnOk()
569 //=================================================================================
570 void AdvancedGUI_PipeTShapeDlg::ClickOnOk() {
575 //=================================================================================
576 // function : ClickOnApply()
578 //=================================================================================
579 bool AdvancedGUI_PipeTShapeDlg::ClickOnApply() {
588 //=================================================================================
589 // function : ActivateThisDialog()
591 //=================================================================================
592 void AdvancedGUI_PipeTShapeDlg::ActivateThisDialog() {
593 GEOMBase_Skeleton::ActivateThisDialog();
594 // globalSelection( GEOM_POINT);
595 // connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(
596 // currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
597 if (myOkPoint1 && myOkPoint2 && myOkPoint3)
598 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
602 //=================================================================================
603 // function : enterEvent [REDEFINED]
605 //=================================================================================
606 void AdvancedGUI_PipeTShapeDlg::enterEvent(QEvent*) {
607 if (!mainFrame()->GroupConstructors->isEnabled())
608 ActivateThisDialog();
611 //=================================================================================
612 // function : resizeEvent [REDEFINED]
614 //=================================================================================
615 void AdvancedGUI_PipeTShapeDlg::resizeEvent(QResizeEvent */*event*/) {
616 QSize scaledSize = imagePipeTShape.size();
617 scaledSize.scale(tshapeScreenShotLabel->size(), Qt::KeepAspectRatio);
618 if (!tshapeScreenShotLabel->pixmap()
619 || scaledSize != tshapeScreenShotLabel->pixmap()->size())
620 updateTshapeScreenshotLabel();
623 //=================================================================================
624 // function : updateTshapeScreenshotLabel
626 //=================================================================================
627 void AdvancedGUI_PipeTShapeDlg::updateTshapeScreenshotLabel() {
628 tshapeScreenShotLabel->setPixmap(imagePipeTShape.scaled(tshapeScreenShotLabel->size(),
630 Qt::SmoothTransformation));
633 //=================================================================================
634 // function : ChamferOrFillet()
636 //=================================================================================
637 void AdvancedGUI_PipeTShapeDlg::ChamferOrFillet(bool) {
638 QGroupBox* send = (QGroupBox*) sender();
640 if (send == ChamferGroupParams->GroupBox1) {
641 if (send->isChecked()) {
642 disconnect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0);
643 FilletGroupParams->GroupBox1->setChecked(false);
644 connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
645 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER"));
648 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
649 updateTshapeScreenshotLabel();
650 if (myOkPoint1 && myOkPoint2 && myOkPoint3)
651 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
653 } else if (send == FilletGroupParams->GroupBox1) {
654 if (send->isChecked()) {
655 disconnect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0);
656 ChamferGroupParams->GroupBox1->setChecked(!send->isChecked());
657 connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
658 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET"));
661 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
662 updateTshapeScreenshotLabel();
663 if (myOkPoint1 && myOkPoint2 && myOkPoint3)
664 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
670 //=================================================================================
671 // function : DisplayPreview()
673 //=================================================================================
674 void AdvancedGUI_PipeTShapeDlg::DisplayPreview(const bool activate, const bool update, const bool toRemoveFromEngine,
675 const double lineWidth, const int displayMode, const int color) {
679 erasePreview(update);
687 SUIT_OverrideCursor wc;
689 bool hexMeshState = HexMeshCheckBox->isChecked();
690 HexMeshCheckBox->setChecked(false);
691 if (!executeNoCheck(objects) || !getOperation()->IsDone()) {
694 ObjectList::iterator it = objects.begin();
695 GEOM::GEOM_Object_var obj = *it;
696 displayPreview(obj, true, activate, false, lineWidth, displayMode, color);
697 if (toRemoveFromEngine)
700 HexMeshCheckBox->setChecked(hexMeshState);
701 } catch (const SALOME::SALOME_Exception& e) {
702 SalomeApp_Tools::QtCatchCorbaException(e);
710 //=================================================================================
711 // function : createOperation
713 //=================================================================================
714 GEOM::GEOM_IOperations_ptr AdvancedGUI_PipeTShapeDlg::createOperation() {
715 return getGeomEngine()->GetIAdvancedOperations(getStudyId());
718 //=================================================================================
719 // function : isValid
721 //=================================================================================
722 bool AdvancedGUI_PipeTShapeDlg::isValid(QString& msg) {
725 ok = MainTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
726 ok = MainTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
727 ok = MainTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
728 ok = IncidentTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
729 ok = IncidentTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
730 ok = IncidentTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
731 ok = ChamferGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
732 ok = ChamferGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
733 ok = FilletGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
735 ok = fabs(MainTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
736 ok = fabs(MainTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
737 ok = fabs(MainTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok;
738 ok = fabs(IncidentTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
739 ok = fabs(IncidentTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
740 ok = fabs(IncidentTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok;
741 ok = fabs(ChamferGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
742 ok = fabs(ChamferGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
743 ok = fabs(FilletGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
745 if (JunctionPointsSel->GroupBox1->isChecked())
746 ok = myOkPoint1 && myOkPoint2 && myOkPoint3 && ok;
751 //=================================================================================
752 // function : CheckCompatiblePosition()
754 //=================================================================================
755 bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition(GEOM::GEOM_Object_var theP1,
756 GEOM::GEOM_Object_var theP2, GEOM::GEOM_Object_var theP3, double theTolerance) {
758 MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
759 IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
760 JunctionPointsSel->PushButton4->setStyleSheet(CssNormal);
761 JunctionPointsSel->PushButton5->setStyleSheet(CssNormal);
763 CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
764 CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
766 JunctionPointsSel->LineEdit4->setText("");
767 JunctionPointsSel->LineEdit5->setText("");
769 MainTubeGroupParams->SpinBox_DZ->setToolTip("");
770 IncidentTubeGroupParams->SpinBox_DZ->setToolTip("");
774 if ( GEOMBase::GetShape( theP1, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
775 P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
779 if ( GEOMBase::GetShape( theP2, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
780 P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
784 if ( GEOMBase::GetShape( theP3, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
785 P3 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
789 double d12 = P1.Distance(P2);
790 double d13 = P1.Distance(P3);
791 double d23 = P2.Distance(P3);
793 if (Abs(d12) <= Precision::Confusion()) {
794 // SetErrorCode("Junctions points P1 and P2 are identical");
797 if (Abs(d13) <= Precision::Confusion()) {
798 // SetErrorCode("Junctions points P1 and P3 are identical");
801 if (Abs(d23) <= Precision::Confusion()) {
802 // SetErrorCode("Junctions points P2 and P3 are identical");
806 long double newL1 = 0.5 * d12;
807 long double newL2 = sqrt(pow(d13,2)-pow(newL1,2));
809 JunctionPointsSel->LineEdit4->setText(QString::number(newL1,'f',7));
810 JunctionPointsSel->LineEdit5->setText(QString::number(newL2,'f',7));
812 if (fabs(newL1 - theL1) > Precision::Approximation()) {
813 if ((newL1 * (1 - theTolerance) - theL1 <= Precision::Approximation()) &&
814 (newL1 * (1 + theTolerance) - theL1 >= Precision::Approximation())) {
815 disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0);
816 MainTubeGroupParams->SpinBox_DZ->setValue(newL1);
817 connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
818 MainTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
819 MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable);
820 JunctionPointsSel->PushButton4->setStyleSheet(CssAcceptable);
823 MainTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
824 MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused);
825 JunctionPointsSel->PushButton4->setStyleSheet(CssRefused);
829 MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
830 JunctionPointsSel->PushButton4->setStyleSheet(CssNormal);
833 if (fabs(newL2 - theL2) > Precision::Approximation()) {
834 if ((newL2 * (1 - theTolerance) - theL2 <= Precision::Approximation()) &&
835 (newL2 * (1 + theTolerance) - theL2 >= Precision::Approximation())) {
836 disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0);
837 IncidentTubeGroupParams->SpinBox_DZ->setValue(newL2);
838 connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
839 IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
840 IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable);
841 JunctionPointsSel->PushButton5->setStyleSheet(CssAcceptable);
844 IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
845 IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused);
846 JunctionPointsSel->PushButton5->setStyleSheet(CssRefused);
850 IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
851 JunctionPointsSel->PushButton5->setStyleSheet(CssNormal);
857 bool AdvancedGUI_PipeTShapeDlg::execute(ObjectList& objects) {
859 if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3)
860 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
862 return executeNoCheck(objects);
865 //=================================================================================
866 // function : execute
868 //=================================================================================
869 bool AdvancedGUI_PipeTShapeDlg::executeNoCheck(ObjectList& objects) {
872 // GEOM::GEOM_Object_var anObj;
873 GEOM::ListOfGO_var anObj;
875 GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation());
877 //@@ retrieve input values from the widgets here @@//
878 CORBA::Double theR1 = MainTubeGroupParams->SpinBox_DX->value();
879 CORBA::Double theW1 = MainTubeGroupParams->SpinBox_DY->value();
880 CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
881 CORBA::Double theR2 = IncidentTubeGroupParams->SpinBox_DX->value();
882 CORBA::Double theW2 = IncidentTubeGroupParams->SpinBox_DY->value();
883 CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
884 CORBA::Double theH = ChamferGroupParams->SpinBox_DX->value();
885 CORBA::Double theW = ChamferGroupParams->SpinBox_DY->value();
886 CORBA::Double theRF = FilletGroupParams->SpinBox_DX->value();
887 CORBA::Boolean theHexMesh = HexMeshCheckBox->isChecked();
889 // if (JunctionPointsSel->GroupBox1->isChecked()) {
890 // CheckCompatiblePosition(theL1, theL2, myPoint1, myPoint2, myPoint3, 0.01);
891 // theL1 = MainTubeGroupParams->SpinBox_DZ->value();
892 // theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
895 // call engine function
896 if (ChamferGroupParams->GroupBox1->isChecked()) {
897 if (JunctionPointsSel->GroupBox1->isChecked())
898 anObj = anOper->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW,
899 theHexMesh, myPoint1, myPoint2, myPoint3);
901 anObj = anOper->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh);
903 else if (FilletGroupParams->GroupBox1->isChecked()) {
904 if (JunctionPointsSel->GroupBox1->isChecked())
905 anObj = anOper->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF,
906 theHexMesh, myPoint1, myPoint2, myPoint3);
908 anObj = anOper->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh);
911 if (JunctionPointsSel->GroupBox1->isChecked())
912 anObj = anOper->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, myPoint1,
915 anObj = anOper->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh);
918 res = anObj->length();
922 // res = !anObj->_is_nil();
923 if (res && !IsPreview()) {
924 QStringList aParameters;
925 //@@ put stringified input parameters to the string list here to store in the data model for notebook @@//
926 aParameters << MainTubeGroupParams->SpinBox_DX->text(); // R1 parameter
927 aParameters << MainTubeGroupParams->SpinBox_DY->text(); // W1 parameter
928 aParameters << MainTubeGroupParams->SpinBox_DZ->text(); // L1 parameter
929 aParameters << IncidentTubeGroupParams->SpinBox_DX->text(); // R2 parameter
930 aParameters << IncidentTubeGroupParams->SpinBox_DY->text(); // W2 parameter
931 aParameters << IncidentTubeGroupParams->SpinBox_DZ->text(); // L2 parameter
932 if (ChamferGroupParams->GroupBox1->isChecked()) {// Chamfer parameter
933 aParameters << ChamferGroupParams->SpinBox_DX->text(); // H parameter
934 aParameters << ChamferGroupParams->SpinBox_DY->text(); // W parameter
936 if (FilletGroupParams->GroupBox1->isChecked()) // Fillet parameter
937 aParameters << FilletGroupParams->SpinBox_DX->text(); // RF parameter
939 if (aParameters.count() > 0)
940 anObj[0]->SetParameters(aParameters.join(":").toLatin1().constData());
943 objects.push_back(anObj[0]._retn());
944 pipeTShapeGroupObjects.clear();
945 for (int i = 1, n = anObj->length(); i < n; i++) {
946 pipeTShapeGroupObjects.push_back(anObj[i]._retn());
949 return objects.size() > 0;
952 //=================================================================================
953 // function : restoreSubShapes
955 //=================================================================================
956 void AdvancedGUI_PipeTShapeDlg::restoreSubShapes(SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject) {
957 SALOMEDS::GenericAttribute_var anAttr;
958 if (!theSObject->FindAttribute(anAttr, "AttributeIOR"))
961 SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
962 CORBA::String_var anIORso = anAttrIOR->Value();
964 // get Object from SObject
965 GEOM::GEOM_Object_var theFather = GEOM::GEOM_Object::_narrow(myGeomGUI->getApp()->orb()->string_to_object(anIORso));
966 if (CORBA::is_nil(theFather))
969 ObjectList::iterator it = pipeTShapeGroupObjects.begin();
971 for (int i = 0; it != pipeTShapeGroupObjects.end(); it++, i++) {
972 getGeomEngine()->AddInStudy(theStudy, (*it), tr((*it)->GetName()).toStdString().c_str(), theFather);