0021014: EDF 1583 SMESH: Improvement of the Python Dump for the creation of groups

To remove sub-filters if necessary

-  SMESH_LogicalFilter( const QList<SUIT_SelectionFilter*>&, const int );
+  SMESH_LogicalFilter( const QList<SUIT_SelectionFilter*>&, const int, bool takeOwnership=false );

 private:
+  void                          deleteFilters();
This commit is contained in:
eap 2011-06-23 12:14:05 +00:00
parent b21414354c
commit 00b26b695f
2 changed files with 25 additions and 2 deletions

View File

@ -30,7 +30,9 @@
// Purpose : Constructor
//=======================================================================
SMESH_LogicalFilter::SMESH_LogicalFilter (const QList<SUIT_SelectionFilter*>& theFilters,
const int theLogOp)
const int theLogOp,
bool takeOwnership)
: myOwnership( takeOwnership )
{
setFilters(theFilters);
setOperation(theLogOp);
@ -42,6 +44,7 @@ SMESH_LogicalFilter::SMESH_LogicalFilter (const QList<SUIT_SelectionFilter*>& th
//=======================================================================
SMESH_LogicalFilter::~SMESH_LogicalFilter()
{
deleteFilters();
}
//=======================================================================
@ -70,6 +73,7 @@ bool SMESH_LogicalFilter::isOk (const SUIT_DataOwner* owner) const
//=======================================================================
void SMESH_LogicalFilter::setFilters (const QList<SUIT_SelectionFilter*>& theFilters)
{
deleteFilters();
myFilters = theFilters;
}
@ -99,3 +103,18 @@ int SMESH_LogicalFilter::getOperation() const
{
return myOperation;
}
//================================================================================
/*!
* \brief Deletes filters if has an ownership
*/
//================================================================================
void SMESH_LogicalFilter::deleteFilters()
{
if ( myOwnership )
{
SUIT_SelectionFilter* filter;
foreach( filter, myFilters )
delete filter;
}
}

View File

@ -38,7 +38,7 @@ class SMESHFILTERSSELECTION_EXPORT SMESH_LogicalFilter : public SUIT_SelectionFi
enum { LO_OR, LO_AND, LO_NOT, LO_UNDEFINED };
public:
SMESH_LogicalFilter( const QList<SUIT_SelectionFilter*>&, const int );
SMESH_LogicalFilter( const QList<SUIT_SelectionFilter*>&, const int, bool takeOwnership=false );
virtual ~SMESH_LogicalFilter();
virtual bool isOk (const SUIT_DataOwner*) const;
@ -48,9 +48,13 @@ class SMESHFILTERSSELECTION_EXPORT SMESH_LogicalFilter : public SUIT_SelectionFi
const QList<SUIT_SelectionFilter*> getFilters() const;
int getOperation() const;
private:
void deleteFilters();
private:
QList<SUIT_SelectionFilter*> myFilters;
int myOperation;
bool myOwnership;
};
#endif