1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

Fix to avoid exception for case46 (regressions)

This commit is contained in:
gka
2014-10-28 19:51:23 +03:00
parent 3054ab58fb
commit 097a0cae0f

View File

@@ -64,6 +64,9 @@
#include <BOPCol_ListOfInteger.hxx> #include <BOPCol_ListOfInteger.hxx>
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
#include <TCollection_CompareOfInteger.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <SortTools_QuickSortOfInteger.hxx>
static static
Standard_Boolean IsClosedShell(const TopoDS_Shell& aSh); Standard_Boolean IsClosedShell(const TopoDS_Shell& aSh);
@@ -284,7 +287,7 @@ void BOPAlgo_Builder::FillIn3DParts(BOPCol_DataMapOfShapeListOfShape& theInParts
const BOPAlgo_ShapeBox& aSBk=aItDMISB.Value(); const BOPAlgo_ShapeBox& aSBk=aItDMISB.Value();
const TopoDS_Shape& aFk=aSBk.Shape(); const TopoDS_Shape& aFk=aSBk.Shape();
if (aMF.Contains(aFk)) { if (aMF.Contains(aFk)) {
continue; continue;
} }
// //
const Bnd_Box& aBk=aSBk.Box(); const Bnd_Box& aBk=aSBk.Box();
@@ -300,67 +303,76 @@ void BOPAlgo_Builder::FillIn3DParts(BOPCol_DataMapOfShapeListOfShape& theInParts
aSelector.SetBox(aBoxS); aSelector.SetBox(aBoxS);
// //
aNbFP=aBBTree.Select(aSelector); aNbFP=aBBTree.Select(aSelector);
// if (aNbFP) {
const BOPCol_ListOfInteger& aLIFP=aSelector.Indices(); const BOPCol_ListOfInteger& aLIFP=aSelector.Indices();
// //sort indices
// 2.7. Collect faces that are IN aSolid [ aLFIN ] TColStd_Array1OfInteger anArray(1, aNbFP);
BOPCol_ListOfShape aLFP(aAlr1); aItLI.Initialize(aLIFP);
BOPCol_ListOfShape aLCBF(aAlr1); for (k = 1; aItLI.More(); aItLI.Next(), ++k) {
BOPCol_MapOfShape aMFDone(100, aAlr1); nFP=aItLI.Value();
BOPCol_IndexedMapOfShape aME(100, aAlr1); anArray(k) = nFP;
//
BOPTools::MapShapes(aSD, TopAbs_EDGE, aME);
//
aItLI.Initialize(aLIFP);
for (; aItLI.More(); aItLI.Next()) {
nFP=aItLI.Value();
const BOPAlgo_ShapeBox& aSBF=aDMISB.Find(nFP);
const TopoDS_Face& aFP=(*(TopoDS_Face*)&aSBF.Shape());
if (aMFDone.Contains(aFP)) {
continue;
} }
TCollection_CompareOfInteger comp;
SortTools_QuickSortOfInteger::Sort(anArray,comp);
// //
aMFDone.Add(aFP); // 2.7. Collect faces that are IN aSolid [ aLFIN ]
BOPCol_ListOfShape aLFP(aAlr1);
BOPCol_ListOfShape aLCBF(aAlr1);
BOPCol_MapOfShape aMFDone(100, aAlr1);
BOPCol_IndexedMapOfShape aME(100, aAlr1);
// //
iIsIN=BOPTools_AlgoTools::IsInternalFace(aFP, aSD, aMEF, 1.e-14, myContext); BOPTools::MapShapes(aSD, TopAbs_EDGE, aME);
// //
aLFP.Clear(); for (k = 1; k <= aNbFP; ++k) {
aLFP.Append(aFP); nFP = anArray(k);
// const BOPAlgo_ShapeBox& aSBF=aDMISB.Find(nFP);
aItLI1.Initialize(aLIFP); const TopoDS_Face& aFP=(*(TopoDS_Face*)&aSBF.Shape());
for (; aItLI1.More(); aItLI1.Next()) { if (aMFDone.Contains(aFP)) {
const TopoDS_Shape& aFx=aDMISB.Find(aItLI1.Value()).Shape(); continue;
if (!aMFDone.Contains(aFx)) {
aLFP.Append(aFx);
}
}
//
aLCBF.Clear();
//----------------------------------------
{
Handle(NCollection_IncAllocator) aAlr2;
aAlr2=new NCollection_IncAllocator();
//
BOPTools_AlgoTools::MakeConnexityBlock(aLFP, aME, aLCBF, aAlr2);
}
//----------------------------------------
aItLS.Initialize(aLCBF);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aFx=aItLS.Value();
aMFDone.Add(aFx);
if (iIsIN) {
aLFIN.Append(aFx);
} }
} //
}// for (; aItLI.More(); aItLI.Next()) { aMFDone.Add(aFP);
// //
iIsIN=BOPTools_AlgoTools::IsInternalFace(aFP, aSD, aMEF, 1.e-14, myContext);
//
aLFP.Clear();
aLFP.Append(aFP);
//
aItLI1.Initialize(aLIFP);
for (; aItLI1.More(); aItLI1.Next()) {
const TopoDS_Shape& aFx=aDMISB.Find(aItLI1.Value()).Shape();
if (!aMFDone.Contains(aFx)) {
aLFP.Append(aFx);
}
}
//
aLCBF.Clear();
//----------------------------------------
{
Handle(NCollection_IncAllocator) aAlr2;
aAlr2=new NCollection_IncAllocator();
//
BOPTools_AlgoTools::MakeConnexityBlock(aLFP, aME, aLCBF, aAlr2);
}
//----------------------------------------
aItLS.Initialize(aLCBF);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aFx=aItLS.Value();
aMFDone.Add(aFx);
if (iIsIN) {
aLFIN.Append(aFx);
}
}
}// for (; aItLI.More(); aItLI.Next()) {
//
}
// 2.8. Store the results in theInParts, theDraftSolids // 2.8. Store the results in theInParts, theDraftSolids
aNbFIN=aLFIN.Extent(); aNbFIN=aLFIN.Extent();
if (aNbFIN || aNbLIF) { if (aNbFIN || aNbLIF) {
aItLS.Initialize(aLIF); aItLS.Initialize(aLIF);
for (; aItLS.More(); aItLS.Next()) { for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aFI=aItLS.Value(); const TopoDS_Shape& aFI=aItLS.Value();
aLFIN.Append(aFI); aLFIN.Append(aFI);
} }
theInParts.Bind(aSolid, aLFIN); theInParts.Bind(aSolid, aLFIN);
} }