{
StdMeshers::StdMeshers_LocalLength_var h =
StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() );
- if(!aVariablesList.isEmpty()) {
- QString aVariables = aVariablesList.join(":");
- h->SetParameters(aVariables.toLatin1().constData());
- }
- else
- h->SetParameters("");
-
+
h->SetLength( params[0].myValue.toDouble() );
+ h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
h->SetPrecision( params[1].myValue.toDouble() );
+ h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
}
else if( hypType()=="SegmentLengthAroundVertex" )
{
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble() );
+ h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
}
else if( hypType()=="Arithmetic1D" )
{
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble(), true );
+ h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
h->SetLength( params[1].myValue.toDouble(), false );
+ h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
}
else if( hypType()=="MaxElementArea" )
{
StdMeshers::StdMeshers_MaxElementArea_var h =
StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() );
-
+ h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
h->SetMaxElementArea( params[0].myValue.toDouble() );
}
else if( hypType()=="MaxElementVolume" )
StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() );
h->SetMaxElementVolume( params[0].myValue.toDouble() );
+ h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
}
else if( hypType()=="StartEndLength" )
{
StdMeshers::StdMeshers_StartEndLength::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble(), true );
+ h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
h->SetLength( params[1].myValue.toDouble(), false );
+ h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
}
else if( hypType()=="Deflection1D" )
{
StdMeshers::StdMeshers_Deflection1D_var h =
StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() );
-
+ h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
h->SetDeflection( params[0].myValue.toDouble() );
}
else if( hypType()=="AutomaticLength" )
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() );
h->SetNumberOfLayers( params[0].myValue.toInt() );
+ h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
}
else if( hypType()=="LayerDistribution" )
{
StdMeshers::StdMeshers_LayerDistribution::_narrow( hypothesis() );
StdMeshersGUI_LayerDistributionParamWdg* w =
widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
-
+
h->SetLayerDistribution( w->GetHypothesis() );
+ h->SetParameters(w->GetHypothesis()->GetParameters());
+ w->GetHypothesis()->ClearParameters();
}
else if( hypType()=="ProjectionSource1D" )
{
}
SMESH::SMESH_Hypothesis_var hyp = initParamsHypothesis();
+ SMESH::ListOfParameters_var aParameters = hyp->GetLastParameters();
if( hypType()=="LocalLength" )
{
StdMeshers::StdMeshers_LocalLength_var h =
StdMeshers::StdMeshers_LocalLength::_narrow( hyp );
-
- QString aParameters(h->GetParameters());
- QStringList aParametersList;
- if(aParameters.length())
- aParametersList = aParameters.split(":");
-
+
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
- QVariant aVariable = parseParameter(aParametersList,0);
- if(aVariable.type() != QVariant::Invalid) {
- item.myValue = aVariable;
- item.isVariable = true;
- }
- else
+ if(!initVariableName(aParameters,item,0))
item.myValue = h->GetLength();
- p.append( item );
-
+ p.append( item );
+
item.myName = tr("SMESH_LOCAL_LENGTH_PRECISION");
- aVariable = parseParameter(aParametersList,1);
- if(aVariable.type() != QVariant::Invalid) {
- item.myValue = aVariable;
- item.isVariable = true;
- }
- else
- item.myValue = h->GetPrecision();
+ if(!initVariableName(aParameters,item,1))
+ item.myValue = h->GetPrecision();
p.append( item );
}
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hyp );
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
- item.myValue = h->GetLength();
+ if(!initVariableName(aParameters,item,0))
+ item.myValue = h->GetLength();
+
p.append( item );
}
else if( hypType()=="Arithmetic1D" )
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hyp );
item.myName = tr( "SMESH_START_LENGTH_PARAM" );
- item.myValue = h->GetLength( true );
+ if(!initVariableName(aParameters,item,0))
+ item.myValue = h->GetLength( true );
p.append( item );
+
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
- item.myValue = h->GetLength( false );
+ if(!initVariableName(aParameters,item,1))
+ item.myValue = h->GetLength( false );
p.append( item );
}
else if( hypType()=="MaxElementArea" )
StdMeshers::StdMeshers_MaxElementArea::_narrow( hyp );
item.myName = tr( "SMESH_MAX_ELEMENT_AREA_PARAM" );
- item.myValue = h->GetMaxElementArea();
+ if(!initVariableName(aParameters,item,0))
+ item.myValue = h->GetMaxElementArea();
p.append( item );
+
}
else if( hypType()=="MaxElementVolume" )
{
StdMeshers::StdMeshers_MaxElementVolume::_narrow( hyp );
item.myName = tr( "SMESH_MAX_ELEMENT_VOLUME_PARAM" );
- item.myValue = h->GetMaxElementVolume();
+ if(!initVariableName(aParameters,item,0))
+ item.myValue = h->GetMaxElementVolume();
p.append( item );
}
else if( hypType()=="StartEndLength" )
StdMeshers::StdMeshers_StartEndLength::_narrow( hyp );
item.myName = tr( "SMESH_START_LENGTH_PARAM" );
- item.myValue = h->GetLength( true );
+
+ if(!initVariableName(aParameters,item,0))
+ item.myValue = h->GetLength( true );
p.append( item );
+
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
- item.myValue = h->GetLength( false );
+ if(!initVariableName(aParameters,item,1))
+ item.myValue = h->GetLength( false );
p.append( item );
+
}
else if( hypType()=="Deflection1D" )
{
StdMeshers::StdMeshers_Deflection1D_var h =
StdMeshers::StdMeshers_Deflection1D::_narrow( hyp );
-
+
item.myName = tr( "SMESH_DEFLECTION1D_PARAM" );
- item.myValue = h->GetDeflection();
+ if(!initVariableName(aParameters,item,0))
+ item.myValue = h->GetDeflection();
p.append( item );
}
else if( hypType()=="AutomaticLength" )
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hyp );
item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
- item.myValue = (int) h->GetNumberOfLayers();
+ if(!initVariableName(aParameters,item,0))
+ item.myValue = (int) h->GetNumberOfLayers();
p.append( item );
}
else if( hypType()=="LayerDistribution" )
- {
- StdMeshers::StdMeshers_LayerDistribution_var h =
+ {
+ StdMeshers::StdMeshers_LayerDistribution_var h =
StdMeshers::StdMeshers_LayerDistribution::_narrow( hyp );
item.myName = tr( "SMESH_LAYERS_DISTRIBUTION" ); p.append( item );
+
+ //Set into not published hypo last variables
+ QStringList aLastVarsList;
+ for(int i = 0;i<aParameters->length();i++)
+ aLastVarsList.append(QString(aParameters[i].in()));
+
+ if(!aLastVarsList.isEmpty())
+ h->GetLayerDistribution()->SetLastParameters(SMESHGUI::JoinObjectParameters(aLastVarsList));
+
customWidgets()->append
( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));
}
//================================================================================
/*!
- * \brief
+ *
*/
//================================================================================
-QVariant StdMeshersGUI_StdHypothesisCreator::
-parseParameter(const QStringList& theList, int theNbParam) const
+
+bool StdMeshersGUI_StdHypothesisCreator::initVariableName(SMESH::ListOfParameters_var theParameters,
+ StdParam &theParams,
+ int order) const
{
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- QVariant aResult;
- if(theList.size() > theNbParam) {
- QString aParameter = theList[theNbParam];
- if(QString::compare(QString(""),aParameter) !=0 ) {
- if(aStudy->IsVariable(aParameter.toLatin1().constData())) {
- aResult=aParameter;
- }
- else {
- bool aResult = false;
- int anIResult = aParameter.toInt(&aResult);
- if(aResult)
- aResult = anIResult;
- else {
- double aDResult = aParameter.toDouble(&aResult);
- if(aResult)
- aResult = aDResult;
- }
- }
- }
- }
- return aResult;
+ QString aVaribaleName = (theParameters->length() > order) ? QString(theParameters[order].in()) : QString("");
+ theParams.isVariable = !aVaribaleName.isEmpty();
+ if(theParams.isVariable)
+ theParams.myValue = aVaribaleName;
+
+ return theParams.isVariable;
}