Salome HOME
First compilable version PHASE_17_BR PHASE_17_Part1_V4
authorouv <ouv@opencascade.com>
Mon, 14 Dec 2009 11:43:31 +0000 (11:43 +0000)
committerouv <ouv@opencascade.com>
Mon, 14 Dec 2009 11:43:31 +0000 (11:43 +0000)
src/GUI/NETGENPluginGUI_HypothesisCreator.cxx
src/GUI/NETGENPluginGUI_HypothesisCreator.h
src/GUI/NETGENPluginGUI_SimpleCreator.cxx
src/GUI/NETGENPluginGUI_SimpleCreator.h

index b3cc07fa86aa1c966f7bd69f3c114cf0b889de9a..ee2fffce750ffe2a638bb90c4ce1e7c37572f7d7 100644 (file)
@@ -37,8 +37,8 @@
 #include <SUIT_ResourceMgr.h>
 
 #include <SalomeApp_Tools.h>
-
 #include <SalomeApp_DoubleSpinBox.h>
+#include <SalomeApp_Notebook.h>
 
 #include <QComboBox>
 #include <QLabel>
@@ -69,7 +69,7 @@ NETGENPluginGUI_HypothesisCreator::~NETGENPluginGUI_HypothesisCreator()
 {
 }
 
-bool NETGENPluginGUI_HypothesisCreator::checkParams(QString& msg) const
+bool NETGENPluginGUI_HypothesisCreator::checkParams(QString& msg, QStringList& absentParams) const
 {
   NetgenHypothesisData data_old, data_new;
   readParamsFromHypo( data_old );
@@ -77,10 +77,10 @@ bool NETGENPluginGUI_HypothesisCreator::checkParams(QString& msg) const
   bool res = storeParamsToHypo( data_new );
   storeParamsToHypo( data_old );
   
-  res = myMaxSize->isValid(msg,true) && res;
-  res = myGrowthRate->isValid(msg,true) && res; ;
-  res = myNbSegPerEdge->isValid(msg,true) && res;
-  res = myNbSegPerRadius->isValid(msg,true) && res;
+  res = myMaxSize->isValid(msg,absentParams,true) && res;
+  res = myGrowthRate->isValid(msg,absentParams,true) && res; ;
+  res = myNbSegPerEdge->isValid(msg,absentParams,true) && res;
+  res = myNbSegPerRadius->isValid(msg,absentParams,true) && res;
   return res;
 }
 
