Salome HOME
Eliminate useless GetSubShape() lines in the python dump
[modules/geom.git] / src / GenerationGUI / GenerationGUI_PrismDlg.cxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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
23 // GEOM GEOMGUI : GUI for Geometry component
24 // File   : GenerationGUI_PrismDlg.cxx
25 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
26 //
27 #include "GenerationGUI_PrismDlg.h"
28
29 #include <DlgRef.h>
30 #include <GeometryGUI.h>
31 #include <GEOMBase.h>
32
33 #include <SUIT_Session.h>
34 #include <SUIT_ResourceMgr.h>
35 #include <SalomeApp_Application.h>
36 #include <LightApp_SelectionMgr.h>
37
38 // OCCT Includes
39 #include <TopoDS_Shape.hxx>
40 #include <TopoDS_Edge.hxx>
41 #include <TopoDS.hxx>
42 #include <TopExp.hxx>
43 #include <TColStd_IndexedMapOfInteger.hxx>
44 #include <TopTools_IndexedMapOfShape.hxx>
45
46 #include <GEOMImpl_Types.hxx>
47
48 //=================================================================================
49 // class    : GenerationGUI_PrismDlg()
50 // purpose  : Constructs a GenerationGUI_PrismDlg which is a child of 'parent', with the
51 //            name 'name' and widget flags set to 'f'.
52 //            The dialog will by default be modeless, unless you set 'modal' to
53 //            TRUE to construct a modal dialog.
54 //=================================================================================
55 GenerationGUI_PrismDlg::GenerationGUI_PrismDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
56                                                 bool modal, Qt::WindowFlags fl)
57   : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl)
58 {
59   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
60   QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM")));
61   QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
62   QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM_2P")));
63   QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM_DXDYDZ")));
64
65   setWindowTitle(tr("GEOM_EXTRUSION_TITLE"));
66
67   /***************************************************************/
68   mainFrame()->GroupConstructors->setTitle(tr("GEOM_EXTRUSION"));
69   mainFrame()->RadioButton1->setIcon(image0);
70   mainFrame()->RadioButton2->setIcon(image2);
71   mainFrame()->RadioButton3->setIcon(image3);
72
73   mainFrame()->RadioButton1->setChecked(true);
74
75   GroupPoints = new DlgRef_2Sel1Spin2Check(centralWidget());
76   GroupPoints->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV"));
77   GroupPoints->TextLabel1->setText(tr("GEOM_BASE"));
78   GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
79   GroupPoints->TextLabel3->setText(tr("GEOM_HEIGHT"));
80   GroupPoints->PushButton1->setIcon(image1);
81   GroupPoints->PushButton2->setIcon(image1);
82   GroupPoints->LineEdit1->setReadOnly(true);
83   GroupPoints->LineEdit2->setReadOnly(true);
84   GroupPoints->CheckButton1->setText(tr("GEOM_BOTHWAY"));
85   GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE"));
86
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
97   GroupPoints3 = new DlgRef_1Sel3Spin1Check(centralWidget());
98   GroupPoints3->GroupBox1->setTitle(tr("GEOM_EXTRUSION_DXDYDZ"));
99   GroupPoints3->TextLabel1->setText(tr("GEOM_BASE"));
100   GroupPoints3->PushButton1->setIcon(image1);
101   GroupPoints3->TextLabel2->setText(tr("GEOM_DX"));
102   GroupPoints3->TextLabel3->setText(tr("GEOM_DY"));
103   GroupPoints3->TextLabel4->setText(tr("GEOM_DZ"));
104   GroupPoints3->CheckButton1->setText(tr("GEOM_BOTHWAY"));
105
106   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
107   layout->setMargin(0); layout->setSpacing(6);
108   layout->addWidget(GroupPoints);
109   layout->addWidget(GroupPoints2);
110   layout->addWidget(GroupPoints3);
111   /***************************************************************/
112
113   setHelpFileName("create_extrusion_page.html");
114
115   Init();
116 }
117
118 //=================================================================================
119 // function : ~GenerationGUI_PrismDlg()
120 // purpose  : Destroys the object and frees any allocated resources
121 //=================================================================================
122 GenerationGUI_PrismDlg::~GenerationGUI_PrismDlg()
123 {
124   // no need to delete child widgets, Qt does it all for us
125 }
126
127 //=================================================================================
128 // function : Init()
129 // purpose  :
130 //=================================================================================
131 void GenerationGUI_PrismDlg::Init()
132 {
133   // Get setting of step value from file configuration
134   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
135   double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
136
137   // min, max, step and decimals for spin boxes & initial values
138   initSpinBox(GroupPoints3->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
139   initSpinBox(GroupPoints3->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
140   initSpinBox(GroupPoints3->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
141   GroupPoints3->SpinBox_DX->setValue(0.0);
142   GroupPoints3->SpinBox_DY->setValue(0.0);
143   GroupPoints3->SpinBox_DZ->setValue(0.0);
144
145   initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
146   GroupPoints->SpinBox_DX->setValue(100.0);
147
148   // init variables
149   myEditCurrentArgument = GroupPoints->LineEdit1;
150   GroupPoints->LineEdit1->setReadOnly(true);
151   GroupPoints->LineEdit2->setReadOnly(true);
152
153   GroupPoints2->LineEdit1->setReadOnly(true);
154   GroupPoints2->LineEdit2->setReadOnly(true);
155   GroupPoints2->LineEdit3->setReadOnly(true);
156
157   GroupPoints3->LineEdit1->setReadOnly(true);
158
159   GroupPoints->LineEdit1->setText("");
160   GroupPoints->LineEdit2->setText("");
161
162   GroupPoints2->LineEdit1->setText("");
163   GroupPoints2->LineEdit2->setText("");
164   GroupPoints2->LineEdit3->setText("");
165
166   GroupPoints3->LineEdit1->setText("");
167
168   myBaseObjects.clear();
169   myPoint1.nullify();
170   myPoint2.nullify();
171   myVec.nullify();
172
173   // signals and slots connections
174   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
175   connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
176
177   connect(this,          SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
178
179   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
180   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
181
182   connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)),    this, SLOT(ValueChangedInSpinBox()));
183   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
184
185   connect(GroupPoints->CheckButton1,  SIGNAL(toggled(bool)), this, SLOT(onBothway()));
186   connect(GroupPoints->CheckButton2,  SIGNAL(toggled(bool)), this, SLOT(onReverse()));
187
188   connect(GroupPoints2->PushButton1,  SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
189   connect(GroupPoints2->PushButton2,  SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
190   connect(GroupPoints2->PushButton3,  SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
191   connect(GroupPoints2->CheckButton1, SIGNAL(toggled(bool)),   this, SLOT(onBothway()));
192
193   connect(GroupPoints3->PushButton1,  SIGNAL(clicked()),            this, SLOT(SetEditCurrentArgument()));
194   connect(GroupPoints3->SpinBox_DX,   SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
195   connect(GroupPoints3->SpinBox_DY,   SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
196   connect(GroupPoints3->SpinBox_DZ,   SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
197   connect(GroupPoints3->CheckButton1, SIGNAL(toggled(bool)),        this, SLOT(onBothway()));
198
199   initName(tr("GEOM_EXTRUSION"));
200
201   ConstructorsClicked(0);
202 }
203
204 //=================================================================================
205 // function : SetDoubleSpinBoxStep()
206 // purpose  : Double spin box management
207 //=================================================================================
208 void GenerationGUI_PrismDlg::SetDoubleSpinBoxStep (double step)
209 {
210   GroupPoints->SpinBox_DX->setSingleStep(step);
211   GroupPoints3->SpinBox_DX->setSingleStep(step);
212   GroupPoints3->SpinBox_DY->setSingleStep(step);
213   GroupPoints3->SpinBox_DZ->setSingleStep(step);
214 }
215
216 //=================================================================================
217 // function : ConstructorsClicked()
218 // purpose  : Radio button management
219 //=================================================================================
220 void GenerationGUI_PrismDlg::ConstructorsClicked (int constructorId)
221 {
222   switch (constructorId) {
223   case 0:
224     GroupPoints2->hide();
225     GroupPoints3->hide();
226     GroupPoints->show();
227     
228     GroupPoints->LineEdit2->setText("");
229     myVec.nullify();
230     
231     GroupPoints->PushButton1->click();
232     break;
233   case 1:
234     GroupPoints->hide();
235     GroupPoints2->show();
236     GroupPoints3->hide();
237     
238     GroupPoints2->LineEdit2->setText("");
239     GroupPoints2->LineEdit3->setText("");
240     myPoint1.nullify();
241     myPoint2.nullify();
242     
243     GroupPoints2->PushButton1->click();
244     break;
245   case 2:
246     GroupPoints->hide();
247     GroupPoints2->hide();
248     GroupPoints3->show();
249     
250     GroupPoints3->PushButton1->click();
251     break;
252   default:
253     break;
254   }
255
256   qApp->processEvents();
257   updateGeometry();
258   resize(minimumSizeHint());
259
260   SelectionIntoArgument();
261   displayPreview();
262 }
263
264 //=================================================================================
265 // function : ClickOnOk()
266 // purpose  :
267 //=================================================================================
268 void GenerationGUI_PrismDlg::ClickOnOk()
269 {
270   if (ClickOnApply())
271     ClickOnCancel();
272 }
273
274 //=================================================================================
275 // function : ClickOnApply()
276 // purpose  :
277 //=================================================================================
278 bool GenerationGUI_PrismDlg::ClickOnApply()
279 {
280   if (!onAccept())
281     return false;
282
283   initName();
284   // activate selection and connect selection manager
285   ConstructorsClicked(getConstructorId());
286   return true;
287 }
288
289 //=================================================================================
290 // function : SelectionIntoArgument()
291 // purpose  : Called when selection is changed or on dialog initialization or activation
292 //=================================================================================
293 void GenerationGUI_PrismDlg::SelectionIntoArgument()
294 {
295   erasePreview();
296   myEditCurrentArgument->setText("");
297
298   if ( myEditCurrentArgument == GroupPoints->LineEdit1  ||
299        myEditCurrentArgument == GroupPoints2->LineEdit1 ||
300        myEditCurrentArgument == GroupPoints3->LineEdit1 ) {
301     myBaseObjects.clear();
302     QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
303     for ( int i = 0; i < objects.count(); i++ ) {
304       GEOM::shape_type stype = objects[i]->GetMaxShapeType();
305       if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
306         continue;
307       myBaseObjects << objects[i];
308     }
309     if ( !myBaseObjects.isEmpty() ) {
310       QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() );
311       GroupPoints->LineEdit1->setText( aName );
312       GroupPoints2->LineEdit1->setText( aName );
313       GroupPoints3->LineEdit1->setText( aName );
314     }
315     else {
316       GroupPoints->LineEdit1->setText( "" );
317       GroupPoints2->LineEdit1->setText( "" );
318       GroupPoints3->LineEdit1->setText( "" );
319     }
320   }
321   else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
322     myVec = getSelected( TopAbs_EDGE );
323     if ( myVec ) {
324       QString aName = GEOMBase::GetName( myVec.get() );
325       myEditCurrentArgument->setText( aName );
326       if ( myBaseObjects.isEmpty() )
327         GroupPoints->PushButton1->click();
328     }
329   }
330   if ( myEditCurrentArgument == GroupPoints2->LineEdit2 ) {
331     myPoint1 = getSelected( TopAbs_VERTEX );
332     if ( myPoint1 ) {
333       QString aName = GEOMBase::GetName( myPoint1.get() );
334       myEditCurrentArgument->setText( aName );
335       if ( !myPoint2 )
336         GroupPoints2->PushButton3->click();
337       else if ( myBaseObjects.isEmpty() )
338         GroupPoints2->PushButton1->click();
339     }
340   }
341   if ( myEditCurrentArgument == GroupPoints2->LineEdit3 ) {
342     myPoint2 = getSelected( TopAbs_VERTEX );
343     if ( myPoint2 ) {
344       QString aName = GEOMBase::GetName( myPoint2.get() );
345       myEditCurrentArgument->setText( aName );
346       if ( myBaseObjects.isEmpty() )
347         GroupPoints2->PushButton1->click();
348       else if ( !myPoint1 )
349         GroupPoints2->PushButton2->click();
350     }
351   }
352
353   displayPreview();
354 }
355
356 //=================================================================================
357 // function : SetEditCurrentArgument()
358 // purpose  :
359 //=================================================================================
360 void GenerationGUI_PrismDlg::SetEditCurrentArgument()
361 {
362   QPushButton* send = (QPushButton*)sender();
363
364   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
365   globalSelection(GEOM_ALLSHAPES);
366   if (send == GroupPoints->PushButton1) {
367     myEditCurrentArgument = GroupPoints->LineEdit1;
368     GroupPoints->PushButton2->setDown(false);
369     GroupPoints->LineEdit2->setEnabled(false);
370   }
371   else if (send == GroupPoints->PushButton2) {
372     myEditCurrentArgument = GroupPoints->LineEdit2;
373     GroupPoints->PushButton1->setDown(false);
374     GroupPoints->LineEdit1->setEnabled(false);
375     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
376   }
377   else if (send == GroupPoints2->PushButton1) {
378     myEditCurrentArgument = GroupPoints2->LineEdit1;
379     GroupPoints2->PushButton2->setDown(false);
380     GroupPoints2->PushButton3->setDown(false);
381     GroupPoints2->LineEdit2->setEnabled(false);
382     GroupPoints2->LineEdit3->setEnabled(false);
383   }
384   else if (send == GroupPoints2->PushButton2) {
385     myEditCurrentArgument = GroupPoints2->LineEdit2;
386     GroupPoints2->PushButton1->setDown(false);
387     GroupPoints2->PushButton3->setDown(false);
388     GroupPoints2->LineEdit1->setEnabled(false);
389     GroupPoints2->LineEdit3->setEnabled(false);
390     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
391   }
392   else if (send == GroupPoints2->PushButton3) {
393     myEditCurrentArgument = GroupPoints2->LineEdit3;
394     GroupPoints2->PushButton1->setDown(false);
395     GroupPoints2->PushButton2->setDown(false);
396     GroupPoints2->LineEdit1->setEnabled(false);
397     GroupPoints2->LineEdit2->setEnabled(false);
398     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
399   }
400   else   if (send == GroupPoints3->PushButton1) {
401     myEditCurrentArgument = GroupPoints3->LineEdit1;
402   }
403   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
404           this, SLOT(SelectionIntoArgument()));
405
406   // enable line edit
407   myEditCurrentArgument->setEnabled(true);
408   myEditCurrentArgument->setFocus();
409   // after setFocus(), because it will be setDown(false) when loses focus
410   send->setDown(true);
411
412   // seems we need it only to avoid preview disappearing, caused by selection mode change
413   displayPreview();
414 }
415
416 //=================================================================================
417 // function : ActivateThisDialog()
418 // purpose  :
419 //=================================================================================
420 void GenerationGUI_PrismDlg::ActivateThisDialog()
421 {
422   GEOMBase_Skeleton::ActivateThisDialog();
423
424   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
425            this, SLOT( SelectionIntoArgument() ) );
426
427   ConstructorsClicked( getConstructorId() );
428 }
429
430 //=================================================================================
431 // function : enterEvent()
432 // purpose  : when mouse enter onto the QWidget
433 //=================================================================================
434 void GenerationGUI_PrismDlg::enterEvent (QEvent*)
435 {
436   if (!mainFrame()->GroupConstructors->isEnabled())
437     ActivateThisDialog();
438 }
439
440 //=================================================================================
441 // function : ValueChangedInSpinBox()
442 // purpose  :
443 //=================================================================================
444 void GenerationGUI_PrismDlg::ValueChangedInSpinBox()
445 {
446   displayPreview();
447 }
448
449 //=================================================================================
450 // function : getHeight()
451 // purpose  :
452 //=================================================================================
453 double GenerationGUI_PrismDlg::getHeight() const
454 {
455   return GroupPoints->SpinBox_DX->value();
456 }
457
458 //=================================================================================
459 // function : createOperation
460 // purpose  :
461 //=================================================================================
462 GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation()
463 {
464   return getGeomEngine()->GetI3DPrimOperations(getStudyId());
465 }
466
467 //=================================================================================
468 // function : isValid
469 // purpose  :
470 //=================================================================================
471 bool GenerationGUI_PrismDlg::isValid (QString& msg)
472 {
473   bool ok = false;
474   switch ( getConstructorId() ) {
475   case 0:
476     ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) &&
477          !myBaseObjects.isEmpty() && myVec;
478     break;
479   case 1:
480     ok = !myBaseObjects.isEmpty() && myPoint1 && myPoint2;
481     break;
482   case 2:
483     ok = GroupPoints3->SpinBox_DX->isValid( msg, !IsPreview() ) &&
484          GroupPoints3->SpinBox_DY->isValid( msg, !IsPreview() ) &&
485          GroupPoints3->SpinBox_DZ->isValid( msg, !IsPreview() ) &&
486          !myBaseObjects.isEmpty();
487     break;
488   default:
489     break;
490   }
491
492   return ok;
493 }
494
495 //=================================================================================
496 // function : execute
497 // purpose  :
498 //=================================================================================
499 bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
500 {
501   QStringList aParameters;
502   GEOM::GEOM_Object_var anObj;
503
504   GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
505
506   for (int i = 0; i < myBaseObjects.count(); i++) {
507     switch (getConstructorId()) {
508     case 0:
509       if (!GroupPoints->CheckButton1->isChecked())
510         anObj = anOper->MakePrismVecH(myBaseObjects[i].get(), myVec.get(), getHeight());
511       else
512         anObj = anOper->MakePrismVecH2Ways(myBaseObjects[i].get(), myVec.get(), getHeight());
513       
514       if (!anObj->_is_nil() && !IsPreview()) {
515         aParameters << GroupPoints->SpinBox_DX->text();
516         anObj->SetParameters(aParameters.join(":").toLatin1().constData());
517       }
518       break;
519     case 1:
520       if (!GroupPoints2->CheckButton1->isChecked())
521         anObj = anOper->MakePrismTwoPnt(myBaseObjects[i].get(), myPoint1.get(), myPoint2.get());
522       else
523         anObj = anOper->MakePrismTwoPnt2Ways(myBaseObjects[i].get(), myPoint1.get(), myPoint2.get());
524       break;
525     case 2:
526       double dx = GroupPoints3->SpinBox_DX->value();
527       double dy = GroupPoints3->SpinBox_DY->value();
528       double dz = GroupPoints3->SpinBox_DZ->value();
529       
530       if (!GroupPoints3->CheckButton1->isChecked())
531         anObj = anOper->MakePrismDXDYDZ(myBaseObjects[i].get(), dx, dy, dz);
532       else
533         anObj = anOper->MakePrismDXDYDZ2Ways(myBaseObjects[i].get(), dx, dy, dz);
534       
535       if (!anObj->_is_nil() && !IsPreview()) {
536         aParameters << GroupPoints3->SpinBox_DX->text();
537         aParameters << GroupPoints3->SpinBox_DY->text();
538         aParameters << GroupPoints3->SpinBox_DZ->text();
539         anObj->SetParameters(aParameters.join(":").toLatin1().constData());
540       }
541       break;
542     }
543     
544     if (!anObj->_is_nil())
545       objects.push_back(anObj._retn());
546   }
547   
548   return true;
549 }
550
551 //=================================================================================
552 // function : onReverse()
553 // purpose  :
554 //=================================================================================
555 void GenerationGUI_PrismDlg::onReverse()
556 {
557   double anOldValue = GroupPoints->SpinBox_DX->value();
558   GroupPoints->SpinBox_DX->setValue(-anOldValue);
559 }
560
561 //=================================================================================
562 // function : onBothway()
563 // purpose  :
564 //=================================================================================
565 void GenerationGUI_PrismDlg::onBothway()
566 {
567   GroupPoints->CheckButton2->setEnabled(!GroupPoints->CheckButton1->isChecked());
568   displayPreview();
569 }
570
571 //=================================================================================
572 // function : addSubshapeToStudy
573 // purpose  : virtual method to add new SubObjects if local selection
574 //=================================================================================
575 void GenerationGUI_PrismDlg::addSubshapesToStudy()
576 {
577   switch (getConstructorId()) {
578   case 0:
579     GEOMBase::PublishSubObject( myVec.get() );
580     break;
581   case 1:
582     GEOMBase::PublishSubObject( myPoint1.get() );
583     GEOMBase::PublishSubObject( myPoint2.get() );
584     break;
585   default:
586     break;
587   }
588 }
589
590 //=================================================================================
591 // function : extractPrefix
592 // purpose  : redefined from GEOMBase_Helper class
593 //=================================================================================
594 bool GenerationGUI_PrismDlg::extractPrefix() const
595 {
596   return myBaseObjects.count() > 1;
597 }