From 1527eb6887c12df9c02fe64763377171b50286b9 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 14 Jan 2009 09:22:40 +0000 Subject: [PATCH] 0019941: EDF 766 SMESH : Max length hypothesis + 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 | 25 ++++++++++++++++++++----- src/SMESHGUI/SMESHGUI_Hypotheses.h | 3 ++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx index 455f83713..f42b6f179 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx @@ -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; } diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.h b/src/SMESHGUI/SMESHGUI_Hypotheses.h index 4a0fba0e3..f5ea0cb72 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.h +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.h @@ -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 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; -- 2.39.2