1 // Copyright (C) 2007-2012 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 showOnlyPreviewControl();
222 // Signal/slot connections
223 connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
224 connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
225 connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
226 // ValueChangedInSpinBox
227 connect(MainTubeGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
228 connect(MainTubeGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
229 connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
230 connect(IncidentTubeGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
231 connect(IncidentTubeGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
232 connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
233 connect(ChamferGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
234 connect(ChamferGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
235 connect(FilletGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
237 connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
238 connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
240 // connect(PreviewPushButton, SIGNAL(clicked()), this, SLOT(DisplayPreview()));
242 connect(JunctionPointsSel->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(SetPosition(bool)));
243 connect(JunctionPointsSel->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
244 connect(JunctionPointsSel->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
245 connect(JunctionPointsSel->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
246 // ApplyNewDimensions
247 connect(JunctionPointsSel->PushButton4, SIGNAL(clicked()), this, SLOT(ApplyNewDimensions()));
248 connect(JunctionPointsSel->PushButton5, SIGNAL(clicked()), this, SLOT(ApplyNewDimensions()));
249 connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(UpdatePicture(QWidget*, QWidget*)));
250 //@@ put additional signal/slot connections here @@//
252 initName(tr("GEOM_PIPE_TSHAPE"));
253 updateTshapeScreenshotLabel();
257 //=================================================================================
258 // function : ApplyNewDimensions()
260 //=================================================================================
261 void AdvancedGUI_PipeTShapeDlg::ApplyNewDimensions() {
262 QPushButton* send = (QPushButton*) sender();
266 if (send == JunctionPointsSel->PushButton4) {
267 if (!JunctionPointsSel->LineEdit4->text().isEmpty()) {
268 newVal = JunctionPointsSel->LineEdit4->text().toDouble(&ok);
270 disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0);
271 MainTubeGroupParams->SpinBox_DZ->setValue(newVal);
272 connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
273 MainTubeGroupParams->SpinBox_DZ->setToolTip("");
274 MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
275 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
280 else if (send == JunctionPointsSel->PushButton5) {
281 if (!JunctionPointsSel->LineEdit5->text().isEmpty()) {
282 newVal = JunctionPointsSel->LineEdit5->text().toDouble(&ok);
284 disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0);
285 IncidentTubeGroupParams->SpinBox_DZ->setValue(newVal);
286 connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
287 IncidentTubeGroupParams->SpinBox_DZ->setToolTip("");
288 IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
289 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
296 //=================================================================================
297 // function : UpdatePicture()
299 //=================================================================================
300 void AdvancedGUI_PipeTShapeDlg::UpdatePicture(QWidget* old, QWidget* now) {
302 if (ChamferGroupParams->GroupBox1->isChecked())
303 if (now == MainTubeGroupParams->SpinBox_DX)
304 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_R1"));
305 else if (now == MainTubeGroupParams->SpinBox_DY)
306 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W1"));
307 else if (now == MainTubeGroupParams->SpinBox_DZ)
308 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_L1"));
309 else if (now == IncidentTubeGroupParams->SpinBox_DX)
310 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_R2"));
311 else if (now == IncidentTubeGroupParams->SpinBox_DY)
312 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W2"));
313 else if (now == IncidentTubeGroupParams->SpinBox_DZ)
314 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_L2"));
315 else if (now == ChamferGroupParams->SpinBox_DX)
316 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_H"));
317 else if (now == ChamferGroupParams->SpinBox_DY)
318 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W"));
320 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER"));
321 else if (FilletGroupParams->GroupBox1->isChecked())
322 if (now == MainTubeGroupParams->SpinBox_DX)
323 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_R1"));
324 else if (now == MainTubeGroupParams->SpinBox_DY)
325 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_W1"));
326 else if (now == MainTubeGroupParams->SpinBox_DZ)
327 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_L1"));
328 else if (now == IncidentTubeGroupParams->SpinBox_DX)
329 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_R2"));
330 else if (now == IncidentTubeGroupParams->SpinBox_DY)
331 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_W2"));
332 else if (now == IncidentTubeGroupParams->SpinBox_DZ)
333 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_L2"));
334 else if (now == FilletGroupParams->SpinBox_DX)
335 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_RF"));
337 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET"));
339 if (now == MainTubeGroupParams->SpinBox_DX)
340 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_R1"));
341 else if (now == MainTubeGroupParams->SpinBox_DY)
342 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_W1"));
343 else if (now == MainTubeGroupParams->SpinBox_DZ)
344 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_L1"));
345 else if (now == IncidentTubeGroupParams->SpinBox_DX)
346 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_R2"));
347 else if (now == IncidentTubeGroupParams->SpinBox_DY)
348 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_W2"));
349 else if (now == IncidentTubeGroupParams->SpinBox_DZ)
350 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_L2"));
352 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
354 updateTshapeScreenshotLabel();
357 //=================================================================================
358 // function : SetPosition()
360 //=================================================================================
361 void AdvancedGUI_PipeTShapeDlg::SetPosition(bool isChecked) {
364 JunctionPointsSel->LineEdit4->setText("");
365 JunctionPointsSel->LineEdit5->setText("");
366 // connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(
367 // SelectionIntoArgument()));
368 JunctionPointsSel->PushButton1->click();
369 SelectionIntoArgument();
371 disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
372 JunctionPointsSel->LineEdit4->setText("");
373 JunctionPointsSel->LineEdit5->setText("");
378 //=================================================================================
379 // function : ValueChangedInSpinBox()
381 //=================================================================================
382 void AdvancedGUI_PipeTShapeDlg::ValueChangedInSpinBox(double newValue)
384 if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3)
385 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
389 //=================================================================================
390 // function : SelectionIntoArgument()
391 // purpose : Called when selection as changed or other case
392 //=================================================================================
393 void AdvancedGUI_PipeTShapeDlg::SelectionIntoArgument() {
396 // myEditCurrentArgument->setText("");
398 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
399 SALOME_ListIO aSelList;
400 aSelMgr->selectedObjects(aSelList);
402 if (aSelList.Extent() != 1) {
403 if (myEditCurrentArgument == JunctionPointsSel->LineEdit1)
405 else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2)
407 else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3)
410 myEditCurrentArgument->setText("");
414 if (aSelList.Extent() == 1) {
415 Handle(SALOME_InteractiveObject) anIO = aSelList.First();
416 GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO);
417 if (!CORBA::is_nil(aSelectedObject)) {
418 QString aName = GEOMBase::GetName(aSelectedObject);
420 if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
422 TColStd_IndexedMapOfInteger aMap;
423 aSelMgr->GetIndexes(anIO, aMap);
424 if (aMap.Extent() == 1) { // Local Selection
425 int anIndex = aMap(1);
426 aName += QString(":vertex_%1").arg(anIndex);
428 //Find SubShape Object in Father
429 GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
431 if (aFindedObject->_is_nil()) { // Object not found in study
432 GEOM::GEOM_IShapesOperations_var aShapesOp =
433 getGeomEngine()->GetIShapesOperations(getStudyId());
434 aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
436 aSelectedObject = aFindedObject; // get Object from study
438 GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE);
439 } else { // Global Selection
440 if (aShape.ShapeType() != TopAbs_VERTEX) {
441 aSelectedObject = GEOM::GEOM_Object::_nil();
447 if (aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX) {
450 myEditCurrentArgument->setText(aName);
451 if (myEditCurrentArgument == JunctionPointsSel->LineEdit1) {
452 myPoint1 = aSelectedObject;
455 JunctionPointsSel->PushButton2->click();
456 } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2) {
457 myPoint2 = aSelectedObject;
460 JunctionPointsSel->PushButton3->click();
461 } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3) {
462 myPoint3 = aSelectedObject;
465 JunctionPointsSel->PushButton1->click();
470 if (myOkPoint1 && myOkPoint2 && myOkPoint3) {
471 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
475 // GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First());
476 // if (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() {
573 setIsApplyAndClose( true );
578 //=================================================================================
579 // function : ClickOnApply()
581 //=================================================================================
582 bool AdvancedGUI_PipeTShapeDlg::ClickOnApply() {
591 //=================================================================================
592 // function : ActivateThisDialog()
594 //=================================================================================
595 void AdvancedGUI_PipeTShapeDlg::ActivateThisDialog() {
596 GEOMBase_Skeleton::ActivateThisDialog();
597 // globalSelection( GEOM_POINT);
598 // connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(
599 // currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
600 if (myOkPoint1 && myOkPoint2 && myOkPoint3)
601 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
605 //=================================================================================
606 // function : enterEvent [REDEFINED]
608 //=================================================================================
609 void AdvancedGUI_PipeTShapeDlg::enterEvent(QEvent*) {
610 if (!mainFrame()->GroupConstructors->isEnabled())
611 ActivateThisDialog();
614 //=================================================================================
615 // function : resizeEvent [REDEFINED]
617 //=================================================================================
618 void AdvancedGUI_PipeTShapeDlg::resizeEvent(QResizeEvent */*event*/) {
619 QSize scaledSize = imagePipeTShape.size();
620 scaledSize.scale(tshapeScreenShotLabel->size(), Qt::KeepAspectRatio);
621 if (!tshapeScreenShotLabel->pixmap()
622 || scaledSize != tshapeScreenShotLabel->pixmap()->size())
623 updateTshapeScreenshotLabel();
626 //=================================================================================
627 // function : updateTshapeScreenshotLabel
629 //=================================================================================
630 void AdvancedGUI_PipeTShapeDlg::updateTshapeScreenshotLabel() {
631 tshapeScreenShotLabel->setPixmap(imagePipeTShape.scaled(tshapeScreenShotLabel->size(),
633 Qt::SmoothTransformation));
636 //=================================================================================
637 // function : ChamferOrFillet()
639 //=================================================================================
640 void AdvancedGUI_PipeTShapeDlg::ChamferOrFillet(bool) {
641 QGroupBox* send = (QGroupBox*) sender();
643 if (send == ChamferGroupParams->GroupBox1) {
644 if (send->isChecked()) {
645 disconnect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0);
646 FilletGroupParams->GroupBox1->setChecked(false);
647 connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
648 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER"));
651 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
652 updateTshapeScreenshotLabel();
653 if (myOkPoint1 && myOkPoint2 && myOkPoint3)
654 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
656 } else if (send == FilletGroupParams->GroupBox1) {
657 if (send->isChecked()) {
658 disconnect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0);
659 ChamferGroupParams->GroupBox1->setChecked(!send->isChecked());
660 connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
661 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET"));
664 imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
665 updateTshapeScreenshotLabel();
666 if (myOkPoint1 && myOkPoint2 && myOkPoint3)
667 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
673 //=================================================================================
674 // function : DisplayPreview()
676 //=================================================================================
677 void AdvancedGUI_PipeTShapeDlg::DisplayPreview(const bool activate, const bool update, const bool toRemoveFromEngine,
678 const double lineWidth, const int displayMode, const int color) {
682 erasePreview(update);
690 SUIT_OverrideCursor wc;
692 bool hexMeshState = HexMeshCheckBox->isChecked();
693 HexMeshCheckBox->setChecked(false);
694 if (!executeNoCheck(objects) || !getOperation()->IsDone()) {
697 ObjectList::iterator it = objects.begin();
698 GEOM::GEOM_Object_var obj = *it;
699 displayPreview(obj, true, activate, false, lineWidth, displayMode, color);
700 if (toRemoveFromEngine)
703 HexMeshCheckBox->setChecked(hexMeshState);
704 } catch (const SALOME::SALOME_Exception& e) {
705 SalomeApp_Tools::QtCatchCorbaException(e);
713 //=================================================================================
714 // function : createOperation
716 //=================================================================================
717 GEOM::GEOM_IOperations_ptr AdvancedGUI_PipeTShapeDlg::createOperation() {
718 return getGeomEngine()->GetIAdvancedOperations(getStudyId());
721 //=================================================================================
722 // function : isValid
724 //=================================================================================
725 bool AdvancedGUI_PipeTShapeDlg::isValid(QString& msg) {
728 ok = MainTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
729 ok = MainTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
730 ok = MainTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
731 ok = IncidentTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
732 ok = IncidentTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
733 ok = IncidentTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
734 ok = ChamferGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
735 ok = ChamferGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
736 ok = FilletGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
738 ok = fabs(MainTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
739 ok = fabs(MainTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
740 ok = fabs(MainTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok;
741 ok = fabs(IncidentTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
742 ok = fabs(IncidentTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
743 ok = fabs(IncidentTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok;
744 ok = fabs(ChamferGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
745 ok = fabs(ChamferGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
746 ok = fabs(FilletGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
748 if (JunctionPointsSel->GroupBox1->isChecked())
749 ok = myOkPoint1 && myOkPoint2 && myOkPoint3 && ok;
754 //=================================================================================
755 // function : CheckCompatiblePosition()
757 //=================================================================================
758 bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition(GEOM::GEOM_Object_var theP1,
759 GEOM::GEOM_Object_var theP2, GEOM::GEOM_Object_var theP3, double theTolerance) {
761 MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
762 IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
763 JunctionPointsSel->PushButton4->setStyleSheet(CssNormal);
764 JunctionPointsSel->PushButton5->setStyleSheet(CssNormal);
766 CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
767 CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
769 JunctionPointsSel->LineEdit4->setText("");
770 JunctionPointsSel->LineEdit5->setText("");
772 MainTubeGroupParams->SpinBox_DZ->setToolTip("");
773 IncidentTubeGroupParams->SpinBox_DZ->setToolTip("");
777 if ( GEOMBase::GetShape( theP1, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
778 P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
782 if ( GEOMBase::GetShape( theP2, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
783 P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
787 if ( GEOMBase::GetShape( theP3, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
788 P3 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
792 double d12 = P1.Distance(P2);
793 double d13 = P1.Distance(P3);
794 double d23 = P2.Distance(P3);
796 if (Abs(d12) <= Precision::Confusion()) {
797 // SetErrorCode("Junctions points P1 and P2 are identical");
800 if (Abs(d13) <= Precision::Confusion()) {
801 // SetErrorCode("Junctions points P1 and P3 are identical");
804 if (Abs(d23) <= Precision::Confusion()) {
805 // SetErrorCode("Junctions points P2 and P3 are identical");
809 long double newL1 = 0.5 * d12;
810 long double newL2 = sqrt(pow(d13,2)-pow(newL1,2));
812 JunctionPointsSel->LineEdit4->setText(QString::number(newL1,'f',7));
813 JunctionPointsSel->LineEdit5->setText(QString::number(newL2,'f',7));
815 if (fabs(newL1 - theL1) > Precision::Approximation()) {
816 if ((newL1 * (1 - theTolerance) - theL1 <= Precision::Approximation()) &&
817 (newL1 * (1 + theTolerance) - theL1 >= Precision::Approximation())) {
818 disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0);
819 MainTubeGroupParams->SpinBox_DZ->setValue(newL1);
820 connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
821 MainTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
822 MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable);
823 JunctionPointsSel->PushButton4->setStyleSheet(CssAcceptable);
826 MainTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
827 MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused);
828 JunctionPointsSel->PushButton4->setStyleSheet(CssRefused);
832 MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
833 JunctionPointsSel->PushButton4->setStyleSheet(CssNormal);
836 if (fabs(newL2 - theL2) > Precision::Approximation()) {
837 if ((newL2 * (1 - theTolerance) - theL2 <= Precision::Approximation()) &&
838 (newL2 * (1 + theTolerance) - theL2 >= Precision::Approximation())) {
839 disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0);
840 IncidentTubeGroupParams->SpinBox_DZ->setValue(newL2);
841 connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
842 IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
843 IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable);
844 JunctionPointsSel->PushButton5->setStyleSheet(CssAcceptable);
847 IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
848 IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused);
849 JunctionPointsSel->PushButton5->setStyleSheet(CssRefused);
853 IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
854 JunctionPointsSel->PushButton5->setStyleSheet(CssNormal);
860 bool AdvancedGUI_PipeTShapeDlg::execute(ObjectList& objects) {
862 if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3)
863 CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
865 return executeNoCheck(objects);
868 //=================================================================================
869 // function : execute
871 //=================================================================================
872 bool AdvancedGUI_PipeTShapeDlg::executeNoCheck(ObjectList& objects) {
875 // GEOM::GEOM_Object_var anObj;
876 GEOM::ListOfGO_var anObj;
878 GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation());
880 //@@ retrieve input values from the widgets here @@//
881 CORBA::Double theR1 = MainTubeGroupParams->SpinBox_DX->value();
882 CORBA::Double theW1 = MainTubeGroupParams->SpinBox_DY->value();
883 CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
884 CORBA::Double theR2 = IncidentTubeGroupParams->SpinBox_DX->value();
885 CORBA::Double theW2 = IncidentTubeGroupParams->SpinBox_DY->value();
886 CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
887 CORBA::Double theH = ChamferGroupParams->SpinBox_DX->value();
888 CORBA::Double theW = ChamferGroupParams->SpinBox_DY->value();
889 CORBA::Double theRF = FilletGroupParams->SpinBox_DX->value();
890 CORBA::Boolean theHexMesh = HexMeshCheckBox->isChecked();
892 // if (JunctionPointsSel->GroupBox1->isChecked()) {
893 // CheckCompatiblePosition(theL1, theL2, myPoint1, myPoint2, myPoint3, 0.01);
894 // theL1 = MainTubeGroupParams->SpinBox_DZ->value();
895 // theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
898 // call engine function
899 if (ChamferGroupParams->GroupBox1->isChecked()) {
900 if (JunctionPointsSel->GroupBox1->isChecked())
901 anObj = anOper->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW,
902 theHexMesh, myPoint1, myPoint2, myPoint3);
904 anObj = anOper->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh);
906 else if (FilletGroupParams->GroupBox1->isChecked()) {
907 if (JunctionPointsSel->GroupBox1->isChecked())
908 anObj = anOper->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF,
909 theHexMesh, myPoint1, myPoint2, myPoint3);
911 anObj = anOper->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh);
914 if (JunctionPointsSel->GroupBox1->isChecked())
915 anObj = anOper->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, myPoint1,
918 anObj = anOper->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh);
921 res = anObj->length();
925 // res = !anObj->_is_nil();
926 if (res && !IsPreview()) {
927 QStringList aParameters;
928 //@@ put stringified input parameters to the string list here to store in the data model for notebook @@//
929 aParameters << MainTubeGroupParams->SpinBox_DX->text(); // R1 parameter
930 aParameters << MainTubeGroupParams->SpinBox_DY->text(); // W1 parameter
931 aParameters << MainTubeGroupParams->SpinBox_DZ->text(); // L1 parameter
932 aParameters << IncidentTubeGroupParams->SpinBox_DX->text(); // R2 parameter
933 aParameters << IncidentTubeGroupParams->SpinBox_DY->text(); // W2 parameter
934 aParameters << IncidentTubeGroupParams->SpinBox_DZ->text(); // L2 parameter
935 if (ChamferGroupParams->GroupBox1->isChecked()) {// Chamfer parameter
936 aParameters << ChamferGroupParams->SpinBox_DX->text(); // H parameter
937 aParameters << ChamferGroupParams->SpinBox_DY->text(); // W parameter
939 if (FilletGroupParams->GroupBox1->isChecked()) // Fillet parameter
940 aParameters << FilletGroupParams->SpinBox_DX->text(); // RF parameter
942 if (aParameters.count() > 0)
943 anObj[0]->SetParameters(aParameters.join(":").toLatin1().constData());
946 objects.push_back(anObj[0]._retn());
947 pipeTShapeGroupObjects.clear();
948 for (int i = 1, n = anObj->length(); i < n; i++) {
949 pipeTShapeGroupObjects.push_back(anObj[i]._retn());
952 return objects.size() > 0;
955 //=================================================================================
956 // function : restoreSubShapes
958 //=================================================================================
959 void AdvancedGUI_PipeTShapeDlg::restoreSubShapes(SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject) {
960 SALOMEDS::GenericAttribute_var anAttr;
961 if (!theSObject->FindAttribute(anAttr, "AttributeIOR"))
964 SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
965 CORBA::String_var anIORso = anAttrIOR->Value();
967 // get Object from SObject
968 GEOM::GEOM_Object_var theFather = GEOM::GEOM_Object::_narrow(myGeomGUI->getApp()->orb()->string_to_object(anIORso));
969 if (CORBA::is_nil(theFather))
972 ObjectList::iterator it = pipeTShapeGroupObjects.begin();
974 for (int i = 0; it != pipeTShapeGroupObjects.end(); it++, i++) {
975 getGeomEngine()->AddInStudy(theStudy, (*it), tr((*it)->GetName()).toStdString().c_str(), theFather);
980 //=================================================================================
981 // function : processPreview()
982 // purpose : Display preview if CheckBoxPreview is checked
983 //=================================================================================
984 void AdvancedGUI_PipeTShapeDlg::processPreview() {
985 if(mainFrame()->CheckBoxPreview->isChecked())