]> SALOME platform Git repositories - modules/geom.git/blob - src/GenerationGUI/GenerationGUI_PrismDlg.cxx
Salome HOME
BUG 19185: Qt4 porting: set step value for double spin boxes
[modules/geom.git] / src / GenerationGUI / GenerationGUI_PrismDlg.cxx
1 // GEOM GEOMGUI : GUI for Geometry component
2 //
3 // Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : GenerationGUI_PrismDlg.cxx
23 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
24 //
25
26 #include "GenerationGUI_PrismDlg.h"
27
28 #include <DlgRef.h>
29 #include <GeometryGUI.h>
30 #include <GEOMBase.h>
31
32 #include <SUIT_ResourceMgr.h>
33 #include <SUIT_Session.h>
34 #include <SalomeApp_Application.h>
35 #include <LightApp_SelectionMgr.h>
36
37 #include <TopoDS_Shape.hxx>
38 #include <TopoDS_Edge.hxx>
39 #include <TopoDS.hxx>
40 #include <TopExp.hxx>
41 #include <TColStd_IndexedMapOfInteger.hxx>
42 #include <TopTools_IndexedMapOfShape.hxx>
43
44 #include <GEOMImpl_Types.hxx>
45
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 )
56 {
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
62   setWindowTitle( tr( "GEOM_EXTRUSION_TITLE" ) );
63
64   /***************************************************************/
65   mainFrame()->GroupConstructors->setTitle( tr( "GEOM_EXTRUSION" ) );
66   mainFrame()->RadioButton1->setIcon( image0 );
67   mainFrame()->RadioButton2->setIcon( image2 );
68   mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
69   mainFrame()->RadioButton3->close();
70
71   mainFrame()->RadioButton1->setChecked( true );
72   myBothway = myBothway2 = false;
73
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" ) );
86
87   GroupPoints2 = new DlgRef_3Sel1Check( centralWidget() );
88
89   GroupPoints2->GroupBox1->setTitle( tr( "GEOM_EXTRUSION_BSV_2P" ) );
90   GroupPoints2->TextLabel1->setText( tr( "GEOM_BASE" ) );
91   GroupPoints2->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
92   GroupPoints2->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
93   GroupPoints2->PushButton1->setIcon( image1 );
94   GroupPoints2->PushButton2->setIcon( image1 );
95   GroupPoints2->PushButton3->setIcon( image1 );
96   GroupPoints2->CheckButton1->setText( tr( "GEOM_BOTHWAY" ) );
97   GroupPoints2->CheckButton1->setChecked( myBothway2 );
98
99   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
100   layout->setMargin( 0 ); layout->setSpacing( 6 );
101   layout->addWidget( GroupPoints );
102   layout->addWidget( GroupPoints2 );
103   /***************************************************************/
104
105   setHelpFileName( "create_extrusion_page.html" );
106
107   Init();
108 }
109
110
111 //=================================================================================
112 // function : ~GenerationGUI_PrismDlg()
113 // purpose  : Destroys the object and frees any allocated resources
114 //=================================================================================
115 GenerationGUI_PrismDlg::~GenerationGUI_PrismDlg()
116 {  
117   // no need to delete child widgets, Qt does it all for us
118 }
119
120
121 //=================================================================================
122 // function : Init()
123 // purpose  :
124 //=================================================================================
125 void GenerationGUI_PrismDlg::Init()
126 {
127   /* init variables */
128   myEditCurrentArgument = GroupPoints->LineEdit1;
129   GroupPoints->LineEdit1->setReadOnly( true );
130   GroupPoints->LineEdit2->setReadOnly( true );
131
132   GroupPoints2->LineEdit1->setReadOnly( true );
133   GroupPoints2->LineEdit2->setReadOnly( true );
134   GroupPoints2->LineEdit3->setReadOnly( true );
135
136   myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil();
137   myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false;
138   
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 );
142
143   /* min, max, step and decimals for spin boxes & initial values */
144   initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
145   GroupPoints->SpinBox_DX->setValue( 100.0 );
146
147   /* signals and slots connections */
148   connect( buttonOk(),    SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
149   connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
150
151   connect( this,          SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
152
153   connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
154   connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
155
156   connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
157   connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
158
159   connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
160   connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
161
162   connect( GroupPoints->CheckButton1,  SIGNAL( toggled( bool ) ), this, SLOT( onBothway() ) );
163   connect( GroupPoints->CheckButton2,  SIGNAL( toggled( bool ) ), this, SLOT( onReverse() ) );
164
165   connect( GroupPoints2->PushButton1,  SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
166   connect( GroupPoints2->PushButton2,  SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
167   connect( GroupPoints2->PushButton3,  SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
168   connect( GroupPoints2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( onBothway2() ) );
169
170   connect( GroupPoints2->LineEdit1,    SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
171   connect( GroupPoints2->LineEdit2,    SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
172   connect( GroupPoints2->LineEdit3,    SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
173
174
175   connect( myGeomGUI->getApp()->selectionMgr(),
176            SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
177
178   initName( tr( "GEOM_EXTRUSION" ) );
179
180   ConstructorsClicked( 0 );
181 }
182
183 //=================================================================================
184 // function : SetDoubleSpinBoxStep()
185 // purpose  : Double spin box management
186 //=================================================================================
187 void GenerationGUI_PrismDlg::SetDoubleSpinBoxStep( double step )
188 {
189   GroupPoints->SpinBox_DX->setSingleStep(step);
190 }
191
192
193 //=================================================================================
194 // function : ConstructorsClicked()
195 // purpose  : Radio button management
196 //=================================================================================
197 void GenerationGUI_PrismDlg::ConstructorsClicked( int constructorId )
198 {
199   erasePreview();
200   disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
201
202   switch ( constructorId ) {
203   case 0:
204     {
205       globalSelection( GEOM_ALLSHAPES );
206
207       GroupPoints2->hide();
208       GroupPoints->show();
209       
210       myEditCurrentArgument = GroupPoints->LineEdit1;
211       GroupPoints->LineEdit1->setText( GroupPoints2->LineEdit1->text() ); // keep base
212       GroupPoints->LineEdit2->setText( "" );
213       myVec = GEOM::GEOM_Object::_nil();
214       myOkVec = false;
215       
216       break;
217     }
218   case 1:
219     {
220       globalSelection( GEOM_ALLSHAPES );
221
222       GroupPoints->hide();
223       GroupPoints2->show();
224       
225       myEditCurrentArgument = GroupPoints2->LineEdit1;
226       GroupPoints2->LineEdit1->setText( GroupPoints->LineEdit1->text() ); // keep base
227       GroupPoints2->LineEdit2->setText( "" );
228       GroupPoints2->LineEdit3->setText( "" );
229       myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
230       myOkPnt1 = myOkPnt2 = false;
231       
232       break;
233     }
234   }
235
236   qApp->processEvents();
237   updateGeometry();
238   resize( minimumSize() );
239
240   myEditCurrentArgument->setFocus();
241   connect( myGeomGUI->getApp()->selectionMgr(),
242            SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
243
244   if ( !myOkBase )
245     SelectionIntoArgument();
246 }
247
248
249 //=================================================================================
250 // function : ClickOnOk()
251 // purpose  :
252 //=================================================================================
253 void GenerationGUI_PrismDlg::ClickOnOk()
254 {
255   if ( ClickOnApply() )
256     ClickOnCancel();
257 }
258
259
260 //=================================================================================
261 // function : ClickOnApply()
262 // purpose  :
263 //=================================================================================
264 bool GenerationGUI_PrismDlg::ClickOnApply()
265 {
266   if ( !onAccept() )
267     return false;
268
269   initName();
270   return true;
271 }
272
273
274 //=================================================================================
275 // function : SelectionIntoArgument()
276 // purpose  : Called when selection has changed
277 //=================================================================================
278 void GenerationGUI_PrismDlg::SelectionIntoArgument()
279 {
280   erasePreview();
281   myEditCurrentArgument->setText( "" );
282
283   if ( getConstructorId() == 0 ) {
284
285     if ( IObjectCount() != 1 ) {
286       if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
287         myOkBase = false;
288       else if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
289         myOkVec = false;
290       return;
291     }
292
293     // nbSel == 1
294     Standard_Boolean testResult = Standard_False;
295     GEOM::GEOM_Object_var aSelectedObject =
296       GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
297
298     if ( !testResult )
299       return;
300
301     bool myOk = true;
302     TopoDS_Shape aShape;
303     QString aName = GEOMBase::GetName( aSelectedObject );    
304     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
305       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
306       TColStd_IndexedMapOfInteger aMap;
307       aSelMgr->GetIndexes( firstIObject(), aMap );
308       if ( aMap.Extent() == 1 ) {
309         int anIndex = aMap( 1 );
310         aName.append( ":edge_" + QString::number( anIndex ) );
311         
312         //Find SubShape Object in Father
313         GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
314         
315         if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
316           GEOM::GEOM_IShapesOperations_var aShapesOp =
317             getGeomEngine()->GetIShapesOperations( getStudyId() );
318           aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
319         }
320         else {
321           aSelectedObject = aFindedObject; // get Object from study           
322         }
323       }
324       else {
325         if ( aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints->LineEdit2 ) {
326           aSelectedObject = GEOM::GEOM_Object::_nil();
327           aName = "";
328           myOk = false;
329         }
330       }
331     }
332     
333     if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
334       myBase = aSelectedObject;
335       myOkBase = true;
336     }
337     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && myOk ) {
338       myOkVec = true;      
339       myVec = aSelectedObject;
340     }
341     myEditCurrentArgument->setText( aName );
342   }
343   else { // getConstructorId()==1 - extrusion using 2 points
344     if ( IObjectCount() != 1 ) {
345       if ( myEditCurrentArgument == GroupPoints2->LineEdit1 )
346         myOkBase = false;
347       else if ( myEditCurrentArgument == GroupPoints2->LineEdit2 ) {
348         myPoint1 = GEOM::GEOM_Object::_nil();
349         myOkPnt1 = false;
350       }
351       else if ( myEditCurrentArgument == GroupPoints2->LineEdit3 ) {
352         myPoint2 = GEOM::GEOM_Object::_nil();
353         myOkPnt2 = false;
354       }
355       return;
356     }
357
358     // nbSel == 1
359     Standard_Boolean testResult = Standard_False;
360     GEOM::GEOM_Object_var aSelectedObject =
361       GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
362     
363     if ( !testResult || CORBA::is_nil( aSelectedObject ) )
364       return;
365     
366     QString aName = GEOMBase::GetName( aSelectedObject );
367     TopoDS_Shape aShape;
368     bool myOk = true;
369     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
370       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
371       TColStd_IndexedMapOfInteger aMap;
372       aSelMgr->GetIndexes( firstIObject(), aMap );
373       if (aMap.Extent() == 1) {
374         int anIndex = aMap(1);
375         aName.append( ":vertex_" + QString::number( anIndex ) );
376
377         //Find SubShape Object in Father
378         GEOM::GEOM_Object_var aFindedObject = findObjectInFather( aSelectedObject, aName );
379         
380         if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
381           GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
382           aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
383         }
384         else {
385           aSelectedObject = aFindedObject;
386         }
387       }
388       else {
389         if ( ( aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit2 ) ||
390              ( aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit3 ) ) {
391           aSelectedObject = GEOM::GEOM_Object::_nil();
392           aName = "";
393           myOk = false;
394         }
395       }
396     }
397
398     myEditCurrentArgument->setText( aName );
399
400     if ( myEditCurrentArgument == GroupPoints2->LineEdit1 ) {
401       myOkBase = true;
402       myBase = aSelectedObject;
403     }
404     else if ( myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk ) {
405       myOkPnt1 = true;
406       myPoint1 = aSelectedObject;
407     }
408     else if ( myEditCurrentArgument == GroupPoints2->LineEdit3 && myOk ) {
409       myOkPnt2 = true;
410       myPoint2 = aSelectedObject;
411     }
412   }
413  
414   displayPreview();
415 }
416
417
418 //=================================================================================
419 // function : SetEditCurrentArgument()
420 // purpose  :
421 //=================================================================================
422 void GenerationGUI_PrismDlg::SetEditCurrentArgument()
423 {
424   QPushButton* send = (QPushButton*)sender();
425   globalSelection( GEOM_ALLSHAPES );
426
427   if ( send == GroupPoints->PushButton1 ) {
428     GroupPoints->LineEdit1->setFocus();
429     myEditCurrentArgument = GroupPoints->LineEdit1;
430   }
431   else if ( send == GroupPoints->PushButton2 ) {
432     GroupPoints->LineEdit2->setFocus();
433     myEditCurrentArgument = GroupPoints->LineEdit2;
434     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
435   }
436   else if ( send == GroupPoints2->PushButton1 ) {
437     GroupPoints2->LineEdit1->setFocus();
438     myEditCurrentArgument = GroupPoints2->LineEdit1;
439   }
440   else if ( send == GroupPoints2->PushButton2 ) {
441     GroupPoints2->LineEdit2->setFocus();
442     myEditCurrentArgument = GroupPoints2->LineEdit2;
443     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
444   }
445   else if ( send == GroupPoints2->PushButton3 ) {
446     GroupPoints2->LineEdit3->setFocus();
447     myEditCurrentArgument = GroupPoints2->LineEdit3;
448     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
449   }
450
451   myEditCurrentArgument->setFocus();
452   SelectionIntoArgument();
453 }
454
455
456 //=================================================================================
457 // function : LineEditReturnPressed()
458 // purpose  :
459 //=================================================================================
460 void GenerationGUI_PrismDlg::LineEditReturnPressed()
461 {
462   QLineEdit* send = (QLineEdit*)sender();
463   if ( send == GroupPoints->LineEdit1 ||
464        send == GroupPoints->LineEdit2 ||
465        send == GroupPoints2->LineEdit1 ||
466        send == GroupPoints2->LineEdit2 ||
467        send == GroupPoints2->LineEdit3 ) {
468     myEditCurrentArgument = send;
469     GEOMBase_Skeleton::LineEditReturnPressed();
470   }
471 }
472
473 //=================================================================================
474 // function : enterEvent()
475 // purpose  : when mouse enter onto the QWidget
476 //=================================================================================
477 void GenerationGUI_PrismDlg::enterEvent( QEvent* )
478 {
479   if ( !mainFrame()->GroupConstructors->isEnabled() )
480     ActivateThisDialog();
481 }
482
483
484 //=================================================================================
485 // function : ActivateThisDialog()
486 // purpose  :
487 //=================================================================================
488 void GenerationGUI_PrismDlg::ActivateThisDialog()
489 {
490   GEOMBase_Skeleton::ActivateThisDialog();
491
492   connect( myGeomGUI->getApp()->selectionMgr(),
493            SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
494
495   ConstructorsClicked( getConstructorId() );
496 }
497
498
499 //=================================================================================
500 // function : ValueChangedInSpinBox()
501 // purpose  :
502 //=================================================================================
503 void GenerationGUI_PrismDlg::ValueChangedInSpinBox()
504 {
505   displayPreview();
506 }
507
508
509 //=================================================================================
510 // function : getHeight()
511 // purpose  :
512 //=================================================================================
513 double GenerationGUI_PrismDlg::getHeight() const
514 {
515   return GroupPoints->SpinBox_DX->value();
516 }
517
518 //=================================================================================
519 // function : createOperation
520 // purpose  :
521 //=================================================================================
522 GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation()
523 {
524   return getGeomEngine()->GetI3DPrimOperations( getStudyId() );
525 }
526
527 //=================================================================================
528 // function : isValid
529 // purpose  :
530 //=================================================================================
531 bool GenerationGUI_PrismDlg::isValid( QString& )
532 {
533   if ( getConstructorId() == 0 )
534     return ( myOkBase && myOkVec );     // by vector and height
535   else
536     return ( myOkBase && myOkPnt1 && myOkPnt2 );   // by two points
537 }
538
539 //=================================================================================
540 // function : execute
541 // purpose  :
542 //=================================================================================
543 bool GenerationGUI_PrismDlg::execute( ObjectList& objects )
544 {
545   GEOM::GEOM_Object_var anObj;
546
547   switch ( getConstructorId() ) {
548   case 0 :
549     if ( !myBothway ) {
550       anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
551         MakePrismVecH( myBase, myVec, getHeight() );
552     }
553     else {
554       anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
555         MakePrismVecH2Ways( myBase, myVec, getHeight() );
556     }
557     break;
558   case 1 :
559     if ( !myBothway2 ) {
560       anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
561         MakePrismTwoPnt( myBase, myPoint1, myPoint2 );
562     }
563     else {
564       anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
565         MakePrismTwoPnt2Ways( myBase, myPoint1, myPoint2 );
566     }
567     break;
568   }
569   if ( !anObj->_is_nil() )
570     objects.push_back( anObj._retn() );
571
572   return true;
573 }
574
575
576 //=================================================================================
577 // function :  onReverse()
578 // purpose  :
579 //=================================================================================
580 void GenerationGUI_PrismDlg::onReverse()
581 {
582   double anOldValue = GroupPoints->SpinBox_DX->value();
583   GroupPoints->SpinBox_DX->setValue( -anOldValue );
584 }
585
586 //=================================================================================
587 // function :  onBothway()
588 // purpose  :  
589 //=================================================================================
590 void GenerationGUI_PrismDlg::onBothway()
591 {
592   bool anOldValue = myBothway;
593   myBothway = !anOldValue;
594   GroupPoints->CheckButton2->setEnabled( !myBothway );
595   displayPreview();
596 }
597
598 void GenerationGUI_PrismDlg::onBothway2()
599 {
600   bool anOldValue = myBothway2;
601   myBothway2 = !anOldValue;
602   displayPreview();
603 }
604
605 //=================================================================================
606 // function : addSubshapeToStudy
607 // purpose  : virtual method to add new SubObjects if local selection
608 //=================================================================================
609 void GenerationGUI_PrismDlg::addSubshapesToStudy()
610 {
611   QMap<QString, GEOM::GEOM_Object_var> objMap;
612
613   switch ( getConstructorId() ) {
614   case 0:
615     objMap[GroupPoints->LineEdit2->text()] = myVec;
616     break;
617   case 1:
618     objMap[GroupPoints2->LineEdit2->text()] = myPoint1;
619     objMap[GroupPoints2->LineEdit3->text()] = myPoint2;
620     break;
621   }
622   addSubshapesToFather( objMap );
623 }