File indexing completed on 2026-09-13 09:15:42
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef _BOPAlgo_BuilderShape_HeaderFile
0019 #define _BOPAlgo_BuilderShape_HeaderFile
0020
0021 #include <Standard.hxx>
0022 #include <Standard_DefineAlloc.hxx>
0023 #include <Standard_Handle.hxx>
0024
0025 #include <BOPAlgo_Algo.hxx>
0026 #include <BRepTools_History.hxx>
0027
0028 #include <NCollection_BaseAllocator.hxx>
0029 #include <TopoDS_Shape.hxx>
0030 #include <NCollection_List.hxx>
0031 #include <TopTools_ShapeMapHasher.hxx>
0032 #include <NCollection_Map.hxx>
0033 class TopoDS_Shape;
0034
0035
0036
0037
0038
0039
0040
0041 class BOPAlgo_BuilderShape : public BOPAlgo_Algo
0042 {
0043 public:
0044 DEFINE_STANDARD_ALLOC
0045
0046 public:
0047
0048 const TopoDS_Shape& Shape() const { return myShape; }
0049
0050 public:
0051
0052 const NCollection_List<TopoDS_Shape>& Modified(const TopoDS_Shape& theS)
0053 {
0054 if (myFillHistory && myHistory)
0055 return myHistory->Modified(theS);
0056 myHistShapes.Clear();
0057 return myHistShapes;
0058 }
0059
0060
0061 const NCollection_List<TopoDS_Shape>& Generated(const TopoDS_Shape& theS)
0062 {
0063 if (myFillHistory && myHistory)
0064 return myHistory->Generated(theS);
0065 myHistShapes.Clear();
0066 return myHistShapes;
0067 }
0068
0069
0070
0071
0072 bool IsDeleted(const TopoDS_Shape& theS)
0073 {
0074 return (myFillHistory && myHistory ? myHistory->IsRemoved(theS) : false);
0075 }
0076
0077
0078 bool HasModified() const
0079 {
0080 return (myFillHistory && myHistory ? myHistory->HasModified() : false);
0081 }
0082
0083
0084 bool HasGenerated() const
0085 {
0086 return (myFillHistory && myHistory ? myHistory->HasGenerated() : false);
0087 }
0088
0089
0090 bool HasDeleted() const { return (myFillHistory && myHistory ? myHistory->HasRemoved() : false); }
0091
0092
0093 occ::handle<BRepTools_History> History()
0094 {
0095 if (myFillHistory)
0096 {
0097 if (myHistory.IsNull())
0098
0099
0100
0101 myHistory = new BRepTools_History();
0102
0103 return myHistory;
0104 }
0105
0106
0107
0108
0109 return nullptr;
0110 }
0111
0112 public:
0113
0114 void SetToFillHistory(const bool theHistFlag) { myFillHistory = theHistFlag; }
0115
0116
0117 bool HasHistory() const { return myFillHistory; }
0118
0119 protected:
0120
0121 BOPAlgo_BuilderShape()
0122 : myFillHistory(true)
0123 {
0124 }
0125
0126
0127 BOPAlgo_BuilderShape(const occ::handle<NCollection_BaseAllocator>& theAllocator)
0128 : BOPAlgo_Algo(theAllocator),
0129 myFillHistory(true)
0130 {
0131 }
0132
0133 protected:
0134
0135 void Clear() override
0136 {
0137 BOPAlgo_Algo::Clear();
0138 myHistory.Nullify();
0139 myMapShape.Clear();
0140 }
0141
0142 protected:
0143 TopoDS_Shape myShape;
0144
0145 NCollection_List<TopoDS_Shape> myHistShapes;
0146 NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>
0147 myMapShape;
0148
0149 bool myFillHistory;
0150 occ::handle<BRepTools_History> myHistory;
0151 };
0152
0153 #endif