]> SALOME platform Git repositories - modules/geom.git/blob - src/GenerationGUI/GenerationGUI_PrismDlg.cxx
Salome HOME
Merge from BR_Dev_For_4_0 branch (from tag mergeto_BR_QT4_Dev_17Jan08)
[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   // VSR: TODO ->>
161   connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) );
162   // <<-
163
164   connect( GroupPoints->CheckButton1,  SIGNAL( toggled( bool ) ), this, SLOT( onBothway() ) );
165   connect( GroupPoints->CheckButton2,  SIGNAL( toggled( bool ) ), this, SLOT( onReverse() ) );
166
167   connect( GroupPoints2->PushButton1,  SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
168   connect( GroupPoints2->PushButton2,  SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
169   connect( GroupPoints2->PushButton3,  SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
170   connect( GroupPoints2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( onBothway2() ) );
171
172   connect( GroupPoints2->LineEdit1,    SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
173   connect( GroupPoints2->LineEdit2,    SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
174   connect( GroupPoints2->LineEdit3,    SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
175
176
177   connect( myGeomGUI->getApp()->selectionMgr(),
178            SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
179
180   initName( tr( "GEOM_EXTRUSION" ) );
181
182   ConstructorsClicked( 0 );
183 }
184
185
186 //=================================================================================
187 // function : ConstructorsClicked()
188 // purpose  : Radio button management
189 //=================================================================================
190 void GenerationGUI_PrismDlg::ConstructorsClicked( int constructorId )
191 {
192   erasePreview();
193   disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
194
195   switch ( constructorId ) {
196   case 0:
197     {
198       globalSelection( GEOM_ALLSHAPES );
199
200       GroupPoints2->hide();
201       GroupPoints->show();
202       
203       myEditCurrentArgument = GroupPoints->LineEdit1;
204       GroupPoints->LineEdit1->setText( GroupPoints2->LineEdit1->text() ); // keep base
205       GroupPoints->LineEdit2->setText( "" );
206       myVec = GEOM::GEOM_Object::_nil();
207       myOkVec = false;
208       
209       break;
210     }
211   case 1:
212     {
213       globalSelection( GEOM_ALLSHAPES );
214
215       GroupPoints->hide();
216       GroupPoints2->show();
217       
218       myEditCurrentArgument = GroupPoints2->LineEdit1;
219       GroupPoints2->LineEdit1->setText( GroupPoints->LineEdit1->text() ); // keep base
220       GroupPoints2->LineEdit2->setText( "" );
221       GroupPoints2->LineEdit3->setText( "" );
222       myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
223       myOkPnt1 = myOkPnt2 = false;
224       
225       break;
226     }
227   }
228
229   qApp->processEvents();
230   updateGeometry();
231   resize( minimumSize() );
232
233   myEditCurrentArgument->setFocus();
234   connect( myGeomGUI->getApp()->selectionMgr(),
235            SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
236
237   if ( !myOkBase )
238     SelectionIntoArgument();
239 }
240
241
242 //=================================================================================
243 // function : ClickOnOk()
244 // purpose  :
245 //=================================================================================
246 void GenerationGUI_PrismDlg::ClickOnOk()
247 {
248   if ( ClickOnApply() )
249     ClickOnCancel();
250 }
251
252
253 //=================================================================================
254 // function : ClickOnApply()
255 // purpose  :
256 //=================================================================================
257 bool GenerationGUI_PrismDlg::ClickOnApply()
258 {
259   if ( !onAccept() )
260     return false;
261
262   initName();
263   return true;
264 }
265
266
267 //=================================================================================
268 // function : SelectionIntoArgument()
269 // purpose  : Called when selection has changed
270 //=================================================================================
271 void GenerationGUI_PrismDlg::SelectionIntoArgument()
272 {
273   erasePreview();
274   myEditCurrentArgument->setText( "" );
275
276   if ( getConstructorId() == 0 ) {
277
278     if ( IObjectCount() != 1 ) {
279       if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
280         myOkBase = false;
281       else if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
282         myOkVec = false;
283       return;
284     }
285
286     // nbSel == 1
287     Standard_Boolean testResult = Standard_False;
288     GEOM::GEOM_Object_var aSelectedObject =
289       GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
290
291     if ( !testResult )
292       return;
293
294     bool myOk = true;
295     TopoDS_Shape aShape;
296     QString aName = GEOMBase::GetName( aSelectedObject );    
297     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
298       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
299       TColStd_IndexedMapOfInteger aMap;
300       aSelMgr->GetIndexes( firstIObject(), aMap );
301       if ( aMap.Extent() == 1 ) {
302         int anIndex = aMap( 1 );
303         aName.append( ":edge_" + QString::number( anIndex ) );
304         
305         //Find SubShape Object in Father
306         GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
307         
308         if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
309           GEOM::GEOM_IShapesOperations_var aShapesOp =
310             getGeomEngine()->GetIShapesOperations( getStudyId() );
311           aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
312         }
313         else {
314           aSelectedObject = aFindedObject; // get Object from study           
315         }
316       }
317       else {
318         if ( aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints->LineEdit2 ) {
319           aSelectedObject = GEOM::GEOM_Object::_nil();
320           aName = "";
321           myOk = false;
322         }
323       }
324     }
325     
326     if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
327       myBase = aSelectedObject;
328       myOkBase = true;
329     }
330     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && myOk ) {
331       myOkVec = true;      
332       myVec = aSelectedObject;
333     }
334     myEditCurrentArgument->setText( aName );
335   }
336   else { // getConstructorId()==1 - extrusion using 2 points
337     if ( IObjectCount() != 1 ) {
338       if ( myEditCurrentArgument == GroupPoints2->LineEdit1 )
339         myOkBase = false;
340       else if ( myEditCurrentArgument == GroupPoints2->LineEdit2 ) {
341         myPoint1 = GEOM::GEOM_Object::_nil();
342         myOkPnt1 = false;
343       }
344       else if ( myEditCurrentArgument == GroupPoints2->LineEdit3 ) {
345         myPoint2 = GEOM::GEOM_Object::_nil();
346         myOkPnt2 = false;
347       }
348       return;
349     }
350
351     // nbSel == 1
352     Standard_Boolean testResult = Standard_False;
353     GEOM::GEOM_Object_var aSelectedObject =
354       GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
355     
356     if ( !testResult || CORBA::is_nil( aSelectedObject ) )
357       return;
358     
359     QString aName = GEOMBase::GetName( aSelectedObject );
360     TopoDS_Shape aShape;
361     bool myOk = true;
362     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
363       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
364       TColStd_IndexedMapOfInteger aMap;
365       aSelMgr->GetIndexes( firstIObject(), aMap );
366       if (aMap.Extent() == 1) {
367         int anIndex = aMap(1);
368         aName.append( ":vertex_" + QString::number( anIndex ) );
369
370         //Find SubShape Object in Father
371         GEOM::GEOM_Object_var aFindedObject = findObjectInFather( aSelectedObject, aName );
372         
373         if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
374           GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
375           aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
376         }
377         else {
378           aSelectedObject = aFindedObject;
379         }
380       }
381       else {
382         if ( ( aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit2 ) ||
383              ( aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit3 ) ) {
384           aSelectedObject = GEOM::GEOM_Object::_nil();
385           aName = "";
386           myOk = false;
387         }
388       }
389     }
390
391     myEditCurrentArgument->setText( aName );
392
393     if ( myEditCurrentArgument == GroupPoints2->LineEdit1 ) {
394       myOkBase = true;
395       myBase = aSelectedObject;
396     }
397     else if ( myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk ) {
398       myOkPnt1 = true;
399       myPoint1 = aSelectedObject;
400     }
401     else if ( myEditCurrentArgument == GroupPoints2->LineEdit3 && myOk ) {
402       myOkPnt2 = true;
403       myPoint2 = aSelectedObject;
404     }
405   }
406  
407   displayPreview();
408 }
409
410
411 //=================================================================================
412 // function : SetEditCurrentArgument()
413 // purpose  :
414 //=================================================================================
415 void GenerationGUI_PrismDlg::SetEditCurrentArgument()
416 {
417   QPushButton* send = (QPushButton*)sender();
418   globalSelection( GEOM_ALLSHAPES );
419
420   if ( send == GroupPoints->PushButton1 ) {
421     GroupPoints->LineEdit1->setFocus();
422     myEditCurrentArgument = GroupPoints->LineEdit1;
423   }
424   else if ( send == GroupPoints->PushButton2 ) {
425     GroupPoints->LineEdit2->setFocus();
426     myEditCurrentArgument = GroupPoints->LineEdit2;
427     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
428   }
429   else if ( send == GroupPoints2->PushButton1 ) {
430     GroupPoints2->LineEdit1->setFocus();
431     myEditCurrentArgument = GroupPoints2->LineEdit1;
432   }
433   else if ( send == GroupPoints2->PushButton2 ) {
434     GroupPoints2->LineEdit2->setFocus();
435     myEditCurrentArgument = GroupPoints2->LineEdit2;
436     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
437   }
438   else if ( send == GroupPoints2->PushButton3 ) {
439     GroupPoints2->LineEdit3->setFocus();
440     myEditCurrentArgument = GroupPoints2->LineEdit3;
441     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
442   }
443
444   myEditCurrentArgument->setFocus();
445   SelectionIntoArgument();
446 }
447
448
449 //=================================================================================
450 // function : LineEditReturnPressed()
451 // purpose  :
452 //=================================================================================
453 void GenerationGUI_PrismDlg::LineEditReturnPressed()
454 {
455   QLineEdit* send = (QLineEdit*)sender();
456   if ( send == GroupPoints->LineEdit1 ||
457        send == GroupPoints->LineEdit2 ||
458        send == GroupPoints2->LineEdit1 ||
459        send == GroupPoints2->LineEdit2 ||
460        send == GroupPoints2->LineEdit3 ) {
461     myEditCurrentArgument = send;
462     GEOMBase_Skeleton::LineEditReturnPressed();
463   }
464 }
465
466 //=================================================================================
467 // function : enterEvent()
468 // purpose  : when mouse enter onto the QWidget
469 //=================================================================================
470 void GenerationGUI_PrismDlg::enterEvent( QEvent* )
471 {
472   if ( !mainFrame()->GroupConstructors->isEnabled() )
473     ActivateThisDialog();
474 }
475
476
477 //=================================================================================
478 // function : ActivateThisDialog()
479 // purpose  :
480 //=================================================================================
481 void GenerationGUI_PrismDlg::ActivateThisDialog()
482 {
483   GEOMBase_Skeleton::ActivateThisDialog();
484
485   connect( myGeomGUI->getApp()->selectionMgr(),
486            SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
487
488   ConstructorsClicked( getConstructorId() );
489 }
490
491
492 //=================================================================================
493 // function : ValueChangedInSpinBox()
494 // purpose  :
495 //=================================================================================
496 void GenerationGUI_PrismDlg::ValueChangedInSpinBox()
497 {
498   displayPreview();
499 }
500
501
502 //=================================================================================
503 // function : getHeight()
504 // purpose  :
505 //=================================================================================
506 double GenerationGUI_PrismDlg::getHeight() const
507 {
508   return GroupPoints->SpinBox_DX->value();
509 }
510
511 //=================================================================================
512 // function : createOperation
513 // purpose  :
514 //=================================================================================
515 GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation()
516 {
517   return getGeomEngine()->GetI3DPrimOperations( getStudyId() );
518 }
519
520 //=================================================================================
521 // function : isValid
522 // purpose  :
523 //=================================================================================
524 bool GenerationGUI_PrismDlg::isValid( QString& )
525 {
526   if ( getConstructorId() == 0 )
527     return ( myOkBase && myOkVec );     // by vector and height
528   else
529     return ( myOkBase && myOkPnt1 && myOkPnt2 );   // by two points
530 }
531
532 //=================================================================================
533 // function : execute
534 // purpose  :
535 //=================================================================================
536 bool GenerationGUI_PrismDlg::execute( ObjectList& objects )
537 {
538   GEOM::GEOM_Object_var anObj;
539
540   switch ( getConstructorId() ) {
541   case 0 :
542     if ( !myBothway ) {
543       anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
544         MakePrismVecH( myBase, myVec, getHeight() );
545     }
546     else {
547       anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
548         MakePrismVecH2Ways( myBase, myVec, getHeight() );
549     }
550     break;
551   case 1 :
552     if ( !myBothway2 ) {
553       anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
554         MakePrismTwoPnt( myBase, myPoint1, myPoint2 );
555     }
556     else {
557       anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
558         MakePrismTwoPnt2Ways( myBase, myPoint1, myPoint2 );
559     }
560     break;
561   }
562   if ( !anObj->_is_nil() )
563     objects.push_back( anObj._retn() );
564
565   return true;
566 }
567
568
569 //=================================================================================
570 // function :  onReverse()
571 // purpose  :
572 //=================================================================================
573 void GenerationGUI_PrismDlg::onReverse()
574 {
575   double anOldValue = GroupPoints->SpinBox_DX->value();
576   GroupPoints->SpinBox_DX->setValue( -anOldValue );
577 }
578
579 //=================================================================================
580 // function :  onBothway()
581 // purpose  :  
582 //=================================================================================
583 void GenerationGUI_PrismDlg::onBothway()
584 {
585   bool anOldValue = myBothway;
586   myBothway = !anOldValue;
587   GroupPoints->CheckButton2->setEnabled( !myBothway );
588   displayPreview();
589 }
590
591 void GenerationGUI_PrismDlg::onBothway2()
592 {
593   bool anOldValue = myBothway2;
594   myBothway2 = !anOldValue;
595   displayPreview();
596 }
597
598 //=================================================================================
599 // function : addSubshapeToStudy
600 // purpose  : virtual method to add new SubObjects if local selection
601 //=================================================================================
602 void GenerationGUI_PrismDlg::addSubshapesToStudy()
603 {
604   QMap<QString, GEOM::GEOM_Object_var> objMap;
605
606   switch ( getConstructorId() ) {
607   case 0:
608     objMap[GroupPoints->LineEdit2->text()] = myVec;
609     break;
610   case 1:
611     objMap[GroupPoints2->LineEdit2->text()] = myPoint1;
612     objMap[GroupPoints2->LineEdit3->text()] = myPoint2;
613     break;
614   }
615   addSubshapesToFather( objMap );
616 }