{
}
+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 );
}
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;
}
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();
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;