Salome HOME
Implementation NoteBook in SMESH module.
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_StdHypothesisCreator.cxx
index d893462df003937e47f7daef73d61c5c280546df..b7bf0f6e58648acc7103177181501f0a3ab123e4 100644 (file)
@@ -421,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" )
     {
@@ -428,7 +429,9 @@ 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" )
     {
@@ -479,8 +482,12 @@ 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());
+      if(QString(w->GetHypothesis()->GetName()) == "LocalLength")
+        h->SetParameters(w->GetHypothesis()->GetParameters());
+      */
     }
     else if( hypType()=="ProjectionSource1D" )
     {
@@ -552,16 +559,17 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
   }
   
   SMESH::SMESH_Hypothesis_var hyp = initParamsHypothesis();
+  SMESH::ListOfParameters_var aParameters = hyp->GetLastParameters();
+  QString aVaribaleName; 
 
   if( hypType()=="LocalLength" )
   {
     StdMeshers::StdMeshers_LocalLength_var h =
       StdMeshers::StdMeshers_LocalLength::_narrow( hyp );
-    SMESH::ListOfParameters_var aParameters = hyp->GetLastParameters();
     
     item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
 
-    QString aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
+    aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
     item.isVariable = !aVaribaleName.isEmpty();
     if(item.isVariable) 
       item.myValue = aVaribaleName;
@@ -583,9 +591,15 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
   {
     StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h =
       StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hyp );
-
     item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
-    item.myValue = h->GetLength();
+
+    aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");    
+    item.isVariable = !aVaribaleName.isEmpty();
+
+    if(item.isVariable)
+      item.myValue = aVaribaleName;
+    else
+      item.myValue = h->GetLength();
     p.append( item );
   }
   else if( hypType()=="Arithmetic1D" )
@@ -593,11 +607,25 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     StdMeshers::StdMeshers_Arithmetic1D_var h =
       StdMeshers::StdMeshers_Arithmetic1D::_narrow( hyp );
 
+    aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
+    
+    item.isVariable = !aVaribaleName.isEmpty();
+
     item.myName = tr( "SMESH_START_LENGTH_PARAM" );
-    item.myValue = h->GetLength( true );
+    if(item.isVariable)
+      item.myValue = aVaribaleName;
+    else
+      item.myValue = h->GetLength( true );
     p.append( item );
+
+    aVaribaleName = (aParameters->length() > 1) ? QString(aParameters[1].in()) : QString("");
+
     item.myName = tr( "SMESH_END_LENGTH_PARAM" );
-    item.myValue = h->GetLength( false );
+
+    if(item.isVariable)
+      item.myValue = aVaribaleName;
+    else
+      item.myValue = h->GetLength( false );
     p.append( item );
   }
   else if( hypType()=="MaxElementArea" )
@@ -660,11 +688,20 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     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()->SetParameters(SMESHGUI::JoinObjectParameters(aLastVarsList));
+    */    
     customWidgets()->append
       ( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));
   }