X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FStdMeshersGUI%2FStdMeshersGUI_StdHypothesisCreator.cxx;h=651d87f33302ecd9db39f816d3208bcb57ae80ee;hb=044316562025258053dd5cdd512918e98fa55c58;hp=2b78c23e12484c59695894fee2982b6ebc29cf65;hpb=25db37c904d526979e171cc30528e49feea5af7c;p=modules%2Fsmesh.git diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index 2b78c23e1..651d87f33 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -32,6 +32,7 @@ #include #include #include +#include // SALOME GUI includes #include @@ -338,8 +339,11 @@ namespace { */ //================================================================================ -bool StdMeshersGUI_StdHypothesisCreator::checkParams() const +bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const { + if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) ) + return false; + // check if object reference parameter is set, as it has no default value bool ok = true; if ( hypType().startsWith("ProjectionSource" )) @@ -397,6 +401,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const } QString valueStr = stdParamValues( params ); + QStringList aVariablesList = getVariablesFromDlg(); if( res && !params.isEmpty() ) { @@ -406,7 +411,9 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() ); 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" ) { @@ -414,6 +421,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() ); h->SetLength( params[0].myValue.toDouble() ); + h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); } else if( hypType()=="Arithmetic1D" ) { @@ -421,13 +429,15 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const 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" ) @@ -436,6 +446,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() ); h->SetMaxElementVolume( params[0].myValue.toDouble() ); + h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); } else if( hypType()=="StartEndLength" ) { @@ -443,13 +454,15 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const 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" ) @@ -465,6 +478,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() ); h->SetNumberOfLayers( params[0].myValue.toInt() ); + h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); } else if( hypType()=="LayerDistribution" ) { @@ -472,8 +486,10 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const 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" ) { @@ -543,20 +559,25 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const p.append( item ); customWidgets()->append(0); } - + 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 ); - + item.myName = tr("SMESH_LOCAL_LENGTH_PARAM"); - item.myValue = h->GetLength(); - p.append( item ); + if(!initVariableName(aParameters,item,0)) + item.myValue = h->GetLength(); + p.append( item ); + item.myName = tr("SMESH_LOCAL_LENGTH_PRECISION"); - item.myValue = h->GetPrecision(); + if(!initVariableName(aParameters,item,1)) + item.myValue = h->GetPrecision(); p.append( item ); + } else if( hypType()=="SegmentLengthAroundVertex" ) { @@ -564,7 +585,9 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const 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" ) @@ -573,10 +596,13 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const 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" ) @@ -585,8 +611,10 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const 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" ) { @@ -594,7 +622,8 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const 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" ) @@ -603,19 +632,25 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const 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" ) @@ -635,15 +670,25 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const 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;ilength();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())); } @@ -734,7 +779,7 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int) if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PARAM")) sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); else if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PRECISION")) - sb->RangeStepAndValidator( 0.0, 1.0, 0.05, 6 ); + sb->RangeStepAndValidator( 0.0, 1.0, 0.05, 7 ); } else if( hypType()=="Arithmetic1D" && sb ) { @@ -912,3 +957,21 @@ void StdMeshersGUI_StdHypothesisCreator::onReject() deactivateObjRefParamWdg( customWidgets() ); } } + +//================================================================================ +/*! + * + */ +//================================================================================ + +bool StdMeshersGUI_StdHypothesisCreator::initVariableName(SMESH::ListOfParameters_var theParameters, + StdParam &theParams, + int order) const +{ + QString aVaribaleName = (theParameters->length() > order) ? QString(theParameters[order].in()) : QString(""); + theParams.isVariable = !aVaribaleName.isEmpty(); + if(theParams.isVariable) + theParams.myValue = aVaribaleName; + + return theParams.isVariable; +}