1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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 // GEOM GEOMGUI : GUI for Geometry component
23 // File : GenerationGUI_PrismDlg.cxx
24 // 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>
44 #include <Precision.hxx>
46 #include <GEOMImpl_Types.hxx>
48 //=================================================================================
49 // class : GenerationGUI_PrismDlg()
50 // purpose : Constructs a GenerationGUI_PrismDlg which is a child of 'parent', with the
51 // name 'name' and widget flags set to 'f'.
52 // The dialog will by default be modeless, unless you set 'modal' to
53 // TRUE to construct a modal dialog.
54 //=================================================================================
55 GenerationGUI_PrismDlg::GenerationGUI_PrismDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
56 bool modal, Qt::WindowFlags fl)
57 : 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);
75 GroupVecH = new DlgRef_2Sel2Spin3Check(centralWidget());
76 GroupVecH->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV"));
77 GroupVecH->TextLabel1->setText(tr("GEOM_BASE"));
78 GroupVecH->TextLabel2->setText(tr("GEOM_VECTOR"));
79 GroupVecH->TextLabel3->setText(tr("GEOM_HEIGHT"));
80 GroupVecH->TextLabel4->setText(tr("GEOM_SCALE_FACTOR"));
81 GroupVecH->PushButton1->setIcon(image1);
82 GroupVecH->PushButton2->setIcon(image1);
83 GroupVecH->LineEdit1->setReadOnly(true);
84 GroupVecH->LineEdit2->setReadOnly(true);
85 GroupVecH->CheckBox1->setText(tr("GEOM_BOTHWAY"));
86 GroupVecH->CheckBox2->setText(tr("GEOM_REVERSE"));
87 GroupVecH->CheckBox3->setText(tr("GEOM_SCALE_PRISM"));
89 Group2Points = new DlgRef_3Sel3Spin2Check(centralWidget());
90 Group2Points->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV_2P"));
91 Group2Points->TextLabel1->setText(tr("GEOM_BASE"));
92 Group2Points->TextLabel2->setText(tr("GEOM_POINT_I").arg(1));
93 Group2Points->TextLabel3->setText(tr("GEOM_POINT_I").arg(2));
94 Group2Points->TextLabel4->setText(tr("GEOM_SCALE_FACTOR"));
95 Group2Points->PushButton1->setIcon(image1);
96 Group2Points->PushButton2->setIcon(image1);
97 Group2Points->PushButton3->setIcon(image1);
98 Group2Points->CheckBox1->setText(tr("GEOM_BOTHWAY"));
99 Group2Points->CheckBox2->setText(tr("GEOM_SCALE_PRISM"));
101 GroupDXDYDZ = new DlgRef_1Sel4Spin2Check(centralWidget());
102 GroupDXDYDZ->GroupBox1->setTitle(tr("GEOM_EXTRUSION_DXDYDZ"));
103 GroupDXDYDZ->TextLabel1->setText(tr("GEOM_BASE"));
104 GroupDXDYDZ->PushButton1->setIcon(image1);
105 GroupDXDYDZ->TextLabel2->setText(tr("GEOM_DX"));
106 GroupDXDYDZ->TextLabel3->setText(tr("GEOM_DY"));
107 GroupDXDYDZ->TextLabel4->setText(tr("GEOM_DZ"));
108 GroupDXDYDZ->TextLabel5->setText(tr("GEOM_SCALE_FACTOR"));
109 GroupDXDYDZ->CheckBox1->setText(tr("GEOM_BOTHWAY"));
110 GroupDXDYDZ->CheckBox2->setText(tr("GEOM_SCALE_PRISM"));
112 QVBoxLayout* layout = new QVBoxLayout(centralWidget());
113 layout->setMargin(0); layout->setSpacing(6);
114 layout->addWidget(GroupVecH);
115 layout->addWidget(Group2Points);
116 layout->addWidget(GroupDXDYDZ);
117 /***************************************************************/
119 setHelpFileName("create_extrusion_page.html");
124 //=================================================================================
125 // function : ~GenerationGUI_PrismDlg()
126 // purpose : Destroys the object and frees any allocated resources
127 //=================================================================================
128 GenerationGUI_PrismDlg::~GenerationGUI_PrismDlg()
130 // no need to delete child widgets, Qt does it all for us
133 //=================================================================================
136 //=================================================================================
137 void GenerationGUI_PrismDlg::Init()
139 // Get setting of step value from file configuration
140 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
141 double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
143 // min, max, step and decimals for spin boxes & initial values
144 double aScaleFactor = 2.0;
145 double aScaleStep = 0.5;
146 double aScaleMin = Precision::Confusion() * 10.0;
148 initSpinBox(GroupVecH->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
149 GroupVecH->SpinBox_DX->setValue(100.0);
151 initSpinBox(GroupDXDYDZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
152 initSpinBox(GroupDXDYDZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
153 initSpinBox(GroupDXDYDZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
154 GroupDXDYDZ->SpinBox_DX->setValue(0.0);
155 GroupDXDYDZ->SpinBox_DY->setValue(0.0);
156 GroupDXDYDZ->SpinBox_DZ->setValue(0.0);
158 initSpinBox(GroupVecH->SpinBox_DY, aScaleMin, COORD_MAX, aScaleStep, "parametric_precision" );
159 initSpinBox(Group2Points->SpinBox1, aScaleMin, COORD_MAX, aScaleStep, "parametric_precision" );
160 initSpinBox(GroupDXDYDZ->SpinBox_SC, aScaleMin, COORD_MAX, aScaleStep, "parametric_precision" );
162 GroupVecH->SpinBox_DY->setValue(aScaleFactor);
163 Group2Points->SpinBox1->setValue(aScaleFactor);
164 GroupDXDYDZ->SpinBox_SC->setValue(aScaleFactor);
166 // hide not used controls
167 Group2Points->TextLabel5->hide();
168 Group2Points->TextLabel6->hide();
170 Group2Points->SpinBox2->hide();
171 Group2Points->SpinBox3->hide();
174 myEditCurrentArgument = GroupVecH->LineEdit1;
175 GroupVecH->LineEdit1->setReadOnly(true);
176 GroupVecH->LineEdit2->setReadOnly(true);
178 Group2Points->LineEdit1->setReadOnly(true);
179 Group2Points->LineEdit2->setReadOnly(true);
180 Group2Points->LineEdit3->setReadOnly(true);
182 GroupDXDYDZ->LineEdit1->setReadOnly(true);
184 GroupVecH->LineEdit1->setText("");
185 GroupVecH->LineEdit2->setText("");
187 Group2Points->LineEdit1->setText("");
188 Group2Points->LineEdit2->setText("");
189 Group2Points->LineEdit3->setText("");
191 GroupDXDYDZ->LineEdit1->setText("");
193 myBaseObjects.clear();
198 showOnlyPreviewControl();
200 // signals and slots connections
201 connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
202 connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
204 connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
206 connect(GroupVecH->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
207 connect(GroupVecH->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
209 connect(GroupVecH->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
210 connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
212 connect(GroupVecH->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
213 connect(GroupVecH->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
214 connect(GroupVecH->CheckBox3, SIGNAL(toggled(bool)), this, SLOT(onScalePrism()));
215 connect(GroupVecH->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
217 connect(Group2Points->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
218 connect(Group2Points->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
219 connect(Group2Points->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
220 connect(Group2Points->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
221 connect(Group2Points->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onScalePrism()));
222 connect(Group2Points->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
224 connect(GroupDXDYDZ->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
225 connect(GroupDXDYDZ->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
226 connect(GroupDXDYDZ->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
227 connect(GroupDXDYDZ->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
228 connect(GroupDXDYDZ->SpinBox_SC, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
229 connect(GroupDXDYDZ->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
230 connect(GroupDXDYDZ->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onScalePrism()));
232 initName(tr("GEOM_EXTRUSION"));
234 ConstructorsClicked(0);
238 //=================================================================================
239 // function : SetDoubleSpinBoxStep()
240 // purpose : Double spin box management
241 //=================================================================================
242 void GenerationGUI_PrismDlg::SetDoubleSpinBoxStep (double step)
244 GroupVecH->SpinBox_DX->setSingleStep(step);
245 GroupDXDYDZ->SpinBox_DX->setSingleStep(step);
246 GroupDXDYDZ->SpinBox_DY->setSingleStep(step);
247 GroupDXDYDZ->SpinBox_DZ->setSingleStep(step);
250 //=================================================================================
251 // function : ConstructorsClicked()
252 // purpose : Radio button management
253 //=================================================================================
254 void GenerationGUI_PrismDlg::ConstructorsClicked (int constructorId)
256 switch (constructorId) {
258 Group2Points->hide();
262 GroupVecH->LineEdit2->setText("");
265 GroupVecH->PushButton1->click();
269 Group2Points->show();
272 Group2Points->LineEdit2->setText("");
273 Group2Points->LineEdit3->setText("");
277 Group2Points->PushButton1->click();
281 Group2Points->hide();
284 GroupDXDYDZ->PushButton1->click();
290 qApp->processEvents();
292 resize(minimumSizeHint());
294 SelectionIntoArgument();
298 //=================================================================================
299 // function : ClickOnOk()
301 //=================================================================================
302 void GenerationGUI_PrismDlg::ClickOnOk()
304 setIsApplyAndClose( true );
309 //=================================================================================
310 // function : ClickOnApply()
312 //=================================================================================
313 bool GenerationGUI_PrismDlg::ClickOnApply()
319 // activate selection and connect selection manager
320 ConstructorsClicked(getConstructorId());
324 //=================================================================================
325 // function : SelectionIntoArgument()
326 // purpose : Called when selection is changed or on dialog initialization or activation
327 //=================================================================================
328 void GenerationGUI_PrismDlg::SelectionIntoArgument()
331 myEditCurrentArgument->setText("");
333 if ( myEditCurrentArgument == GroupVecH->LineEdit1 ||
334 myEditCurrentArgument == Group2Points->LineEdit1 ||
335 myEditCurrentArgument == GroupDXDYDZ->LineEdit1 ) {
336 myBaseObjects.clear();
337 QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
338 for ( int i = 0; i < objects.count(); i++ ) {
339 GEOM::shape_type stype = objects[i]->GetMaxShapeType();
340 if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
342 myBaseObjects << objects[i];
344 if ( !myBaseObjects.isEmpty() ) {
345 QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() );
346 GroupVecH->LineEdit1->setText( aName );
347 Group2Points->LineEdit1->setText( aName );
348 GroupDXDYDZ->LineEdit1->setText( aName );
351 GroupVecH->LineEdit1->setText( "" );
352 Group2Points->LineEdit1->setText( "" );
353 GroupDXDYDZ->LineEdit1->setText( "" );
356 else if ( myEditCurrentArgument == GroupVecH->LineEdit2 ) {
357 myVec = getSelected( TopAbs_EDGE );
359 QString aName = GEOMBase::GetName( myVec.get() );
360 myEditCurrentArgument->setText( aName );
361 if ( myBaseObjects.isEmpty() )
362 GroupVecH->PushButton1->click();
365 if ( myEditCurrentArgument == Group2Points->LineEdit2 ) {
366 myPoint1 = getSelected( TopAbs_VERTEX );
368 QString aName = GEOMBase::GetName( myPoint1.get() );
369 myEditCurrentArgument->setText( aName );
371 Group2Points->PushButton3->click();
372 else if ( myBaseObjects.isEmpty() )
373 Group2Points->PushButton1->click();
376 if ( myEditCurrentArgument == Group2Points->LineEdit3 ) {
377 myPoint2 = getSelected( TopAbs_VERTEX );
379 QString aName = GEOMBase::GetName( myPoint2.get() );
380 myEditCurrentArgument->setText( aName );
381 if ( myBaseObjects.isEmpty() )
382 Group2Points->PushButton1->click();
383 else if ( !myPoint1 )
384 Group2Points->PushButton2->click();
391 //=================================================================================
392 // function : SetEditCurrentArgument()
394 //=================================================================================
395 void GenerationGUI_PrismDlg::SetEditCurrentArgument()
397 QPushButton* send = (QPushButton*)sender();
399 disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
400 globalSelection(GEOM_ALLSHAPES);
401 if (send == GroupVecH->PushButton1) {
402 myEditCurrentArgument = GroupVecH->LineEdit1;
403 GroupVecH->PushButton2->setDown(false);
404 GroupVecH->LineEdit2->setEnabled(false);
406 else if (send == GroupVecH->PushButton2) {
407 myEditCurrentArgument = GroupVecH->LineEdit2;
408 GroupVecH->PushButton1->setDown(false);
409 GroupVecH->LineEdit1->setEnabled(false);
410 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
412 else if (send == Group2Points->PushButton1) {
413 myEditCurrentArgument = Group2Points->LineEdit1;
414 Group2Points->PushButton2->setDown(false);
415 Group2Points->PushButton3->setDown(false);
416 Group2Points->LineEdit2->setEnabled(false);
417 Group2Points->LineEdit3->setEnabled(false);
419 else if (send == Group2Points->PushButton2) {
420 myEditCurrentArgument = Group2Points->LineEdit2;
421 Group2Points->PushButton1->setDown(false);
422 Group2Points->PushButton3->setDown(false);
423 Group2Points->LineEdit1->setEnabled(false);
424 Group2Points->LineEdit3->setEnabled(false);
425 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
427 else if (send == Group2Points->PushButton3) {
428 myEditCurrentArgument = Group2Points->LineEdit3;
429 Group2Points->PushButton1->setDown(false);
430 Group2Points->PushButton2->setDown(false);
431 Group2Points->LineEdit1->setEnabled(false);
432 Group2Points->LineEdit2->setEnabled(false);
433 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
435 else if (send == GroupDXDYDZ->PushButton1) {
436 myEditCurrentArgument = GroupDXDYDZ->LineEdit1;
438 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
439 this, SLOT(SelectionIntoArgument()));
442 myEditCurrentArgument->setEnabled(true);
443 myEditCurrentArgument->setFocus();
444 // after setFocus(), because it will be setDown(false) when loses focus
447 // seems we need it only to avoid preview disappearing, caused by selection mode change
451 //=================================================================================
452 // function : ActivateThisDialog()
454 //=================================================================================
455 void GenerationGUI_PrismDlg::ActivateThisDialog()
457 GEOMBase_Skeleton::ActivateThisDialog();
459 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
460 this, SLOT( SelectionIntoArgument() ) );
462 ConstructorsClicked( getConstructorId() );
465 //=================================================================================
466 // function : enterEvent()
467 // purpose : when mouse enter onto the QWidget
468 //=================================================================================
469 void GenerationGUI_PrismDlg::enterEvent (QEvent*)
471 if (!mainFrame()->GroupConstructors->isEnabled())
472 ActivateThisDialog();
475 //=================================================================================
476 // function : ValueChangedInSpinBox()
478 //=================================================================================
479 void GenerationGUI_PrismDlg::ValueChangedInSpinBox()
484 //=================================================================================
485 // function : createOperation
487 //=================================================================================
488 GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation()
490 return getGeomEngine()->GetI3DPrimOperations(getStudyId());
493 //=================================================================================
494 // function : isValid
496 //=================================================================================
497 bool GenerationGUI_PrismDlg::isValid (QString& msg)
500 switch ( getConstructorId() ) {
502 ok = GroupVecH->SpinBox_DX->isValid( msg, !IsPreview() ) &&
503 !myBaseObjects.isEmpty() && myVec;
506 ok = !myBaseObjects.isEmpty() && myPoint1 && myPoint2;
509 ok = GroupDXDYDZ->SpinBox_DX->isValid( msg, !IsPreview() ) &&
510 GroupDXDYDZ->SpinBox_DY->isValid( msg, !IsPreview() ) &&
511 GroupDXDYDZ->SpinBox_DZ->isValid( msg, !IsPreview() ) &&
512 !myBaseObjects.isEmpty();
521 //=================================================================================
522 // function : onReverse()
524 //=================================================================================
525 void GenerationGUI_PrismDlg::onReverse()
527 double anOldValue = GroupVecH->SpinBox_DX->value();
528 GroupVecH->SpinBox_DX->setValue(-anOldValue);
531 //=================================================================================
532 // function : onBothway()
534 //=================================================================================
535 void GenerationGUI_PrismDlg::onBothway()
537 GroupVecH->CheckBox2->setEnabled(!GroupVecH->CheckBox1->isChecked()); // is reversed
538 GroupVecH->CheckBox3->setEnabled(!GroupVecH->CheckBox1->isChecked()); // is scaled
539 GroupVecH->TextLabel4->setEnabled(!GroupVecH->CheckBox1->isChecked() &&
540 GroupVecH->CheckBox3->isChecked()); // scale factor
541 GroupVecH->SpinBox_DY->setEnabled(!GroupVecH->CheckBox1->isChecked() &&
542 GroupVecH->CheckBox3->isChecked()); // scale factor
544 Group2Points->CheckBox2->setEnabled(!Group2Points->CheckBox1->isChecked()); // is scaled
545 Group2Points->TextLabel4->setEnabled(!Group2Points->CheckBox1->isChecked() &&
546 Group2Points->CheckBox2->isChecked()); // scale factor
547 Group2Points->SpinBox1->setEnabled(!Group2Points->CheckBox1->isChecked() &&
548 Group2Points->CheckBox2->isChecked()); // scale factor
550 GroupDXDYDZ->CheckBox2->setEnabled(!GroupDXDYDZ->CheckBox1->isChecked()); // is scaled
551 GroupDXDYDZ->TextLabel5->setEnabled(!GroupDXDYDZ->CheckBox1->isChecked() &&
552 GroupDXDYDZ->CheckBox2->isChecked()); // scale factor
553 GroupDXDYDZ->SpinBox_SC->setEnabled(!GroupDXDYDZ->CheckBox1->isChecked() &&
554 GroupDXDYDZ->CheckBox2->isChecked()); // scale factor
559 //=================================================================================
560 // function : onScalePrism()
562 //=================================================================================
563 void GenerationGUI_PrismDlg::onScalePrism()
565 GroupVecH->TextLabel4->setEnabled(GroupVecH->CheckBox3->isChecked());
566 GroupVecH->SpinBox_DY->setEnabled(GroupVecH->CheckBox3->isChecked());
568 Group2Points->TextLabel4->setEnabled(Group2Points->CheckBox2->isChecked());
569 Group2Points->SpinBox1->setEnabled(Group2Points->CheckBox2->isChecked());
571 GroupDXDYDZ->TextLabel5->setEnabled(GroupDXDYDZ->CheckBox2->isChecked());
572 GroupDXDYDZ->SpinBox_SC->setEnabled(GroupDXDYDZ->CheckBox2->isChecked());
577 //=================================================================================
578 // function : execute
580 //=================================================================================
581 bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
583 QStringList aParameters;
584 GEOM::GEOM_Object_var anObj;
586 GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
588 for (int i = 0; i < myBaseObjects.count(); i++) {
589 switch (getConstructorId()) {
591 if (GroupVecH->CheckBox1->isChecked())
592 anObj = anOper->MakePrismVecH2Ways(myBaseObjects[i].get(), myVec.get(),
593 GroupVecH->SpinBox_DX->value());
595 if (GroupVecH->CheckBox3->isChecked())
596 anObj = anOper->MakePrismVecHWithScaling(myBaseObjects[i].get(), myVec.get(),
597 GroupVecH->SpinBox_DX->value(),
598 GroupVecH->SpinBox_DY->value());
600 anObj = anOper->MakePrismVecH(myBaseObjects[i].get(), myVec.get(),
601 GroupVecH->SpinBox_DX->value());
604 if (!anObj->_is_nil() && !IsPreview()) {
605 aParameters << GroupVecH->SpinBox_DX->text();
606 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
610 if (Group2Points->CheckBox1->isChecked())
611 anObj = anOper->MakePrismTwoPnt2Ways(myBaseObjects[i].get(), myPoint1.get(), myPoint2.get());
613 if (Group2Points->CheckBox2->isChecked())
614 anObj = anOper->MakePrismTwoPntWithScaling(myBaseObjects[i].get(), myPoint1.get(),
615 myPoint2.get(), Group2Points->SpinBox1->value());
617 anObj = anOper->MakePrismTwoPnt(myBaseObjects[i].get(), myPoint1.get(), myPoint2.get());
621 double dx = GroupDXDYDZ->SpinBox_DX->value();
622 double dy = GroupDXDYDZ->SpinBox_DY->value();
623 double dz = GroupDXDYDZ->SpinBox_DZ->value();
625 if (GroupDXDYDZ->CheckBox1->isChecked())
626 anObj = anOper->MakePrismDXDYDZ2Ways(myBaseObjects[i].get(), dx, dy, dz);
628 if (GroupDXDYDZ->CheckBox2->isChecked())
629 anObj = anOper->MakePrismDXDYDZWithScaling(myBaseObjects[i].get(), dx, dy, dz,
630 GroupDXDYDZ->SpinBox_SC->value());
632 anObj = anOper->MakePrismDXDYDZ(myBaseObjects[i].get(), dx, dy, dz);
635 if (!anObj->_is_nil() && !IsPreview()) {
636 aParameters << GroupDXDYDZ->SpinBox_DX->text();
637 aParameters << GroupDXDYDZ->SpinBox_DY->text();
638 aParameters << GroupDXDYDZ->SpinBox_DZ->text();
639 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
644 if (!anObj->_is_nil())
645 objects.push_back(anObj._retn());
651 //=================================================================================
652 // function : addSubshapeToStudy
653 // purpose : virtual method to add new SubObjects if local selection
654 //=================================================================================
655 void GenerationGUI_PrismDlg::addSubshapesToStudy()
657 switch (getConstructorId()) {
659 GEOMBase::PublishSubObject( myVec.get() );
662 GEOMBase::PublishSubObject( myPoint1.get() );
663 GEOMBase::PublishSubObject( myPoint2.get() );
670 //=================================================================================
671 // function : extractPrefix
672 // purpose : redefined from GEOMBase_Helper class
673 //=================================================================================
674 bool GenerationGUI_PrismDlg::extractPrefix() const
676 return myBaseObjects.count() > 1;