From 2e650d124a69623eb005fa513b763cc8b0782430 Mon Sep 17 00:00:00 2001 From: ouv Date: Mon, 14 Dec 2009 11:43:31 +0000 Subject: [PATCH] First compilable version --- src/GUI/NETGENPluginGUI_HypothesisCreator.cxx | 31 +++++++------------ src/GUI/NETGENPluginGUI_HypothesisCreator.h | 2 +- src/GUI/NETGENPluginGUI_SimpleCreator.cxx | 28 ++++++++--------- src/GUI/NETGENPluginGUI_SimpleCreator.h | 2 +- 4 files changed, 27 insertions(+), 36 deletions(-) diff --git a/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx b/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx index b3cc07f..ee2fffc 100644 --- a/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx @@ -37,8 +37,8 @@ #include #include - #include +#include #include #include @@ -69,7 +69,7 @@ NETGENPluginGUI_HypothesisCreator::~NETGENPluginGUI_HypothesisCreator() { } -bool NETGENPluginGUI_HypothesisCreator::checkParams(QString& msg) const +bool NETGENPluginGUI_HypothesisCreator::checkParams(QString& msg, QStringList& absentParams) const { NetgenHypothesisData data_old, data_new; readParamsFromHypo( data_old ); @@ -77,10 +77,10 @@ bool NETGENPluginGUI_HypothesisCreator::checkParams(QString& msg) const bool res = storeParamsToHypo( data_new ); storeParamsToHypo( data_old ); - res = myMaxSize->isValid(msg,true) && res; - res = myGrowthRate->isValid(msg,true) && res; ; - res = myNbSegPerEdge->isValid(msg,true) && res; - res = myNbSegPerRadius->isValid(msg,true) && res; + res = myMaxSize->isValid(msg,absentParams,true) && res; + res = myGrowthRate->isValid(msg,absentParams,true) && res; ; + res = myNbSegPerEdge->isValid(msg,absentParams,true) && res; + res = myNbSegPerRadius->isValid(msg,absentParams,true) && res; return res; } @@ -242,20 +242,20 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromHypo( NetgenHypothesisData HypothesisData* data = SMESH::GetHypothesisData( hypType() ); h_data.myName = isCreation() && data ? data->Label : ""; - SMESH::ListOfParameters_var aParameters = h->GetLastParameters(); + SALOME::StringArray* aParameters = h->GetParameters(); h_data.myMaxSize = h->GetMaxSize(); - h_data.myMaxSizeVar = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString(""); + h_data.myMaxSizeVar = (aParameters->length() > 0) ? QString(aParameters->operator[](0).in()) : QString(""); h_data.mySecondOrder = h->GetSecondOrder(); h_data.myOptimize = h->GetOptimize(); h_data.myFineness = (int) h->GetFineness(); h_data.myGrowthRate = h->GetGrowthRate(); - h_data.myGrowthRateVar = (aParameters->length() > 1) ? QString(aParameters[1].in()) : QString(""); + h_data.myGrowthRateVar = (aParameters->length() > 1) ? QString(aParameters->operator[](1).in()) : QString(""); h_data.myNbSegPerEdge = h->GetNbSegPerEdge(); - h_data.myNbSegPerEdgeVar = (aParameters->length() > 2) ? QString(aParameters[2].in()) : QString(""); + h_data.myNbSegPerEdgeVar = (aParameters->length() > 2) ? QString(aParameters->operator[](2).in()) : QString(""); h_data.myNbSegPerRadius = h->GetNbSegPerRadius(); - h_data.myNbSegPerRadiusVar = (aParameters->length() > 3) ? QString(aParameters[3].in()) : QString(""); + h_data.myNbSegPerRadiusVar = (aParameters->length() > 3) ? QString(aParameters->operator[](3).in()) : QString(""); if ( myIs2D ) { @@ -307,14 +307,7 @@ bool NETGENPluginGUI_HypothesisCreator::storeParamsToHypo( const NetgenHypothesi h_2d->SetQuadAllowed( h_data.myAllowQuadrangles ); } - h->SetParameters(aVariablesList.join(":").toLatin1().constData()); - if( fineness==UserDefined ) - { - h->SetParameters(aVariablesList.join(":").toLatin1().constData()); - h->SetParameters(aVariablesList.join(":").toLatin1().constData()); - h->SetParameters(aVariablesList.join(":").toLatin1().constData()); - } - + getNotebook()->setParameters( h, aVariablesList ); } catch(const SALOME::SALOME_Exception& ex) { diff --git a/src/GUI/NETGENPluginGUI_HypothesisCreator.h b/src/GUI/NETGENPluginGUI_HypothesisCreator.h index a23739e..80b906f 100644 --- a/src/GUI/NETGENPluginGUI_HypothesisCreator.h +++ b/src/GUI/NETGENPluginGUI_HypothesisCreator.h @@ -57,7 +57,7 @@ public: NETGENPluginGUI_HypothesisCreator( const QString& ); virtual ~NETGENPluginGUI_HypothesisCreator(); - virtual bool checkParams(QString& msg) const; + virtual bool checkParams(QString& msg, QStringList& absentParams) const; virtual QString helpPage() const; protected: diff --git a/src/GUI/NETGENPluginGUI_SimpleCreator.cxx b/src/GUI/NETGENPluginGUI_SimpleCreator.cxx index 3a9c871..210fa30 100644 --- a/src/GUI/NETGENPluginGUI_SimpleCreator.cxx +++ b/src/GUI/NETGENPluginGUI_SimpleCreator.cxx @@ -39,6 +39,7 @@ // SALOME GUI includes #include #include +#include // Qt includes #include @@ -83,14 +84,14 @@ NETGENPluginGUI_SimpleCreator::~NETGENPluginGUI_SimpleCreator() { } -bool NETGENPluginGUI_SimpleCreator::checkParams(QString& msg) const +bool NETGENPluginGUI_SimpleCreator::checkParams(QString& msg, QStringList& absentParams) const { bool result = true; - result = myNbSeg->isValid(msg,true) && result; - result = myLength->isValid(msg,true) && result; - result = myArea->isValid(msg,true) && result; + result = myNbSeg->isValid(msg,absentParams,true) && result; + result = myLength->isValid(msg,absentParams,true) && result; + result = myArea->isValid(msg,absentParams,true) && result; if (myVolume) - result = myVolume->isValid(msg,true) && result; + result = myVolume->isValid(msg,absentParams,true) && result; return result; } @@ -243,7 +244,7 @@ void NETGENPluginGUI_SimpleCreator::retrieveParams() const // set values of hypothesis - SMESH::ListOfParameters_var aParameters = h->GetLastParameters(); + SALOME::StringArray* aParameters = h->GetParameters(); // 1D int nbSeg = isCreation() ? dfltNbSeg : (int) h->GetNumberOfSegments(); @@ -253,7 +254,7 @@ void NETGENPluginGUI_SimpleCreator::retrieveParams() const if ( nbSeg ) { myLength->setEnabled( false ); myNbSeg->setEnabled( true ); - aPrm = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString(""); + aPrm = (aParameters->length() > 0) ? QString(aParameters->operator[](0).in()) : QString(""); if(aPrm.isEmpty()) myNbSeg->setValue( nbSeg ); else @@ -262,7 +263,7 @@ void NETGENPluginGUI_SimpleCreator::retrieveParams() const else { myNbSeg->setEnabled( false ); myLength->setEnabled( true ); - aPrm = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString(""); + aPrm = (aParameters->length() > 0) ? QString(aParameters->operator[](0).in()) : QString(""); if(aPrm.isEmpty()) myLength->setValue( h->GetLocalLength() ); else @@ -273,7 +274,7 @@ void NETGENPluginGUI_SimpleCreator::retrieveParams() const if ( double area = h->GetMaxElementArea() ) { myLenFromEdgesCheckBox->setChecked( false ); myArea->setEnabled( true ); - aPrm = (aParameters->length() > 1) ? QString(aParameters[1].in()) : QString(""); + aPrm = (aParameters->length() > 1) ? QString(aParameters->operator[](1).in()) : QString(""); if(aPrm.isEmpty()) myArea->setValue( area ); else @@ -290,7 +291,7 @@ void NETGENPluginGUI_SimpleCreator::retrieveParams() const if ( double volume = (double) h->GetMaxElementVolume() ) { myLenFromFacesCheckBox->setChecked( false ); myVolume->setEnabled( true ); - aPrm = (aParameters->length() > 2) ? QString(aParameters[2].in()) : QString(""); + aPrm = (aParameters->length() > 2) ? QString(aParameters->operator[](2).in()) : QString(""); if(aPrm.isEmpty()) myVolume->setValue( volume ); else @@ -329,8 +330,6 @@ QString NETGENPluginGUI_SimpleCreator::storeParams() const aVariablesList.append(myLength->text()); } - h->SetParameters(aVariablesList.join(":").toLatin1().constData()); - // 2D if ( myArea->isEnabled() ) { h->SetMaxElementArea( myArea->value() ); @@ -343,8 +342,6 @@ QString NETGENPluginGUI_SimpleCreator::storeParams() const aVariablesList.append(QString()); } - h->SetParameters(aVariablesList.join(":").toLatin1().constData()); - // 3D if ( myVolume ) { NETGENPlugin_SimpleHypothesis_3D_var h = @@ -359,8 +356,9 @@ QString NETGENPluginGUI_SimpleCreator::storeParams() const valStr += "; lenFromFaces"; aVariablesList.append(QString()); } - h->SetParameters(aVariablesList.join(":").toLatin1().constData()); } + + getNotebook()->setParameters( h, aVariablesList ); } catch(const SALOME::SALOME_Exception& ex) { diff --git a/src/GUI/NETGENPluginGUI_SimpleCreator.h b/src/GUI/NETGENPluginGUI_SimpleCreator.h index 4b7bb88..4f7834b 100644 --- a/src/GUI/NETGENPluginGUI_SimpleCreator.h +++ b/src/GUI/NETGENPluginGUI_SimpleCreator.h @@ -45,7 +45,7 @@ public: NETGENPluginGUI_SimpleCreator(const QString& theHypType); virtual ~NETGENPluginGUI_SimpleCreator(); - virtual bool checkParams(QString& msg) const; + virtual bool checkParams(QString& msg, QStringList& absentParams) const; virtual QString helpPage() const; protected: -- 2.30.2