1 // GEOM GEOMGUI : GUI for Geometry component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : GenerationGUI_PrismDlg.cxx
23 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
26 #include "GenerationGUI_PrismDlg.h"
29 #include <GeometryGUI.h>
32 #include <SUIT_Session.h>
33 #include <SUIT_ResourceMgr.h>
34 #include <SalomeApp_Application.h>
35 #include <LightApp_SelectionMgr.h>
38 #include <TopoDS_Shape.hxx>
39 #include <TopoDS_Edge.hxx>
42 #include <TColStd_IndexedMapOfInteger.hxx>
43 #include <TopTools_IndexedMapOfShape.hxx>
45 #include <GEOMImpl_Types.hxx>
47 //=================================================================================
48 // class : GenerationGUI_PrismDlg()
49 // purpose : Constructs a GenerationGUI_PrismDlg which is a child of 'parent', with the
50 // name 'name' and widget flags set to 'f'.
51 // The dialog will by default be modeless, unless you set 'modal' to
52 // TRUE to construct a modal dialog.
53 //=================================================================================
54 GenerationGUI_PrismDlg::GenerationGUI_PrismDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
55 bool modal, Qt::WindowFlags fl)
56 : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
59 SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
60 QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM")));
61 QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
62 QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM_2P")));
63 QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM_DXDYDZ")));
65 setWindowTitle(tr("GEOM_EXTRUSION_TITLE"));
67 /***************************************************************/
68 mainFrame()->GroupConstructors->setTitle(tr("GEOM_EXTRUSION"));
69 mainFrame()->RadioButton1->setIcon(image0);
70 mainFrame()->RadioButton2->setIcon(image2);
71 mainFrame()->RadioButton3->setIcon(image3);
73 mainFrame()->RadioButton1->setChecked(true);
74 myBothway = myBothway2 = myBothway3 = false;
76 GroupPoints = new DlgRef_2Sel1Spin2Check(centralWidget());
77 GroupPoints->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV"));
78 GroupPoints->TextLabel1->setText(tr("GEOM_BASE"));
79 GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
80 GroupPoints->TextLabel3->setText(tr("GEOM_HEIGHT"));
81 GroupPoints->PushButton1->setIcon(image1);
82 GroupPoints->PushButton2->setIcon(image1);
83 GroupPoints->LineEdit1->setReadOnly(true);
84 GroupPoints->LineEdit2->setReadOnly(true);
85 GroupPoints->CheckButton1->setText(tr("GEOM_BOTHWAY"));
86 GroupPoints->CheckButton1->setChecked(myBothway);
87 GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE"));
89 GroupPoints2 = new DlgRef_3Sel1Check(centralWidget());
90 GroupPoints2->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV_2P"));
91 GroupPoints2->TextLabel1->setText(tr("GEOM_BASE"));
92 GroupPoints2->TextLabel2->setText(tr("GEOM_POINT_I").arg(1));
93 GroupPoints2->TextLabel3->setText(tr("GEOM_POINT_I").arg(2));
94 GroupPoints2->PushButton1->setIcon(image1);
95 GroupPoints2->PushButton2->setIcon(image1);
96 GroupPoints2->PushButton3->setIcon(image1);
97 GroupPoints2->CheckButton1->setText(tr("GEOM_BOTHWAY"));
98 GroupPoints2->CheckButton1->setChecked(myBothway2);
100 GroupPoints3 = new DlgRef_1Sel3Spin1Check(centralWidget());
101 GroupPoints3->GroupBox1->setTitle(tr("GEOM_EXTRUSION_DXDYDZ"));
102 GroupPoints3->TextLabel1->setText(tr("GEOM_BASE"));
103 GroupPoints3->PushButton1->setIcon(image1);
104 GroupPoints3->TextLabel2->setText(tr("GEOM_DX"));
105 GroupPoints3->TextLabel3->setText(tr("GEOM_DY"));
106 GroupPoints3->TextLabel4->setText(tr("GEOM_DZ"));
107 GroupPoints3->CheckButton1->setText(tr("GEOM_BOTHWAY"));
108 GroupPoints3->CheckButton1->setChecked(myBothway3);
110 QVBoxLayout* layout = new QVBoxLayout(centralWidget());
111 layout->setMargin(0); layout->setSpacing(6);
112 layout->addWidget(GroupPoints);
113 layout->addWidget(GroupPoints2);
114 layout->addWidget(GroupPoints3);
115 /***************************************************************/
117 setHelpFileName("create_extrusion_page.html");
122 //=================================================================================
123 // function : ~GenerationGUI_PrismDlg()
124 // purpose : Destroys the object and frees any allocated resources
125 //=================================================================================
126 GenerationGUI_PrismDlg::~GenerationGUI_PrismDlg()
128 // no need to delete child widgets, Qt does it all for us
131 //=================================================================================
134 //=================================================================================
135 void GenerationGUI_PrismDlg::Init()
137 // Get setting of step value from file configuration
138 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
139 double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
141 // min, max, step and decimals for spin boxes & initial values
142 initSpinBox(GroupPoints3->SpinBox_DX, COORD_MIN, COORD_MAX, step, 6); // VSR:TODO : DBL_DIGITS_DISPLAY
143 initSpinBox(GroupPoints3->SpinBox_DY, COORD_MIN, COORD_MAX, step, 6); // VSR:TODO : DBL_DIGITS_DISPLAY
144 initSpinBox(GroupPoints3->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 6); // VSR:TODO : DBL_DIGITS_DISPLAY
145 GroupPoints3->SpinBox_DX->setValue(0.0);
146 GroupPoints3->SpinBox_DY->setValue(0.0);
147 GroupPoints3->SpinBox_DZ->setValue(0.0);
149 initSpinBox(GroupPoints->SpinBox_DX, 0.000001, COORD_MAX, step, 6); // VSR: TODO: DBL_DIGITS_DISPLAY
150 GroupPoints->SpinBox_DX->setValue(100.0);
153 myEditCurrentArgument = GroupPoints->LineEdit1;
154 GroupPoints->LineEdit1->setReadOnly(true);
155 GroupPoints->LineEdit2->setReadOnly(true);
157 GroupPoints2->LineEdit1->setReadOnly(true);
158 GroupPoints2->LineEdit2->setReadOnly(true);
159 GroupPoints2->LineEdit3->setReadOnly(true);
161 GroupPoints3->LineEdit1->setReadOnly(true);
163 GroupPoints->LineEdit1->setText("");
164 GroupPoints->LineEdit2->setText("");
166 GroupPoints2->LineEdit1->setText("");
167 GroupPoints2->LineEdit2->setText("");
168 GroupPoints2->LineEdit3->setText("");
170 GroupPoints3->LineEdit1->setText("");
172 myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil();
173 myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false;
175 // signals and slots connections
176 connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
177 connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
179 connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
181 connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
182 connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
184 connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
185 connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
187 connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
188 connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
190 connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
191 connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
193 connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
194 connect(GroupPoints2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
195 connect(GroupPoints2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
196 connect(GroupPoints2->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
198 connect(GroupPoints2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
199 connect(GroupPoints2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
200 connect(GroupPoints2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
202 connect(GroupPoints3->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
203 connect(GroupPoints3->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
204 connect(GroupPoints3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
205 connect(GroupPoints3->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
206 connect(GroupPoints3->SpinBox_DZ, SIGNAL(valueChanged (double)), this, SLOT(ValueChangedInSpinBox()));
207 connect(GroupPoints3->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
209 initName(tr("GEOM_EXTRUSION"));
211 ConstructorsClicked(0);
214 //=================================================================================
215 // function : SetDoubleSpinBoxStep()
216 // purpose : Double spin box management
217 //=================================================================================
218 void GenerationGUI_PrismDlg::SetDoubleSpinBoxStep (double step)
220 GroupPoints->SpinBox_DX->setSingleStep(step);
221 GroupPoints3->SpinBox_DX->setSingleStep(step);
222 GroupPoints3->SpinBox_DY->setSingleStep(step);
223 GroupPoints3->SpinBox_DZ->setSingleStep(step);
226 //=================================================================================
227 // function : ConstructorsClicked()
228 // purpose : Radio button management
229 //=================================================================================
230 void GenerationGUI_PrismDlg::ConstructorsClicked (int constructorId)
232 disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
234 switch (constructorId) {
237 GroupPoints2->hide();
238 GroupPoints3->hide();
241 GroupPoints->LineEdit1->setText(GroupPoints2->LineEdit1->text()); // keep base
242 GroupPoints->LineEdit2->setText("");
243 myVec = GEOM::GEOM_Object::_nil();
246 GroupPoints->PushButton1->click();
252 GroupPoints2->show();
253 GroupPoints3->hide();
255 GroupPoints2->LineEdit1->setText(GroupPoints->LineEdit1->text()); // keep base
256 GroupPoints2->LineEdit2->setText("");
257 GroupPoints2->LineEdit3->setText("");
258 myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
259 myOkPnt1 = myOkPnt2 = false;
261 GroupPoints2->PushButton1->click();
267 GroupPoints2->hide();
268 GroupPoints3->show();
270 GroupPoints3->LineEdit1->setText(GroupPoints->LineEdit1->text()); // keep base
272 GroupPoints3->PushButton1->click();
277 qApp->processEvents();
279 resize(minimumSize());
283 SelectionIntoArgument();
290 //=================================================================================
291 // function : ClickOnOk()
293 //=================================================================================
294 void GenerationGUI_PrismDlg::ClickOnOk()
300 //=================================================================================
301 // function : ClickOnApply()
303 //=================================================================================
304 bool GenerationGUI_PrismDlg::ClickOnApply()
310 // activate selection and connect selection manager
311 ConstructorsClicked(getConstructorId());
315 //=================================================================================
316 // function : SelectionIntoArgument()
317 // purpose : Called when selection is changed or on dialog initialization or activation
318 //=================================================================================
319 void GenerationGUI_PrismDlg::SelectionIntoArgument()
322 myEditCurrentArgument->setText("");
324 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
325 SALOME_ListIO aSelList;
326 aSelMgr->selectedObjects(aSelList);
328 if (getConstructorId() == 0)
330 if (aSelList.Extent() != 1) {
331 if (myEditCurrentArgument == GroupPoints->LineEdit1)
333 else if (myEditCurrentArgument == GroupPoints->LineEdit2)
339 Standard_Boolean testResult = Standard_False;
340 GEOM::GEOM_Object_var aSelectedObject =
341 GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
342 if (!testResult || CORBA::is_nil(aSelectedObject))
345 QString aName = GEOMBase::GetName(aSelectedObject);
347 // Get Selected object if selected subshape
350 if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
352 TColStd_IndexedMapOfInteger aMap;
353 aSelMgr->GetIndexes(aSelList.First(), aMap);
354 if (aMap.Extent() == 1) {
355 int anIndex = aMap(1);
356 aName.append(":edge_" + QString::number(anIndex));
358 //Find SubShape Object in Father
359 GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
361 if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
362 GEOM::GEOM_IShapesOperations_var aShapesOp =
363 getGeomEngine()->GetIShapesOperations(getStudyId());
364 aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
367 aSelectedObject = aFindedObject; // get Object from study
370 else { // Global Selection
371 if (aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints->LineEdit2) {
372 aSelectedObject = GEOM::GEOM_Object::_nil();
379 myEditCurrentArgument->setText(aName);
381 if (myEditCurrentArgument == GroupPoints->LineEdit1) {
382 myBase = aSelectedObject;
385 GroupPoints->PushButton2->click();
387 else if (myEditCurrentArgument == GroupPoints->LineEdit2 && myOk) {
389 myVec = aSelectedObject;
391 GroupPoints->PushButton1->click();
394 else if (getConstructorId() == 1) { // getConstructorId()==1 - extrusion using 2 points
395 if (aSelList.Extent() != 1) {
396 if (myEditCurrentArgument == GroupPoints2->LineEdit1)
398 else if (myEditCurrentArgument == GroupPoints2->LineEdit2) {
399 myPoint1 = GEOM::GEOM_Object::_nil();
402 else if (myEditCurrentArgument == GroupPoints2->LineEdit3) {
403 myPoint2 = GEOM::GEOM_Object::_nil();
410 Standard_Boolean testResult = Standard_False;
411 GEOM::GEOM_Object_var aSelectedObject =
412 GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
414 if (!testResult || CORBA::is_nil(aSelectedObject))
417 QString aName = GEOMBase::GetName(aSelectedObject);
420 if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
421 TColStd_IndexedMapOfInteger aMap;
422 aSelMgr->GetIndexes(aSelList.First(), aMap);
423 if (aMap.Extent() == 1) {
424 int anIndex = aMap(1);
425 aName.append(":vertex_" + QString::number(anIndex));
427 //Find SubShape Object in Father
428 GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
430 if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
431 GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
432 aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
435 aSelectedObject = aFindedObject;
439 if ((aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit2) ||
440 (aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit3)) {
441 aSelectedObject = GEOM::GEOM_Object::_nil();
448 myEditCurrentArgument->setText(aName);
450 if (myEditCurrentArgument == GroupPoints2->LineEdit1) {
452 myBase = aSelectedObject;
454 GroupPoints2->PushButton2->click();
456 else if (myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk) {
458 myPoint1 = aSelectedObject;
460 GroupPoints2->PushButton3->click();
462 else if (myEditCurrentArgument == GroupPoints2->LineEdit3 && myOk) {
464 myPoint2 = aSelectedObject;
466 GroupPoints2->PushButton1->click();
469 else if (getConstructorId() == 2) { // extrusion using dx dy dz
470 Standard_Boolean testResult = Standard_False;
471 GEOM::GEOM_Object_var aSelectedObject =
472 GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
474 if (!testResult || CORBA::is_nil(aSelectedObject))
477 QString aName = GEOMBase::GetName(aSelectedObject);
478 myBase = aSelectedObject;
480 myEditCurrentArgument->setText(aName);
484 disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
485 myGeomGUI->getApp()->selectionMgr()->clearSelected();
486 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
487 this, SLOT(SelectionIntoArgument()));
492 //=================================================================================
493 // function : SetEditCurrentArgument()
495 //=================================================================================
496 void GenerationGUI_PrismDlg::SetEditCurrentArgument()
498 QPushButton* send = (QPushButton*)sender();
500 disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
501 globalSelection(GEOM_ALLSHAPES);
502 if (send == GroupPoints->PushButton1) {
503 myEditCurrentArgument = GroupPoints->LineEdit1;
504 GroupPoints->PushButton2->setDown(false);
505 GroupPoints->LineEdit2->setEnabled(false);
507 else if (send == GroupPoints->PushButton2) {
508 myEditCurrentArgument = GroupPoints->LineEdit2;
509 GroupPoints->PushButton1->setDown(false);
510 GroupPoints->LineEdit1->setEnabled(false);
511 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
513 else if (send == GroupPoints2->PushButton1) {
514 myEditCurrentArgument = GroupPoints2->LineEdit1;
515 GroupPoints2->PushButton2->setDown(false);
516 GroupPoints2->PushButton3->setDown(false);
517 GroupPoints2->LineEdit2->setEnabled(false);
518 GroupPoints2->LineEdit3->setEnabled(false);
520 else if (send == GroupPoints2->PushButton2) {
521 myEditCurrentArgument = GroupPoints2->LineEdit2;
522 GroupPoints2->PushButton1->setDown(false);
523 GroupPoints2->PushButton3->setDown(false);
524 GroupPoints2->LineEdit1->setEnabled(false);
525 GroupPoints2->LineEdit3->setEnabled(false);
526 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
528 else if (send == GroupPoints2->PushButton3) {
529 myEditCurrentArgument = GroupPoints2->LineEdit3;
530 GroupPoints2->PushButton1->setDown(false);
531 GroupPoints2->PushButton2->setDown(false);
532 GroupPoints2->LineEdit1->setEnabled(false);
533 GroupPoints2->LineEdit2->setEnabled(false);
534 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
536 else if (send == GroupPoints3->PushButton1) {
537 myEditCurrentArgument = GroupPoints3->LineEdit1;
539 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
540 this, SLOT(SelectionIntoArgument()));
543 myEditCurrentArgument->setEnabled(true);
544 myEditCurrentArgument->setFocus();
545 // after setFocus(), because it will be setDown(false) when loses focus
548 // seems we need it only to avoid preview disappearing, caused by selection mode change
552 //=================================================================================
553 // function : LineEditReturnPressed()
555 //=================================================================================
556 void GenerationGUI_PrismDlg::LineEditReturnPressed()
558 QLineEdit* send = (QLineEdit*)sender();
559 if (send == GroupPoints->LineEdit1 ||
560 send == GroupPoints->LineEdit2 ||
561 send == GroupPoints2->LineEdit1 ||
562 send == GroupPoints2->LineEdit2 ||
563 send == GroupPoints2->LineEdit3 ||
564 send == GroupPoints3->LineEdit1) {
565 myEditCurrentArgument = send;
566 GEOMBase_Skeleton::LineEditReturnPressed();
570 //=================================================================================
571 // function : ActivateThisDialog()
573 //=================================================================================
574 void GenerationGUI_PrismDlg::ActivateThisDialog()
576 GEOMBase_Skeleton::ActivateThisDialog();
578 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
579 this, SLOT( SelectionIntoArgument() ) );
581 ConstructorsClicked( getConstructorId() );
584 //=================================================================================
585 // function : enterEvent()
586 // purpose : when mouse enter onto the QWidget
587 //=================================================================================
588 void GenerationGUI_PrismDlg::enterEvent (QEvent*)
590 if (!mainFrame()->GroupConstructors->isEnabled())
591 ActivateThisDialog();
594 //=================================================================================
595 // function : ValueChangedInSpinBox()
597 //=================================================================================
598 void GenerationGUI_PrismDlg::ValueChangedInSpinBox()
603 //=================================================================================
604 // function : getHeight()
606 //=================================================================================
607 double GenerationGUI_PrismDlg::getHeight() const
609 return GroupPoints->SpinBox_DX->value();
612 //=================================================================================
613 // function : createOperation
615 //=================================================================================
616 GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation()
618 return getGeomEngine()->GetI3DPrimOperations(getStudyId());
621 //=================================================================================
622 // function : isValid
624 //=================================================================================
625 bool GenerationGUI_PrismDlg::isValid (QString&)
627 if (getConstructorId() == 0)
628 return (myOkBase && myOkVec); // by vector and height
629 else if (getConstructorId() == 1)
630 return (myOkBase && myOkPnt1 && myOkPnt2); // by two points
631 else if (getConstructorId() == 2)
637 //=================================================================================
638 // function : execute
640 //=================================================================================
641 bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
643 GEOM::GEOM_Object_var anObj;
645 switch (getConstructorId()) {
648 anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
649 MakePrismVecH(myBase, myVec, getHeight());
652 anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
653 MakePrismVecH2Ways(myBase, myVec, getHeight());
658 anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
659 MakePrismTwoPnt(myBase, myPoint1, myPoint2);
662 anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
663 MakePrismTwoPnt2Ways(myBase, myPoint1, myPoint2);
667 double dx = GroupPoints3->SpinBox_DX->value();
668 double dy = GroupPoints3->SpinBox_DY->value();
669 double dz = GroupPoints3->SpinBox_DZ->value();
672 anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
673 MakePrismDXDYDZ(myBase, dx, dy, dz);
676 anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
677 MakePrismDXDYDZ2Ways(myBase, dx, dy, dz);
682 if (!anObj->_is_nil())
683 objects.push_back(anObj._retn());
688 //=================================================================================
689 // function : onReverse()
691 //=================================================================================
692 void GenerationGUI_PrismDlg::onReverse()
694 double anOldValue = GroupPoints->SpinBox_DX->value();
695 GroupPoints->SpinBox_DX->setValue(-anOldValue);
698 //=================================================================================
699 // function : onBothway()
701 //=================================================================================
702 void GenerationGUI_PrismDlg::onBothway()
705 switch (getConstructorId()) {
707 anOldValue = myBothway;
708 myBothway = !anOldValue;
709 GroupPoints->CheckButton2->setEnabled(!myBothway);
713 anOldValue = myBothway2;
714 myBothway2 = !anOldValue;
718 anOldValue = myBothway3;
719 myBothway3 = !anOldValue;
725 //=================================================================================
726 // function : addSubshapeToStudy
727 // purpose : virtual method to add new SubObjects if local selection
728 //=================================================================================
729 void GenerationGUI_PrismDlg::addSubshapesToStudy()
731 QMap<QString, GEOM::GEOM_Object_var> objMap;
733 switch (getConstructorId()) {
735 objMap[GroupPoints->LineEdit2->text()] = myVec;
738 objMap[GroupPoints2->LineEdit2->text()] = myPoint1;
739 objMap[GroupPoints2->LineEdit3->text()] = myPoint2;
742 addSubshapesToFather(objMap);