42cf5bc1 |
1 | // Created on: 2012-06-01 |
2 | // Created by: Eugeny MALTCHIKOV |
3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _BRepFeat_Builder_HeaderFile |
17 | #define _BRepFeat_Builder_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_DefineAlloc.hxx> |
21 | #include <Standard_Handle.hxx> |
22 | |
23 | #include <BOPCol_MapOfShape.hxx> |
24 | #include <Standard_Integer.hxx> |
25 | #include <BOPAlgo_BOP.hxx> |
26 | #include <Standard_Boolean.hxx> |
27 | #include <TopTools_ListOfShape.hxx> |
28 | #include <BOPCol_ListOfShape.hxx> |
29 | #include <BOPCol_DataMapOfShapeListOfShape.hxx> |
30 | #include <BOPCol_DataMapOfShapeShape.hxx> |
31 | #include <BOPCol_BaseAllocator.hxx> |
32 | class TopoDS_Shape; |
33 | class TopoDS_Face; |
34 | |
35 | |
36 | //! Provides a basic tool to implement features topological |
37 | //! operations. The main goal of the algorithm is to perform |
38 | //! the result of the operation according to the |
39 | //! kept parts of the tool. |
40 | //! Input data: a) DS; |
41 | //! b) The kept parts of the tool; |
42 | //! If the map of the kept parts of the tool |
43 | //! is not filled boolean operation of the |
44 | //! given type will be performed; |
45 | //! c) Operation required. |
46 | //! Steps: a) Fill myShapes, myRemoved maps; |
47 | //! b) Rebuild edges and faces; |
48 | //! c) Build images of the object; |
49 | //! d) Build the result of the operation. |
50 | //! Result: Result shape of the operation required. |
51 | class BRepFeat_Builder : public BOPAlgo_BOP |
52 | { |
53 | public: |
54 | |
55 | DEFINE_STANDARD_ALLOC |
56 | |
57 | |
58 | Standard_EXPORT BRepFeat_Builder(); |
59 | Standard_EXPORT virtual ~BRepFeat_Builder(); |
60 | |
61 | //! Clears internal fields and arguments. |
62 | Standard_EXPORT virtual void Clear() Standard_OVERRIDE; |
63 | |
64 | //! Initialyzes the object of local boolean operation. |
65 | Standard_EXPORT void Init (const TopoDS_Shape& theShape); |
66 | |
67 | //! Initialyzes the arguments of local boolean operation. |
68 | Standard_EXPORT void Init (const TopoDS_Shape& theShape, const TopoDS_Shape& theTool); |
69 | |
70 | //! Sets the operation of local boolean operation. |
71 | //! If theFuse = 0 than the operation is CUT, otherwise FUSE. |
72 | Standard_EXPORT void SetOperation (const Standard_Integer theFuse); |
73 | |
74 | //! Sets the operation of local boolean operation. |
75 | //! If theFlag = TRUE it means that no selection of parts |
76 | //! of the tool is needed, t.e. no second part. In that case |
77 | //! if theFuse = 0 than operation is COMMON, otherwise CUT21. |
78 | //! If theFlag = FALSE SetOperation(theFuse) function is called. |
79 | Standard_EXPORT void SetOperation (const Standard_Integer theFuse, const Standard_Boolean theFlag); |
80 | |
81 | //! Collects parts of the tool. |
82 | Standard_EXPORT void PartsOfTool (TopTools_ListOfShape& theLT); |
83 | |
84 | //! Initialyzes parts of the tool for second step of algorithm. |
85 | //! Collects shapes and all sub-shapes into myShapes map. |
86 | Standard_EXPORT void KeepParts (const TopTools_ListOfShape& theIm); |
87 | |
88 | //! Adds shape theS and all its sub-shapes into myShapes map. |
89 | Standard_EXPORT void KeepPart (const TopoDS_Shape& theS); |
90 | |
91 | //! Main function to build the result of the |
92 | //! local operation required. |
93 | Standard_EXPORT void PerformResult(); |
94 | |
95 | //! Rebuilds faces in accordance with the kept parts of the tool. |
96 | Standard_EXPORT void RebuildFaces(); |
97 | |
98 | //! Rebuilds edges in accordance with the kept parts of the tool. |
99 | Standard_EXPORT void RebuildEdge (const TopoDS_Shape& theE, const TopoDS_Face& theF, const BOPCol_MapOfShape& theME, BOPCol_ListOfShape& aLEIm); |
100 | |
101 | //! Collects the images of the object, that contains in |
102 | //! the images of the tool. |
103 | Standard_EXPORT void CheckSolidImages(); |
104 | |
105 | //! Collects the removed parts of the tool into myRemoved map. |
106 | Standard_EXPORT void FillRemoved(); |
107 | |
108 | //! Adds the shape S and its sub-shapes into myRemoved map. |
109 | Standard_EXPORT void FillRemoved (const TopoDS_Shape& theS, BOPCol_MapOfShape& theM); |
110 | |
111 | |
112 | |
113 | |
114 | protected: |
115 | |
116 | |
117 | //! Prepares builder of local operation. |
118 | Standard_EXPORT virtual void Prepare() Standard_OVERRIDE; |
119 | |
120 | //! Function is redefined to avoid the usage of removed faces. |
121 | Standard_EXPORT virtual void FillIn3DParts (BOPCol_DataMapOfShapeListOfShape& theInParts, BOPCol_DataMapOfShapeShape& theDraftSolids, const BOPCol_BaseAllocator& theAllocator) Standard_OVERRIDE; |
122 | |
123 | |
124 | BOPCol_MapOfShape myShapes; |
125 | BOPCol_MapOfShape myRemoved; |
126 | Standard_Integer myFuse; |
127 | |
128 | |
129 | private: |
130 | |
131 | |
132 | |
133 | |
134 | |
135 | }; |
136 | |
137 | |
138 | |
139 | |
140 | |
141 | |
142 | |
143 | #endif // _BRepFeat_Builder_HeaderFile |