#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // ====================================================================================================== // function: Constructor // purpose: // ====================================================================================================== BOP_SolidSolidHistoryCollector::BOP_SolidSolidHistoryCollector(const TopoDS_Shape& theShape1, const TopoDS_Shape& theShape2, const BOP_Operation theOperation): BOP_HistoryCollector(theShape1, theShape2, theOperation) { } // ====================================================================================================== // function: AddNewShape // purpose: // warning: Treats only faces // ====================================================================================================== void BOP_SolidSolidHistoryCollector::AddNewShape(const TopoDS_Shape& theOldShape, const TopoDS_Shape& theNewShape, const BOPTools_PDSFiller& theDSFiller) { if(theOldShape.ShapeType() != theNewShape.ShapeType()) return; if(theOldShape.ShapeType() != TopAbs_FACE) { return; } Standard_Integer iRank = 0; const BooleanOperations_IndexedDataMapOfShapeInteger& aMap1 = theDSFiller->DS().ShapeIndexMap(1); const BooleanOperations_IndexedDataMapOfShapeInteger& aMap2 = theDSFiller->DS().ShapeIndexMap(2); if(aMap1.Contains(theOldShape)) iRank = 1; else { if(aMap2.Contains(theOldShape)) iRank = 2; } if(iRank == 0) return; TopTools_DataMapOfShapeListOfShape& aHistoryMap = myModifMap; if(aHistoryMap.IsBound(theOldShape)) { aHistoryMap.ChangeFind(theOldShape).Append(theNewShape); } else { TopTools_ListOfShape aShapeList; aShapeList.Append(theNewShape); aHistoryMap.Bind(theOldShape, aShapeList); } } // ====================================================================================================== // function: SetResult // purpose: // ====================================================================================================== void BOP_SolidSolidHistoryCollector::SetResult(const TopoDS_Shape& theResult, const BOPTools_PDSFiller& theDSFiller) { myResult = theResult; myHasDeleted = Standard_False; TopAbs_ShapeEnum aType = TopAbs_FACE; TopTools_IndexedMapOfShape aMap; TopExp::MapShapes(myResult, aType, aMap); TopExp_Explorer anExpObj(myS1, aType); for(; anExpObj.More(); anExpObj.Next()) { const TopoDS_Shape& aS = anExpObj.Current(); if(!aMap.Contains(aS)) { if(!myModifMap.IsBound(aS) || myModifMap(aS).IsEmpty()) { if(!myGenMap.IsBound(aS) || myGenMap(aS).IsEmpty()) { myHasDeleted = Standard_True; break; } } } } if(!myHasDeleted) { TopExp_Explorer anExpTool(myS2, aType); for(; anExpTool.More(); anExpTool.Next()) { const TopoDS_Shape& aS = anExpTool.Current(); if(!aMap.Contains(aS)) { if(!myModifMap.IsBound(aS) || myModifMap(aS).IsEmpty()) { if(!myGenMap.IsBound(aS) || myGenMap(aS).IsEmpty()) { myHasDeleted = Standard_True; break; } } } } } }