NPAL14335 (EDF 344 SMESH : "ERROR : Iterator not implemented " when loading a script)

add optional SMDSAbs_ElementType arg to GetInverseElementIterator()
This commit is contained in:
eap 2006-12-29 14:27:54 +00:00
parent 8c74c25d2c
commit 7dad29749c
2 changed files with 17 additions and 5 deletions

View File

@ -88,16 +88,28 @@ const SMDS_PositionPtr& SMDS_MeshNode::GetPosition() const
return myPosition; return myPosition;
} }
//=======================================================================
/*!
* \brief Iterator on list of elements
*/
//=======================================================================
class SMDS_MeshNode_MyInvIterator:public SMDS_ElemIterator class SMDS_MeshNode_MyInvIterator:public SMDS_ElemIterator
{ {
NCollection_List<const SMDS_MeshElement*>::Iterator myIterator; NCollection_List<const SMDS_MeshElement*>::Iterator myIterator;
SMDSAbs_ElementType myType;
public: public:
SMDS_MeshNode_MyInvIterator(const NCollection_List<const SMDS_MeshElement*>& s): SMDS_MeshNode_MyInvIterator(const NCollection_List<const SMDS_MeshElement*>& s,
myIterator(s) SMDSAbs_ElementType type):
myIterator(s), myType(type)
{} {}
bool more() bool more()
{ {
if ( myType != SMDSAbs_All ) {
while ( myIterator.More() && myIterator.Value()->GetType() != myType)
myIterator.Next();
}
return myIterator.More() != Standard_False; return myIterator.More() != Standard_False;
} }
@ -110,9 +122,9 @@ class SMDS_MeshNode_MyInvIterator:public SMDS_ElemIterator
}; };
SMDS_ElemIteratorPtr SMDS_MeshNode:: SMDS_ElemIteratorPtr SMDS_MeshNode::
GetInverseElementIterator() const GetInverseElementIterator(SMDSAbs_ElementType type) const
{ {
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(myInverseElements)); return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(myInverseElements,type));
} }
// Same as GetInverseElementIterator but the create iterator only return // Same as GetInverseElementIterator but the create iterator only return

View File

@ -56,7 +56,7 @@ class SMDS_WNT_EXPORT SMDS_MeshNode:public SMDS_MeshElement
void RemoveInverseElement(const SMDS_MeshElement * parent); void RemoveInverseElement(const SMDS_MeshElement * parent);
void ClearInverseElements(); void ClearInverseElements();
bool emptyInverseElements(); bool emptyInverseElements();
SMDS_ElemIteratorPtr GetInverseElementIterator() const; SMDS_ElemIteratorPtr GetInverseElementIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
void SetPosition(const SMDS_PositionPtr& aPos); void SetPosition(const SMDS_PositionPtr& aPos);
const SMDS_PositionPtr& GetPosition() const; const SMDS_PositionPtr& GetPosition() const;
SMDSAbs_ElementType GetType() const; SMDSAbs_ElementType GetType() const;