1 #include <BOP_SolidSolidHistoryCollector.ixx>
4 #include <TopExp_Explorer.hxx>
5 #include <BooleanOperations_ShapesDataStructure.hxx>
6 #include <BooleanOperations_IndexedDataMapOfShapeInteger.hxx>
7 #include <BOPTools_SSInterference.hxx>
8 #include <BOPTools_InterferencePool.hxx>
9 #include <BOPTools_CArray1OfSSInterference.hxx>
10 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
11 #include <BOPTools_Curve.hxx>
12 #include <BOPTools_PaveBlock.hxx>
13 #include <BOPTools_DSFiller.hxx>
14 #include <BOPTools_PaveFiller.hxx>
15 #include <BOPTools_CommonBlock.hxx>
16 #include <BOPTools_ListOfCommonBlock.hxx>
17 #include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
18 #include <BOPTools_ListIteratorOfListOfPave.hxx>
19 #include <BOP_BuilderTools.hxx>
20 #include <TopTools_IndexedMapOfShape.hxx>
22 #include <TColStd_ListIteratorOfListOfInteger.hxx>
24 // ======================================================================================================
25 // function: Constructor
27 // ======================================================================================================
28 BOP_SolidSolidHistoryCollector::BOP_SolidSolidHistoryCollector(const TopoDS_Shape& theShape1,
29 const TopoDS_Shape& theShape2,
30 const BOP_Operation theOperation):
31 BOP_HistoryCollector(theShape1, theShape2, theOperation)
35 // ======================================================================================================
36 // function: AddNewShape
38 // warning: Treats only faces
39 // ======================================================================================================
40 void BOP_SolidSolidHistoryCollector::AddNewShape(const TopoDS_Shape& theOldShape,
41 const TopoDS_Shape& theNewShape,
42 const BOPTools_PDSFiller& theDSFiller)
44 if(theOldShape.ShapeType() != theNewShape.ShapeType())
47 if(theOldShape.ShapeType() != TopAbs_FACE) {
50 Standard_Integer iRank = 0;
51 const BooleanOperations_IndexedDataMapOfShapeInteger& aMap1 =
52 theDSFiller->DS().ShapeIndexMap(1);
54 const BooleanOperations_IndexedDataMapOfShapeInteger& aMap2 =
55 theDSFiller->DS().ShapeIndexMap(2);
57 if(aMap1.Contains(theOldShape))
60 if(aMap2.Contains(theOldShape))
67 TopTools_DataMapOfShapeListOfShape& aHistoryMap = myModifMap;
69 if(aHistoryMap.IsBound(theOldShape)) {
70 aHistoryMap.ChangeFind(theOldShape).Append(theNewShape);
73 TopTools_ListOfShape aShapeList;
74 aShapeList.Append(theNewShape);
75 aHistoryMap.Bind(theOldShape, aShapeList);
79 // ======================================================================================================
80 // function: SetResult
82 // ======================================================================================================
83 void BOP_SolidSolidHistoryCollector::SetResult(const TopoDS_Shape& theResult,
84 const BOPTools_PDSFiller& theDSFiller)
87 myHasDeleted = Standard_False;
89 TopAbs_ShapeEnum aType = TopAbs_FACE;
90 TopTools_IndexedMapOfShape aMap;
91 TopExp::MapShapes(myResult, aType, aMap);
93 TopExp_Explorer anExpObj(myS1, aType);
95 for(; anExpObj.More(); anExpObj.Next()) {
96 const TopoDS_Shape& aS = anExpObj.Current();
98 if(!aMap.Contains(aS)) {
100 if(!myModifMap.IsBound(aS) || myModifMap(aS).IsEmpty()) {
102 if(!myGenMap.IsBound(aS) || myGenMap(aS).IsEmpty()) {
103 myHasDeleted = Standard_True;
111 TopExp_Explorer anExpTool(myS2, aType);
113 for(; anExpTool.More(); anExpTool.Next()) {
114 const TopoDS_Shape& aS = anExpTool.Current();
116 if(!aMap.Contains(aS)) {
117 if(!myModifMap.IsBound(aS) || myModifMap(aS).IsEmpty()) {
119 if(!myGenMap.IsBound(aS) || myGenMap(aS).IsEmpty()) {
120 myHasDeleted = Standard_True;