Salome HOME
Merge from V6_main 01/04/2013
[modules/geom.git] / src / BasicGUI / BasicGUI_CurveDlg.cxx
1 // Copyright (C) 2007-2013  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   : BasicGUI_CurveDlg.cxx
25 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
26
27 #include "BasicGUI_CurveDlg.h"
28 #include "BasicGUI_ParamCurveWidget.h"
29
30 #include <DlgRef.h>
31 #include <GeometryGUI.h>
32 #include <GEOMBase.h>
33
34 #include <SUIT_ResourceMgr.h>
35 #include <SUIT_Session.h>
36 #include <SalomeApp_Application.h>
37 #include <SalomeApp_Study.h>
38 #include <LightApp_SelectionMgr.h>
39
40 #include <SALOME_ListIteratorOfListIO.hxx>
41 #include <SALOME_ListIO.hxx>
42
43 #include <TopoDS_Shape.hxx>
44 #include <TopoDS.hxx>
45 #include <TopExp.hxx>
46 #include <TColStd_IndexedMapOfInteger.hxx>
47 #include <TopTools_IndexedMapOfShape.hxx>
48
49 #include <GEOMImpl_Types.hxx>
50
51 //=================================================================================
52 // class    : BasicGUI_CurveDlg()
53 // purpose  : Constructs a BasicGUI_CurveDlg which is a child of 'parent', with the
54 //            name 'name' and widget flags set to 'f'.
55 //            The dialog will by default be modeless, unless you set 'modal' to
56 //            TRUE to construct a modal dialog.
57 //=================================================================================
58 BasicGUI_CurveDlg::BasicGUI_CurveDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
59                                       bool modal, Qt::WindowFlags fl )
60   : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
61 {
62   QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_POLYLINE")));
63   QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SPLINE")));
64   QPixmap image3 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BEZIER")));
65   QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
66
67   setWindowTitle(tr("GEOM_CURVE_TITLE"));
68
69   /***************************************************************/
70   mainFrame()->RadioButton1->setIcon(image0);
71   mainFrame()->RadioButton2->setIcon(image3);
72   mainFrame()->RadioButton3->setIcon(image2);
73
74   // Creation mode
75   QGroupBox* creationModeGroup = new QGroupBox (this);
76   QButtonGroup* bg = new QButtonGroup (this);
77
78   creationModeGroup->setTitle(tr("GEOM_CURVE_CRMODE"));
79   QHBoxLayout * creationModeLayout = new QHBoxLayout (creationModeGroup);
80   myBySelectionBtn = new QRadioButton (tr("GEOM_CURVE_SELECTION") ,creationModeGroup);
81   myAnaliticalBtn = new QRadioButton (tr("GEOM_CURVE_ANALITICAL") ,creationModeGroup);
82
83   bg->addButton(myBySelectionBtn);
84   bg->addButton(myAnaliticalBtn);
85
86   creationModeLayout->addWidget(myBySelectionBtn);
87   creationModeLayout->addWidget(myAnaliticalBtn);
88
89   // Points and flags
90   myGroupPoints = new DlgRef_1Sel3Check (centralWidget());
91
92   myGroupPoints->GroupBox1->setTitle(tr("GEOM_NODES"));
93   myGroupPoints->TextLabel1->setText(tr("GEOM_POINTS"));
94   myGroupPoints->PushButton1->setIcon(image1);
95   myGroupPoints->PushButton1->setDown(true);
96
97   myGroupPoints->LineEdit1->setReadOnly( true );
98
99   myGroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) );
100   myGroupPoints->CheckButton1->setChecked(false);
101   //myGroupPoints->CheckButton1->hide();
102
103   myGroupPoints->CheckButton2->setText( tr( "GEOM_IS_REORDER" ) );
104   myGroupPoints->CheckButton2->setChecked(false);
105   myGroupPoints->CheckButton2->hide();
106
107   myGroupPoints->CheckButton3->hide();
108
109   // Parametrical mode
110   myGroupParams = new BasicGUI_ParamCurveWidget( centralWidget() );
111
112   // Tangents (only for Interpolation constructor and only not closed and no reordering)
113   myGroupTangents = new QGroupBox (this);
114   myGroupTangents->setCheckable(true);
115   myGroupTangents->setChecked(false);
116   myGroupTangents->setTitle(tr("GEOM_INTERPOL_TANGENTS"));
117
118   QGridLayout* tangentsLayout = new QGridLayout (myGroupTangents);
119
120   myPushBtnV1 = new QPushButton (myGroupTangents);
121   myPushBtnV2 = new QPushButton (myGroupTangents);
122   myPushBtnV1->setIcon(image1);
123   myPushBtnV2->setIcon(image1);
124
125   myLineEditV1 = new QLineEdit (myGroupTangents);
126   myLineEditV2 = new QLineEdit (myGroupTangents);
127   myLineEditV1->setReadOnly(true);
128   myLineEditV2->setReadOnly(true);
129
130   QLabel* aTextLabelV1 = new QLabel (myGroupTangents);
131   QLabel* aTextLabelV2 = new QLabel (myGroupTangents);
132   aTextLabelV1->setText(tr("GEOM_INTERPOL_FIRST_VEC"));
133   aTextLabelV2->setText(tr("GEOM_INTERPOL_LAST_VEC"));
134
135   tangentsLayout->addWidget(aTextLabelV1, 0, 0);
136   tangentsLayout->addWidget(myPushBtnV1 , 0, 1);
137   tangentsLayout->addWidget(myLineEditV1, 0, 2);
138   tangentsLayout->addWidget(aTextLabelV2, 1, 0);
139   tangentsLayout->addWidget(myPushBtnV2 , 1, 1);
140   tangentsLayout->addWidget(myLineEditV2, 1, 2);
141
142   // Layout
143   QVBoxLayout* layout = new QVBoxLayout (centralWidget());
144   layout->setMargin(0);
145   layout->setSpacing(6);
146   layout->addWidget(creationModeGroup);
147   layout->addWidget(myGroupPoints);
148   layout->addWidget(myGroupParams);
149   layout->addWidget(myGroupTangents);
150   /***************************************************************/
151
152   setHelpFileName("create_curve_page.html");
153
154   Init();
155 }
156
157 //=================================================================================
158 // function : ~BasicGUI_CurveDlg()
159 // purpose  : Destroys the object and frees any allocated resources
160 //=================================================================================
161 BasicGUI_CurveDlg::~BasicGUI_CurveDlg()
162 {
163 }
164
165 //=================================================================================
166 // function : Init()
167 // purpose  :
168 //=================================================================================
169 void BasicGUI_CurveDlg::Init()
170 {
171   /* init variables */
172   showOnlyPreviewControl();
173   myBySelectionBtn->setChecked(true);
174
175   /* Get setting of step value from file configuration */
176   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
177   double step = resMgr ? resMgr->doubleValue( "Geometry", "SettingsGeomStep", 10. ) : 10.;
178
179   double aMax( 100. ), aMin( 0.0 );
180
181   /* min, max, step and decimals for spin boxes & initial values */
182   initSpinBox( myGroupParams->myPMin, COORD_MIN, COORD_MAX, step, "length_precision" );
183   initSpinBox( myGroupParams->myPMax, COORD_MIN, COORD_MAX, step, "length_precision" );
184   myGroupParams->myPStep->setValue( 10 );
185   myGroupParams->myPStep->setMaximum( 999 );
186   myGroupParams->myPStep->setSingleStep( 10 );
187   myGroupParams->myPMin->setValue( aMin );
188   myGroupParams->myPMax->setValue( aMax );
189   myGroupParams->myPStep->setValue( step );
190   myGroupParams->myXExpr->setText("t");
191   myGroupParams->myYExpr->setText("t");
192   myGroupParams->myZExpr->setText("t");
193
194   myGroupParams->hide();
195
196   /* signals and slots connections */
197   connect(myGeomGUI,     SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
198   connect(myGeomGUI,     SIGNAL(SignalCloseAllDialogs()),        this, SLOT(ClickOnCancel()));
199
200   connect(buttonOk(),    SIGNAL(clicked()),                      this, SLOT(ClickOnOk()));
201   connect(buttonApply(), SIGNAL(clicked()),                      this, SLOT(ClickOnApply()));
202
203   connect(this,          SIGNAL(constructorsClicked(int)),       this, SLOT(ConstructorsClicked(int)));
204
205   connect(myGroupPoints->PushButton1,  SIGNAL(clicked()),        this, SLOT(SetEditCurrentArgument()));
206   connect(myPushBtnV1,                 SIGNAL(clicked()),        this, SLOT(SetEditCurrentArgument()));
207   connect(myPushBtnV2,                 SIGNAL(clicked()),        this, SLOT(SetEditCurrentArgument()));
208
209   connect(myGroupPoints->CheckButton1, SIGNAL(toggled(bool)),    this, SLOT(CheckButtonToggled()));
210   connect(myGroupPoints->CheckButton2, SIGNAL(toggled(bool)),    this, SLOT(CheckButtonToggled()));
211   connect(myGroupTangents,             SIGNAL(toggled(bool)),    this, SLOT(CheckButtonToggled()));
212
213   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
214           this, SLOT(SelectionIntoArgument()));
215
216   connect(myBySelectionBtn,       SIGNAL(clicked()),             this, SLOT(CreationModeChanged()));
217   connect(myAnaliticalBtn,        SIGNAL(clicked()),             this, SLOT(CreationModeChanged()));
218
219   connect(myGroupParams->myPMin,  SIGNAL(valueChanged(double)),  this, SLOT(ValueChangedInSpinBox(double)));
220   connect(myGroupParams->myPMax,  SIGNAL(valueChanged(double)),  this, SLOT(ValueChangedInSpinBox(double)));
221   connect(myGroupParams->myPStep, SIGNAL(valueChanged(int)),     this, SLOT(ValueChangedInSpinBox(int)));
222
223   connect(myGroupParams->myXExpr, SIGNAL(editingFinished()),     this, SLOT(OnEditingFinished()));
224   connect(myGroupParams->myYExpr, SIGNAL(editingFinished()),     this, SLOT(OnEditingFinished()));
225   connect(myGroupParams->myZExpr, SIGNAL(editingFinished()),     this, SLOT(OnEditingFinished()));
226
227   initName(tr("GEOM_CURVE"));
228   //resize(100, 100);
229   ConstructorsClicked(0);
230 }
231
232 //=================================================================================
233 // function : ConstructorsClicked()
234 // purpose  :
235 //=================================================================================
236 void BasicGUI_CurveDlg::ConstructorsClicked (int id)
237 {
238   QString aTitle = tr(id == 0 ? "GEOM_POLYLINE" : id == 1 ? "GEOM_BEZIER" : "GEOM_INTERPOL");
239   mainFrame()->GroupConstructors->setTitle(aTitle);
240
241   if (id == 0) { // polyline (wire)
242     myGroupPoints->CheckButton1->setText( tr( "GEOM_BUILD_CLOSED_WIRE" ) );
243     myGroupPoints->CheckButton2->hide();
244     myGroupTangents->hide();
245   }
246   else if (id == 1) { // bezier
247     myGroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) );
248     myGroupPoints->CheckButton2->hide();
249     myGroupTangents->hide();
250   }
251   else { // b-spline
252     myGroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) );
253     myGroupPoints->CheckButton2->show();
254     myGroupTangents->setVisible(myBySelectionBtn->isChecked());
255   }
256
257   myPoints.clear();
258   myVec1.nullify();
259   myVec2.nullify();
260
261   myGroupPoints->LineEdit1->setText("");
262   myLineEditV1->setText("");
263   myLineEditV2->setText("");
264
265   qApp->processEvents();
266   updateGeometry();
267   resize(minimumSizeHint());
268
269   myGroupPoints->PushButton1->click();
270 }
271
272 //=================================================================================
273 // function : SetEditCurrentArgument()
274 // purpose  :
275 //=================================================================================
276 void BasicGUI_CurveDlg::SetEditCurrentArgument()
277 {
278   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
279
280   globalSelection(); // close local contexts, if any
281
282   if (sender() == myGroupPoints->PushButton1) {
283     myEditCurrentArgument = myGroupPoints->LineEdit1;
284     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
285   }
286   else if (sender() == myPushBtnV1) {
287     myEditCurrentArgument = myLineEditV1;
288     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
289   }
290   else if (sender() == myPushBtnV2) {
291     myEditCurrentArgument = myLineEditV2;
292     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
293   }
294
295   myEditCurrentArgument->setFocus();
296
297   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
298           this, SLOT(SelectionIntoArgument()));
299
300   SelectionIntoArgument();
301 }
302
303 //=================================================================================
304 // function : CheckButtonToggled()
305 // purpose  :
306 //=================================================================================
307 void BasicGUI_CurveDlg::CheckButtonToggled()
308 {
309   if (sender() == myGroupTangents) {
310     if (myGroupTangents->isChecked())
311       myPushBtnV1->click();
312     else
313       myGroupPoints->PushButton1->click();
314   }
315   else {
316     if (getConstructorId() == 2) { // Interpolation
317       bool disableTangents = (myGroupPoints->CheckButton1->isChecked() ||
318                               myGroupPoints->CheckButton2->isChecked());
319       myGroupTangents->setEnabled(!disableTangents);
320     }
321     processPreview();
322   }
323 }
324
325 //=================================================================================
326 // function : ClickOnOk()
327 // purpose  :
328 //=================================================================================
329 void BasicGUI_CurveDlg::ClickOnOk()
330 {
331   setIsApplyAndClose(true);
332   if (ClickOnApply())
333     ClickOnCancel();
334 }
335
336 //=================================================================================
337 // function : ClickOnApply()
338 // purpose  :
339 //=================================================================================
340 bool BasicGUI_CurveDlg::ClickOnApply()
341 {
342   if (!onAccept())
343     return false;
344
345   initName();
346   ConstructorsClicked(getConstructorId());
347   return true;
348 }
349
350 //=================================================================================
351 // function : SelectionIntoArgument()
352 // purpose  : Called when selection as changed or other case
353 //=================================================================================
354 static void synchronize (QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right)
355 {
356   // 1. remove items from the "left" list that are not in the "right" list
357   QMutableListIterator<GEOM::GeomObjPtr> it1 (left);
358   while (it1.hasNext()) {
359     GEOM::GeomObjPtr o1 = it1.next();
360     bool found = false;
361     QMutableListIterator<GEOM::GeomObjPtr> it2( right );
362     while ( it2.hasNext() && !found )
363       found = o1 == it2.next();
364     if ( !found )
365       it1.remove();
366   }
367   // 2. add items from the "right" list that are not in the "left" list (to keep selection order)
368   it1 = right;
369   while ( it1.hasNext() ) {
370     GEOM::GeomObjPtr o1 = it1.next();
371     bool found = false;
372     QMutableListIterator<GEOM::GeomObjPtr> it2( left );
373     while ( it2.hasNext() && !found )
374       found = o1 == it2.next();
375     if ( !found )
376       left << o1;
377   }
378 }
379
380 void BasicGUI_CurveDlg::SelectionIntoArgument()
381 {
382   myEditCurrentArgument->setText("");
383
384   if (myEditCurrentArgument == myGroupPoints->LineEdit1) {
385     QList<GEOM::GeomObjPtr> points = getSelected(TopAbs_VERTEX, -1);
386     synchronize(myPoints, points);
387     if (!myPoints.isEmpty())
388       myGroupPoints->LineEdit1->setText(QString::number(myPoints.count()) + "_" +
389                                         tr("GEOM_POINT") + tr("_S_"));
390   }
391   else {
392     QList<GEOM::GeomObjPtr> vecs = getSelected(TopAbs_EDGE, -1);
393     if (vecs.count() != 1) {
394       if      (myEditCurrentArgument == myLineEditV1) myVec1.nullify();
395       else if (myEditCurrentArgument == myLineEditV2) myVec2.nullify();
396     }
397     else {
398       if (myEditCurrentArgument == myLineEditV1) {
399         myVec1 = vecs.first();
400       }
401       else if (myEditCurrentArgument == myLineEditV2) {
402         myVec2 = vecs.first();
403       }
404       QString aName = GEOMBase::GetName(vecs.first().get());
405       myEditCurrentArgument->setText(aName);
406     }
407   }
408
409   processPreview();
410 }
411
412 //=================================================================================
413 // function : ActivateThisDialog()
414 // purpose  :
415 //=================================================================================
416 void BasicGUI_CurveDlg::ActivateThisDialog()
417 {
418   GEOMBase_Skeleton::ActivateThisDialog();
419
420   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
421            this, SLOT(SelectionIntoArgument()));
422
423   ConstructorsClicked(getConstructorId());
424 }
425
426 //=================================================================================
427 // function : DeactivateActiveDialog()
428 // purpose  : public slot to deactivate if active
429 //=================================================================================
430 void BasicGUI_CurveDlg::DeactivateActiveDialog()
431 {
432   // myGeomGUI->SetState( -1 );
433   GEOMBase_Skeleton::DeactivateActiveDialog();
434 }
435
436 //=================================================================================
437 // function : enterEvent()
438 // purpose  :
439 //=================================================================================
440 void BasicGUI_CurveDlg::enterEvent (QEvent*)
441 {
442   if (!mainFrame()->GroupConstructors->isEnabled())
443     ActivateThisDialog();
444 }
445
446 //=================================================================================
447 // function : createOperation
448 // purpose  :
449 //=================================================================================
450 GEOM::GEOM_IOperations_ptr BasicGUI_CurveDlg::createOperation()
451 {
452   return myGeomGUI->GetGeomGen()->GetICurvesOperations(getStudyId());
453 }
454
455 //=================================================================================
456 // function : isValid
457 // purpose  :
458 //=================================================================================
459 bool BasicGUI_CurveDlg::isValid (QString& msg)
460 {
461   if (myBySelectionBtn->isChecked()) {
462     bool ok = true;
463     if (getConstructorId() == 2) { // Interpolation
464       bool disableTangents = (myGroupPoints->CheckButton1->isChecked() ||
465                               myGroupPoints->CheckButton2->isChecked());
466       if (!disableTangents && myGroupTangents->isChecked()) {
467         ok = (myVec1 && myVec2);
468         if (!ok) msg = tr("GEOM_BOTH_TANGENTS_REQUIRED");
469       }
470     }
471     return ok && myPoints.count() > 1;
472   }
473   else {
474     bool ok = myGroupParams->myPMin->isValid( msg, !IsPreview() ) &&
475               myGroupParams->myPMax->isValid( msg, !IsPreview() ) &&
476               myGroupParams->myPStep->isValid( msg, !IsPreview() );
477     ok &= !myGroupParams->myXExpr->text().isEmpty();
478     ok &= !myGroupParams->myYExpr->text().isEmpty();
479     ok &= !myGroupParams->myZExpr->text().isEmpty();
480     return ok;
481   }
482 }
483
484 //=================================================================================
485 // function : execute
486 // purpose  :
487 //=================================================================================
488 bool BasicGUI_CurveDlg::execute (ObjectList& objects)
489 {
490   bool res = false;
491
492   GEOM::GEOM_Object_var anObj;
493
494   GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation());
495
496   GEOM::ListOfGO_var points = new GEOM::ListOfGO();
497   points->length(myPoints.count());
498   for (int i = 0; i < myPoints.count(); i++)
499     points[i] = myPoints[i].copy();
500
501   switch (getConstructorId()) {
502   case 0 :
503     if (myBySelectionBtn->isChecked())
504       anObj = anOper->MakePolyline(points.in(), myGroupPoints->CheckButton1->isChecked());
505     else
506       anObj = anOper->MakeCurveParametricNew(qPrintable(myGroupParams->myXExpr->text()),
507                                              qPrintable(myGroupParams->myYExpr->text()),
508                                              qPrintable(myGroupParams->myZExpr->text()),
509                                              myGroupParams->myPMin->value(),
510                                              myGroupParams->myPMax->value(),
511                                              myGroupParams->myPStep->value(),
512                                              GEOM::Polyline);
513     res = true;
514     break;
515   case 1 :
516     if (myBySelectionBtn->isChecked())
517       anObj = anOper->MakeSplineBezier(points.in(), myGroupPoints->CheckButton1->isChecked());
518     else
519       anObj = anOper->MakeCurveParametricNew(qPrintable(myGroupParams->myXExpr->text()),
520                                              qPrintable(myGroupParams->myYExpr->text()),
521                                              qPrintable(myGroupParams->myZExpr->text()),
522                                              myGroupParams->myPMin->value(),
523                                              myGroupParams->myPMax->value(),
524                                              myGroupParams->myPStep->value(),
525                                              GEOM::Bezier);
526     res = true;
527     break;
528   case 2 :
529     if (myBySelectionBtn->isChecked()) {
530       bool disableTangents = (myGroupPoints->CheckButton1->isChecked() ||
531                               myGroupPoints->CheckButton2->isChecked());
532       if (!disableTangents && myGroupTangents->isChecked()) {
533         anObj = anOper->MakeSplineInterpolWithTangents(points.in(), myVec1.get(), myVec2.get());
534       }
535       else
536         anObj = anOper->MakeSplineInterpolation(points.in(), myGroupPoints->CheckButton1->isChecked(),
537                                                 myGroupPoints->CheckButton2->isChecked());
538     }
539     else
540       anObj = anOper->MakeCurveParametricNew(qPrintable(myGroupParams->myXExpr->text()),
541                                              qPrintable(myGroupParams->myYExpr->text()),
542                                              qPrintable(myGroupParams->myZExpr->text()),
543                                              myGroupParams->myPMin->value(),
544                                              myGroupParams->myPMax->value(),
545                                              myGroupParams->myPStep->value(),
546                                              GEOM::Interpolation);
547     res = true;
548     break;
549   }
550
551   if (!anObj->_is_nil()) {
552     if (myAnaliticalBtn->isChecked() && !IsPreview()) {
553       QStringList aParameters;
554       aParameters<<myGroupParams->myPMin->text();
555       aParameters<<myGroupParams->myPMax->text();
556       aParameters<<myGroupParams->myPStep->text();
557       anObj->SetParameters(aParameters.join(":").toLatin1().constData());
558     }
559     objects.push_back(anObj._retn());
560   }
561
562   return res;
563 }
564
565 //=================================================================================
566 // function : addSubshapesToStudy
567 // purpose  : virtual method to add new SubObjects if local selection
568 //=================================================================================
569 void BasicGUI_CurveDlg::addSubshapesToStudy()
570 {
571   for ( int i = 0; i < myPoints.count(); i++ )
572     GEOMBase::PublishSubObject( myPoints[i].get() );
573 }
574
575 //=================================================================================
576 // function : CreationModeChanged
577 // purpose  :
578 //=================================================================================
579 void BasicGUI_CurveDlg::CreationModeChanged()
580 {
581   const QObject* s = sender();
582   myGroupPoints->setVisible(myBySelectionBtn == s);
583   myGroupParams->setVisible(myBySelectionBtn != s);
584
585   ConstructorsClicked(getConstructorId());
586 }
587
588 //=================================================================================
589 // function : ValueChangedInSpinBox()
590 // purpose  :
591 //=================================================================================
592 void BasicGUI_CurveDlg::ValueChangedInSpinBox (double/*theValue*/)
593 {
594   processPreview();
595 }
596
597 //=================================================================================
598 // function : ValueChangedInSpinBox()
599 // purpose  :
600 //=================================================================================
601 void BasicGUI_CurveDlg::ValueChangedInSpinBox (int/*theValue*/)
602 {
603   processPreview();
604 }
605
606 //=================================================================================
607 // function : OnEditingFinished()
608 // purpose  :
609 //=================================================================================
610 void BasicGUI_CurveDlg::OnEditingFinished()
611 {
612   processPreview();
613 }