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 Standard_Boolean aRes = Standard_False;
414 Handle(SALOME_InteractiveObject) anIO = aSelList.First();
415 GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
416 if (!CORBA::is_nil(aSelectedObject) && aRes) {
417 QString aName = GEOMBase::GetName(aSelectedObject);
419 if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
421 TColStd_IndexedMapOfInteger aMap;
422 aSelMgr->GetIndexes(anIO, aMap);
423 if (aMap.Extent() == 1) { // Local Selection
424 int anIndex = aMap(1);
425 aName += QString(":vertex_%1").arg(anIndex);
427 //Find SubShape Object in Father
428 GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
430 if (aFindedObject->_is_nil()) { // Object not found in study
431 GEOM::GEOM_IShapesOperations_var aShapesOp =
432 getGeomEngine()->GetIShapesOperations(getStudyId());
433 aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
435 aSelectedObject = aFindedObject; // get Object from study
437 GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE);
438 } else { // Global Selection
439 if (aShape.ShapeType() != TopAbs_VERTEX) {
440 aSelectedObject = GEOM::GEOM_Object::_nil();
446 if (aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX) {
449 myEditCurrentArgument->setText(aName);
450 if (myEditCurrentArgument == JunctionPointsSel->LineEdit1) {
451 myPoint1 = aSelectedObject;
454 JunctionPointsSel->PushButton2->click();
455 } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2) {
456 myPoint2 = aSelectedObject;
459 JunctionPointsSel->PushButton3->click();
460 } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3) {
461 myPoint3 = aSelectedObject;
464 JunctionPointsSel->PushButton1->click();
469 if (myOkPoint1 && myOkPoint2 && myOkPoint3) {
470 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
474 // Standard_Boolean testResult = Standard_False;
475 // GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
476 // if (!testResult || aSelectedObject->_is_nil())
479 // myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
481 // // clear selection
482 // disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
483 // myGeomGUI->getApp()->selectionMgr()->clearSelected();
484 // connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
486 // if (myEditCurrentArgument == JunctionPointsSel->LineEdit1) {
487 // myPoint1 = aSelectedObject;
488 // myOkPoint1 = true;
490 // JunctionPointsSel->PushButton2->click();
491 // // P2GroupParams->PushButton1->click();
492 // } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2) {
493 // // } else if (myEditCurrentArgument == P2GroupParams->LineEdit1) {
494 // myPoint2 = aSelectedObject;
495 // myOkPoint2 = true;
497 // JunctionPointsSel->PushButton3->click();
498 // // P3GroupParams->PushButton1->click();
499 // } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3) {
500 // // } else if (myEditCurrentArgument == P3GroupParams->LineEdit1) {
501 // myPoint3 = aSelectedObject;
502 // myOkPoint3 = true;
504 // JunctionPointsSel->PushButton1->click();
508 //=================================================================================
509 // function : SetEditCurrentArgument()
511 //=================================================================================
512 void AdvancedGUI_PipeTShapeDlg::SetEditCurrentArgument() {
513 QPushButton* send = (QPushButton*) sender();
515 if (send == JunctionPointsSel->PushButton1) {
516 myEditCurrentArgument = JunctionPointsSel->LineEdit1;
517 JunctionPointsSel->PushButton2->setDown(false);
518 JunctionPointsSel->LineEdit2->setEnabled(false);
519 JunctionPointsSel->PushButton3->setDown(false);
520 JunctionPointsSel->LineEdit3->setEnabled(false);
521 } else if (send == JunctionPointsSel->PushButton2) {
522 myEditCurrentArgument = JunctionPointsSel->LineEdit2;
523 JunctionPointsSel->PushButton1->setDown(false);
524 JunctionPointsSel->LineEdit1->setEnabled(false);
525 JunctionPointsSel->PushButton3->setDown(false);
526 JunctionPointsSel->LineEdit3->setEnabled(false);
527 } else if (send == JunctionPointsSel->PushButton3) {
528 myEditCurrentArgument = JunctionPointsSel->LineEdit3;
529 JunctionPointsSel->PushButton1->setDown(false);
530 JunctionPointsSel->LineEdit1->setEnabled(false);
531 JunctionPointsSel->PushButton2->setDown(false);
532 JunctionPointsSel->LineEdit2->setEnabled(false);
536 myEditCurrentArgument->setEnabled(true);
537 myEditCurrentArgument->setFocus();
538 myEditCurrentArgument->setText("");
539 // after setFocus(), because it will be setDown(false) when loses focus
542 JunctionPointsSel->LineEdit4->setText("");
543 JunctionPointsSel->LineEdit5->setText("");
545 disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
546 // globalSelection(GEOM_POINT);
547 globalSelection(); // close local contexts, if any
548 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
549 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
552 //=================================================================================
553 // function : SetDoubleSpinBoxStep()
554 // purpose : Double spin box management
555 //=================================================================================
556 void AdvancedGUI_PipeTShapeDlg::SetDoubleSpinBoxStep(double step) {
557 MainTubeGroupParams->SpinBox_DX->setSingleStep(step);
558 MainTubeGroupParams->SpinBox_DY->setSingleStep(step);
559 MainTubeGroupParams->SpinBox_DZ->setSingleStep(step);
560 IncidentTubeGroupParams->SpinBox_DX->setSingleStep(step);
561 IncidentTubeGroupParams->SpinBox_DY->setSingleStep(step);
562 IncidentTubeGroupParams->SpinBox_DZ->setSingleStep(step);
563 ChamferGroupParams->SpinBox_DX->setSingleStep(step);
564 ChamferGroupParams->SpinBox_DY->setSingleStep(step);
565 FilletGroupParams->SpinBox_DX->setSingleStep(step);
568 //=================================================================================
569 // function : ClickOnOk()
571 //=================================================================================
572 void AdvancedGUI_PipeTShapeDlg::ClickOnOk() {
577 //=================================================================================
578 // function : ClickOnApply()
580 //=================================================================================
581 bool AdvancedGUI_PipeTShapeDlg::ClickOnApply() {
590 //=================================================================================
591 // function : ActivateThisDialog()
593 //=================================================================================
594 void AdvancedGUI_PipeTShapeDlg::ActivateThisDialog() {
595 GEOMBase_Skeleton::ActivateThisDialog();
596 // globalSelection( GEOM_POINT);
597 // connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(
598 // currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
599 if (myOkPoint1 && myOkPoint2 && myOkPoint3)
600 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
604 //=================================================================================
605 // function : enterEvent [REDEFINED]
607 //=================================================================================
608 void AdvancedGUI_PipeTShapeDlg::enterEvent(QEvent*) {
609 if (!mainFrame()->GroupConstructors->isEnabled())
610 ActivateThisDialog();
613 //=================================================================================
614 // function : resizeEvent [REDEFINED]
616 //=================================================================================
617 void AdvancedGUI_PipeTShapeDlg::resizeEvent(QResizeEvent */*event*/) {
618 QSize scaledSize = imagePipeTShape.size();
619 scaledSize.scale(tshapeScreenShotLabel->size(), Qt::KeepAspectRatio);
620 if (!tshapeScreenShotLabel->pixmap()
621 || scaledSize != tshapeScreenShotLabel->pixmap()->size())
622 updateTshapeScreenshotLabel();
625 //=================================================================================
626 // function : updateTshapeScreenshotLabel
628 //=================================================================================
629 void AdvancedGUI_PipeTShapeDlg::updateTshapeScreenshotLabel() {
630 tshapeScreenShotLabel->setPixmap(imagePipeTShape.scaled(tshapeScreenShotLabel->size(),
632 Qt::SmoothTransformation));
635 //=================================================================================
636 // function : ChamferOrFillet()
638 //=================================================================================
639 void AdvancedGUI_PipeTShapeDlg::ChamferOrFillet(bool) {
640 QGroupBox* send = (QGroupBox*) sender();
642 if (send == ChamferGroupParams->GroupBox1) {
643 if (send->isChecked()) {
644 disconnect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0);
645 FilletGroupParams->GroupBox1->setChecked(false);
646 connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
647 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER"));
650 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
651 updateTshapeScreenshotLabel();
652 if (myOkPoint1 && myOkPoint2 && myOkPoint3)
653 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
655 } else if (send == FilletGroupParams->GroupBox1) {
656 if (send->isChecked()) {
657 disconnect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0);
658 ChamferGroupParams->GroupBox1->setChecked(!send->isChecked());
659 connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
660 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET"));
663 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
664 updateTshapeScreenshotLabel();
665 if (myOkPoint1 && myOkPoint2 && myOkPoint3)
666 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
672 //=================================================================================
673 // function : DisplayPreview()
675 //=================================================================================
676 void AdvancedGUI_PipeTShapeDlg::DisplayPreview(const bool activate, const bool update, const bool toRemoveFromEngine,
677 const double lineWidth, const int displayMode, const int color) {
681 erasePreview(update);
689 SUIT_OverrideCursor wc;
691 bool hexMeshState = HexMeshCheckBox->isChecked();
692 HexMeshCheckBox->setChecked(false);
693 if (!executeNoCheck(objects) || !getOperation()->IsDone()) {
696 ObjectList::iterator it = objects.begin();
697 GEOM::GEOM_Object_var obj = *it;
698 displayPreview(obj, true, activate, false, lineWidth, displayMode, color);
699 if (toRemoveFromEngine)
702 HexMeshCheckBox->setChecked(hexMeshState);
703 } catch (const SALOME::SALOME_Exception& e) {
704 SalomeApp_Tools::QtCatchCorbaException(e);
712 //=================================================================================
713 // function : createOperation
715 //=================================================================================
716 GEOM::GEOM_IOperations_ptr AdvancedGUI_PipeTShapeDlg::createOperation() {
717 return getGeomEngine()->GetIAdvancedOperations(getStudyId());
720 //=================================================================================
721 // function : isValid
723 //=================================================================================
724 bool AdvancedGUI_PipeTShapeDlg::isValid(QString& msg) {
727 ok = MainTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
728 ok = MainTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
729 ok = MainTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
730 ok = IncidentTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
731 ok = IncidentTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
732 ok = IncidentTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
733 ok = ChamferGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
734 ok = ChamferGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
735 ok = FilletGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
737 ok = fabs(MainTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
738 ok = fabs(MainTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
739 ok = fabs(MainTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok;
740 ok = fabs(IncidentTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
741 ok = fabs(IncidentTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
742 ok = fabs(IncidentTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok;
743 ok = fabs(ChamferGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
744 ok = fabs(ChamferGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
745 ok = fabs(FilletGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
747 if (JunctionPointsSel->GroupBox1->isChecked())
748 ok = myOkPoint1 && myOkPoint2 && myOkPoint3 && ok;
753 //=================================================================================
754 // function : CheckCompatiblePosition()
756 //=================================================================================
757 bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition(GEOM::GEOM_Object_var theP1,
758 GEOM::GEOM_Object_var theP2, GEOM::GEOM_Object_var theP3, double theTolerance) {
760 MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
761 IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
762 JunctionPointsSel->PushButton4->setStyleSheet(CssNormal);
763 JunctionPointsSel->PushButton5->setStyleSheet(CssNormal);
765 CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
766 CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
768 JunctionPointsSel->LineEdit4->setText("");
769 JunctionPointsSel->LineEdit5->setText("");
771 MainTubeGroupParams->SpinBox_DZ->setToolTip("");
772 IncidentTubeGroupParams->SpinBox_DZ->setToolTip("");
776 if ( GEOMBase::GetShape( theP1, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
777 P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
781 if ( GEOMBase::GetShape( theP2, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
782 P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
786 if ( GEOMBase::GetShape( theP3, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
787 P3 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
791 double d12 = P1.Distance(P2);
792 double d13 = P1.Distance(P3);
793 double d23 = P2.Distance(P3);
795 if (Abs(d12) <= Precision::Confusion()) {
796 // SetErrorCode("Junctions points P1 and P2 are identical");
799 if (Abs(d13) <= Precision::Confusion()) {
800 // SetErrorCode("Junctions points P1 and P3 are identical");
803 if (Abs(d23) <= Precision::Confusion()) {
804 // SetErrorCode("Junctions points P2 and P3 are identical");
808 long double newL1 = 0.5 * d12;
809 long double newL2 = sqrt(pow(d13,2)-pow(newL1,2));
811 JunctionPointsSel->LineEdit4->setText(QString::number(newL1,'f',7));
812 JunctionPointsSel->LineEdit5->setText(QString::number(newL2,'f',7));
814 if (fabs(newL1 - theL1) > Precision::Approximation()) {
815 if ((newL1 * (1 - theTolerance) - theL1 <= Precision::Approximation()) &&
816 (newL1 * (1 + theTolerance) - theL1 >= Precision::Approximation())) {
817 disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0);
818 MainTubeGroupParams->SpinBox_DZ->setValue(newL1);
819 connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
820 MainTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
821 MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable);
822 JunctionPointsSel->PushButton4->setStyleSheet(CssAcceptable);
825 MainTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
826 MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused);
827 JunctionPointsSel->PushButton4->setStyleSheet(CssRefused);
831 MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
832 JunctionPointsSel->PushButton4->setStyleSheet(CssNormal);
835 if (fabs(newL2 - theL2) > Precision::Approximation()) {
836 if ((newL2 * (1 - theTolerance) - theL2 <= Precision::Approximation()) &&
837 (newL2 * (1 + theTolerance) - theL2 >= Precision::Approximation())) {
838 disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0);
839 IncidentTubeGroupParams->SpinBox_DZ->setValue(newL2);
840 connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
841 IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
842 IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable);
843 JunctionPointsSel->PushButton5->setStyleSheet(CssAcceptable);
846 IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
847 IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused);
848 JunctionPointsSel->PushButton5->setStyleSheet(CssRefused);
852 IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
853 JunctionPointsSel->PushButton5->setStyleSheet(CssNormal);
859 bool AdvancedGUI_PipeTShapeDlg::execute(ObjectList& objects) {
861 if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3)
862 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
864 return executeNoCheck(objects);
867 //=================================================================================
868 // function : execute
870 //=================================================================================
871 bool AdvancedGUI_PipeTShapeDlg::executeNoCheck(ObjectList& objects) {
874 // GEOM::GEOM_Object_var anObj;
875 GEOM::ListOfGO_var anObj;
877 GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation());
879 //@@ retrieve input values from the widgets here @@//
880 CORBA::Double theR1 = MainTubeGroupParams->SpinBox_DX->value();
881 CORBA::Double theW1 = MainTubeGroupParams->SpinBox_DY->value();
882 CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
883 CORBA::Double theR2 = IncidentTubeGroupParams->SpinBox_DX->value();
884 CORBA::Double theW2 = IncidentTubeGroupParams->SpinBox_DY->value();
885 CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
886 CORBA::Double theH = ChamferGroupParams->SpinBox_DX->value();
887 CORBA::Double theW = ChamferGroupParams->SpinBox_DY->value();
888 CORBA::Double theRF = FilletGroupParams->SpinBox_DX->value();
889 CORBA::Boolean theHexMesh = HexMeshCheckBox->isChecked();
891 // if (JunctionPointsSel->GroupBox1->isChecked()) {
892 // CheckCompatiblePosition(theL1, theL2, myPoint1, myPoint2, myPoint3, 0.01);
893 // theL1 = MainTubeGroupParams->SpinBox_DZ->value();
894 // theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
897 // call engine function
898 if (ChamferGroupParams->GroupBox1->isChecked()) {
899 if (JunctionPointsSel->GroupBox1->isChecked())
900 anObj = anOper->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW,
901 theHexMesh, myPoint1, myPoint2, myPoint3);
903 anObj = anOper->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh);
905 else if (FilletGroupParams->GroupBox1->isChecked()) {
906 if (JunctionPointsSel->GroupBox1->isChecked())
907 anObj = anOper->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF,
908 theHexMesh, myPoint1, myPoint2, myPoint3);
910 anObj = anOper->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh);
913 if (JunctionPointsSel->GroupBox1->isChecked())
914 anObj = anOper->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, myPoint1,
917 anObj = anOper->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh);
920 res = anObj->length();
924 // res = !anObj->_is_nil();
925 if (res && !IsPreview()) {
926 QStringList aParameters;
927 //@@ put stringified input parameters to the string list here to store in the data model for notebook @@//
928 aParameters << MainTubeGroupParams->SpinBox_DX->text(); // R1 parameter
929 aParameters << MainTubeGroupParams->SpinBox_DY->text(); // W1 parameter
930 aParameters << MainTubeGroupParams->SpinBox_DZ->text(); // L1 parameter
931 aParameters << IncidentTubeGroupParams->SpinBox_DX->text(); // R2 parameter
932 aParameters << IncidentTubeGroupParams->SpinBox_DY->text(); // W2 parameter
933 aParameters << IncidentTubeGroupParams->SpinBox_DZ->text(); // L2 parameter
934 if (ChamferGroupParams->GroupBox1->isChecked()) {// Chamfer parameter
935 aParameters << ChamferGroupParams->SpinBox_DX->text(); // H parameter
936 aParameters << ChamferGroupParams->SpinBox_DY->text(); // W parameter
938 if (FilletGroupParams->GroupBox1->isChecked()) // Fillet parameter
939 aParameters << FilletGroupParams->SpinBox_DX->text(); // RF parameter
941 if (aParameters.count() > 0)
942 anObj[0]->SetParameters(aParameters.join(":").toLatin1().constData());
945 objects.push_back(anObj[0]._retn());
946 pipeTShapeGroupObjects.clear();
947 for (int i = 1, n = anObj->length(); i < n; i++) {
948 pipeTShapeGroupObjects.push_back(anObj[i]._retn());
951 return objects.size() > 0;
954 //=================================================================================
955 // function : restoreSubShapes
957 //=================================================================================
958 void AdvancedGUI_PipeTShapeDlg::restoreSubShapes(SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject) {
959 SALOMEDS::GenericAttribute_var anAttr;
960 if (!theSObject->FindAttribute(anAttr, "AttributeIOR"))
963 SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
964 CORBA::String_var anIORso = anAttrIOR->Value();
966 // get Object from SObject
967 GEOM::GEOM_Object_var theFather = GEOM::GEOM_Object::_narrow(myGeomGUI->getApp()->orb()->string_to_object(anIORso));
968 if (CORBA::is_nil(theFather))
971 ObjectList::iterator it = pipeTShapeGroupObjects.begin();
973 for (int i = 0; it != pipeTShapeGroupObjects.end(); it++, i++) {
974 getGeomEngine()->AddInStudy(theStudy, (*it), tr((*it)->GetName()).toStdString().c_str(), theFather);