From f58f52a55937780426b1475e75ed65d3162207eb Mon Sep 17 00:00:00 2001 From: rnv Date: Mon, 1 Dec 2008 13:26:07 +0000 Subject: [PATCH] *** empty log message *** --- src/GUI/NETGENPluginGUI_SimpleCreator.cxx | 49 ++++++++++++++++--- src/GUI/NETGENPluginGUI_SimpleCreator.h | 4 +- .../NETGENPlugin_SimpleHypothesis_2D_i.cxx | 2 +- 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/src/GUI/NETGENPluginGUI_SimpleCreator.cxx b/src/GUI/NETGENPluginGUI_SimpleCreator.cxx index 5456c25..786b149 100644 --- a/src/GUI/NETGENPluginGUI_SimpleCreator.cxx +++ b/src/GUI/NETGENPluginGUI_SimpleCreator.cxx @@ -27,6 +27,7 @@ #include #include #include +#include // IDL includes #include CORBA_SERVER_HEADER(NETGENPlugin_Algorithm) @@ -36,7 +37,7 @@ // SALOME GUI includes #include -#include +#include // Qt includes #include @@ -129,7 +130,7 @@ QFrame* NETGENPluginGUI_SimpleCreator::buildFrame() // * number of segments myNbSegRadioBut = new QRadioButton( tr( "SMESH_NB_SEGMENTS_HYPOTHESIS" ), dimGroup ); - myNbSeg = new QtxIntSpinBox( dimGroup ); + myNbSeg = new SalomeApp_IntSpinBox( dimGroup ); myNbSeg->setMinimum( 1 ); myNbSeg->setMaximum( 9999 ); myNbSeg->setValue( 1 ); @@ -217,26 +218,41 @@ void NETGENPluginGUI_SimpleCreator::retrieveParams() const NETGENPlugin::NETGENPlugin_SimpleHypothesis_2D_var h = NETGENPlugin::NETGENPlugin_SimpleHypothesis_2D::_narrow( initParamsHypothesis() ); + SMESH::ListOfParameters_var aParameters = h->GetLastParameters(); + // 1D int nbSeg = (int) h->GetNumberOfSegments(); myNbSegRadioBut->setChecked( nbSeg ); myLengthRadioBut->setChecked( !nbSeg ); + QString aPrm; if ( nbSeg ) { myLength->setEnabled( false ); myNbSeg->setEnabled( true ); - myNbSeg->setValue( nbSeg ); + aPrm = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString(""); + if(aPrm.isEmpty()) + myNbSeg->setValue( nbSeg ); + else + myNbSeg->setText(aPrm); } else { myNbSeg->setEnabled( false ); myLength->setEnabled( true ); - myLength->setValue( h->GetLocalLength() ); + aPrm = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString(""); + if(aPrm.isEmpty()) + myLength->setValue( h->GetLocalLength() ); + else + myLength->setText(aPrm); } // 2D if ( double area = h->GetMaxElementArea() ) { myLenFromEdgesCheckBox->setChecked( false ); myArea->setEnabled( true ); - myArea->setValue( area ); + aPrm = (aParameters->length() > 1) ? QString(aParameters[1].in()) : QString(""); + if(aPrm.isEmpty()) + myArea->setValue( area ); + else + myArea->setText( aPrm ); } else { myLenFromEdgesCheckBox->setChecked( true ); @@ -250,7 +266,11 @@ void NETGENPluginGUI_SimpleCreator::retrieveParams() const if ( double volume = (double) h->GetMaxElementVolume() ) { myLenFromFacesCheckBox->setChecked( false ); myVolume->setEnabled( true ); - myVolume->setValue( volume ); + aPrm = (aParameters->length() > 2) ? QString(aParameters[2].in()) : QString(""); + if(aPrm.isEmpty()) + myVolume->setValue( volume ); + else + myVolume->setText( aPrm ); } else { myLenFromFacesCheckBox->setChecked( true ); @@ -270,26 +290,37 @@ QString NETGENPluginGUI_SimpleCreator::storeParams() const if( isCreation() ) SMESH::SetName( SMESH::FindSObject( h ), myName->text().toLatin1().data() ); + + // 1D + QStringList aVariablesList; if ( myNbSeg->isEnabled() ) { h->SetNumberOfSegments( myNbSeg->value() ); valStr += "nbSeg=" + myNbSeg->text(); + aVariablesList.append(myNbSeg->text()); } else { h->SetLocalLength( myLength->value() ); - valStr += "len=" + myNbSeg->text(); + valStr += "len=" + myLength->text(); + aVariablesList.append(myLength->text()); } + + h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); // 2D if ( myArea->isEnabled() ) { h->SetMaxElementArea( myArea->value() ); valStr += "; area=" + myArea->text(); + aVariablesList.append(myArea->text()); } else { h->LengthFromEdges(); valStr += "; lenFromEdges"; + aVariablesList.append(QString()); } + h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); + // 3D if ( myVolume ) { NETGENPlugin::NETGENPlugin_SimpleHypothesis_3D_var h = @@ -297,11 +328,15 @@ QString NETGENPluginGUI_SimpleCreator::storeParams() const if ( myVolume->isEnabled() ) { h->SetMaxElementVolume( myVolume->value() ); valStr += "; vol=" + myVolume->text(); + aVariablesList.append( myVolume->text()); + h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); } else { h->LengthFromFaces(); valStr += "; lenFromFaces"; + aVariablesList.append(QString()); } + h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); } } catch(const SALOME::SALOME_Exception& ex) diff --git a/src/GUI/NETGENPluginGUI_SimpleCreator.h b/src/GUI/NETGENPluginGUI_SimpleCreator.h index 483bb4e..f971b65 100644 --- a/src/GUI/NETGENPluginGUI_SimpleCreator.h +++ b/src/GUI/NETGENPluginGUI_SimpleCreator.h @@ -31,7 +31,7 @@ class QCheckBox; class QLineEdit; class QRadioButton; -class QtxIntSpinBox; +class SalomeApp_IntSpinBox; class SMESHGUI_SpinBox; class NETGENPLUGIN_EXPORT NETGENPluginGUI_SimpleCreator : public SMESHGUI_GenericHypothesisCreator @@ -60,7 +60,7 @@ protected slots: private: QLineEdit * myName; - QtxIntSpinBox* myNbSeg; + SalomeApp_IntSpinBox* myNbSeg; SMESHGUI_SpinBox* myLength; QRadioButton* myNbSegRadioBut, *myLengthRadioBut; diff --git a/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.cxx b/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.cxx index 1b49fee..189b362 100644 --- a/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.cxx +++ b/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.cxx @@ -114,7 +114,7 @@ void NETGENPlugin_SimpleHypothesis_2D_i::SetLocalLength(CORBA::Double segmentLen catch (SALOME_Exception& S_ex) { THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM ); } - SMESH::TPythonDump() << _this() << ".LocalLength( " << segmentLength << " )"; + SMESH::TPythonDump() << _this() << ".SetLocalLength( " << segmentLength << " )"; } //================================================================================ -- 2.30.2