mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-04 13:50:34 +05:00
PAL10953: add methods allowing creation of hypotheses using params of an other hyp. PAL1094: return string from storeParams() to be shown on object browser
This commit is contained in:
parent
219bb8601a
commit
6277715d4c
@ -27,6 +27,16 @@ SMESHGUI_GenericHypothesisCreator::~SMESHGUI_GenericHypothesisCreator()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr initParamsHyp,
|
||||||
|
QWidget* parent)
|
||||||
|
{
|
||||||
|
MESSAGE( "Creation of hypothesis with initial params" );
|
||||||
|
|
||||||
|
if ( !CORBA::is_nil( initParamsHyp ) && hypType() == initParamsHyp->GetName() )
|
||||||
|
myInitParamsHypo = SMESH::SMESH_Hypothesis::_duplicate( initParamsHyp );
|
||||||
|
create( false, parent );
|
||||||
|
}
|
||||||
|
|
||||||
void SMESHGUI_GenericHypothesisCreator::create( const bool isAlgo, QWidget* parent )
|
void SMESHGUI_GenericHypothesisCreator::create( const bool isAlgo, QWidget* parent )
|
||||||
{
|
{
|
||||||
MESSAGE( "Creation of hypothesis" );
|
MESSAGE( "Creation of hypothesis" );
|
||||||
@ -94,6 +104,7 @@ bool SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_
|
|||||||
|
|
||||||
bool res = true;
|
bool res = true;
|
||||||
myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
|
myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
|
||||||
|
|
||||||
QFrame* fr = buildFrame();
|
QFrame* fr = buildFrame();
|
||||||
if( fr )
|
if( fr )
|
||||||
{
|
{
|
||||||
@ -105,12 +116,18 @@ bool SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_
|
|||||||
dlg->setType( type() );
|
dlg->setType( type() );
|
||||||
retrieveParams();
|
retrieveParams();
|
||||||
res = dlg->exec()==QDialog::Accepted;
|
res = dlg->exec()==QDialog::Accepted;
|
||||||
if( res )
|
if( res ) {
|
||||||
storeParams();
|
QString paramValues = storeParams();
|
||||||
|
if ( !paramValues.isEmpty() ) {
|
||||||
|
if ( _PTR(SObject) SHyp = SMESH::FindSObject( myHypo ))
|
||||||
|
SMESH::SetValue( SHyp, paramValues );
|
||||||
|
}
|
||||||
|
}
|
||||||
delete dlg;
|
delete dlg;
|
||||||
}
|
}
|
||||||
changeWidgets().clear();
|
changeWidgets().clear();
|
||||||
myHypo = SMESH::SMESH_Hypothesis::_nil();
|
myHypo = SMESH::SMESH_Hypothesis::_nil();
|
||||||
|
myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,11 +253,45 @@ bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& par
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString SMESHGUI_GenericHypothesisCreator::stdParamValues( const ListOfStdParams& params)
|
||||||
|
{
|
||||||
|
QString valueStr = "";
|
||||||
|
ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
|
||||||
|
for( int i=0; param!=aLast; param++, i++ )
|
||||||
|
{
|
||||||
|
if ( i > 0 )
|
||||||
|
valueStr += "; ";
|
||||||
|
switch( (*param).myValue.type() )
|
||||||
|
{
|
||||||
|
case QVariant::Int:
|
||||||
|
valueStr += valueStr.number( (*param).myValue.toInt() );
|
||||||
|
break;
|
||||||
|
case QVariant::Double:
|
||||||
|
valueStr += valueStr.number( (*param).myValue.toDouble() );
|
||||||
|
break;
|
||||||
|
case QVariant::String:
|
||||||
|
valueStr += (*param).myValue.toString();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
QVariant valCopy = (*param).myValue;
|
||||||
|
valueStr += valCopy.asString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return valueStr;
|
||||||
|
}
|
||||||
|
|
||||||
SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() const
|
SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() const
|
||||||
{
|
{
|
||||||
return myHypo;
|
return myHypo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis() const
|
||||||
|
{
|
||||||
|
if ( CORBA::is_nil( myInitParamsHypo ))
|
||||||
|
return myHypo;
|
||||||
|
return myInitParamsHypo;
|
||||||
|
}
|
||||||
|
|
||||||
QString SMESHGUI_GenericHypothesisCreator::hypType() const
|
QString SMESHGUI_GenericHypothesisCreator::hypType() const
|
||||||
{
|
{
|
||||||
return myHypType;
|
return myHypType;
|
||||||
|
@ -50,6 +50,7 @@ public:
|
|||||||
|
|
||||||
void create( const bool isAlgo, QWidget* );
|
void create( const bool isAlgo, QWidget* );
|
||||||
void edit( SMESH::SMESH_Hypothesis_ptr, QWidget* );
|
void edit( SMESH::SMESH_Hypothesis_ptr, QWidget* );
|
||||||
|
void create( SMESH::SMESH_Hypothesis_ptr, QWidget* );
|
||||||
virtual bool checkParams() const = 0;
|
virtual bool checkParams() const = 0;
|
||||||
|
|
||||||
QString hypType() const;
|
QString hypType() const;
|
||||||
@ -67,15 +68,17 @@ protected:
|
|||||||
typedef QPtrList<QWidget> ListOfWidgets;
|
typedef QPtrList<QWidget> ListOfWidgets;
|
||||||
|
|
||||||
SMESH::SMESH_Hypothesis_var hypothesis() const;
|
SMESH::SMESH_Hypothesis_var hypothesis() const;
|
||||||
|
SMESH::SMESH_Hypothesis_var initParamsHypothesis() const;
|
||||||
const ListOfWidgets& widgets() const;
|
const ListOfWidgets& widgets() const;
|
||||||
ListOfWidgets& changeWidgets();
|
ListOfWidgets& changeWidgets();
|
||||||
|
|
||||||
virtual QFrame* buildFrame () = 0;
|
virtual QFrame* buildFrame () = 0;
|
||||||
QFrame* buildStdFrame ();
|
QFrame* buildStdFrame ();
|
||||||
virtual void retrieveParams() const = 0;
|
virtual void retrieveParams() const = 0;
|
||||||
virtual void storeParams () const = 0;
|
virtual QString storeParams () const = 0;
|
||||||
virtual bool stdParams ( ListOfStdParams& ) const;
|
virtual bool stdParams ( ListOfStdParams& ) const;
|
||||||
bool getStdParamFromDlg( ListOfStdParams& ) const;
|
bool getStdParamFromDlg( ListOfStdParams& ) const;
|
||||||
|
static QString stdParamValues( const ListOfStdParams& );
|
||||||
virtual void attuneStdWidget( QWidget*, const int ) const;
|
virtual void attuneStdWidget( QWidget*, const int ) const;
|
||||||
virtual QWidget* getCustomWidget( const StdParam &, QWidget* ) const;
|
virtual QWidget* getCustomWidget( const StdParam &, QWidget* ) const;
|
||||||
virtual bool getParamFromCustomWidget( StdParam& , QWidget* ) const;
|
virtual bool getParamFromCustomWidget( StdParam& , QWidget* ) const;
|
||||||
@ -90,7 +93,7 @@ private:
|
|||||||
bool editHypothesis( SMESH::SMESH_Hypothesis_ptr, QWidget* );
|
bool editHypothesis( SMESH::SMESH_Hypothesis_ptr, QWidget* );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESH::SMESH_Hypothesis_var myHypo;
|
SMESH::SMESH_Hypothesis_var myHypo, myInitParamsHypo;
|
||||||
QString myHypType;
|
QString myHypType;
|
||||||
ListOfWidgets myParamWidgets;
|
ListOfWidgets myParamWidgets;
|
||||||
bool myIsCreate;
|
bool myIsCreate;
|
||||||
|
Loading…
Reference in New Issue
Block a user