First compilable version

This commit is contained in:
ouv 2009-12-14 11:43:31 +00:00
parent 10fc3eb3e0
commit 2e650d124a
4 changed files with 27 additions and 36 deletions

View File

@ -37,8 +37,8 @@
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Tools.h>
#include <SalomeApp_DoubleSpinBox.h>
#include <SalomeApp_Notebook.h>
#include <QComboBox>
#include <QLabel>
@ -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)
{

View File

@ -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:

View File

@ -39,6 +39,7 @@
// SALOME GUI includes
#include <SalomeApp_Tools.h>
#include <SalomeApp_IntSpinBox.h>
#include <SalomeApp_Notebook.h>
// Qt includes
#include <QLabel>
@ -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)
{

View File

@ -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: