mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-25 09:20:32 +05:00
PAL20378
This commit is contained in:
parent
5ff23c3748
commit
1f8dc8762c
@ -2099,9 +2099,9 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
{
|
{
|
||||||
// BUG 0020378
|
// BUG 0020378
|
||||||
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
|
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
|
||||||
SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
|
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
|
||||||
if (aCreator) {
|
if (aCreator) {
|
||||||
aCreator->edit( aHypothesis.in(), anIObject->getName(), desktop() );
|
aCreator->edit( aHypothesis.in(), anIObject->getName(), desktop(), this, SLOT( onHypothesisEdit( int ) ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2109,7 +2109,6 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateObjBrowser( true );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4427,8 +4426,11 @@ int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString
|
|||||||
return tfont;
|
return tfont;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Actions after hypothesis edition
|
||||||
|
Updates object browser after hypothesis edition
|
||||||
|
*/
|
||||||
|
void SMESHGUI::onHypothesisEdit( int result )
|
||||||
|
{
|
||||||
|
updateObjBrowser( true );
|
||||||
|
}
|
||||||
|
@ -126,7 +126,7 @@ private slots:
|
|||||||
void onViewManagerActivated( SUIT_ViewManager* );
|
void onViewManagerActivated( SUIT_ViewManager* );
|
||||||
void onOperationCommited( SUIT_Operation* );
|
void onOperationCommited( SUIT_Operation* );
|
||||||
void onOperationAborted( SUIT_Operation* );
|
void onOperationAborted( SUIT_Operation* );
|
||||||
|
void onHypothesisEdit( int result );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void SignalDeactivateActiveDialog();
|
void SignalDeactivateActiveDialog();
|
||||||
|
@ -48,13 +48,12 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QEventLoop>
|
|
||||||
|
|
||||||
#define SPACING 6
|
#define SPACING 6
|
||||||
#define MARGIN 11
|
#define MARGIN 11
|
||||||
|
|
||||||
SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& theHypType )
|
SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& theHypType )
|
||||||
: myHypType( theHypType ), myIsCreate( false ), myDlg( 0 ), myEventLoop( 0 )
|
: myHypType( theHypType ), myIsCreate( false ), myDlg( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,45 +69,36 @@ void SMESHGUI_GenericHypothesisCreator::setInitParamsHypothesis(SMESH::SMESH_Hyp
|
|||||||
|
|
||||||
void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr initParamsHyp,
|
void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr initParamsHyp,
|
||||||
const QString& theHypName,
|
const QString& theHypName,
|
||||||
QWidget* parent)
|
QWidget* parent, QObject* obj, const QString& slot )
|
||||||
{
|
{
|
||||||
MESSAGE( "Creation of hypothesis with initial params" );
|
MESSAGE( "Creation of hypothesis with initial params" );
|
||||||
setInitParamsHypothesis( initParamsHyp );
|
setInitParamsHypothesis( initParamsHyp );
|
||||||
create( false, theHypName, parent );
|
create( false, theHypName, parent, obj, slot );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
|
void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
|
||||||
const QString& theHypName,
|
const QString& theHypName,
|
||||||
QWidget* theParent )
|
QWidget* theParent, QObject* obj, const QString& slot )
|
||||||
{
|
{
|
||||||
MESSAGE( "Creation of hypothesis" );
|
MESSAGE( "Creation of hypothesis" );
|
||||||
|
|
||||||
myIsCreate = true;
|
myIsCreate = true;
|
||||||
|
|
||||||
// Create hypothesis/algorithm
|
// Create hypothesis/algorithm
|
||||||
if (isAlgo) {
|
if (isAlgo)
|
||||||
SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
|
SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
|
||||||
}
|
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
SMESH::SMESH_Hypothesis_var aHypothesis =
|
SMESH::SMESH_Hypothesis_var aHypothesis =
|
||||||
SMESH::CreateHypothesis( hypType(), theHypName, false );
|
SMESH::CreateHypothesis( hypType(), theHypName, false );
|
||||||
if( !editHypothesis( aHypothesis.in(), theHypName, theParent ) )
|
editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
|
||||||
{ //remove just created hypothesis
|
|
||||||
_PTR(SObject) aHypSObject = SMESH::FindSObject( aHypothesis.in() );
|
|
||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
|
||||||
if( aStudy && !aStudy->GetProperties()->IsLocked() )
|
|
||||||
{
|
|
||||||
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
|
|
||||||
aBuilder->RemoveObjectWithChildren( aHypSObject );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr theHypothesis,
|
void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr theHypothesis,
|
||||||
const QString& theHypName,
|
const QString& theHypName,
|
||||||
QWidget* theParent )
|
QWidget* theParent, QObject* obj, const QString& slot )
|
||||||
{
|
{
|
||||||
if( CORBA::is_nil( theHypothesis ) )
|
if( CORBA::is_nil( theHypothesis ) )
|
||||||
return;
|
return;
|
||||||
@ -117,37 +107,21 @@ void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr theHyp
|
|||||||
|
|
||||||
myIsCreate = false;
|
myIsCreate = false;
|
||||||
|
|
||||||
if( !editHypothesis( theHypothesis, theHypName, theParent ) )
|
editHypothesis( theHypothesis, theHypName, theParent, obj, slot );
|
||||||
return;
|
|
||||||
|
|
||||||
SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( theHypothesis );
|
|
||||||
if( listSOmesh.size() > 0 )
|
|
||||||
for( int i = 0; i < listSOmesh.size(); i++ )
|
|
||||||
{
|
|
||||||
_PTR(SObject) submSO = listSOmesh[i];
|
|
||||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
|
|
||||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
|
|
||||||
if( !aSubMesh->_is_nil() )
|
|
||||||
aMesh = aSubMesh->GetFather();
|
|
||||||
_PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
|
|
||||||
SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0);
|
|
||||||
}
|
|
||||||
SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ptr h,
|
void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ptr h,
|
||||||
const QString& theHypName,
|
const QString& theHypName,
|
||||||
QWidget* theParent )
|
QWidget* theParent,
|
||||||
|
QObject* obj, const QString& slot )
|
||||||
{
|
{
|
||||||
if( CORBA::is_nil( h ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool res = true;
|
|
||||||
myHypName = theHypName;
|
myHypName = theHypName;
|
||||||
myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
|
myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
|
||||||
|
|
||||||
SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent );
|
SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent );
|
||||||
connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
|
connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
|
||||||
|
connect( this, SIGNAL( finished( int ) ), obj, slot.toLatin1().constData() );
|
||||||
|
|
||||||
myDlg = Dlg;
|
myDlg = Dlg;
|
||||||
QFrame* fr = buildFrame();
|
QFrame* fr = buildFrame();
|
||||||
if( fr )
|
if( fr )
|
||||||
@ -160,24 +134,9 @@ bool SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_
|
|||||||
retrieveParams();
|
retrieveParams();
|
||||||
Dlg->show();
|
Dlg->show();
|
||||||
Dlg->resize( Dlg->minimumSizeHint() );
|
Dlg->resize( Dlg->minimumSizeHint() );
|
||||||
if ( !myEventLoop )
|
|
||||||
myEventLoop = new QEventLoop( this );
|
|
||||||
myEventLoop->exec(); // make myDlg not modal
|
|
||||||
res = myDlg->result();
|
|
||||||
if( res ) {
|
|
||||||
/*QString paramValues = */storeParams();
|
|
||||||
// No longer needed since NoteBook appears and "Value" OB field shows names of variable
|
|
||||||
// if ( !paramValues.isEmpty() ) {
|
|
||||||
// if ( _PTR(SObject) SHyp = SMESH::FindSObject( myHypo ))
|
|
||||||
// SMESH::SetValue( SHyp, paramValues );
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
delete Dlg; myDlg = 0;
|
else
|
||||||
changeWidgets().clear();
|
emit finished( QDialog::Accepted );
|
||||||
myHypo = SMESH::SMESH_Hypothesis::_nil();
|
|
||||||
myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
|
QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
|
||||||
@ -284,10 +243,53 @@ void SMESHGUI_GenericHypothesisCreator::valueChanged( QWidget* )
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int /*result*/ )
|
void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
|
||||||
{
|
{
|
||||||
if ( myEventLoop )
|
bool res = result==QDialog::Accepted;
|
||||||
myEventLoop->exit();
|
if( res )
|
||||||
|
{
|
||||||
|
/*QString paramValues = */storeParams();
|
||||||
|
// No longer needed since NoteBook appears and "Value" OB field shows names of variable
|
||||||
|
// if ( !paramValues.isEmpty() ) {
|
||||||
|
// if ( _PTR(SObject) SHyp = SMESH::FindSObject( myHypo ))
|
||||||
|
// SMESH::SetValue( SHyp, paramValues );
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
changeWidgets().clear();
|
||||||
|
|
||||||
|
if( myIsCreate && !res )
|
||||||
|
{
|
||||||
|
//remove just created hypothesis
|
||||||
|
_PTR(SObject) aHypSObject = SMESH::FindSObject( myHypo );
|
||||||
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
|
if( aStudy && !aStudy->GetProperties()->IsLocked() )
|
||||||
|
{
|
||||||
|
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
|
||||||
|
aBuilder->RemoveObjectWithChildren( aHypSObject );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( !myIsCreate && res )
|
||||||
|
{
|
||||||
|
SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( myHypo );
|
||||||
|
if( listSOmesh.size() > 0 )
|
||||||
|
for( int i = 0; i < listSOmesh.size(); i++ )
|
||||||
|
{
|
||||||
|
_PTR(SObject) submSO = listSOmesh[i];
|
||||||
|
SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
|
||||||
|
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
|
||||||
|
if( !aSubMesh->_is_nil() )
|
||||||
|
aMesh = aSubMesh->GetFather();
|
||||||
|
_PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
|
||||||
|
SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
|
||||||
|
myHypo = SMESH::SMESH_Hypothesis::_nil();
|
||||||
|
myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
|
||||||
|
myDlg->close(); myDlg = 0;
|
||||||
|
//delete myDlg; myDlg = 0;
|
||||||
|
emit finished( result );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SMESHGUI_GenericHypothesisCreator::stdParams( ListOfStdParams& ) const
|
bool SMESHGUI_GenericHypothesisCreator::stdParams( ListOfStdParams& ) const
|
||||||
@ -542,6 +544,7 @@ SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreato
|
|||||||
: QtxDialog( parent, false, true ),
|
: QtxDialog( parent, false, true ),
|
||||||
myCreator( creator )
|
myCreator( creator )
|
||||||
{
|
{
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
setMinimumSize( 300, height() );
|
setMinimumSize( 300, height() );
|
||||||
// setFixedSize( 300, height() );
|
// setFixedSize( 300, height() );
|
||||||
QVBoxLayout* topLayout = new QVBoxLayout( mainFrame() );
|
QVBoxLayout* topLayout = new QVBoxLayout( mainFrame() );
|
||||||
@ -573,6 +576,7 @@ SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreato
|
|||||||
|
|
||||||
SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
|
SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
|
||||||
{
|
{
|
||||||
|
delete myCreator;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
|
void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
|
||||||
@ -668,15 +672,69 @@ HypothesisData::HypothesisData( const QString& theTypeName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
HypothesesSet::HypothesesSet( const QString& theSetName )
|
HypothesesSet::HypothesesSet( const QString& theSetName )
|
||||||
: HypoSetName( theSetName )
|
: myHypoSetName( theSetName ),
|
||||||
|
myIsAlgo( false )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
HypothesesSet::HypothesesSet( const QString& theSetName,
|
HypothesesSet::HypothesesSet( const QString& theSetName,
|
||||||
const QStringList& theHypoList,
|
const QStringList& theHypoList,
|
||||||
const QStringList& theAlgoList )
|
const QStringList& theAlgoList )
|
||||||
: HypoSetName( theSetName ),
|
: myHypoSetName( theSetName ),
|
||||||
HypoList( theHypoList ),
|
myHypoList( theHypoList ),
|
||||||
AlgoList( theAlgoList )
|
myAlgoList( theAlgoList ),
|
||||||
|
myIsAlgo( false )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList* HypothesesSet::list(bool is_algo) const
|
||||||
|
{
|
||||||
|
return const_cast<QStringList*>( &( is_algo ? myAlgoList : myHypoList ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList* HypothesesSet::list() const
|
||||||
|
{
|
||||||
|
return list( myIsAlgo );
|
||||||
|
}
|
||||||
|
|
||||||
|
QString HypothesesSet::name() const
|
||||||
|
{
|
||||||
|
return myHypoSetName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HypothesesSet::set( bool isAlgo, const QStringList& lst )
|
||||||
|
{
|
||||||
|
*list(isAlgo) = lst;
|
||||||
|
}
|
||||||
|
|
||||||
|
int HypothesesSet::count( bool isAlgo ) const
|
||||||
|
{
|
||||||
|
return list(isAlgo)->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HypothesesSet::isAlgo() const
|
||||||
|
{
|
||||||
|
return myIsAlgo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HypothesesSet::init( bool isAlgo )
|
||||||
|
{
|
||||||
|
myIsAlgo = isAlgo;
|
||||||
|
myIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HypothesesSet::more() const
|
||||||
|
{
|
||||||
|
return myIndex < list()->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HypothesesSet::next()
|
||||||
|
{
|
||||||
|
myIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString HypothesesSet::current() const
|
||||||
|
{
|
||||||
|
return list()->at(myIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
// SMESH includes
|
// SMESH includes
|
||||||
#include "SMESH_SMESHGUI.hxx"
|
#include "SMESH_SMESHGUI.hxx"
|
||||||
|
#include "SMESHGUI_HypothesesUtils.h"
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtxDialog.h>
|
#include <QtxDialog.h>
|
||||||
@ -51,10 +52,9 @@ public:
|
|||||||
virtual ~SMESHGUI_GenericHypothesisCreator();
|
virtual ~SMESHGUI_GenericHypothesisCreator();
|
||||||
|
|
||||||
void create( SMESH::SMESH_Hypothesis_ptr,
|
void create( SMESH::SMESH_Hypothesis_ptr,
|
||||||
const QString&, QWidget* );
|
const QString&, QWidget*, QObject*, const QString& );
|
||||||
void create( bool, const QString&, QWidget* );
|
void create( bool, const QString&, QWidget*, QObject*, const QString& );
|
||||||
void edit( SMESH::SMESH_Hypothesis_ptr,
|
void edit( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*, QObject*, const QString& );
|
||||||
const QString&, QWidget* );
|
|
||||||
void setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr);
|
void setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr);
|
||||||
|
|
||||||
virtual bool checkParams( QString& ) const;
|
virtual bool checkParams( QString& ) const;
|
||||||
@ -68,6 +68,9 @@ public:
|
|||||||
QString getShapeEntry() const { return myShapeEntry; }
|
QString getShapeEntry() const { return myShapeEntry; }
|
||||||
void setShapeEntry( const QString& theEntry );
|
void setShapeEntry( const QString& theEntry );
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void finished( int );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct StdParam
|
struct StdParam
|
||||||
{
|
{
|
||||||
@ -113,8 +116,7 @@ private slots:
|
|||||||
virtual void onDialogFinished( int );
|
virtual void onDialogFinished( int );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool editHypothesis( SMESH::SMESH_Hypothesis_ptr,
|
void editHypothesis( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*, QObject* obj, const QString& );
|
||||||
const QString&, QWidget* );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESH::SMESH_Hypothesis_var myHypo, myInitParamsHypo;
|
SMESH::SMESH_Hypothesis_var myHypo, myInitParamsHypo;
|
||||||
@ -123,7 +125,6 @@ private:
|
|||||||
ListOfWidgets myParamWidgets;
|
ListOfWidgets myParamWidgets;
|
||||||
bool myIsCreate;
|
bool myIsCreate;
|
||||||
QtxDialog* myDlg;
|
QtxDialog* myDlg;
|
||||||
QEventLoop* myEventLoop;
|
|
||||||
QString myShapeEntry;
|
QString myShapeEntry;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -135,20 +136,19 @@ public:
|
|||||||
SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator*, QWidget* );
|
SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator*, QWidget* );
|
||||||
virtual ~SMESHGUI_HypothesisDlg();
|
virtual ~SMESHGUI_HypothesisDlg();
|
||||||
|
|
||||||
void setHIcon( const QPixmap& );
|
void setHIcon( const QPixmap& );
|
||||||
void setCustomFrame( QFrame* );
|
void setCustomFrame( QFrame* );
|
||||||
void setType( const QString& );
|
void setType( const QString& );
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void accept();
|
virtual void accept();
|
||||||
virtual void reject();
|
virtual void reject();
|
||||||
void onHelp();
|
void onHelp();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESHGUI_GenericHypothesisCreator* myCreator;
|
SMESHGUI_GenericHypothesisCreator* myCreator;
|
||||||
QLabel* myIconLabel;
|
QLabel *myIconLabel, *myTypeLabel;
|
||||||
QLabel* myTypeLabel;
|
QString myHelpFileName;
|
||||||
QString myHelpFileName;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -193,8 +193,28 @@ public:
|
|||||||
HypothesesSet( const QString& );
|
HypothesesSet( const QString& );
|
||||||
HypothesesSet( const QString&, const QStringList&, const QStringList& );
|
HypothesesSet( const QString&, const QStringList&, const QStringList& );
|
||||||
|
|
||||||
QString HypoSetName;
|
QString name() const;
|
||||||
QStringList HypoList, AlgoList;
|
void set( bool, const QStringList& );
|
||||||
|
int count( bool ) const;
|
||||||
|
|
||||||
|
bool isAlgo() const;
|
||||||
|
|
||||||
|
//this method sets internal index to -1, thus before any data access it is necessary to call next()
|
||||||
|
void init( bool );
|
||||||
|
|
||||||
|
bool more() const;
|
||||||
|
void next();
|
||||||
|
QString current() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QStringList* list(bool) const;
|
||||||
|
QStringList* list() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool myIsAlgo;
|
||||||
|
QString myHypoSetName;
|
||||||
|
QStringList myHypoList, myAlgoList;
|
||||||
|
int myIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SMESHGUI_HYPOTHESES_H
|
#endif // SMESHGUI_HYPOTHESES_H
|
||||||
|
@ -251,8 +251,8 @@ namespace SMESH
|
|||||||
hypoSet != myListOfHypothesesSets.end();
|
hypoSet != myListOfHypothesesSets.end();
|
||||||
++hypoSet ) {
|
++hypoSet ) {
|
||||||
HypothesesSet* aSet = *hypoSet;
|
HypothesesSet* aSet = *hypoSet;
|
||||||
if ( aSet && aSet->AlgoList.count() ) {
|
if ( aSet && aSet->count( true ) ) {
|
||||||
aSetNameList.append( aSet->HypoSetName );
|
aSetNameList.append( aSet->name() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ namespace SMESH
|
|||||||
hypoSet != myListOfHypothesesSets.end();
|
hypoSet != myListOfHypothesesSets.end();
|
||||||
++hypoSet ) {
|
++hypoSet ) {
|
||||||
HypothesesSet* aSet = *hypoSet;
|
HypothesesSet* aSet = *hypoSet;
|
||||||
if ( aSet && aSet->HypoSetName == theSetName )
|
if ( aSet && aSet->name() == theSetName )
|
||||||
return aSet;
|
return aSet;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -321,7 +321,7 @@ namespace SMESH
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
HypothesisCreatorPtr GetHypothesisCreator(const QString& aHypType)
|
SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator(const QString& aHypType)
|
||||||
{
|
{
|
||||||
if(MYDEBUG) MESSAGE("Get HypothesisCreator for " << aHypType.toLatin1().data());
|
if(MYDEBUG) MESSAGE("Get HypothesisCreator for " << aHypType.toLatin1().data());
|
||||||
|
|
||||||
@ -340,7 +340,8 @@ namespace SMESH
|
|||||||
// 2. Get names of plugin libraries
|
// 2. Get names of plugin libraries
|
||||||
HypothesisData* aHypData = GetHypothesisData(aHypType);
|
HypothesisData* aHypData = GetHypothesisData(aHypType);
|
||||||
if (!aHypData)
|
if (!aHypData)
|
||||||
return HypothesisCreatorPtr(aCreator);
|
return aCreator;
|
||||||
|
|
||||||
QString aClientLibName = aHypData->ClientLibName;
|
QString aClientLibName = aHypData->ClientLibName;
|
||||||
QString aServerLibName = aHypData->ServerLibName;
|
QString aServerLibName = aHypData->ServerLibName;
|
||||||
|
|
||||||
@ -391,7 +392,7 @@ namespace SMESH
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HypothesisCreatorPtr(aCreator);
|
return aCreator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,8 +58,6 @@ class algo_error_array;
|
|||||||
|
|
||||||
namespace SMESH
|
namespace SMESH
|
||||||
{
|
{
|
||||||
typedef boost::shared_ptr<SMESHGUI_GenericHypothesisCreator> HypothesisCreatorPtr;
|
|
||||||
|
|
||||||
SMESHGUI_EXPORT
|
SMESHGUI_EXPORT
|
||||||
void InitAvailableHypotheses();
|
void InitAvailableHypotheses();
|
||||||
|
|
||||||
@ -87,7 +85,7 @@ namespace SMESH
|
|||||||
const HypothesisData* );
|
const HypothesisData* );
|
||||||
|
|
||||||
SMESHGUI_EXPORT
|
SMESHGUI_EXPORT
|
||||||
HypothesisCreatorPtr GetHypothesisCreator( const QString& );
|
SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& );
|
||||||
|
|
||||||
SMESHGUI_EXPORT
|
SMESHGUI_EXPORT
|
||||||
SMESH::SMESH_Hypothesis_ptr CreateHypothesis( const QString&,
|
SMESH::SMESH_Hypothesis_ptr CreateHypothesis( const QString&,
|
||||||
|
@ -1019,7 +1019,7 @@ namespace
|
|||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
void SMESHGUI_MeshOp::createHypothesis (const int theDim,
|
void SMESHGUI_MeshOp::createHypothesis(const int theDim,
|
||||||
const int theType,
|
const int theType,
|
||||||
const QString& theTypeName)
|
const QString& theTypeName)
|
||||||
{
|
{
|
||||||
@ -1027,6 +1027,8 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim,
|
|||||||
if (!aData)
|
if (!aData)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
myDim = theDim;
|
||||||
|
myType = theType;
|
||||||
QStringList aHypNames;
|
QStringList aHypNames;
|
||||||
TDim2Type2HypList::const_iterator aDimIter = myExistingHyps.begin();
|
TDim2Type2HypList::const_iterator aDimIter = myExistingHyps.begin();
|
||||||
for ( ; aDimIter != myExistingHyps.end(); aDimIter++) {
|
for ( ; aDimIter != myExistingHyps.end(); aDimIter++) {
|
||||||
@ -1045,7 +1047,7 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim,
|
|||||||
QString aHypName = GetUniqueName( aHypNames, aData->Label);
|
QString aHypName = GetUniqueName( aHypNames, aData->Label);
|
||||||
|
|
||||||
// existing hypos
|
// existing hypos
|
||||||
int nbHyp = myExistingHyps[theDim][theType].count();
|
bool dialog = false;
|
||||||
|
|
||||||
QString aClientLibName = aData->ClientLibName;
|
QString aClientLibName = aData->ClientLibName;
|
||||||
if (aClientLibName == "") {
|
if (aClientLibName == "") {
|
||||||
@ -1055,7 +1057,7 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim,
|
|||||||
// Get hypotheses creator client (GUI)
|
// Get hypotheses creator client (GUI)
|
||||||
// BUG 0020378
|
// BUG 0020378
|
||||||
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
|
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
|
||||||
SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(theTypeName);
|
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
|
||||||
|
|
||||||
// Create hypothesis
|
// Create hypothesis
|
||||||
if (aCreator) {
|
if (aCreator) {
|
||||||
@ -1063,7 +1065,6 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim,
|
|||||||
SMESH::SMESH_Hypothesis_var initParamHyp =
|
SMESH::SMESH_Hypothesis_var initParamHyp =
|
||||||
getInitParamsHypothesis(theTypeName, aData->ServerLibName);
|
getInitParamsHypothesis(theTypeName, aData->ServerLibName);
|
||||||
|
|
||||||
int obj = myDlg->getActiveObject();
|
|
||||||
removeCustomFilters(); // Issue 0020170
|
removeCustomFilters(); // Issue 0020170
|
||||||
|
|
||||||
// Get Entry of the Geom object
|
// Get Entry of the Geom object
|
||||||
@ -1080,23 +1081,49 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim,
|
|||||||
|
|
||||||
aCreator->setShapeEntry( anObjEntry );
|
aCreator->setShapeEntry( anObjEntry );
|
||||||
myDlg->setEnabled( false );
|
myDlg->setEnabled( false );
|
||||||
aCreator->create(initParamHyp, aHypName, myDlg);
|
aCreator->create(initParamHyp, aHypName, myDlg, this, SLOT( onHypoCreated( int ) ) );
|
||||||
onActivateObject( obj ); // Issue 0020170. Restore filters
|
dialog = true;
|
||||||
myDlg->setEnabled( true );
|
|
||||||
} else {
|
|
||||||
SMESH::CreateHypothesis(theTypeName, aHypName, false);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
SMESH::CreateHypothesis(theTypeName, aHypName, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !dialog )
|
||||||
|
onHypoCreated(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* Necessary steps after hypothesis creation
|
||||||
|
* \param result - creation result:
|
||||||
|
* 0 = rejected
|
||||||
|
* 1 = accepted
|
||||||
|
* 2 = additional value meaning that slot is called not from dialog box
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
void SMESHGUI_MeshOp::onHypoCreated( int result )
|
||||||
|
{
|
||||||
|
if( result != 2 )
|
||||||
|
{
|
||||||
|
int obj = myDlg->getActiveObject();
|
||||||
|
onActivateObject( obj ); // Issue 0020170. Restore filters
|
||||||
|
myDlg->setEnabled( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
_PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
|
_PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
|
||||||
|
|
||||||
HypothesisData* algoData = hypData( theDim, Algo, currentHyp( theDim, Algo ));
|
int nbHyp = myExistingHyps[myDim][myType].count();
|
||||||
|
HypothesisData* algoData = hypData( myDim, Algo, currentHyp( myDim, Algo ));
|
||||||
QStringList aNewHyps;
|
QStringList aNewHyps;
|
||||||
existingHyps(theDim, theType, aFather, aNewHyps, myExistingHyps[theDim][theType], algoData);
|
existingHyps(myDim, myType, aFather, aNewHyps, myExistingHyps[myDim][myType], algoData);
|
||||||
if (aNewHyps.count() > nbHyp) {
|
if (aNewHyps.count() > nbHyp)
|
||||||
|
{
|
||||||
for (int i = nbHyp; i < aNewHyps.count(); i++)
|
for (int i = nbHyp; i < aNewHyps.count(); i++)
|
||||||
myDlg->tab(theDim)->addHyp(theType, aNewHyps[i]);
|
myDlg->tab(myDim)->addHyp(myType, aNewHyps[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( result!=2 && myHypoSet )
|
||||||
|
processSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -1126,7 +1153,7 @@ void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex )
|
|||||||
|
|
||||||
// BUG 0020378
|
// BUG 0020378
|
||||||
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHyp->GetName());
|
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHyp->GetName());
|
||||||
SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(aHyp->GetName());
|
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHyp->GetName());
|
||||||
if ( aCreator )
|
if ( aCreator )
|
||||||
{
|
{
|
||||||
// Get initial parameters
|
// Get initial parameters
|
||||||
@ -1147,15 +1174,27 @@ void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex )
|
|||||||
}
|
}
|
||||||
|
|
||||||
aCreator->setShapeEntry( anObjEntry );
|
aCreator->setShapeEntry( anObjEntry );
|
||||||
int obj = myDlg->getActiveObject();
|
|
||||||
removeCustomFilters(); // Issue 0020170
|
removeCustomFilters(); // Issue 0020170
|
||||||
myDlg->setEnabled( false );
|
myDlg->setEnabled( false );
|
||||||
aCreator->edit( aHyp.in(), aHypItem.second, dlg() );
|
aCreator->edit( aHyp.in(), aHypItem.second, dlg(), this, SLOT( onHypoEdited( int ) ) );
|
||||||
onActivateObject( obj ); // Issue 0020170. Restore filters
|
|
||||||
myDlg->setEnabled( true );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* Necessary steps after hypothesis edition
|
||||||
|
* \param result - creation result:
|
||||||
|
* 0 = rejected
|
||||||
|
* 1 = accepted
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
void SMESHGUI_MeshOp::onHypoEdited( int result )
|
||||||
|
{
|
||||||
|
int obj = myDlg->getActiveObject();
|
||||||
|
onActivateObject( obj ); // Issue 0020170. Restore filters
|
||||||
|
myDlg->setEnabled( true );
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief access to hypothesis data
|
* \brief access to hypothesis data
|
||||||
@ -1347,8 +1386,9 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
|
|||||||
//================================================================================
|
//================================================================================
|
||||||
void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
|
void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
|
||||||
{
|
{
|
||||||
HypothesesSet* aHypoSet = SMESH::GetHypothesesSet(theSetName);
|
myHypoSet = SMESH::GetHypothesesSet(theSetName);
|
||||||
if (!aHypoSet) return;
|
if (!myHypoSet)
|
||||||
|
return;
|
||||||
|
|
||||||
// clear all hyps
|
// clear all hyps
|
||||||
for (int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++) {
|
for (int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++) {
|
||||||
@ -1357,45 +1397,68 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
|
|||||||
setCurrentHyp(dim, MainHyp, -1);
|
setCurrentHyp(dim, MainHyp, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int aHypType = Algo; aHypType < AddHyp; aHypType++) {
|
myHypoSet->init(true); //algorithms
|
||||||
bool isAlgo = (aHypType == Algo);
|
processSet();
|
||||||
|
myHypoSet->init(false); //hypotheses
|
||||||
|
processSet();
|
||||||
|
myHypoSet = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// set hyps from the set
|
//================================================================================
|
||||||
QStringList* aHypoList = isAlgo ? &aHypoSet->AlgoList : &aHypoSet->HypoList;
|
/*!
|
||||||
for (int i = 0, n = aHypoList->count(); i < n; i++) {
|
* \brief One step of hypothesis/algorithm list creation
|
||||||
const QString& aHypoTypeName = (*aHypoList)[ i ];
|
*
|
||||||
HypothesisData* aHypData = SMESH::GetHypothesisData(aHypoTypeName);
|
* Creates a hypothesis or an algorithm for current item of internal list of names myHypoSet
|
||||||
if (!aHypData)
|
*/
|
||||||
continue;
|
//================================================================================
|
||||||
|
void SMESHGUI_MeshOp::processSet()
|
||||||
|
{
|
||||||
|
myHypoSet->next();
|
||||||
|
if( !myHypoSet->more() )
|
||||||
|
return;
|
||||||
|
|
||||||
int aDim = aHypData->Dim[0];
|
bool isAlgo = myHypoSet->isAlgo();
|
||||||
// create or/and set
|
QString aHypoTypeName = myHypoSet->current();
|
||||||
if (isAlgo) {
|
HypothesisData* aHypData = SMESH::GetHypothesisData(aHypoTypeName);
|
||||||
int index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
|
if (!aHypData)
|
||||||
if ( index < 0 ) {
|
{
|
||||||
QStringList anAvailable;
|
processSet();
|
||||||
availableHyps( aDim, Algo, anAvailable, myAvailableHypData[aDim][Algo] );
|
return;
|
||||||
myDlg->tab( aDim )->setAvailableHyps( Algo, anAvailable );
|
}
|
||||||
index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
|
|
||||||
}
|
int aDim = aHypData->Dim[0];
|
||||||
setCurrentHyp( aDim, Algo, index );
|
// create or/and set
|
||||||
onAlgoSelected( index, aDim );
|
if (isAlgo)
|
||||||
}
|
{
|
||||||
else {
|
int index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
|
||||||
bool mainHyp = true;
|
if ( index < 0 )
|
||||||
QStringList anAvailable;
|
{
|
||||||
availableHyps( aDim, MainHyp, anAvailable, myAvailableHypData[aDim][MainHyp] );
|
QStringList anAvailable;
|
||||||
myDlg->tab( aDim )->setAvailableHyps( MainHyp, anAvailable );
|
availableHyps( aDim, Algo, anAvailable, myAvailableHypData[aDim][Algo] );
|
||||||
int index = myAvailableHypData[aDim][MainHyp].indexOf( aHypData );
|
myDlg->tab( aDim )->setAvailableHyps( Algo, anAvailable );
|
||||||
if ( index < 0 ) {
|
index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
|
||||||
mainHyp = false;
|
}
|
||||||
index = myAvailableHypData[aDim][AddHyp].indexOf( aHypData );
|
setCurrentHyp( aDim, Algo, index );
|
||||||
}
|
onAlgoSelected( index, aDim );
|
||||||
if (index >= 0)
|
processSet();
|
||||||
createHypothesis(aDim, mainHyp ? MainHyp : AddHyp, aHypoTypeName);
|
}
|
||||||
}
|
else
|
||||||
} // loop on hypos in the set
|
{
|
||||||
} // loop on algo/hypo
|
bool mainHyp = true;
|
||||||
|
QStringList anAvailable;
|
||||||
|
availableHyps( aDim, MainHyp, anAvailable, myAvailableHypData[aDim][MainHyp] );
|
||||||
|
myDlg->tab( aDim )->setAvailableHyps( MainHyp, anAvailable );
|
||||||
|
int index = myAvailableHypData[aDim][MainHyp].indexOf( aHypData );
|
||||||
|
if ( index < 0 )
|
||||||
|
{
|
||||||
|
mainHyp = false;
|
||||||
|
index = myAvailableHypData[aDim][AddHyp].indexOf( aHypData );
|
||||||
|
}
|
||||||
|
if (index >= 0)
|
||||||
|
createHypothesis(aDim, mainHyp ? MainHyp : AddHyp, aHypoTypeName);
|
||||||
|
else
|
||||||
|
processSet();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -1690,7 +1753,7 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
|
|||||||
QStringList tmp;
|
QStringList tmp;
|
||||||
existingHyps( theDim, Algo, pObj, tmp, myExistingHyps[ theDim ][ Algo ]);
|
existingHyps( theDim, Algo, pObj, tmp, myExistingHyps[ theDim ][ Algo ]);
|
||||||
|
|
||||||
// look for anexisting algo of such a type
|
// look for an existing algo of such a type
|
||||||
THypList& aHypVarList = myExistingHyps[ theDim ][ Algo ];
|
THypList& aHypVarList = myExistingHyps[ theDim ][ Algo ];
|
||||||
THypList::iterator anIter = aHypVarList.begin();
|
THypList::iterator anIter = aHypVarList.begin();
|
||||||
for ( ; anIter != aHypVarList.end(); anIter++)
|
for ( ; anIter != aHypVarList.end(); anIter++)
|
||||||
@ -1704,23 +1767,27 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anAlgoVar->_is_nil()) {
|
if (anAlgoVar->_is_nil())
|
||||||
|
{
|
||||||
HypothesisData* aHypData = SMESH::GetHypothesisData( aHypName );
|
HypothesisData* aHypData = SMESH::GetHypothesisData( aHypName );
|
||||||
if (aHypData) {
|
if (aHypData)
|
||||||
|
{
|
||||||
QString aClientLibName = aHypData->ClientLibName;
|
QString aClientLibName = aHypData->ClientLibName;
|
||||||
if (aClientLibName == "") {
|
if (aClientLibName == "")
|
||||||
|
{
|
||||||
// Call hypothesis creation server method (without GUI)
|
// Call hypothesis creation server method (without GUI)
|
||||||
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
|
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Get hypotheses creator client (GUI)
|
// Get hypotheses creator client (GUI)
|
||||||
// BUG 0020378
|
// BUG 0020378
|
||||||
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName);
|
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName);
|
||||||
SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(aHypName);
|
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName);
|
||||||
|
|
||||||
// Create algorithm
|
// Create algorithm
|
||||||
if (aCreator) {
|
if (aCreator)
|
||||||
aCreator->create(true, aHypName, myDlg);
|
aCreator->create(true, aHypName, myDlg, 0, QString::null );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
|
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include "SMESHGUI_SelectionOp.h"
|
#include "SMESHGUI_SelectionOp.h"
|
||||||
|
|
||||||
|
class HypothesesSet;
|
||||||
class SMESHGUI_MeshDlg;
|
class SMESHGUI_MeshDlg;
|
||||||
class SMESHGUI_ShapeByMeshOp;
|
class SMESHGUI_ShapeByMeshOp;
|
||||||
class HypothesisData;
|
class HypothesisData;
|
||||||
@ -77,6 +78,9 @@ protected slots:
|
|||||||
void onPublishShapeByMeshDlg( SUIT_Operation* );
|
void onPublishShapeByMeshDlg( SUIT_Operation* );
|
||||||
void onCloseShapeByMeshDlg( SUIT_Operation* );
|
void onCloseShapeByMeshDlg( SUIT_Operation* );
|
||||||
void onAlgoSelected( const int, const int = -1 );
|
void onAlgoSelected( const int, const int = -1 );
|
||||||
|
void processSet();
|
||||||
|
void onHypoCreated( int );
|
||||||
|
void onHypoEdited( int );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef QList<HypothesisData*> THypDataList; // typedef: list of hypothesis data
|
typedef QList<HypothesisData*> THypDataList; // typedef: list of hypothesis data
|
||||||
@ -135,6 +139,8 @@ private:
|
|||||||
THypDataList myAvailableHypData[4][NbHypTypes];
|
THypDataList myAvailableHypData[4][NbHypTypes];
|
||||||
|
|
||||||
bool myIgnoreAlgoSelection;
|
bool myIgnoreAlgoSelection;
|
||||||
|
HypothesesSet* myHypoSet;
|
||||||
|
int myDim, myType;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SMESHGUI_MESHOP_H
|
#endif // SMESHGUI_MESHOP_H
|
||||||
|
@ -186,8 +186,7 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&,
|
|||||||
{
|
{
|
||||||
QString aHypos = isHypo ? atts.value("hypos") : atts.value("algos");
|
QString aHypos = isHypo ? atts.value("hypos") : atts.value("algos");
|
||||||
aHypos = aHypos.remove( ' ' );
|
aHypos = aHypos.remove( ' ' );
|
||||||
QStringList* aHypoList = isHypo ? & aHypoSet->HypoList : & aHypoSet->AlgoList;
|
aHypoSet->set( !isHypo, aHypos.split( ',', QString::SkipEmptyParts ) );
|
||||||
*aHypoList = aHypos.split( ',', QString::SkipEmptyParts );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,18 +200,25 @@ void StdMeshersGUI_LayerDistributionParamWdg::onEdit()
|
|||||||
CORBA::String_var hypType = myHyp->GetName();
|
CORBA::String_var hypType = myHyp->GetName();
|
||||||
// BUG 0020378
|
// BUG 0020378
|
||||||
//SMESHGUI_GenericHypothesisCreator* editor = SMESH::GetHypothesisCreator(hypType.in());
|
//SMESHGUI_GenericHypothesisCreator* editor = SMESH::GetHypothesisCreator(hypType.in());
|
||||||
SMESH::HypothesisCreatorPtr editor = SMESH::GetHypothesisCreator(hypType.in());
|
SMESHGUI_GenericHypothesisCreator* editor = SMESH::GetHypothesisCreator(hypType.in());
|
||||||
if ( !editor ) return;
|
if ( !editor ) return;
|
||||||
|
|
||||||
if ( myDlg ) myDlg->hide();
|
if ( myDlg )
|
||||||
|
myDlg->hide();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
QWidget* parent = this;
|
QWidget* parent = this;
|
||||||
if ( myDlg ) parent = myDlg->parentWidget();
|
if ( myDlg )
|
||||||
editor->edit( myHyp, myName, parent );
|
parent = myDlg->parentWidget();
|
||||||
|
editor->edit( myHyp, myName, parent, this, SLOT( onEdited( int ) ) );
|
||||||
}
|
}
|
||||||
catch(...) {
|
catch(...)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ( myDlg ) myDlg->show();
|
|
||||||
|
void StdMeshersGUI_LayerDistributionParamWdg::onEdited( int result )
|
||||||
|
{
|
||||||
|
if ( myDlg )
|
||||||
|
myDlg->show();
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,7 @@ private slots:
|
|||||||
void onCreate();
|
void onCreate();
|
||||||
void onEdit();
|
void onEdit();
|
||||||
void onHypTypePopup( QAction* );
|
void onHypTypePopup( QAction* );
|
||||||
|
void onEdited(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
Loading…
Reference in New Issue
Block a user