]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/NMTDS/NMTDS_Iterator.cxx
Salome HOME
0021672: [CEA 565] Dump Study from script
[modules/geom.git] / src / NMTDS / NMTDS_Iterator.cxx
index 030002de3cf2fc9094f1e831f7d78793fcd90061..00bd62623dbeab90fdb5a572364c6b1f8128eb45 100755 (executable)
@@ -1,29 +1,29 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 // File:        NMTDS_Iterator.cxx
-// Created:     Sun May 07 15:04:41 2006
 // Author:      Peter KURNEV
-//
-#include <NMTDS_Iterator.ixx>
+
+#include <NMTDS_Iterator.hxx>
 //
 #include <Bnd_Box.hxx>
 //
 #include <NCollection_UBTreeFiller.hxx>
 #include <NMTDS_CArray1OfIndexRange.hxx>
 #include <NMTDS_IndexRange.hxx>
-#include <NMTDS_PassKeyBoolean.hxx>
-#include <NMTDS_MapOfPassKeyBoolean.hxx>
+#include <NMTDS_PairBoolean.hxx>
+#include <NMTDS_MapOfPairBoolean.hxx>
 #include <NMTDS_IndexedDataMapOfShapeBox.hxx>
 #include <NMTDS_IndexedDataMapOfIntegerShape.hxx>
 #include <NMTDS_Tools.hxx>
 #include <NMTDS_DataMapOfIntegerMapOfInteger.hxx>
 #include <NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx>
+#include <NMTDS_ShapesDataStructure.hxx>
 
 //=======================================================================
 //function : NMTDS_Iterator
 //purpose  : 
 //=======================================================================
