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_ResourceMgr.h>
33 #include <SUIT_Session.h>
34 #include <SalomeApp_Application.h>
35 #include <LightApp_SelectionMgr.h>
37 #include <TopoDS_Shape.hxx>
38 #include <TopoDS_Edge.hxx>
41 #include <TColStd_IndexedMapOfInteger.hxx>
42 #include <TopTools_IndexedMapOfShape.hxx>
44 #include <GEOMImpl_Types.hxx>
46 //=================================================================================
47 // class : GenerationGUI_PrismDlg()
48 // purpose : Constructs a GenerationGUI_PrismDlg which is a child of 'parent', with the
49 // name 'name' and widget flags set to 'f'.
50 // The dialog will by default be modeless, unless you set 'modal' to
51 // TRUE to construct a modal dialog.
52 //=================================================================================
53 GenerationGUI_PrismDlg::GenerationGUI_PrismDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
54 bool modal, Qt::WindowFlags fl )
55 : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
57 SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
58 QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PRISM" ) ) );
59 QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
60 QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PRISM_2P" ) ) );
61 QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PRISM_DXDYDZ" ) ) );
63 setWindowTitle( tr( "GEOM_EXTRUSION_TITLE" ) );
65 /***************************************************************/
66 mainFrame()->GroupConstructors->setTitle( tr( "GEOM_EXTRUSION" ) );
67 mainFrame()->RadioButton1->setIcon( image0 );
68 mainFrame()->RadioButton2->setIcon( image2 );
69 mainFrame()->RadioButton3->setIcon( image3 );
71 mainFrame()->RadioButton1->setChecked( true );
72 myBothway = myBothway2 = myBothway3 = false;
74 GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() );
75 GroupPoints->GroupBox1->setTitle( tr( "GEOM_EXTRUSION_BSV" ) );
76 GroupPoints->TextLabel1->setText( tr( "GEOM_BASE" ) );
77 GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
78 GroupPoints->TextLabel3->setText( tr( "GEOM_HEIGHT" ) );
79 GroupPoints->PushButton1->setIcon( image1 );
80 GroupPoints->PushButton2->setIcon( image1 );
81 GroupPoints->LineEdit1->setReadOnly( true );
82 GroupPoints->LineEdit2->setReadOnly( true );
83 GroupPoints->CheckButton1->setText( tr( "GEOM_BOTHWAY" ) );
84 GroupPoints->CheckButton1->setChecked( myBothway );
85 GroupPoints->CheckButton2->setText( tr( "GEOM_REVERSE" ) );
87 GroupPoints2 = new DlgRef_3Sel1Check( centralWidget() );
88 GroupPoints2->GroupBox1->setTitle( tr( "GEOM_EXTRUSION_BSV_2P" ) );
89 GroupPoints2->TextLabel1->setText( tr( "GEOM_BASE" ) );
90 GroupPoints2->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
91 GroupPoints2->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
92 GroupPoints2->PushButton1->setIcon( image1 );
93 GroupPoints2->PushButton2->setIcon( image1 );
94 GroupPoints2->PushButton3->setIcon( image1 );
95 GroupPoints2->CheckButton1->setText( tr( "GEOM_BOTHWAY" ) );
96 GroupPoints2->CheckButton1->setChecked( myBothway2 );
98 GroupPoints3 = new DlgRef_1Sel3Spin1Check( centralWidget() );
99 GroupPoints3->GroupBox1->setTitle(tr("GEOM_EXTRUSION_DXDYDZ"));
100 GroupPoints3->TextLabel1->setText(tr("GEOM_BASE"));
101 GroupPoints3->PushButton1->setIcon(image1);
102 GroupPoints3->TextLabel2->setText(tr("GEOM_DX"));
103 GroupPoints3->TextLabel3->setText(tr("GEOM_DY"));
104 GroupPoints3->TextLabel4->setText(tr("GEOM_DZ"));
105 GroupPoints3->CheckButton1->setText( tr( "GEOM_BOTHWAY" ) );
106 GroupPoints3->CheckButton1->setChecked( myBothway3 );
108 QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
109 layout->setMargin( 0 ); layout->setSpacing( 6 );
110 layout->addWidget( GroupPoints );
111 layout->addWidget( GroupPoints2 );
112 layout->addWidget( GroupPoints3);
113 /***************************************************************/
115 setHelpFileName( "create_extrusion_page.html" );
121 //=================================================================================
122 // function : ~GenerationGUI_PrismDlg()
123 // purpose : Destroys the object and frees any allocated resources
124 //=================================================================================
125 GenerationGUI_PrismDlg::~GenerationGUI_PrismDlg()
127 // no need to delete child widgets, Qt does it all for us
131 //=================================================================================
134 //=================================================================================
135 void GenerationGUI_PrismDlg::Init()
138 myEditCurrentArgument = GroupPoints->LineEdit1;
139 GroupPoints->LineEdit1->setReadOnly( true );
140 GroupPoints->LineEdit2->setReadOnly( true );
142 GroupPoints2->LineEdit1->setReadOnly( true );
143 GroupPoints2->LineEdit2->setReadOnly( true );
144 GroupPoints2->LineEdit3->setReadOnly( true );
146 GroupPoints3->LineEdit1->setReadOnly( true );
148 myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil();
149 myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false;
151 /* Get setting of step value from file configuration */
152 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
153 double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
155 /* min, max, step and decimals for spin boxes & initial values */
156 initSpinBox( GroupPoints3->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
157 initSpinBox( GroupPoints3->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
158 initSpinBox( GroupPoints3->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
159 GroupPoints3->SpinBox_DX->setValue( 0.0 );
160 GroupPoints3->SpinBox_DY->setValue( 0.0 );
161 GroupPoints3->SpinBox_DZ->setValue( 0.0 );
163 initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
164 GroupPoints->SpinBox_DX->setValue( 100.0 );
166 /* signals and slots connections */
167 connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
168 connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
170 connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
172 connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
173 connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
175 connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
176 connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
178 connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
179 connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
181 connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( onBothway() ) );
182 connect( GroupPoints->CheckButton2, SIGNAL( toggled( bool ) ), this, SLOT( onReverse() ) );
184 connect( GroupPoints2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
185 connect( GroupPoints2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
186 connect( GroupPoints2->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
187 connect( GroupPoints2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( onBothway() ) );
189 connect( GroupPoints2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
190 connect( GroupPoints2->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
191 connect( GroupPoints2->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
193 connect( GroupPoints3->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
194 connect( GroupPoints3->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
195 connect( GroupPoints3->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
196 connect( GroupPoints3->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
197 connect( GroupPoints3->SpinBox_DZ, SIGNAL( valueChanged ( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
198 connect( GroupPoints3->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( onBothway() ) );
200 connect( myGeomGUI->getApp()->selectionMgr(),
201 SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
203 initName( tr( "GEOM_EXTRUSION" ) );
205 ConstructorsClicked( 0 );
208 //=================================================================================
209 // function : SetDoubleSpinBoxStep()
210 // purpose : Double spin box management
211 //=================================================================================
212 void GenerationGUI_PrismDlg::SetDoubleSpinBoxStep( double step )
214 GroupPoints->SpinBox_DX->setSingleStep(step);
215 GroupPoints3->SpinBox_DX->setSingleStep(step);
216 GroupPoints3->SpinBox_DY->setSingleStep(step);
217 GroupPoints3->SpinBox_DZ->setSingleStep(step);
221 //=================================================================================
222 // function : ConstructorsClicked()
223 // purpose : Radio button management
224 //=================================================================================
225 void GenerationGUI_PrismDlg::ConstructorsClicked( int constructorId )
228 disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
230 switch ( constructorId ) {
233 globalSelection( GEOM_ALLSHAPES );
235 GroupPoints2->hide();
236 GroupPoints3->hide();
239 myEditCurrentArgument = GroupPoints->LineEdit1;
240 GroupPoints->LineEdit1->setText( GroupPoints2->LineEdit1->text() ); // keep base
241 GroupPoints->LineEdit2->setText( "" );
242 myVec = GEOM::GEOM_Object::_nil();
249 globalSelection( GEOM_ALLSHAPES );
252 GroupPoints2->show();
253 GroupPoints3->hide();
255 myEditCurrentArgument = GroupPoints2->LineEdit1;
256 GroupPoints2->LineEdit1->setText( GroupPoints->LineEdit1->text() ); // keep base
257 GroupPoints2->LineEdit2->setText( "" );
258 GroupPoints2->LineEdit3->setText( "" );
259 myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
260 myOkPnt1 = myOkPnt2 = false;
266 globalSelection( GEOM_ALLSHAPES );
269 GroupPoints2->hide();
270 GroupPoints3->show();
272 myEditCurrentArgument = GroupPoints3->LineEdit1;
273 GroupPoints3->LineEdit1->setText( GroupPoints->LineEdit1->text() ); // keep base
277 qApp->processEvents();
279 resize( minimumSize() );
281 myEditCurrentArgument->setFocus();
282 connect( myGeomGUI->getApp()->selectionMgr(),
283 SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
286 SelectionIntoArgument();
290 //=================================================================================
291 // function : ClickOnOk()
293 //=================================================================================
294 void GenerationGUI_PrismDlg::ClickOnOk()
296 if ( ClickOnApply() )
301 //=================================================================================
302 // function : ClickOnApply()
304 //=================================================================================
305 bool GenerationGUI_PrismDlg::ClickOnApply()
315 //=================================================================================
316 // function : SelectionIntoArgument()
317 // purpose : Called when selection has changed
318 //=================================================================================
319 void GenerationGUI_PrismDlg::SelectionIntoArgument()
322 myEditCurrentArgument->setText( "" );
324 if ( getConstructorId() == 0 ) {
326 if ( IObjectCount() != 1 ) {
327 if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
329 else if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
335 Standard_Boolean testResult = Standard_False;
336 GEOM::GEOM_Object_var aSelectedObject =
337 GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
344 QString aName = GEOMBase::GetName( aSelectedObject );
345 if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
346 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
347 TColStd_IndexedMapOfInteger aMap;
348 aSelMgr->GetIndexes( firstIObject(), aMap );
349 if ( aMap.Extent() == 1 ) {
350 int anIndex = aMap( 1 );
351 aName.append( ":edge_" + QString::number( anIndex ) );
353 //Find SubShape Object in Father
354 GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
356 if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
357 GEOM::GEOM_IShapesOperations_var aShapesOp =
358 getGeomEngine()->GetIShapesOperations( getStudyId() );
359 aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
362 aSelectedObject = aFindedObject; // get Object from study
366 if ( aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints->LineEdit2 ) {
367 aSelectedObject = GEOM::GEOM_Object::_nil();
374 if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
375 myBase = aSelectedObject;
378 else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && myOk ) {
380 myVec = aSelectedObject;
382 myEditCurrentArgument->setText( aName );
384 else if ( getConstructorId() == 1 ) { // getConstructorId()==1 - extrusion using 2 points
385 if ( IObjectCount() != 1 ) {
386 if ( myEditCurrentArgument == GroupPoints2->LineEdit1 )
388 else if ( myEditCurrentArgument == GroupPoints2->LineEdit2 ) {
389 myPoint1 = GEOM::GEOM_Object::_nil();
392 else if ( myEditCurrentArgument == GroupPoints2->LineEdit3 ) {
393 myPoint2 = GEOM::GEOM_Object::_nil();
400 Standard_Boolean testResult = Standard_False;
401 GEOM::GEOM_Object_var aSelectedObject =
402 GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
404 if ( !testResult || CORBA::is_nil( aSelectedObject ) )
407 QString aName = GEOMBase::GetName( aSelectedObject );
410 if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
411 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
412 TColStd_IndexedMapOfInteger aMap;
413 aSelMgr->GetIndexes( firstIObject(), aMap );
414 if (aMap.Extent() == 1) {
415 int anIndex = aMap(1);
416 aName.append( ":vertex_" + QString::number( anIndex ) );
418 //Find SubShape Object in Father
419 GEOM::GEOM_Object_var aFindedObject = findObjectInFather( aSelectedObject, aName );
421 if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
422 GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
423 aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
426 aSelectedObject = aFindedObject;
430 if ( ( aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit2 ) ||
431 ( aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit3 ) ) {
432 aSelectedObject = GEOM::GEOM_Object::_nil();
439 myEditCurrentArgument->setText( aName );
441 if ( myEditCurrentArgument == GroupPoints2->LineEdit1 ) {
443 myBase = aSelectedObject;
445 else if ( myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk ) {
447 myPoint1 = aSelectedObject;
449 else if ( myEditCurrentArgument == GroupPoints2->LineEdit3 && myOk ) {
451 myPoint2 = aSelectedObject;
454 else if ( getConstructorId() == 2 ) { // extrusion using dx dy dz
455 Standard_Boolean testResult = Standard_False;
456 GEOM::GEOM_Object_var aSelectedObject =
457 GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
459 if ( !testResult || CORBA::is_nil( aSelectedObject ) )
462 QString aName = GEOMBase::GetName( aSelectedObject );
463 myBase = aSelectedObject;
464 myEditCurrentArgument->setText( aName );
471 //=================================================================================
472 // function : SetEditCurrentArgument()
474 //=================================================================================
475 void GenerationGUI_PrismDlg::SetEditCurrentArgument()
477 QPushButton* send = (QPushButton*)sender();
478 globalSelection( GEOM_ALLSHAPES );
480 if ( send == GroupPoints->PushButton1 ) {
481 GroupPoints->LineEdit1->setFocus();
482 myEditCurrentArgument = GroupPoints->LineEdit1;
484 else if ( send == GroupPoints->PushButton2 ) {
485 GroupPoints->LineEdit2->setFocus();
486 myEditCurrentArgument = GroupPoints->LineEdit2;
487 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
489 else if ( send == GroupPoints2->PushButton1 ) {
490 GroupPoints2->LineEdit1->setFocus();
491 myEditCurrentArgument = GroupPoints2->LineEdit1;
493 else if ( send == GroupPoints2->PushButton2 ) {
494 GroupPoints2->LineEdit2->setFocus();
495 myEditCurrentArgument = GroupPoints2->LineEdit2;
496 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
498 else if ( send == GroupPoints2->PushButton3 ) {
499 GroupPoints2->LineEdit3->setFocus();
500 myEditCurrentArgument = GroupPoints2->LineEdit3;
501 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
503 else if ( send == GroupPoints3->PushButton1 ) {
504 GroupPoints3->LineEdit1->setFocus();
505 myEditCurrentArgument = GroupPoints3->LineEdit1;
508 myEditCurrentArgument->setFocus();
509 SelectionIntoArgument();
513 //=================================================================================
514 // function : LineEditReturnPressed()
516 //=================================================================================
517 void GenerationGUI_PrismDlg::LineEditReturnPressed()
519 QLineEdit* send = (QLineEdit*)sender();
520 if ( send == GroupPoints->LineEdit1 ||
521 send == GroupPoints->LineEdit2 ||
522 send == GroupPoints2->LineEdit1 ||
523 send == GroupPoints2->LineEdit2 ||
524 send == GroupPoints2->LineEdit3 ||
525 send == GroupPoints3->LineEdit1) {
526 myEditCurrentArgument = send;
527 GEOMBase_Skeleton::LineEditReturnPressed();
531 //=================================================================================
532 // function : enterEvent()
533 // purpose : when mouse enter onto the QWidget
534 //=================================================================================
535 void GenerationGUI_PrismDlg::enterEvent( QEvent* )
537 if ( !mainFrame()->GroupConstructors->isEnabled() )
538 ActivateThisDialog();
542 //=================================================================================
543 // function : ActivateThisDialog()
545 //=================================================================================
546 void GenerationGUI_PrismDlg::ActivateThisDialog()
548 GEOMBase_Skeleton::ActivateThisDialog();
550 connect( myGeomGUI->getApp()->selectionMgr(),
551 SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
553 ConstructorsClicked( getConstructorId() );
557 //=================================================================================
558 // function : ValueChangedInSpinBox()
560 //=================================================================================
561 void GenerationGUI_PrismDlg::ValueChangedInSpinBox()
567 //=================================================================================
568 // function : getHeight()
570 //=================================================================================
571 double GenerationGUI_PrismDlg::getHeight() const
573 return GroupPoints->SpinBox_DX->value();
576 //=================================================================================
577 // function : createOperation
579 //=================================================================================
580 GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation()
582 return getGeomEngine()->GetI3DPrimOperations( getStudyId() );
585 //=================================================================================
586 // function : isValid
588 //=================================================================================
589 bool GenerationGUI_PrismDlg::isValid( QString& )
591 if ( getConstructorId() == 0 )
592 return ( myOkBase && myOkVec ); // by vector and height
593 else if ( getConstructorId() == 1 )
594 return ( myOkBase && myOkPnt1 && myOkPnt2 ); // by two points
595 else if ( getConstructorId() == 2 )
599 //=================================================================================
600 // function : execute
602 //=================================================================================
603 bool GenerationGUI_PrismDlg::execute( ObjectList& objects )
605 GEOM::GEOM_Object_var anObj;
607 switch ( getConstructorId() ) {
610 anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
611 MakePrismVecH( myBase, myVec, getHeight() );
614 anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
615 MakePrismVecH2Ways( myBase, myVec, getHeight() );
620 anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
621 MakePrismTwoPnt( myBase, myPoint1, myPoint2 );
624 anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
625 MakePrismTwoPnt2Ways( myBase, myPoint1, myPoint2 );
629 double dx = GroupPoints3->SpinBox_DX->value();
630 double dy = GroupPoints3->SpinBox_DY->value();
631 double dz = GroupPoints3->SpinBox_DZ->value();
634 anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
635 MakePrismDXDYDZ( myBase, dx, dy, dz );
638 anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
639 MakePrismDXDYDZ2Ways( myBase, dx, dy, dz );
643 if ( !anObj->_is_nil() )
644 objects.push_back( anObj._retn() );
650 //=================================================================================
651 // function : onReverse()
653 //=================================================================================
654 void GenerationGUI_PrismDlg::onReverse()
656 double anOldValue = GroupPoints->SpinBox_DX->value();
657 GroupPoints->SpinBox_DX->setValue( -anOldValue );
660 //=================================================================================
661 // function : onBothway()
663 //=================================================================================
664 void GenerationGUI_PrismDlg::onBothway()
667 switch ( getConstructorId() ) {
669 anOldValue = myBothway;
670 myBothway = !anOldValue;
671 GroupPoints->CheckButton2->setEnabled( !myBothway );
675 anOldValue = myBothway2;
676 myBothway2 = !anOldValue;
680 anOldValue = myBothway3;
681 myBothway3 = !anOldValue;
687 //=================================================================================
688 // function : addSubshapeToStudy
689 // purpose : virtual method to add new SubObjects if local selection
690 //=================================================================================
691 void GenerationGUI_PrismDlg::addSubshapesToStudy()
693 QMap<QString, GEOM::GEOM_Object_var> objMap;
695 switch ( getConstructorId() ) {
697 objMap[GroupPoints->LineEdit2->text()] = myVec;
700 objMap[GroupPoints2->LineEdit2->text()] = myPoint1;
701 objMap[GroupPoints2->LineEdit3->text()] = myPoint2;
704 addSubshapesToFather( objMap );