Salome HOME
Mantis issue 0021432: EDF GEOM: Faces with huge tolerance can be built in GEOM.
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_ShapeSet.cxx
index e48672d62b91c7d5f1769912c5c00a22b4c721d7..720df322cfd5a6e89e9472bc5e3dcff48a900082 100755 (executable)
@@ -1,27 +1,28 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011  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:       GEOMAlgo_ShapeSet.cxx
-// Created:    
-// Author:     Peter KURNEV 
+
+// File:        GEOMAlgo_ShapeSet.cxx
+// Created:     
+// Author:      Peter KURNEV 
 //
 #include <GEOMAlgo_ShapeSet.ixx>
 
@@ -61,7 +62,7 @@
 //purpose  : 
 //=======================================================================
   void GEOMAlgo_ShapeSet::Add(const TopoDS_Shape& theShape,
-                             const TopAbs_ShapeEnum theType)
+                              const TopAbs_ShapeEnum theType)
 {
   TopExp_Explorer aExp;
   //
 //=======================================================================
   const TopTools_ListOfShape& GEOMAlgo_ShapeSet::GetSet()const
 {
-  /*
-  TopTools_ListOfShape *pL;
-  TopTools_MapIteratorOfMapOfOrientedShape aIt;
-  //
-  pL=(TopTools_ListOfShape *)&myList;
-  pL->Clear();
-  aIt.Initialize(myMap);
-  for (; aIt.More(); aIt.Next()) {
-    pL->Append(aIt.Key());
-  }
-  */
   return myList;
 }
 //=======================================================================
     if (aOr==TopAbs_FORWARD || aOr==TopAbs_REVERSED) {
       bRet=myMap.Contains(aF);
       if (!bRet) {
-       break;
+        break;
       }
     }
   }
 //=======================================================================
   void GEOMAlgo_ShapeSet::Subtract(const GEOMAlgo_ShapeSet& theOther)
 {
-  /*
-  TopTools_MapIteratorOfMapOfOrientedShape aIt;
-  //
-  aIt.Initialize(theOther.myMap);
-  for (; aIt.More(); aIt.Next()) {
-    const TopoDS_Shape& aS=aIt.Key();
-    myMap.Remove(aS);
-  }
-  */
-  //
   TopTools_ListIteratorOfListOfShape aIt;
   TopTools_ListOfShape aLS;
   //
     const TopoDS_Shape& aS=aIt.Value();
     if (!theOther.myMap.Contains(aS)) {
       if(myMap.Add(aS)){
-       aLS.Append(aS);
+        aLS.Append(aS);
       }
     }
   }
   //
   myList=aLS;
 }
+//modified by NIZNHY-PKV Wed Oct 28 13:51:36 2010f
+//=======================================================================
+//function : IsEqual
+//purpose  : 
+//=======================================================================
+  Standard_Boolean GEOMAlgo_ShapeSet::IsEqual(const GEOMAlgo_ShapeSet& theOther)const
+{
+  Standard_Boolean bRet;
+  Standard_Integer aNb1, aNb2;
+  TopTools_ListIteratorOfListOfShape aIt;
+  //
+  bRet=Standard_True;
+  aNb1=myList.Extent();
+  const TopTools_ListOfShape& aLS2=theOther.GetSet();
+  aNb2=aLS2.Extent();
+  if (aNb1!=aNb2) {
+    return !bRet;
+  }
+  //
+  aIt.Initialize(myList);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aS=aIt.Value();
+    if(!theOther.myMap.Contains(aS)) {
+      bRet=!bRet;
+      break;
+    }
+  }
+  return bRet;
+}
+//modified by NIZNHY-PKV Wed Oct 28 13:51:38 2010t