-  NMTDS_Iterator::NMTDS_Iterator()
+NMTDS_Iterator::NMTDS_Iterator()
 {
   myDS=NULL; 
   myLength=0;
 //function : ~NMTDS_Iterator
 //purpose  : 
 //=======================================================================
-  NMTDS_Iterator::~NMTDS_Iterator()
+NMTDS_Iterator::~NMTDS_Iterator()
 {
 }
 //=======================================================================
 // function: SetDS
 // purpose: 
 //=======================================================================
-  void NMTDS_Iterator::SetDS(const NMTDS_PShapesDataStructure& aDS)
+void NMTDS_Iterator::SetDS(const NMTDS_PShapesDataStructure& aDS)
 {
   myDS=aDS;
 }
@@ -82,7 +83,7 @@
 // function: DS
 // purpose: 
 //=======================================================================
-  const NMTDS_ShapesDataStructure&  NMTDS_Iterator::DS()const
+const NMTDS_ShapesDataStructure&  NMTDS_Iterator::DS()const
 {
   return *myDS;
 }
@@ -90,7 +91,7 @@
 // function: ExpectedLength
 // purpose: 
 //=======================================================================
-  Standard_Integer NMTDS_Iterator::ExpectedLength() const
+Standard_Integer NMTDS_Iterator::ExpectedLength() const
 {
   return myLength;
 }
@@ -98,9 +99,9 @@
 // function: BlockLength
 // purpose: 
 //=======================================================================
-  Standard_Integer NMTDS_Iterator::BlockLength() const
+Standard_Integer NMTDS_Iterator::BlockLength() const
 {
-  Standard_Integer aNbIIs;
+  Standard_Integer aNbIIs, iTresh;
   Standard_Real aCfPredict=.5;
   
   aNbIIs=ExpectedLength();
   if (aNbIIs<=1) {
     return 1;
   }
+  //modified by NIZNHY-PKV Mon Dec 12 08:50:50 2011f
+  iTresh=1000;
+  if (aNbIIs>iTresh) {
+    aNbIIs=iTresh;
+    return aNbIIs;
+  }
+  //modified by NIZNHY-PKV Mon Dec 12 08:50:54 2011t
   //
   aNbIIs=(Standard_Integer) (aCfPredict*(Standard_Real)aNbIIs);
   return aNbIIs;
 // function: Initialize
 // purpose: 
 //=======================================================================
-  void NMTDS_Iterator::Initialize(const TopAbs_ShapeEnum aType1,
-                                  const TopAbs_ShapeEnum aType2)
+void NMTDS_Iterator::Initialize(const TopAbs_ShapeEnum aType1,
+                               const TopAbs_ShapeEnum aType2)
 {
   Standard_Integer iX;
   //
 // function: More
 // purpose: 
 //=======================================================================
-  Standard_Boolean NMTDS_Iterator::More()const
+Standard_Boolean NMTDS_Iterator::More()const
 {
   return myIterator.More();
 }
 // function: Next
 // purpose: 
 //=======================================================================
-  void NMTDS_Iterator::Next()
+void NMTDS_Iterator::Next()
 {
   myIterator.Next();
 }
 // function: Current
 // purpose: 
 //=======================================================================
-  void NMTDS_Iterator::Current(Standard_Integer& aIndex1,
-                               Standard_Integer& aIndex2,
-                               Standard_Boolean& aWithSubShape) const
+void NMTDS_Iterator::Current(Standard_Integer& aIndex1,
+                            Standard_Integer& aIndex2,
+                            Standard_Boolean& aWithSubShape) const
 {
-  const NMTDS_PassKeyBoolean& aPKB=myIterator.Value();
+  const NMTDS_PairBoolean& aPKB=myIterator.Value();
   aPKB.Ids(aIndex1, aIndex2);
   aWithSubShape=aPKB.Flag();
 }
 // function: SDVertices
 // purpose: 
 //=======================================================================
-  const TColStd_DataMapOfIntegerListOfInteger& NMTDS_Iterator::SDVertices()const
+const TColStd_DataMapOfIntegerListOfInteger& NMTDS_Iterator::SDVertices()const
 {
   return myMVSD;
 }
 // function: Prepare
 // purpose: 
 //=======================================================================
-  void NMTDS_Iterator::Prepare()
+void NMTDS_Iterator::Prepare()
 {
   Standard_Integer i;
   //
 // function: Intersect
 // purpose: 
 //=======================================================================
-  void NMTDS_Iterator::Intersect()
+void NMTDS_Iterator::Intersect()
 {
   Standard_Boolean bFlag;
   Standard_Integer aNb, i, aNbB, aNbR, iFlag;
-  Standard_Integer i1, i2, aNbSD, iX, j, iDS, jB, iR, k, aNbLV;
+  Standard_Integer i1, i2, aNbSD, iX, j, iDS, jB, iR, k, aNbLV, aNbLV1;
   TColStd_ListIteratorOfListOfInteger aIt;
   TColStd_DataMapOfIntegerInteger aMII;
-  //modified by NIZNHY-PKV Mon Jan 22 15:08:00 2007f
-  //TColStd_MapOfInteger aMFence;
   TColStd_DataMapOfIntegerListOfInteger aMVSD;
   TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD;
-  //modified by NIZNHY-PKV Mon Jan 22 10:21:50 2007t
   TopTools_DataMapOfShapeInteger aMSI;
   TopAbs_ShapeEnum aTi, aTj;
-  NMTDS_PassKeyBoolean aPKXB; 
-  NMTDS_MapOfPassKeyBoolean aMPKXB;
+  NMTDS_PairBoolean aPKXB; 
+  NMTDS_MapOfPairBoolean aMPKXB;
   NMTDS_IndexedDataMapOfShapeBox aMSB;
   //
   NMTDS_BoxBndTreeSelector aSelector;
             aMPKXB.Remove(aPKXB);
           }
         }
-        aMVSD.Bind(i, aLV1);
+       //
+       aNbLV1=aLV1.Extent();
+       if (aNbLV1) {
+         aMVSD.Bind(i, aLV1);
+       }
       }
     }//for (i=i1; i<=i2; ++i) {
   }//for (iR=1; iR<aNbR; ++iR) {
   //=================
   myMVSD.Clear();
   NMTDS_Iterator::FillMVSD(aMVSD, myMVSD);
+  
+  //modified by NIZNHY-PKV Mon Dec 12 09:51:29 2011f
+  aMPKXB.Clear();
+  Standard::Purge();
+  //modified by NIZNHY-PKV Mon Dec 12 09:51:33 2011t
 }
 //=======================================================================
 //function : FillMVSD
 //purpose  : 
 //=======================================================================
-  void NMTDS_Iterator::FillMVSD(const TColStd_DataMapOfIntegerListOfInteger& aMVSD,
-                                TColStd_DataMapOfIntegerListOfInteger& bMVSD)
+void NMTDS_Iterator::FillMVSD(const TColStd_DataMapOfIntegerListOfInteger& aMVSD,
+                             TColStd_DataMapOfIntegerListOfInteger& bMVSD)
 {
   Standard_Boolean bFound;
   Standard_Integer aNbVSD, iCnt, i, j, k;