From: san Date: Mon, 7 Feb 2005 13:51:15 +0000 (+0000) Subject: PAL6825 X-Git-Tag: V2_2_0b4~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=92595f008083c36efe3fb4d5005655ef12582ad0;p=modules%2Fsmesh.git PAL6825 --- diff --git a/src/SMESHDS/SMESHDS_Group.cxx b/src/SMESHDS/SMESHDS_Group.cxx index ecd6efb8c..9c7dfa4a9 100644 --- a/src/SMESHDS/SMESHDS_Group.cxx +++ b/src/SMESHDS/SMESHDS_Group.cxx @@ -93,6 +93,7 @@ bool SMESHDS_Group::Add (const int theID) SetType( aElem->GetType() ); myGroup.Add (aElem); + resetIterator(); return true; } @@ -108,6 +109,7 @@ bool SMESHDS_Group::Remove (const int theID) if (!aElem || !myGroup.Contains(aElem)) return false; myGroup.Remove (aElem); + resetIterator(); return true; } @@ -119,6 +121,7 @@ bool SMESHDS_Group::Remove (const int theID) void SMESHDS_Group::Clear() { myGroup.Clear(); + resetIterator(); } // ===================== diff --git a/src/SMESHDS/SMESHDS_GroupBase.cxx b/src/SMESHDS/SMESHDS_GroupBase.cxx index c3fc31d70..c4adcc53b 100644 --- a/src/SMESHDS/SMESHDS_GroupBase.cxx +++ b/src/SMESHDS/SMESHDS_GroupBase.cxx @@ -41,7 +41,7 @@ SMESHDS_GroupBase::SMESHDS_GroupBase (const int theID, const SMESHDS_Mesh* theMesh, const SMDSAbs_ElementType theType): myID(theID), myMesh(theMesh), myType(theType), myStoreName(""), - myCurIndex(0), myCurID(0) + myCurIndex(0), myCurID(-1) { } @@ -86,6 +86,18 @@ const SMDS_MeshElement* SMESHDS_GroupBase::findInMesh (const int theID) const return aElem; } +//============================================================================= +/*! + * Internal method: resets cached iterator, should be called by ancestors + * when they are modified (ex: Add() or Remove() ) + */ +//============================================================================= +void SMESHDS_GroupBase::resetIterator() +{ + myCurIndex = 0; + myCurID = -1; +} + //======================================================================= //function : Extent //purpose : diff --git a/src/SMESHDS/SMESHDS_GroupBase.hxx b/src/SMESHDS/SMESHDS_GroupBase.hxx index fbb91414a..a7aa87ced 100644 --- a/src/SMESHDS/SMESHDS_GroupBase.hxx +++ b/src/SMESHDS/SMESHDS_GroupBase.hxx @@ -68,6 +68,7 @@ class SMESHDS_GroupBase protected: const SMDS_MeshElement* findInMesh (const int theID) const; + void resetIterator(); private: SMESHDS_GroupBase (const SMESHDS_GroupBase& theOther);