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