0028284: Avoid classification of sub-shapes of arguments of BOPs relatively solids...
[occt.git] / src / BOPAlgo / BOPAlgo_CheckerSI.cxx
index d038073..323b5af 100644 (file)
@@ -22,8 +22,8 @@
 #include <BOPDS_DS.hxx>
 #include <BOPDS_Interf.hxx>
 #include <BOPDS_IteratorSI.hxx>
-#include <BOPDS_MapOfPassKey.hxx>
-#include <BOPDS_PassKey.hxx>
+#include <BOPDS_MapOfPair.hxx>
+#include <BOPDS_Pair.hxx>
 #include <BOPDS_PIteratorSI.hxx>
 #include <BOPDS_VectorOfInterfEF.hxx>
 #include <BOPDS_VectorOfInterfFF.hxx>
@@ -105,49 +105,36 @@ void BOPAlgo_CheckerSI::Init()
 void BOPAlgo_CheckerSI::Perform()
 {
   try {
-    Standard_Integer iErr;
-    //
     OCC_CATCH_SIGNALS
     //
-    myErrorStatus=0;
-    if (myArguments.Extent()!=1) {
-      myErrorStatus=10;
+    myErrorStatus = 0;
+    if (myArguments.Extent() != 1) {
+      myErrorStatus = 10;
       return;
     }
     //
-    if (myNonDestructive) {
-      PrepareCopy();
-      if (myErrorStatus) {
-        return; 
-      }
-    }
-    //
+    // Perform intersection of sub shapes
     BOPAlgo_PaveFiller::Perform();
-    iErr=myErrorStatus; 
     //
-    PostTreat();
-    if (myErrorStatus) {
-      iErr=myErrorStatus; 
-    }
+    // Perform intersection with solids
+    if (!myErrorStatus)
+      PerformVZ();
     //
-    if (myNonDestructive) {
-      PostTreatCopy();
-      if (myErrorStatus) {
-        iErr=myErrorStatus; 
-      }
-    }
+    if (!myErrorStatus)
+      PerformEZ();
     //
-    if (iErr) {
-      myErrorStatus=iErr;
-    }
+    if (!myErrorStatus)
+      PerformFZ();
+    //
+    if (!myErrorStatus)
+      PerformZZ();
+    //
+    // Treat the intersection results
+    PostTreat();
   }
   //
   catch (Standard_Failure) {
-    if (myNonDestructive) { 
-      PostTreatCopy();
-    }
-    //
-    myErrorStatus=11;
+    myErrorStatus = 11;
   }
 }
 //=======================================================================
@@ -157,12 +144,12 @@ void BOPAlgo_CheckerSI::Perform()
 void BOPAlgo_CheckerSI::PostTreat()
 {
   Standard_Integer i, aNb, n1, n2; 
-  BOPDS_PassKey aPK;
+  BOPDS_Pair aPK;
   //
   myErrorStatus=0;
   //
-  BOPDS_MapOfPassKey& aMPK=
-    *((BOPDS_MapOfPassKey*)&myDS->Interferences());
+  BOPDS_MapOfPair& aMPK=
+    *((BOPDS_MapOfPair*)&myDS->Interferences());
   aMPK.Clear();
   //
   // 0
@@ -174,7 +161,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
       continue;
     }
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -187,7 +174,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
       continue;
     }
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -200,7 +187,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
       continue;
     }
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -213,7 +200,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
       continue;
     }
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -229,7 +216,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
       continue;
     }
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -276,7 +263,7 @@ void BOPAlgo_CheckerSI::PostTreat()
       continue;
     }
     //
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -291,7 +278,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
       continue;
     }
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -302,7 +289,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     //
     const BOPDS_InterfEZ& aEZ=aEZs(i);
     aEZ.Indices(n1, n2);
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -313,7 +300,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     //
     const BOPDS_InterfFZ& aFZ=aFZs(i);
     aFZ.Indices(n1, n2);
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -324,76 +311,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     //
     const BOPDS_InterfZZ& aZZ=aZZs(i);
     aZZ.Indices(n1, n2);
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
 }
-//=======================================================================
-//function : PrepareCopy
-//purpose  : 
-//=======================================================================
-void BOPAlgo_CheckerSI::PrepareCopy()
-{
-  Standard_Boolean bIsDone;
-  BRepBuilderAPI_Copy aCopier;
-  BOPCol_MapOfShape aMSA;
-  BOPCol_MapIteratorOfMapOfShape aItMS;
-  //
-  myErrorStatus=0;
-  //
-  myNewOldMap.Clear();
-  //
-  const TopoDS_Shape& aSA=myArguments.First();
-  //
-  BOPTools::MapShapes(aSA, aMSA);
-  //
-  aCopier.Perform(aSA, Standard_False);
-  bIsDone=aCopier.IsDone();
-  if (!bIsDone) {
-    myErrorStatus=12; 
-    return;
-  }
-  //
-  const TopoDS_Shape& aSC=aCopier.Shape();
-  //
-  aItMS.Initialize(aMSA);
-  for(; aItMS.More(); aItMS.Next()) {
-    const TopoDS_Shape& aSAx=aItMS.Value();
-    const TopoDS_Shape& aSCx=aCopier.Modified(aSAx).First();
-    myNewOldMap.Bind(aSCx, aSAx);
-  }
-  //
-  myArguments.Clear();
-  myArguments.Append(aSC);
-}
-//=======================================================================
-//function : PostTreatCopy
-//purpose  : 
-//=======================================================================
-void BOPAlgo_CheckerSI::PostTreatCopy() 
-{
-  Standard_Integer i, aNb;
-  //
-  myErrorStatus=0;
-  //
-  aNb=myDS->NbSourceShapes();
-  for (i=0; i!=aNb; ++i) {
-    BOPDS_ShapeInfo& aSI=myDS->ChangeShapeInfo(i);
-    const TopoDS_Shape& aSCi=aSI.Shape();
-    if (!myNewOldMap.IsBound(aSCi)) {
-      myErrorStatus=13;
-      return;
-    }
-    //
-    const TopoDS_Shape& aSAi=myNewOldMap.Find(aSCi);
-    aSI.SetShape(aSAi);
-  }
-}
-//
-// myErrorStatus:
-//
-// 10 - The number of the arguments is not 1
-// 11 - Exception is caught
-// 12 - BRepBuilderAPI_Copy is not done
-// 13 - myNewOldMap doe not contain DS shape 
-