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>
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)
58 SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
59 QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM")));
60 QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
61 QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM_2P")));
62 QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM_DXDYDZ")));
64 setWindowTitle(tr("GEOM_EXTRUSION_TITLE"));
66 /***************************************************************/
67 mainFrame()->GroupConstructors->setTitle(tr("GEOM_EXTRUSION"));
68 mainFrame()->RadioButton1->setIcon(image0);
69 mainFrame()->RadioButton2->setIcon(image2);
70 mainFrame()->RadioButton3->setIcon(image3);
72 mainFrame()->RadioButton1->setChecked(true);
74 GroupVecH = new DlgRef_2Sel2Spin3Check(centralWidget());
75 GroupVecH->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV"));
76 GroupVecH->TextLabel1->setText(tr("GEOM_BASE"));
77 GroupVecH->TextLabel2->setText(tr("GEOM_VECTOR"));
78 GroupVecH->TextLabel3->setText(tr("GEOM_HEIGHT"));
79 GroupVecH->TextLabel4->setText(tr("GEOM_SCALE_FACTOR"));
80 GroupVecH->PushButton1->setIcon(image1);
81 GroupVecH->PushButton2->setIcon(image1);
82 GroupVecH->LineEdit1->setReadOnly(true);
83 GroupVecH->LineEdit2->setReadOnly(true);
84 GroupVecH->CheckBox1->setText(tr("GEOM_BOTHWAY"));
85 GroupVecH->CheckBox2->setText(tr("GEOM_REVERSE"));
86 GroupVecH->CheckBox3->setText(tr("GEOM_SCALE_PRISM"));
88 Group2Points = new DlgRef_3Sel3Spin2Check(centralWidget());
89 Group2Points->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV_2P"));
90 Group2Points->TextLabel1->setText(tr("GEOM_BASE"));
91 Group2Points->TextLabel2->setText(tr("GEOM_POINT_I").arg(1));
92 Group2Points->TextLabel3->setText(tr("GEOM_POINT_I").arg(2));
93 Group2Points->TextLabel4->setText(tr("GEOM_SCALE_FACTOR"));
94 Group2Points->PushButton1->setIcon(image1);
95 Group2Points->PushButton2->setIcon(image1);
96 Group2Points->PushButton3->setIcon(image1);
97 Group2Points->CheckBox1->setText(tr("GEOM_BOTHWAY"));
98 Group2Points->CheckBox2->setText(tr("GEOM_SCALE_PRISM"));
100 GroupDXDYDZ = new DlgRef_1Sel4Spin2Check(centralWidget());
101 GroupDXDYDZ->GroupBox1->setTitle(tr("GEOM_EXTRUSION_DXDYDZ"));
102 GroupDXDYDZ->TextLabel1->setText(tr("GEOM_BASE"));
103 GroupDXDYDZ->PushButton1->setIcon(image1);
104 GroupDXDYDZ->TextLabel2->setText(tr("GEOM_DX"));
105 GroupDXDYDZ->TextLabel3->setText(tr("GEOM_DY"));
106 GroupDXDYDZ->TextLabel4->setText(tr("GEOM_DZ"));
107 GroupDXDYDZ->TextLabel5->setText(tr("GEOM_SCALE_FACTOR"));
108 GroupDXDYDZ->CheckBox1->setText(tr("GEOM_BOTHWAY"));
109 GroupDXDYDZ->CheckBox2->setText(tr("GEOM_SCALE_PRISM"));
111 QVBoxLayout* layout = new QVBoxLayout(centralWidget());
112 layout->setMargin(0); layout->setSpacing(6);
113 layout->addWidget(GroupVecH);
114 layout->addWidget(Group2Points);
115 layout->addWidget(GroupDXDYDZ);
116 /***************************************************************/
118 setHelpFileName("create_extrusion_page.html");
123 //=================================================================================
124 // function : ~GenerationGUI_PrismDlg()
125 // purpose : Destroys the object and frees any allocated resources
126 //=================================================================================
127 GenerationGUI_PrismDlg::~GenerationGUI_PrismDlg()
129 // no need to delete child widgets, Qt does it all for us
132 //=================================================================================
135 //=================================================================================
136 void GenerationGUI_PrismDlg::Init()
138 // Get setting of step value from file configuration
139 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
140 double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
142 // min, max, step and decimals for spin boxes & initial values
143 double aScaleFactor = 2.0;
144 double aScaleStep = 0.5;
146 initSpinBox(GroupVecH->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
147 GroupVecH->SpinBox_DX->setValue(100.0);
149 initSpinBox(GroupDXDYDZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
150 initSpinBox(GroupDXDYDZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
151 initSpinBox(GroupDXDYDZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
152 GroupDXDYDZ->SpinBox_DX->setValue(0.0);
153 GroupDXDYDZ->SpinBox_DY->setValue(0.0);
154 GroupDXDYDZ->SpinBox_DZ->setValue(0.0);
156 initSpinBox(GroupVecH->SpinBox_DY, 0.0, COORD_MAX, aScaleStep, "parametric_precision" );
157 initSpinBox(Group2Points->SpinBox1, 0.0, COORD_MAX, aScaleStep, "parametric_precision" );
158 initSpinBox(GroupDXDYDZ->SpinBox_SC, 0.0, COORD_MAX, aScaleStep, "parametric_precision" );
160 GroupVecH->SpinBox_DY->setValue(aScaleFactor);
161 Group2Points->SpinBox1->setValue(aScaleFactor);
162 GroupDXDYDZ->SpinBox_SC->setValue(aScaleFactor);
164 // hide not used controls
165 Group2Points->TextLabel5->hide();
166 Group2Points->TextLabel6->hide();
168 Group2Points->SpinBox2->hide();
169 Group2Points->SpinBox3->hide();
172 myEditCurrentArgument = GroupVecH->LineEdit1;
173 GroupVecH->LineEdit1->setReadOnly(true);
174 GroupVecH->LineEdit2->setReadOnly(true);
176 Group2Points->LineEdit1->setReadOnly(true);
177 Group2Points->LineEdit2->setReadOnly(true);
178 Group2Points->LineEdit3->setReadOnly(true);
180 GroupDXDYDZ->LineEdit1->setReadOnly(true);
182 GroupVecH->LineEdit1->setText("");
183 GroupVecH->LineEdit2->setText("");
185 Group2Points->LineEdit1->setText("");
186 Group2Points->LineEdit2->setText("");
187 Group2Points->LineEdit3->setText("");
189 GroupDXDYDZ->LineEdit1->setText("");
191 myBaseObjects.clear();
196 // signals and slots connections
197 connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
198 connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
200 connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
202 connect(GroupVecH->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
203 connect(GroupVecH->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
205 connect(GroupVecH->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
206 connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
208 connect(GroupVecH->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
209 connect(GroupVecH->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
210 connect(GroupVecH->CheckBox3, SIGNAL(toggled(bool)), this, SLOT(onScalePrism()));
211 connect(GroupVecH->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
213 connect(Group2Points->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
214 connect(Group2Points->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
215 connect(Group2Points->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
216 connect(Group2Points->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
217 connect(Group2Points->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onScalePrism()));
218 connect(Group2Points->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
220 connect(GroupDXDYDZ->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
221 connect(GroupDXDYDZ->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
222 connect(GroupDXDYDZ->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
223 connect(GroupDXDYDZ->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
224 connect(GroupDXDYDZ->SpinBox_SC, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
225 connect(GroupDXDYDZ->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
226 connect(GroupDXDYDZ->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onScalePrism()));
228 initName(tr("GEOM_EXTRUSION"));
230 ConstructorsClicked(0);
234 //=================================================================================
235 // function : SetDoubleSpinBoxStep()
236 // purpose : Double spin box management
237 //=================================================================================
238 void GenerationGUI_PrismDlg::SetDoubleSpinBoxStep (double step)
240 GroupVecH->SpinBox_DX->setSingleStep(step);
241 GroupDXDYDZ->SpinBox_DX->setSingleStep(step);
242 GroupDXDYDZ->SpinBox_DY->setSingleStep(step);
243 GroupDXDYDZ->SpinBox_DZ->setSingleStep(step);
246 //=================================================================================
247 // function : ConstructorsClicked()
248 // purpose : Radio button management
249 //=================================================================================
250 void GenerationGUI_PrismDlg::ConstructorsClicked (int constructorId)
252 switch (constructorId) {
254 Group2Points->hide();
258 GroupVecH->LineEdit2->setText("");
261 GroupVecH->PushButton1->click();
265 Group2Points->show();
268 Group2Points->LineEdit2->setText("");
269 Group2Points->LineEdit3->setText("");
273 Group2Points->PushButton1->click();
277 Group2Points->hide();
280 GroupDXDYDZ->PushButton1->click();
286 qApp->processEvents();
288 resize(minimumSizeHint());
290 SelectionIntoArgument();
294 //=================================================================================
295 // function : ClickOnOk()
297 //=================================================================================
298 void GenerationGUI_PrismDlg::ClickOnOk()
304 //=================================================================================
305 // function : ClickOnApply()
307 //=================================================================================
308 bool GenerationGUI_PrismDlg::ClickOnApply()
314 // activate selection and connect selection manager
315 ConstructorsClicked(getConstructorId());
319 //=================================================================================
320 // function : SelectionIntoArgument()
321 // purpose : Called when selection is changed or on dialog initialization or activation
322 //=================================================================================
323 void GenerationGUI_PrismDlg::SelectionIntoArgument()
326 myEditCurrentArgument->setText("");
328 if ( myEditCurrentArgument == GroupVecH->LineEdit1 ||
329 myEditCurrentArgument == Group2Points->LineEdit1 ||
330 myEditCurrentArgument == GroupDXDYDZ->LineEdit1 ) {
331 myBaseObjects.clear();
332 QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
333 for ( int i = 0; i < objects.count(); i++ ) {
334 GEOM::shape_type stype = objects[i]->GetMaxShapeType();
335 if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
337 myBaseObjects << objects[i];
339 if ( !myBaseObjects.isEmpty() ) {
340 QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() );
341 GroupVecH->LineEdit1->setText( aName );
342 Group2Points->LineEdit1->setText( aName );
343 GroupDXDYDZ->LineEdit1->setText( aName );
346 GroupVecH->LineEdit1->setText( "" );
347 Group2Points->LineEdit1->setText( "" );
348 GroupDXDYDZ->LineEdit1->setText( "" );
351 else if ( myEditCurrentArgument == GroupVecH->LineEdit2 ) {
352 myVec = getSelected( TopAbs_EDGE );
354 QString aName = GEOMBase::GetName( myVec.get() );
355 myEditCurrentArgument->setText( aName );
356 if ( myBaseObjects.isEmpty() )
357 GroupVecH->PushButton1->click();
360 if ( myEditCurrentArgument == Group2Points->LineEdit2 ) {
361 myPoint1 = getSelected( TopAbs_VERTEX );
363 QString aName = GEOMBase::GetName( myPoint1.get() );
364 myEditCurrentArgument->setText( aName );
366 Group2Points->PushButton3->click();
367 else if ( myBaseObjects.isEmpty() )
368 Group2Points->PushButton1->click();
371 if ( myEditCurrentArgument == Group2Points->LineEdit3 ) {
372 myPoint2 = getSelected( TopAbs_VERTEX );
374 QString aName = GEOMBase::GetName( myPoint2.get() );
375 myEditCurrentArgument->setText( aName );
376 if ( myBaseObjects.isEmpty() )
377 Group2Points->PushButton1->click();
378 else if ( !myPoint1 )
379 Group2Points->PushButton2->click();
386 //=================================================================================
387 // function : SetEditCurrentArgument()
389 //=================================================================================
390 void GenerationGUI_PrismDlg::SetEditCurrentArgument()
392 QPushButton* send = (QPushButton*)sender();
394 disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
395 globalSelection(GEOM_ALLSHAPES);
396 if (send == GroupVecH->PushButton1) {
397 myEditCurrentArgument = GroupVecH->LineEdit1;
398 GroupVecH->PushButton2->setDown(false);
399 GroupVecH->LineEdit2->setEnabled(false);
401 else if (send == GroupVecH->PushButton2) {
402 myEditCurrentArgument = GroupVecH->LineEdit2;
403 GroupVecH->PushButton1->setDown(false);
404 GroupVecH->LineEdit1->setEnabled(false);
405 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
407 else if (send == Group2Points->PushButton1) {
408 myEditCurrentArgument = Group2Points->LineEdit1;
409 Group2Points->PushButton2->setDown(false);
410 Group2Points->PushButton3->setDown(false);
411 Group2Points->LineEdit2->setEnabled(false);
412 Group2Points->LineEdit3->setEnabled(false);
414 else if (send == Group2Points->PushButton2) {
415 myEditCurrentArgument = Group2Points->LineEdit2;
416 Group2Points->PushButton1->setDown(false);
417 Group2Points->PushButton3->setDown(false);
418 Group2Points->LineEdit1->setEnabled(false);
419 Group2Points->LineEdit3->setEnabled(false);
420 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
422 else if (send == Group2Points->PushButton3) {
423 myEditCurrentArgument = Group2Points->LineEdit3;
424 Group2Points->PushButton1->setDown(false);
425 Group2Points->PushButton2->setDown(false);
426 Group2Points->LineEdit1->setEnabled(false);
427 Group2Points->LineEdit2->setEnabled(false);
428 localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
430 else if (send == GroupDXDYDZ->PushButton1) {
431 myEditCurrentArgument = GroupDXDYDZ->LineEdit1;
433 connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
434 this, SLOT(SelectionIntoArgument()));
437 myEditCurrentArgument->setEnabled(true);
438 myEditCurrentArgument->setFocus();
439 // after setFocus(), because it will be setDown(false) when loses focus
442 // seems we need it only to avoid preview disappearing, caused by selection mode change
446 //=================================================================================
447 // function : ActivateThisDialog()
449 //=================================================================================
450 void GenerationGUI_PrismDlg::ActivateThisDialog()
452 GEOMBase_Skeleton::ActivateThisDialog();
454 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
455 this, SLOT( SelectionIntoArgument() ) );
457 ConstructorsClicked( getConstructorId() );
460 //=================================================================================
461 // function : enterEvent()
462 // purpose : when mouse enter onto the QWidget
463 //=================================================================================
464 void GenerationGUI_PrismDlg::enterEvent (QEvent*)
466 if (!mainFrame()->GroupConstructors->isEnabled())
467 ActivateThisDialog();
470 //=================================================================================
471 // function : ValueChangedInSpinBox()
473 //=================================================================================
474 void GenerationGUI_PrismDlg::ValueChangedInSpinBox()
479 //=================================================================================
480 // function : createOperation
482 //=================================================================================
483 GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation()
485 return getGeomEngine()->GetI3DPrimOperations(getStudyId());
488 //=================================================================================
489 // function : isValid
491 //=================================================================================
492 bool GenerationGUI_PrismDlg::isValid (QString& msg)
495 switch ( getConstructorId() ) {
497 ok = GroupVecH->SpinBox_DX->isValid( msg, !IsPreview() ) &&
498 !myBaseObjects.isEmpty() && myVec;
501 ok = !myBaseObjects.isEmpty() && myPoint1 && myPoint2;
504 ok = GroupDXDYDZ->SpinBox_DX->isValid( msg, !IsPreview() ) &&
505 GroupDXDYDZ->SpinBox_DY->isValid( msg, !IsPreview() ) &&
506 GroupDXDYDZ->SpinBox_DZ->isValid( msg, !IsPreview() ) &&
507 !myBaseObjects.isEmpty();
516 //=================================================================================
517 // function : onReverse()
519 //=================================================================================
520 void GenerationGUI_PrismDlg::onReverse()
522 double anOldValue = GroupVecH->SpinBox_DX->value();
523 GroupVecH->SpinBox_DX->setValue(-anOldValue);
526 //=================================================================================
527 // function : onBothway()
529 //=================================================================================
530 void GenerationGUI_PrismDlg::onBothway()
532 GroupVecH->CheckBox2->setEnabled(!GroupVecH->CheckBox1->isChecked()); // is reversed
533 GroupVecH->CheckBox3->setEnabled(!GroupVecH->CheckBox1->isChecked()); // is scaled
534 GroupVecH->TextLabel4->setEnabled(!GroupVecH->CheckBox1->isChecked() &&
535 GroupVecH->CheckBox3->isChecked()); // scale factor
536 GroupVecH->SpinBox_DY->setEnabled(!GroupVecH->CheckBox1->isChecked() &&
537 GroupVecH->CheckBox3->isChecked()); // scale factor
539 Group2Points->CheckBox2->setEnabled(!Group2Points->CheckBox1->isChecked()); // is scaled
540 Group2Points->TextLabel4->setEnabled(!Group2Points->CheckBox1->isChecked() &&
541 Group2Points->CheckBox2->isChecked()); // scale factor
542 Group2Points->SpinBox1->setEnabled(!Group2Points->CheckBox1->isChecked() &&
543 Group2Points->CheckBox2->isChecked()); // scale factor
545 GroupDXDYDZ->CheckBox2->setEnabled(!GroupDXDYDZ->CheckBox1->isChecked()); // is scaled
546 GroupDXDYDZ->TextLabel5->setEnabled(!GroupDXDYDZ->CheckBox1->isChecked() &&
547 GroupDXDYDZ->CheckBox2->isChecked()); // scale factor
548 GroupDXDYDZ->SpinBox_SC->setEnabled(!GroupDXDYDZ->CheckBox1->isChecked() &&
549 GroupDXDYDZ->CheckBox2->isChecked()); // scale factor
554 //=================================================================================
555 // function : onScalePrism()
557 //=================================================================================
558 void GenerationGUI_PrismDlg::onScalePrism()
560 GroupVecH->TextLabel4->setEnabled(GroupVecH->CheckBox3->isChecked());
561 GroupVecH->SpinBox_DY->setEnabled(GroupVecH->CheckBox3->isChecked());
563 Group2Points->TextLabel4->setEnabled(Group2Points->CheckBox2->isChecked());
564 Group2Points->SpinBox1->setEnabled(Group2Points->CheckBox2->isChecked());
566 GroupDXDYDZ->TextLabel5->setEnabled(GroupDXDYDZ->CheckBox2->isChecked());
567 GroupDXDYDZ->SpinBox_SC->setEnabled(GroupDXDYDZ->CheckBox2->isChecked());
572 //=================================================================================
573 // function : execute
575 //=================================================================================
576 bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
578 QStringList aParameters;
579 GEOM::GEOM_Object_var anObj;
581 GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
583 for (int i = 0; i < myBaseObjects.count(); i++) {
584 switch (getConstructorId()) {
586 if (GroupVecH->CheckBox1->isChecked())
587 anObj = anOper->MakePrismVecH2Ways(myBaseObjects[i].get(), myVec.get(),
588 GroupVecH->SpinBox_DX->value());
590 if (GroupVecH->CheckBox3->isChecked())
591 anObj = anOper->MakePrismVecHWithScaling(myBaseObjects[i].get(), myVec.get(),
592 GroupVecH->SpinBox_DX->value(),
593 GroupVecH->SpinBox_DY->value());
595 anObj = anOper->MakePrismVecH(myBaseObjects[i].get(), myVec.get(),
596 GroupVecH->SpinBox_DX->value());
599 if (!anObj->_is_nil() && !IsPreview()) {
600 aParameters << GroupVecH->SpinBox_DX->text();
601 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
605 if (Group2Points->CheckBox1->isChecked())
606 anObj = anOper->MakePrismTwoPnt2Ways(myBaseObjects[i].get(), myPoint1.get(), myPoint2.get());
608 if (Group2Points->CheckBox2->isChecked())
609 anObj = anOper->MakePrismTwoPntWithScaling(myBaseObjects[i].get(), myPoint1.get(),
610 myPoint2.get(), Group2Points->SpinBox1->value());
612 anObj = anOper->MakePrismTwoPnt(myBaseObjects[i].get(), myPoint1.get(), myPoint2.get());
616 double dx = GroupDXDYDZ->SpinBox_DX->value();
617 double dy = GroupDXDYDZ->SpinBox_DY->value();
618 double dz = GroupDXDYDZ->SpinBox_DZ->value();
620 if (GroupDXDYDZ->CheckBox1->isChecked())
621 anObj = anOper->MakePrismDXDYDZ2Ways(myBaseObjects[i].get(), dx, dy, dz);
623 if (GroupDXDYDZ->CheckBox2->isChecked())
624 anObj = anOper->MakePrismDXDYDZWithScaling(myBaseObjects[i].get(), dx, dy, dz,
625 GroupDXDYDZ->SpinBox_SC->value());
627 anObj = anOper->MakePrismDXDYDZ(myBaseObjects[i].get(), dx, dy, dz);
630 if (!anObj->_is_nil() && !IsPreview()) {
631 aParameters << GroupDXDYDZ->SpinBox_DX->text();
632 aParameters << GroupDXDYDZ->SpinBox_DY->text();
633 aParameters << GroupDXDYDZ->SpinBox_DZ->text();
634 anObj->SetParameters(aParameters.join(":").toLatin1().constData());
639 if (!anObj->_is_nil())
640 objects.push_back(anObj._retn());
646 //=================================================================================
647 // function : addSubshapeToStudy
648 // purpose : virtual method to add new SubObjects if local selection
649 //=================================================================================
650 void GenerationGUI_PrismDlg::addSubshapesToStudy()
652 switch (getConstructorId()) {
654 GEOMBase::PublishSubObject( myVec.get() );
657 GEOMBase::PublishSubObject( myPoint1.get() );
658 GEOMBase::PublishSubObject( myPoint2.get() );
665 //=================================================================================
666 // function : extractPrefix
667 // purpose : redefined from GEOMBase_Helper class
668 //=================================================================================
669 bool GenerationGUI_PrismDlg::extractPrefix() const
671 return myBaseObjects.count() > 1;