X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FBasicGUI%2FBasicGUI_CurveDlg.cxx;h=c964983aeb9504c9c40cbd62536ca93fdfebf290;hb=b0fbfd05c463a14c0d926a53711aafdf2c0b6fad;hp=69a25e85765ea0305b347c21b85f45e9e395f699;hpb=9499b99fe2dcb53e1ea364f97986f8f432b04600;p=modules%2Fgeom.git diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx index 69a25e857..c964983ae 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.cxx +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -1,85 +1,119 @@ -// GEOM GEOMGUI : GUI for Geometry component +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File : BasicGUI_CurveDlg.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ -#include "BasicGUI_CurveDlg.h" +// GEOM GEOMGUI : GUI for Geometry component +// File : BasicGUI_CurveDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include "BasicGUI_CurveDlg.h" +#include "BasicGUI_ParamCurveWidget.h" -#include +#include +#include +#include -#include "utilities.h" +#include +#include +#include +#include +#include -#include "SALOME_ListIteratorOfListIO.hxx" -#include "SALOME_ListIO.hxx" +#include +#include -#include "GEOMImpl_Types.hxx" +#include +#include +#include +#include +#include -using namespace std; -#include +#include //================================================================================= // class : BasicGUI_CurveDlg() -// purpose : Constructs a BasicGUI_CurveDlg which is a child of 'parent', with the +// purpose : Constructs a BasicGUI_CurveDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_CurveDlg::BasicGUI_CurveDlg(GeometryGUI* theGeometryGUI, QWidget* parent, - const char* name, bool modal, WFlags fl) - :GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BasicGUI_CurveDlg::BasicGUI_CurveDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { - QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POLYLINE"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SPLINE"))); - QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BEZIER"))); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POLYLINE" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SPLINE" ) ) ); + QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BEZIER" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); - - setCaption(tr("GEOM_CURVE_TITLE")); + setWindowTitle( tr( "GEOM_CURVE_TITLE" ) ); /***************************************************************/ - RadioButton1->setPixmap( image0 ); - RadioButton2->setPixmap( image3 ); - RadioButton3->setPixmap( image2 ); + mainFrame()->RadioButton1->setIcon( image0 ); + mainFrame()->RadioButton2->setIcon( image3 ); + mainFrame()->RadioButton3->setIcon( image2 ); + + QGroupBox* creationModeCroup = new QGroupBox(this); + QButtonGroup* bg = new QButtonGroup(this); + + creationModeCroup->setTitle( tr( "GEOM_CURVE_CRMODE" ) ); + QHBoxLayout * creationModeLayout = new QHBoxLayout(creationModeCroup); + myBySelectionBtn = new QRadioButton( tr( "GEOM_CURVE_SELECTION" ) ,creationModeCroup ); + myAnaliticalBtn = new QRadioButton( tr( "GEOM_CURVE_ANALITICAL" ) ,creationModeCroup ); + + bg->addButton(myBySelectionBtn); + bg->addButton(myAnaliticalBtn); + + creationModeLayout->addWidget(myBySelectionBtn); + creationModeLayout->addWidget(myAnaliticalBtn); + + GroupPoints = new DlgRef_1Sel3Check( centralWidget() ); - GroupPoints = new DlgRef_1Sel_QTD( this, "GroupPoints" ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_NODES" ) ); - GroupPoints->TextLabel1->setText( tr("GEOM_POINTS") ); - GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->TextLabel1->setText( tr( "GEOM_POINTS" ) ); + GroupPoints->PushButton1->setIcon( image1 ); + GroupPoints->PushButton1->setDown( true ); GroupPoints->LineEdit1->setReadOnly( true ); - Layout1->addWidget(GroupPoints, 2, 0); + GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) ); + GroupPoints->CheckButton1->setChecked(false); + //GroupPoints->CheckButton1->hide(); + + GroupPoints->CheckButton2->setText( tr( "GEOM_IS_REORDER" ) ); + GroupPoints->CheckButton2->setChecked(false); + GroupPoints->CheckButton2->hide(); + + GroupPoints->CheckButton3->hide(); + + myParams = new BasicGUI_ParamCurveWidget( centralWidget() ); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( creationModeCroup ); + layout->addWidget( GroupPoints ); + layout->addWidget( myParams ); /***************************************************************/ - setHelpFileName("curve.htm"); + setHelpFileName( "create_curve_page.html" ); Init(); } @@ -103,28 +137,66 @@ void BasicGUI_CurveDlg::Init() /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; - myPoints = new GEOM::ListOfGO(); - myPoints->length( 0 ); + myPoints.clear(); - globalSelection( GEOM_POINT ); + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); - /* signals and slots connections */ - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + showOnlyPreviewControl(); + myBySelectionBtn->setChecked(true); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr ? resMgr->doubleValue( "Geometry", "SettingsGeomStep", 10. ) : 10.; + + double aMax( 100. ), aMin( 0.0 ); + + /* min, max, step and decimals for spin boxes & initial values */ + initSpinBox( myParams->myPMin, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( myParams->myPMax, COORD_MIN, COORD_MAX, step, "length_precision" ); + myParams->myPStep->setValue( 10 ); + myParams->myPStep->setMaximum( 999 ); + myParams->myPStep->setSingleStep( 10 ); + myParams->myPMin->setValue( aMin ); + myParams->myPMax->setValue( aMax ); + myParams->myPStep->setValue( step ); + myParams->myXExpr->setText("t"); + myParams->myYExpr->setText("t"); + myParams->myZExpr->setText("t"); - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + myParams->hide(); + + /* signals and slots connections */ + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog( ) ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); + + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + + connect( GroupPoints->CheckButton1, SIGNAL( toggled(bool) ), this, SLOT( CheckButtonToggled() ) ); + connect( GroupPoints->CheckButton2, SIGNAL( toggled(bool) ), this, SLOT( CheckButtonToggled() ) ); + + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + connect( myBySelectionBtn, SIGNAL( clicked() ), this, SLOT( CreationModeChanged() ) ); + connect( myAnaliticalBtn, SIGNAL( clicked() ), this, SLOT( CreationModeChanged() ) ); + + connect(myParams->myPMin, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(myParams->myPMax, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(myParams->myPStep, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int))); + + connect(myParams->myXExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished())); + connect(myParams->myYExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished())); + connect(myParams->myZExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished())); initName( tr( "GEOM_CURVE" ) ); - ConstructorsClicked( 0 ); + resize(100,100); + ConstructorsClicked( 0 ); } //================================================================================= @@ -134,12 +206,31 @@ void BasicGUI_CurveDlg::Init() void BasicGUI_CurveDlg::ConstructorsClicked( int id ) { QString aTitle = tr( id == 0 ? "GEOM_POLYLINE" : id == 1 ? "GEOM_BEZIER" : "GEOM_INTERPOL" ); - GroupConstructors->setTitle( aTitle ); - - myPoints = new GEOM::ListOfGO(); - myPoints->length( 0 ); + mainFrame()->GroupConstructors->setTitle( aTitle ); - myEditCurrentArgument->setText(""); + if (id == 0) { // polyline (wire) + //GroupPoints->CheckButton1->hide(); + GroupPoints->CheckButton1->setText( tr( "GEOM_BUILD_CLOSED_WIRE" ) ); + GroupPoints->CheckButton2->hide(); + } + else if (id == 1) { // bezier + //GroupPoints->CheckButton1->hide(); + GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) ); + GroupPoints->CheckButton2->hide(); + } + else { // b-spline + //GroupPoints->CheckButton1->show(); + GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) ); + GroupPoints->CheckButton2->show(); + } + + myPoints.clear(); + + myEditCurrentArgument->setText( "" ); + qApp->processEvents(); + updateGeometry(); + resize( minimumSizeHint() ); + SelectionIntoArgument(); } @@ -149,24 +240,19 @@ void BasicGUI_CurveDlg::ConstructorsClicked( int id ) //================================================================================= void BasicGUI_CurveDlg::SetEditCurrentArgument() { - if ( sender() == GroupPoints->PushButton1 ) + if ( sender() == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setFocus(); SelectionIntoArgument(); } - //================================================================================= -// function : LineEditReturnPressed() +// function : CheckButtonToggled() // purpose : //================================================================================= -void BasicGUI_CurveDlg::LineEditReturnPressed() +void BasicGUI_CurveDlg::CheckButtonToggled() { - if ( sender() == GroupPoints->LineEdit1 ) - { - myEditCurrentArgument = GroupPoints->LineEdit1; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + processPreview(); } //================================================================================= @@ -175,6 +261,7 @@ void BasicGUI_CurveDlg::LineEditReturnPressed() //================================================================================= void BasicGUI_CurveDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -189,68 +276,34 @@ bool BasicGUI_CurveDlg::ClickOnApply() return false; initName(); - ConstructorsClicked( getConstructorId() ); + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); return true; } -//======================================================================= -// function : ClickOnCancel() -// purpose : -//======================================================================= -void BasicGUI_CurveDlg::ClickOnCancel() -{ - GEOMBase_Skeleton::ClickOnCancel(); -} - -//================================================================================= -/*! function : isPointInList() - * purpose : Check is point (theObject) in the list \a thePoints. - * \author enk - * \retval -1, if point not in list, else 1 in list - */ -//================================================================================= -static int isPointInList(list& thePoints, - GEOM::GEOM_Object_var& theObject) -{ - int len = thePoints.size(); - - if(len<1){ - return -1; - } - - for(list::iterator i=thePoints.begin();i!=thePoints.end();i++) - if (string((*i)->GetEntry()) == string(theObject->GetEntry())){ - return 1; - } - - return -1; -} -//================================================================================= -/*! function : removeUnnecessaryPnt() - * purpose : Remove unnecessary points from list \a theOldPoints - * \author enk - * \li \a theOldPoints - ordered sequence with unnecessary point - * \li \a theNewPoints - not ordered sequence with necessary points - */ -//================================================================================= -static void removeUnnecessaryPnt(list& theOldPoints, - GEOM::ListOfGO_var& theNewPoints) +static void synchronize( QList& left, QList& right ) { - list objs_to_remove; - for(list::iterator i=theOldPoints.begin();i!=theOldPoints.end();i++){ + // 1. remove items from the "left" list that are not in the "right" list + QMutableListIterator it1( left ); + while ( it1.hasNext() ) { + GEOM::GeomObjPtr o1 = it1.next(); bool found = false; - for (int j=0;jlength() && !found ; j++){ - if(string((*i)->GetEntry()) == string(theNewPoints[j]->GetEntry())){ - found = true; - } - } - if(!found){ - objs_to_remove.push_back(*i); - //cout << "removed: " << (*i)->GetEntry() << endl; - } + QMutableListIterator it2( right ); + while ( it2.hasNext() && !found ) + found = o1 == it2.next(); + if ( !found ) + it1.remove(); } - for(list::iterator i=objs_to_remove.begin();i!=objs_to_remove.end();i++){ - theOldPoints.remove(*i); + // 2. add items from the "right" list that are not in the "left" list (to keep selection order) + it1 = right; + while ( it1.hasNext() ) { + GEOM::GeomObjPtr o1 = it1.next(); + bool found = false; + QMutableListIterator it2( left ); + while ( it2.hasNext() && !found ) + found = o1 == it2.next(); + if ( !found ) + left << o1; } } @@ -260,45 +313,13 @@ static void removeUnnecessaryPnt(list& theOldPoints, //================================================================================= void BasicGUI_CurveDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText(""); - - Standard_Boolean aRes = Standard_False; - int i = 0; - int IOC = IObjectCount(); - bool is_append = myPoints->length() < IOC; // if true - add point, else remove - myPoints->length( IOC ); // this length may be greater than number of objects, - // that will actually be put into myPoints - for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() ) - { - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) - { - //TopoDS_Shape aPointShape; - //if ( myGeomBase->GetShape( aSelectedObject, aPointShape, TopAbs_VERTEX ) ) - int pos = isPointInList(myOrderedSel,aSelectedObject); - if(is_append && pos==-1) - myOrderedSel.push_back(aSelectedObject); - myPoints[i++] = aSelectedObject; - } - } - - myPoints->length( i ); // this is the right length, smaller of equal to the previously set - if(IOC == 0) - myOrderedSel.clear(); + QList points = getSelected( TopAbs_VERTEX, -1 ); + synchronize( myPoints, points ); + if ( !myPoints.isEmpty() ) + GroupPoints->LineEdit1->setText( QString::number( myPoints.count() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) ); else - removeUnnecessaryPnt(myOrderedSel,myPoints); - - if(myOrderedSel.size() == myPoints->length()){ - int k=0; - for (list::iterator j=myOrderedSel.begin();j!=myOrderedSel.end();j++) - myPoints[k++] = *j; - } else { - //cout << "ERROR: Ordered sequence size != selection sequence size! ("<length()<<")"<LineEdit1->setText( QString::number( i ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) ); - - displayPreview(); + GroupPoints->LineEdit1->setText( "" ); + processPreview(); } @@ -309,12 +330,12 @@ void BasicGUI_CurveDlg::SelectionIntoArgument() void BasicGUI_CurveDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( SelectionIntoArgument() ) ); - // myGeomGUI->SetState( 0 ); + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); - globalSelection( GEOM_POINT ); ConstructorsClicked( getConstructorId() ); } @@ -332,9 +353,9 @@ void BasicGUI_CurveDlg::DeactivateActiveDialog() // function : enterEvent() // purpose : //================================================================================= -void BasicGUI_CurveDlg::enterEvent(QEvent* e) +void BasicGUI_CurveDlg::enterEvent( QEvent* ) { - if ( !GroupConstructors->isEnabled() ) + if ( !mainFrame()->GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -353,7 +374,17 @@ GEOM::GEOM_IOperations_ptr BasicGUI_CurveDlg::createOperation() //================================================================================= bool BasicGUI_CurveDlg::isValid( QString& msg ) { - return myPoints->length() > 1; + if( myBySelectionBtn->isChecked() ) + return myPoints.count() > 1; + else { + bool ok = myParams->myPMin->isValid( msg, !IsPreview() ) && + myParams->myPMax->isValid( msg, !IsPreview() ) && + myParams->myPStep->isValid( msg, !IsPreview() ); + ok &= !myParams->myXExpr->text().isEmpty(); + ok &= !myParams->myYExpr->text().isEmpty(); + ok &= !myParams->myZExpr->text().isEmpty(); + return ok; + } } //================================================================================= @@ -366,34 +397,115 @@ bool BasicGUI_CurveDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) - { + GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() ); + + GEOM::ListOfGO_var points = new GEOM::ListOfGO(); + points->length( myPoints.count() ); + for ( int i = 0; i < myPoints.count(); i++ ) + points[i] = myPoints[i].copy(); + + switch ( getConstructorId() ) { case 0 : - anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakePolyline( myPoints ); + if( myBySelectionBtn->isChecked() ) + anObj = anOper->MakePolyline( points.in(), GroupPoints->CheckButton1->isChecked() ); + else + anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()), + qPrintable(myParams->myYExpr->text()), + qPrintable(myParams->myZExpr->text()), + myParams->myPMin->value(), + myParams->myPMax->value(), + myParams->myPStep->value(), + GEOM::Polyline); res = true; break; case 1 : - anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSplineBezier( myPoints ); + if( myBySelectionBtn->isChecked() ) + anObj = anOper->MakeSplineBezier( points.in(), GroupPoints->CheckButton1->isChecked() ); + else + anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()), + qPrintable(myParams->myYExpr->text()), + qPrintable(myParams->myZExpr->text()), + myParams->myPMin->value(), + myParams->myPMax->value(), + myParams->myPStep->value(), + GEOM::Bezier); + res = true; break; case 2 : - anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSplineInterpolation( myPoints ); + if( myBySelectionBtn->isChecked() ) + anObj = anOper->MakeSplineInterpolation( points.in(), GroupPoints->CheckButton1->isChecked(), + GroupPoints->CheckButton2->isChecked() ); + else + anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()), + qPrintable(myParams->myYExpr->text()), + qPrintable(myParams->myZExpr->text()), + myParams->myPMin->value(), + myParams->myPMax->value(), + myParams->myPStep->value(), + GEOM::Interpolation); res = true; break; } - if ( !anObj->_is_nil() ) + if ( !anObj->_is_nil() ) { + if(myAnaliticalBtn->isChecked() && !IsPreview()) { + QStringList aParameters; + aParameters<myPMin->text(); + aParameters<myPMax->text(); + aParameters<myPStep->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } objects.push_back( anObj._retn() ); - + } + return res; } //================================================================================= -// function : closeEvent +// function : addSubshapeToStudy +// purpose : virtual method to add new SubObjects if local selection +//================================================================================= +void BasicGUI_CurveDlg::addSubshapesToStudy() +{ + for ( int i = 0; i < myPoints.count(); i++ ) + GEOMBase::PublishSubObject( myPoints[i].get() ); +} + +//================================================================================= +// function : CreationModeChanged +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::CreationModeChanged() { + const QObject* s = sender(); + GroupPoints->setVisible(myBySelectionBtn == s); + myParams->setVisible(myBySelectionBtn != s); + + ConstructorsClicked( getConstructorId() ); +} + +//================================================================================= +// function : ValueChangedInSpinBox() // purpose : //================================================================================= -void BasicGUI_CurveDlg::closeEvent( QCloseEvent* e ) +void BasicGUI_CurveDlg::ValueChangedInSpinBox(double/*theValue*/) { - GEOMBase_Skeleton::closeEvent( e ); + processPreview(); } +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::ValueChangedInSpinBox(int/*theValue*/) +{ + processPreview(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::OnEditingFinished() { + processPreview(); +}