0021308: Remove hard-coded dependency of the external mesh plugins from the SMESH module
Call h->SetVarParameter() instead of h->SetParameters()
This commit is contained in:
parent
f4f7958614
commit
403e97bf9c
@ -374,22 +374,20 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromHypo( NetgenHypothesisData
|
||||
HypothesisData* data = SMESH::GetHypothesisData( hypType() );
|
||||
h_data.myName = isCreation() && data ? data->Label : "";
|
||||
|
||||
SMESH::ListOfParameters_var aParameters = h->GetLastParameters();
|
||||
|
||||
h_data.myMaxSize = h->GetMaxSize();
|
||||
h_data.myMaxSizeVar = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
|
||||
h_data.myMaxSizeVar = getVariableName("SetMaxSize");
|
||||
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 = getVariableName("SetGrowthRate");
|
||||
h_data.myNbSegPerEdge = h->GetNbSegPerEdge();
|
||||
h_data.myNbSegPerEdgeVar = (aParameters->length() > 2) ? QString(aParameters[2].in()) : QString("");
|
||||
h_data.myNbSegPerEdgeVar = getVariableName("SetNbSegPerEdge");
|
||||
h_data.myNbSegPerRadius = h->GetNbSegPerRadius();
|
||||
h_data.myNbSegPerRadiusVar = (aParameters->length() > 3) ? QString(aParameters[3].in()) : QString("");
|
||||
h_data.myNbSegPerRadiusVar = getVariableName("SetNbSegPerRadius");
|
||||
h_data.myMinSize = h->GetMinSize();
|
||||
h_data.myMinSizeVar = (aParameters->length() > 4) ? QString(aParameters[4].in()) : QString("");
|
||||
h_data.myMinSizeVar = getVariableName("SetMinSize");
|
||||
|
||||
if ( myIs2D )
|
||||
{
|
||||
@ -418,7 +416,7 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromHypo( NetgenHypothesisData
|
||||
}
|
||||
that->myLocalSizeMap[entry] = valstring;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -432,9 +430,8 @@ bool NETGENPluginGUI_HypothesisCreator::storeParamsToHypo( const NetgenHypothesi
|
||||
{
|
||||
if( isCreation() )
|
||||
SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().data() );
|
||||
QStringList aVariablesList;
|
||||
h->SetVarParameter( h_data.myMaxSizeVar.toLatin1().constData(), "SetMaxSize");
|
||||
h->SetMaxSize( h_data.myMaxSize );
|
||||
aVariablesList.append(h_data.myMaxSizeVar);
|
||||
h->SetSecondOrder( h_data.mySecondOrder );
|
||||
h->SetOptimize( h_data.myOptimize );
|
||||
int fineness = h_data.myFineness;
|
||||
@ -442,16 +439,15 @@ bool NETGENPluginGUI_HypothesisCreator::storeParamsToHypo( const NetgenHypothesi
|
||||
|
||||
if( fineness==UserDefined )
|
||||
{
|
||||
h->SetVarParameter( h_data.myGrowthRateVar.toLatin1().constData(), "SetGrowthRate");
|
||||
h->SetGrowthRate( h_data.myGrowthRate );
|
||||
h->SetVarParameter( h_data.myNbSegPerEdgeVar.toLatin1().constData(), "SetNbSegPerEdge");
|
||||
h->SetNbSegPerEdge( h_data.myNbSegPerEdge );
|
||||
h->SetVarParameter( h_data.myNbSegPerRadiusVar.toLatin1().constData(), "SetNbSegPerRadius");
|
||||
h->SetNbSegPerRadius( h_data.myNbSegPerRadius );
|
||||
|
||||
aVariablesList.append(h_data.myGrowthRateVar);
|
||||
aVariablesList.append(h_data.myNbSegPerEdgeVar);
|
||||
aVariablesList.append(h_data.myNbSegPerRadiusVar);
|
||||
}
|
||||
h->SetVarParameter( h_data.myMinSizeVar.toLatin1().constData(), "SetMinSize");
|
||||
h->SetMinSize( h_data.myMinSize );
|
||||
aVariablesList.append(h_data.myMinSizeVar);
|
||||
|
||||
if ( myIs2D )
|
||||
{
|
||||
@ -462,15 +458,6 @@ 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());
|
||||
}
|
||||
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
|
||||
|
||||
QMapIterator<QString,QString> i(myLocalSizeMap);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
|
@ -263,7 +263,7 @@ void NETGENPluginGUI_SimpleCreator::retrieveParams() const
|
||||
if ( nbSeg ) {
|
||||
myLength->setEnabled( false );
|
||||
myNbSeg->setEnabled( true );
|
||||
aPrm = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
|
||||
aPrm = getVariableName("SetNumberOfSegments");
|
||||
if(aPrm.isEmpty())
|
||||
myNbSeg->setValue( nbSeg );
|
||||
else
|
||||
@ -272,7 +272,7 @@ void NETGENPluginGUI_SimpleCreator::retrieveParams() const
|
||||
else {
|
||||
myNbSeg->setEnabled( false );
|
||||
myLength->setEnabled( true );
|
||||
aPrm = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
|
||||
aPrm = getVariableName("SetLocalLength");
|
||||
if(aPrm.isEmpty())
|
||||
myLength->setValue( h->GetLocalLength() );
|
||||
else
|
||||
@ -283,7 +283,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 = getVariableName("SetMaxElementArea");
|
||||
if(aPrm.isEmpty())
|
||||
myArea->setValue( area );
|
||||
else
|
||||
@ -302,7 +302,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 = getVariableName("SetMaxElementVolume");
|
||||
if(aPrm.isEmpty())
|
||||
myVolume->setValue( volume );
|
||||
else
|
||||
@ -329,51 +329,43 @@ QString NETGENPluginGUI_SimpleCreator::storeParams() const
|
||||
|
||||
|
||||
// 1D
|
||||
QStringList aVariablesList;
|
||||
if ( myNbSeg->isEnabled() ) {
|
||||
h->SetVarParameter( myNbSeg->text().toLatin1().constData(), "SetNumberOfSegments");
|
||||
h->SetNumberOfSegments( myNbSeg->value() );
|
||||
valStr += "nbSeg=" + myNbSeg->text();
|
||||
aVariablesList.append(myNbSeg->text());
|
||||
}
|
||||
else {
|
||||
h->SetVarParameter( myLength->text().toLatin1().constData(), "SetLocalLength");
|
||||
h->SetLocalLength( myLength->value() );
|
||||
valStr += "len=" + myLength->text();
|
||||
aVariablesList.append(myLength->text());
|
||||
}
|
||||
|
||||
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
|
||||
|
||||
// 2D
|
||||
if ( myArea->isEnabled() ) {
|
||||
h->SetVarParameter( myArea->text().toLatin1().constData(), "SetMaxElementArea");
|
||||
h->SetMaxElementArea( myArea->value() );
|
||||
valStr += "; area=" + myArea->text();
|
||||
aVariablesList.append(myArea->text());
|
||||
}
|
||||
else {
|
||||
h->LengthFromEdges();
|
||||
valStr += "; lenFromEdges";
|
||||
aVariablesList.append(QString());
|
||||
}
|
||||
if ( myAllowQuadCheckBox )
|
||||
h->SetAllowQuadrangles( myAllowQuadCheckBox->isChecked() );
|
||||
|
||||
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
|
||||
|
||||
// 3D
|
||||
if ( myVolume ) {
|
||||
NETGENPlugin_SimpleHypothesis_3D_var h =
|
||||
NETGENPlugin_SimpleHypothesis_3D::_narrow( hypothesis() );
|
||||
if ( myVolume->isEnabled() ) {
|
||||
h->SetVarParameter( myVolume->text().toLatin1().constData(), "SetMaxElementVolume");
|
||||
h->SetMaxElementVolume( myVolume->value() );
|
||||
valStr += "; vol=" + myVolume->text();
|
||||
aVariablesList.append( myVolume->text());
|
||||
}
|
||||
else {
|
||||
h->LengthFromFaces();
|
||||
valStr += "; lenFromFaces";
|
||||
aVariablesList.append(QString());
|
||||
}
|
||||
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
|
||||
}
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& ex)
|
||||
|
Loading…
x
Reference in New Issue
Block a user