+ if (ID == myMax)
+ myMax = 0;
+ if (ID == myMin)
+ myMin = 0;
+}
+
+//=======================================================================
+//function : GetMaxID
+//purpose :
+//=======================================================================
+
+int SMDS_MeshElementIDFactory::GetMaxID() const
+{
+ if (myMax == 0)
+ updateMinMax();
+ return myMax;
+}
+
+//=======================================================================
+//function : GetMinID
+//purpose :
+//=======================================================================
+
+int SMDS_MeshElementIDFactory::GetMinID() const
+{
+ if (myMin == 0)
+ updateMinMax();
+ return myMin;
+}
+
+//=======================================================================
+//function : updateMinMax
+//purpose :
+//=======================================================================
+
+void SMDS_MeshElementIDFactory::updateMinMax() const
+{
+ myMin = IntegerLast();
+ myMax = 0;
+ SMDS_IdElementMap::Iterator it(myIDElements);
+ for (; it.More(); it.Next())
+ updateMinMax (it.Key());
+ if (myMin == IntegerLast())
+ myMin = 0;
+}
+
+//=======================================================================
+//function : elementsIterator
+//purpose : Return an iterator on elements of the factory
+//=======================================================================
+
+class SMDS_Fact_MyElemIterator:public SMDS_ElemIterator
+{
+ SMDS_IdElementMap::Iterator myIterator;
+ public:
+ SMDS_Fact_MyElemIterator(const SMDS_IdElementMap& s):myIterator(s)
+ {}
+
+ bool more()
+ {
+ return myIterator.More() != Standard_False;
+ }
+
+ const SMDS_MeshElement* next()
+ {
+ const SMDS_MeshElement* current = myIterator.Value();
+ myIterator.Next();
+ return current;
+ }
+};
+
+SMDS_ElemIteratorPtr SMDS_MeshElementIDFactory::elementsIterator() const
+{
+ return SMDS_ElemIteratorPtr
+ (new SMDS_Fact_MyElemIterator(myIDElements));