@@ -242,20 +242,20 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromHypo( NetgenHypothesisData
   HypothesisData* data = SMESH::GetHypothesisData( hypType() );
   h_data.myName = isCreation() && data ? data->Label : "";
 
-  SMESH::ListOfParameters_var aParameters = h->GetLastParameters();
+  SALOME::StringArray* aParameters = h->GetParameters();
 
   h_data.myMaxSize = h->GetMaxSize();
-  h_data.myMaxSizeVar = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
+  h_data.myMaxSizeVar = (aParameters->length() > 0) ? QString(aParameters->operator[](0).in()) : QString("");
   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 = (aParameters->length() > 1) ? QString(aParameters->operator[](1).in()) : QString("");
   h_data.myNbSegPerEdge = h->GetNbSegPerEdge();
-  h_data.myNbSegPerEdgeVar  = (aParameters->length() > 2) ? QString(aParameters[2].in()) : QString("");
+  h_data.myNbSegPerEdgeVar  = (aParameters->length() > 2) ? QString(aParameters->operator[](2).in()) : QString("");
   h_data.myNbSegPerRadius = h->GetNbSegPerRadius();
-  h_data.myNbSegPerRadiusVar = (aParameters->length() > 3) ? QString(aParameters[3].in()) : QString("");
+  h_data.myNbSegPerRadiusVar = (aParameters->length() > 3) ? QString(aParameters->operator[](3).in()) : QString("");
 
   if ( myIs2D )
     {
@@ -307,14 +307,7 @@ 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());
-      }
-        
+    getNotebook()->setParameters( h, aVariablesList );
   }
   catch(const SALOME::SALOME_Exception& ex)
   {
index a23739eee8b3e008bb815c9de4f940577f181afb..80b906f4336295e376bbaa97000be93a1f9da7e3 100644 (file)
@@ -57,7 +57,7 @@ public:
   NETGENPluginGUI_HypothesisCreator( const QString& );
   virtual ~NETGENPluginGUI_HypothesisCreator();
 
-  virtual bool     checkParams(QString& msg) const;
+  virtual bool     checkParams(QString& msg, QStringList& absentParams) const;
   virtual QString  helpPage() const;
 
 protected:
index 3a9c87172490470634dd044d6494f4341b015611..210fa3082c992d0de5ee7842ef3fd67f2430d6ca 100644 (file)
@@ -39,6 +39,7 @@
 // SALOME GUI includes
 #include <SalomeApp_Tools.h>
 #include <SalomeApp_IntSpinBox.h>
+#include <SalomeApp_Notebook.h>
 
 // Qt includes
 #include <QLabel>
@@ -83,14 +84,14 @@ NETGENPluginGUI_SimpleCreator::~NETGENPluginGUI_SimpleCreator()
 {
 }
 
-bool NETGENPluginGUI_SimpleCreator::checkParams(QString& msg) const
+bool NETGENPluginGUI_SimpleCreator::checkParams(QString& msg, QStringList& absentParams) const
 {
   bool result = true;
-  result = myNbSeg->isValid(msg,true) && result;
-  result = myLength->isValid(msg,true) && result;
-  result = myArea->isValid(msg,true) && result;
+  result = myNbSeg->isValid(msg,absentParams,true) && result;
+  result = myLength->isValid(msg,absentParams,true) && result;
+  result = myArea->isValid(msg,absentParams,true) && result;
   if (myVolume)
-    result = myVolume->isValid(msg,true) && result;
+    result = myVolume->isValid(msg,absentParams,true) && result;
   
   return result;
 }
@@ -243,7 +244,7 @@ void NETGENPluginGUI_SimpleCreator::retrieveParams() const
 
   // set values of hypothesis
 
-  SMESH::ListOfParameters_var aParameters = h->GetLastParameters();
+  SALOME::StringArray* aParameters = h->GetParameters();
 
   // 1D
   int nbSeg = isCreation() ? dfltNbSeg : (int) h->GetNumberOfSegments();
@@ -253,7 +254,7 @@ void NETGENPluginGUI_SimpleCreator::retrieveParams() const
   if ( nbSeg ) {
     myLength->setEnabled( false );
     myNbSeg->setEnabled( true );
-    aPrm = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
+    aPrm = (aParameters->length() > 0) ? QString(aParameters->operator[](0).in()) : QString("");
     if(aPrm.isEmpty())
       myNbSeg->setValue( nbSeg );
     else
@@ -262,7 +263,7 @@ void NETGENPluginGUI_SimpleCreator::retrieveParams() const
   else {
     myNbSeg->setEnabled( false );
     myLength->setEnabled( true );
-    aPrm = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
+    aPrm = (aParameters->length() > 0) ? QString(aParameters->operator[](0).in()) : QString("");
     if(aPrm.isEmpty())
       myLength->setValue( h->GetLocalLength() );
     else
@@ -273,7 +274,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 = (aParameters->length() > 1) ? QString(aParameters->operator[](1).in()) : QString("");
     if(aPrm.isEmpty()) 
       myArea->setValue( area );
     else
@@ -290,7 +291,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 = (aParameters->length() > 2) ? QString(aParameters->operator[](2).in()) : QString("");
       if(aPrm.isEmpty())
         myVolume->setValue( volume );
       else
@@ -329,8 +330,6 @@ QString NETGENPluginGUI_SimpleCreator::storeParams() const
       aVariablesList.append(myLength->text());
     }
     
-    h->SetParameters(aVariablesList.join(":").toLatin1().constData());
-
     // 2D
     if ( myArea->isEnabled() ) {
       h->SetMaxElementArea( myArea->value() );
@@ -343,8 +342,6 @@ QString NETGENPluginGUI_SimpleCreator::storeParams() const
       aVariablesList.append(QString());
     }
 
-    h->SetParameters(aVariablesList.join(":").toLatin1().constData());
-
     // 3D
     if ( myVolume ) {
       NETGENPlugin_SimpleHypothesis_3D_var h =
@@ -359,8 +356,9 @@ QString NETGENPluginGUI_SimpleCreator::storeParams() const
         valStr += "; lenFromFaces";
         aVariablesList.append(QString());
       }
-      h->SetParameters(aVariablesList.join(":").toLatin1().constData());
     }
+
+    getNotebook()->setParameters( h, aVariablesList );
   }
   catch(const SALOME::SALOME_Exception& ex)
   {
index 4b7bb88d57dfe5f3656fec82e3bbf78a91dcc5d1..4f7834b6b6238b5a4070c2fe5aa2b4f52d1623b0 100644 (file)
@@ -45,7 +45,7 @@ public:
   NETGENPluginGUI_SimpleCreator(const QString& theHypType);
   virtual ~NETGENPluginGUI_SimpleCreator();
 
-  virtual bool     checkParams(QString& msg) const;
+  virtual bool     checkParams(QString& msg, QStringList& absentParams) const;
   virtual QString  helpPage() const;
 
 protected: