]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0019941: EDF 766 SMESH : Max length hypothesis
authoreap <eap@opencascade.com>
Wed, 14 Jan 2009 09:22:40 +0000 (09:22 +0000)
committereap <eap@opencascade.com>
Wed, 14 Jan 2009 09:22:40 +0000 (09:22 +0000)
+  void                         setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr);
-  SMESH::SMESH_Hypothesis_var  initParamsHypothesis() const;
+  SMESH::SMESH_Hypothesis_var  initParamsHypothesis(const bool strict=false) const;

src/SMESHGUI/SMESHGUI_Hypotheses.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.h

index 455f83713672a749a0264ad5ed6ee4b77d7bc1ca..f42b6f179a01c1377c40db987da9206fe2d9bd42 100644 (file)
@@ -61,14 +61,18 @@ SMESHGUI_GenericHypothesisCreator::~SMESHGUI_GenericHypothesisCreator()
 {
 }
 
+void SMESHGUI_GenericHypothesisCreator::setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr hyp)
+{
+  if ( !CORBA::is_nil( hyp ) && hypType() == hyp->GetName() )
+    myInitParamsHypo = SMESH::SMESH_Hypothesis::_duplicate( hyp );
+}
+
 void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr initParamsHyp,
                                                const QString& theHypName,
                                                 QWidget* parent)
 {
   MESSAGE( "Creation of hypothesis with initial params" );
-
-  if ( !CORBA::is_nil( initParamsHyp ) && hypType() == initParamsHyp->GetName() )
-    myInitParamsHypo = SMESH::SMESH_Hypothesis::_duplicate( initParamsHyp );
+  setInitParamsHypothesis( initParamsHyp );
   create( false, theHypName, parent );
 }
 
@@ -341,9 +345,20 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() cons
   return myHypo;
 }
 
-SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis() const
+//================================================================================
+/*!
+ * \brief Return hypothesis containing initial parameters
+ *  \param strictly - if true, always return myInitParamsHypo,
+ *                    else, return myInitParamsHypo only in creation mode and if it
+ *                    is non-nil
+ */
+//================================================================================
+
+SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis(const bool strictly) const
 {
-  if ( CORBA::is_nil( myInitParamsHypo ))
+  if ( strictly )
+    return myInitParamsHypo;
+  if ( !isCreation() || CORBA::is_nil( myInitParamsHypo ))
     return myHypo;
   return myInitParamsHypo;
 }
index 4a0fba0e3dc07dbcf5952830c83d3202370781fb..f5ea0cb72f7327acd4ce300be700eee5e20392a5 100644 (file)
@@ -54,6 +54,7 @@ public:
   void                         create( bool, const QString&, QWidget* );
   void                         edit( SMESH::SMESH_Hypothesis_ptr,
                                     const QString&, QWidget* );
+  void                         setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr);
 
   virtual bool                 checkParams() const = 0;
   virtual void                 onReject();
@@ -75,7 +76,7 @@ protected:
   typedef QList<QWidget*>      ListOfWidgets;
 
   SMESH::SMESH_Hypothesis_var  hypothesis() const;
-  SMESH::SMESH_Hypothesis_var  initParamsHypothesis() const;
+  SMESH::SMESH_Hypothesis_var  initParamsHypothesis(const bool strict=false) const;
   const ListOfWidgets&         widgets() const;
   ListOfWidgets&               changeWidgets();
   QtxDialog*                   dlg() const;