{
// BUG 0020378
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
- SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
+ SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
if (aCreator) {
- aCreator->edit( aHypothesis.in(), anIObject->getName(), desktop() );
+ aCreator->edit( aHypothesis.in(), anIObject->getName(), desktop(), this, SLOT( onHypothesisEdit( int ) ) );
}
else
{
}
}
}
- updateObjBrowser( true );
break;
}
return tfont;
}
-
-
-
-
-
+/*!
+ \brief Actions after hypothesis edition
+ Updates object browser after hypothesis edition
+*/
+void SMESHGUI::onHypothesisEdit( int result )
+{
+ updateObjBrowser( true );
+}
void onViewManagerActivated( SUIT_ViewManager* );
void onOperationCommited( SUIT_Operation* );
void onOperationAborted( SUIT_Operation* );
-
+ void onHypothesisEdit( int result );
signals:
void SignalDeactivateActiveDialog();
#include <QLabel>
#include <QGroupBox>
#include <QVBoxLayout>
-#include <QEventLoop>
#define SPACING 6
#define MARGIN 11
SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& theHypType )
- : myHypType( theHypType ), myIsCreate( false ), myDlg( 0 ), myEventLoop( 0 )
+ : myHypType( theHypType ), myIsCreate( false ), myDlg( 0 )
{
}
void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr initParamsHyp,
const QString& theHypName,
- QWidget* parent)
+ QWidget* parent, QObject* obj, const QString& slot )
{
MESSAGE( "Creation of hypothesis with initial params" );
setInitParamsHypothesis( initParamsHyp );
- create( false, theHypName, parent );
+ create( false, theHypName, parent, obj, slot );
}
void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
const QString& theHypName,
- QWidget* theParent )
+ QWidget* theParent, QObject* obj, const QString& slot )
{
MESSAGE( "Creation of hypothesis" );
myIsCreate = true;
// Create hypothesis/algorithm
- if (isAlgo) {
+ if (isAlgo)
SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
- }
- else {
+
+ else
+ {
SMESH::SMESH_Hypothesis_var aHypothesis =
SMESH::CreateHypothesis( hypType(), theHypName, false );
- if( !editHypothesis( aHypothesis.in(), theHypName, theParent ) )
- { //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 );
- }
- }
+ editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
}
- SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
}
void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr theHypothesis,
const QString& theHypName,
- QWidget* theParent )
+ QWidget* theParent, QObject* obj, const QString& slot )
{
if( CORBA::is_nil( theHypothesis ) )
return;
myIsCreate = false;
- if( !editHypothesis( theHypothesis, theHypName, theParent ) )
- 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 );
+ editHypothesis( theHypothesis, theHypName, theParent, obj, slot );
}
-bool SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ptr h,
+void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ptr h,
const QString& theHypName,
- QWidget* theParent )
+ QWidget* theParent,
+ QObject* obj, const QString& slot )
{
- if( CORBA::is_nil( h ) )
- return false;
-
- bool res = true;
myHypName = theHypName;
myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent );
connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
+ connect( this, SIGNAL( finished( int ) ), obj, slot.toLatin1().constData() );
+
myDlg = Dlg;
QFrame* fr = buildFrame();
if( fr )
retrieveParams();
Dlg->show();
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;
- changeWidgets().clear();
- myHypo = SMESH::SMESH_Hypothesis::_nil();
- myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
- return res;
+ else
+ emit finished( QDialog::Accepted );
}
QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
{
}
-void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int /*result*/ )
+void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
{
- if ( myEventLoop )
- myEventLoop->exit();
+ bool res = result==QDialog::Accepted;
+ 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
: QtxDialog( parent, false, true ),
myCreator( creator )
{
+ setAttribute(Qt::WA_DeleteOnClose, true);
setMinimumSize( 300, height() );
// setFixedSize( 300, height() );
QVBoxLayout* topLayout = new QVBoxLayout( mainFrame() );
SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
{
+ delete myCreator;
}
void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
}
HypothesesSet::HypothesesSet( const QString& theSetName )
- : HypoSetName( theSetName )
+ : myHypoSetName( theSetName ),
+ myIsAlgo( false )
{
}
HypothesesSet::HypothesesSet( const QString& theSetName,
const QStringList& theHypoList,
const QStringList& theAlgoList )
- : HypoSetName( theSetName ),
- HypoList( theHypoList ),
- AlgoList( theAlgoList )
+ : myHypoSetName( theSetName ),
+ myHypoList( theHypoList ),
+ 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);
+}
+
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_HypothesesUtils.h"
// Qt includes
#include <QtxDialog.h>
virtual ~SMESHGUI_GenericHypothesisCreator();
void create( SMESH::SMESH_Hypothesis_ptr,
- const QString&, QWidget* );
- void create( bool, const QString&, QWidget* );
- void edit( SMESH::SMESH_Hypothesis_ptr,
- const QString&, QWidget* );
+ const QString&, QWidget*, QObject*, const QString& );
+ void create( bool, const QString&, QWidget*, QObject*, const QString& );
+ void edit( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*, QObject*, const QString& );
void setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr);
virtual bool checkParams( QString& ) const;
QString getShapeEntry() const { return myShapeEntry; }
void setShapeEntry( const QString& theEntry );
+signals:
+ void finished( int );
+
protected:
struct StdParam
{
virtual void onDialogFinished( int );
private:
- bool editHypothesis( SMESH::SMESH_Hypothesis_ptr,
- const QString&, QWidget* );
+ void editHypothesis( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*, QObject* obj, const QString& );
private:
SMESH::SMESH_Hypothesis_var myHypo, myInitParamsHypo;
ListOfWidgets myParamWidgets;
bool myIsCreate;
QtxDialog* myDlg;
- QEventLoop* myEventLoop;
QString myShapeEntry;
};
SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator*, QWidget* );
virtual ~SMESHGUI_HypothesisDlg();
- void setHIcon( const QPixmap& );
- void setCustomFrame( QFrame* );
- void setType( const QString& );
+ void setHIcon( const QPixmap& );
+ void setCustomFrame( QFrame* );
+ void setType( const QString& );
protected slots:
- virtual void accept();
- virtual void reject();
- void onHelp();
+ virtual void accept();
+ virtual void reject();
+ void onHelp();
private:
- SMESHGUI_GenericHypothesisCreator* myCreator;
- QLabel* myIconLabel;
- QLabel* myTypeLabel;
- QString myHelpFileName;
+ SMESHGUI_GenericHypothesisCreator* myCreator;
+ QLabel *myIconLabel, *myTypeLabel;
+ QString myHelpFileName;
};
/*!
HypothesesSet( const QString& );
HypothesesSet( const QString&, const QStringList&, const QStringList& );
- QString HypoSetName;
- QStringList HypoList, AlgoList;
+ QString name() const;
+ 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
hypoSet != myListOfHypothesesSets.end();
++hypoSet ) {
HypothesesSet* aSet = *hypoSet;
- if ( aSet && aSet->AlgoList.count() ) {
- aSetNameList.append( aSet->HypoSetName );
+ if ( aSet && aSet->count( true ) ) {
+ aSetNameList.append( aSet->name() );
}
}
hypoSet != myListOfHypothesesSets.end();
++hypoSet ) {
HypothesesSet* aSet = *hypoSet;
- if ( aSet && aSet->HypoSetName == theSetName )
+ if ( aSet && aSet->name() == theSetName )
return aSet;
}
return 0;
return false;
}
- HypothesisCreatorPtr GetHypothesisCreator(const QString& aHypType)
+ SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator(const QString& aHypType)
{
if(MYDEBUG) MESSAGE("Get HypothesisCreator for " << aHypType.toLatin1().data());
// 2. Get names of plugin libraries
HypothesisData* aHypData = GetHypothesisData(aHypType);
if (!aHypData)
- return HypothesisCreatorPtr(aCreator);
+ return aCreator;
+
QString aClientLibName = aHypData->ClientLibName;
QString aServerLibName = aHypData->ServerLibName;
}
}
- return HypothesisCreatorPtr(aCreator);
+ return aCreator;
}
namespace SMESH
{
- typedef boost::shared_ptr<SMESHGUI_GenericHypothesisCreator> HypothesisCreatorPtr;
-
SMESHGUI_EXPORT
void InitAvailableHypotheses();
const HypothesisData* );
SMESHGUI_EXPORT
- HypothesisCreatorPtr GetHypothesisCreator( const QString& );
+ SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& );
SMESHGUI_EXPORT
SMESH::SMESH_Hypothesis_ptr CreateHypothesis( const QString&,
*/
//================================================================================
-void SMESHGUI_MeshOp::createHypothesis (const int theDim,
+void SMESHGUI_MeshOp::createHypothesis(const int theDim,
const int theType,
const QString& theTypeName)
{
if (!aData)
return;
+ myDim = theDim;
+ myType = theType;
QStringList aHypNames;
TDim2Type2HypList::const_iterator aDimIter = myExistingHyps.begin();
for ( ; aDimIter != myExistingHyps.end(); aDimIter++) {
QString aHypName = GetUniqueName( aHypNames, aData->Label);
// existing hypos
- int nbHyp = myExistingHyps[theDim][theType].count();
+ bool dialog = false;
QString aClientLibName = aData->ClientLibName;
if (aClientLibName == "") {
// Get hypotheses creator client (GUI)
// BUG 0020378
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
- SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(theTypeName);
+ SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
// Create hypothesis
if (aCreator) {
SMESH::SMESH_Hypothesis_var initParamHyp =
getInitParamsHypothesis(theTypeName, aData->ServerLibName);
- int obj = myDlg->getActiveObject();
removeCustomFilters(); // Issue 0020170
// Get Entry of the Geom object
aCreator->setShapeEntry( anObjEntry );
myDlg->setEnabled( false );
- aCreator->create(initParamHyp, aHypName, myDlg);
- onActivateObject( obj ); // Issue 0020170. Restore filters
- myDlg->setEnabled( true );
- } else {
- SMESH::CreateHypothesis(theTypeName, aHypName, false);
+ aCreator->create(initParamHyp, aHypName, myDlg, this, SLOT( onHypoCreated( int ) ) );
+ dialog = true;
}
+ 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");
- HypothesisData* algoData = hypData( theDim, Algo, currentHyp( theDim, Algo ));
+ int nbHyp = myExistingHyps[myDim][myType].count();
+ HypothesisData* algoData = hypData( myDim, Algo, currentHyp( myDim, Algo ));
QStringList aNewHyps;
- existingHyps(theDim, theType, aFather, aNewHyps, myExistingHyps[theDim][theType], algoData);
- if (aNewHyps.count() > nbHyp) {
+ existingHyps(myDim, myType, aFather, aNewHyps, myExistingHyps[myDim][myType], algoData);
+ if (aNewHyps.count() > nbHyp)
+ {
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();
}
//================================================================================
// BUG 0020378
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHyp->GetName());
- SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(aHyp->GetName());
+ SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHyp->GetName());
if ( aCreator )
{
// Get initial parameters
}
aCreator->setShapeEntry( anObjEntry );
- int obj = myDlg->getActiveObject();
removeCustomFilters(); // Issue 0020170
myDlg->setEnabled( false );
- aCreator->edit( aHyp.in(), aHypItem.second, dlg() );
- onActivateObject( obj ); // Issue 0020170. Restore filters
- myDlg->setEnabled( true );
+ aCreator->edit( aHyp.in(), aHypItem.second, dlg(), this, SLOT( onHypoEdited( int ) ) );
}
}
+//================================================================================
+/*!
+ * 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
//================================================================================
void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
{
- HypothesesSet* aHypoSet = SMESH::GetHypothesesSet(theSetName);
- if (!aHypoSet) return;
+ myHypoSet = SMESH::GetHypothesesSet(theSetName);
+ if (!myHypoSet)
+ return;
// clear all hyps
for (int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++) {
setCurrentHyp(dim, MainHyp, -1);
}
- for (int aHypType = Algo; aHypType < AddHyp; aHypType++) {
- bool isAlgo = (aHypType == Algo);
+ myHypoSet->init(true); //algorithms
+ 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++) {
- const QString& aHypoTypeName = (*aHypoList)[ i ];
- HypothesisData* aHypData = SMESH::GetHypothesisData(aHypoTypeName);
- if (!aHypData)
- continue;
+//================================================================================
+/*!
+ * \brief One step of hypothesis/algorithm list creation
+ *
+ * Creates a hypothesis or an algorithm for current item of internal list of names myHypoSet
+ */
+//================================================================================
+void SMESHGUI_MeshOp::processSet()
+{
+ myHypoSet->next();
+ if( !myHypoSet->more() )
+ return;
- int aDim = aHypData->Dim[0];
- // create or/and set
- if (isAlgo) {
- int index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
- if ( index < 0 ) {
- QStringList anAvailable;
- availableHyps( aDim, Algo, anAvailable, myAvailableHypData[aDim][Algo] );
- myDlg->tab( aDim )->setAvailableHyps( Algo, anAvailable );
- index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
- }
- setCurrentHyp( aDim, Algo, index );
- onAlgoSelected( index, aDim );
- }
- else {
- 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);
- }
- } // loop on hypos in the set
- } // loop on algo/hypo
+ bool isAlgo = myHypoSet->isAlgo();
+ QString aHypoTypeName = myHypoSet->current();
+ HypothesisData* aHypData = SMESH::GetHypothesisData(aHypoTypeName);
+ if (!aHypData)
+ {
+ processSet();
+ return;
+ }
+
+ int aDim = aHypData->Dim[0];
+ // create or/and set
+ if (isAlgo)
+ {
+ int index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
+ if ( index < 0 )
+ {
+ QStringList anAvailable;
+ availableHyps( aDim, Algo, anAvailable, myAvailableHypData[aDim][Algo] );
+ myDlg->tab( aDim )->setAvailableHyps( Algo, anAvailable );
+ index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
+ }
+ setCurrentHyp( aDim, Algo, index );
+ onAlgoSelected( index, aDim );
+ processSet();
+ }
+ else
+ {
+ 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();
+ }
}
//================================================================================
QStringList tmp;
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::iterator anIter = aHypVarList.begin();
for ( ; anIter != aHypVarList.end(); anIter++)
}
}
- if (anAlgoVar->_is_nil()) {
+ if (anAlgoVar->_is_nil())
+ {
HypothesisData* aHypData = SMESH::GetHypothesisData( aHypName );
- if (aHypData) {
+ if (aHypData)
+ {
QString aClientLibName = aHypData->ClientLibName;
- if (aClientLibName == "") {
+ if (aClientLibName == "")
+ {
// Call hypothesis creation server method (without GUI)
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
- } else {
+ }
+ else
+ {
// Get hypotheses creator client (GUI)
// BUG 0020378
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName);
- SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(aHypName);
+ SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName);
// Create algorithm
- if (aCreator) {
- aCreator->create(true, aHypName, myDlg);
- }
+ if (aCreator)
+ aCreator->create(true, aHypName, myDlg, 0, QString::null );
else
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
}
#include "SMESHGUI_SelectionOp.h"
+class HypothesesSet;
class SMESHGUI_MeshDlg;
class SMESHGUI_ShapeByMeshOp;
class HypothesisData;
void onPublishShapeByMeshDlg( SUIT_Operation* );
void onCloseShapeByMeshDlg( SUIT_Operation* );
void onAlgoSelected( const int, const int = -1 );
+ void processSet();
+ void onHypoCreated( int );
+ void onHypoEdited( int );
private:
typedef QList<HypothesisData*> THypDataList; // typedef: list of hypothesis data
THypDataList myAvailableHypData[4][NbHypTypes];
bool myIgnoreAlgoSelection;
+ HypothesesSet* myHypoSet;
+ int myDim, myType;
};
#endif // SMESHGUI_MESHOP_H
{
QString aHypos = isHypo ? atts.value("hypos") : atts.value("algos");
aHypos = aHypos.remove( ' ' );
- QStringList* aHypoList = isHypo ? & aHypoSet->HypoList : & aHypoSet->AlgoList;
- *aHypoList = aHypos.split( ',', QString::SkipEmptyParts );
+ aHypoSet->set( !isHypo, aHypos.split( ',', QString::SkipEmptyParts ) );
}
}
}
CORBA::String_var hypType = myHyp->GetName();
// BUG 0020378
//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 ( myDlg ) myDlg->hide();
+ if ( myDlg )
+ myDlg->hide();
try {
QWidget* parent = this;
- if ( myDlg ) parent = myDlg->parentWidget();
- editor->edit( myHyp, myName, parent );
+ if ( myDlg )
+ 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();
}
void onCreate();
void onEdit();
void onHypTypePopup( QAction* );
+ void onEdited(int);
private:
void init();