0027987: CellsBuilder algorithm does not find shared common parts of the arguments
authoremv <emv@opencascade.com>
Fri, 21 Oct 2016 08:09:34 +0000 (11:09 +0300)
committerapn <apn@opencascade.com>
Thu, 27 Oct 2016 14:03:24 +0000 (17:03 +0300)
Treatment of the possibility of shared parts has been added.

src/BOPAlgo/BOPAlgo_CellsBuilder.cxx
tests/bugs/modalg_6/bug27987 [new file with mode: 0644]

index 82ad086..8302bf6 100644 (file)
@@ -203,27 +203,25 @@ void BOPAlgo_CellsBuilder::IndexParts()
     aExp.Init(aS, myType);
     for (; aExp.More(); aExp.Next()) {
       const TopoDS_Shape& aST = aExp.Current();
-      if (!myImages.IsBound(aST)) {
-        BOPCol_ListOfShape aLS;
-        aLS.Append(aS);
-        myIndex.Add(aST, aLS);
+      const BOPCol_ListOfShape* pLSIm = myImages.Seek(aST);
+      if (!pLSIm) {
+        BOPCol_ListOfShape* pLS = myIndex.ChangeSeek(aST);
+        if (!pLS) {
+          pLS = &myIndex(myIndex.Add(aST, BOPCol_ListOfShape()));
+        }
+        pLS ->Append(aS);
         continue;
       }
       //
-      const BOPCol_ListOfShape& aLSIm = myImages.Find(aST);
-      aItIm.Initialize(aLSIm);
+      aItIm.Initialize(*pLSIm);
       for (; aItIm.More(); aItIm.Next()) {
         const TopoDS_Shape& aSTIm = aItIm.Value();
         //
-        if (myIndex.Contains(aSTIm)) {
-          BOPCol_ListOfShape& aLS = myIndex.ChangeFromKey(aSTIm);
-          aLS.Append(aS);
-        }
-        else {
-          BOPCol_ListOfShape aLS;
-          aLS.Append(aS);
-          myIndex.Add(aSTIm, aLS);
+        BOPCol_ListOfShape* pLS = myIndex.ChangeSeek(aSTIm);
+        if (!pLS) {
+          pLS = &myIndex(myIndex.Add(aSTIm, BOPCol_ListOfShape()));
         }
+        pLS ->Append(aS);
       } // for (; aItIm.More(); aItIm.Next()) {
     } // for (; aExp.More(); aExp.Next()) {
   } // for (; aIt.More(); aIt.Next()) {
diff --git a/tests/bugs/modalg_6/bug27987 b/tests/bugs/modalg_6/bug27987
new file mode 100644 (file)
index 0000000..a952d2f
--- /dev/null
@@ -0,0 +1,21 @@
+puts "========"
+puts "OCC27987"
+puts "========"
+puts ""
+#################################################
+# CellsBuilder algorithm does not find shared common parts of the arguments
+#################################################
+
+restore [locate_data_file bug27987.brep] b
+
+explode b
+bclearobjects
+bcleartools
+baddobjects b_1
+baddtools b_2
+bfillds
+bcbuild rx
+bcadd result b_1 1 b_2 1
+
+checknbshapes result -face 1
+checkview -display result -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file