42cf5bc1 |
1 | // Created on: 1993-10-14 |
2 | // Created by: Remi LEQUETTE |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _BRepAlgoAPI_BooleanOperation_HeaderFile |
18 | #define _BRepAlgoAPI_BooleanOperation_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
42cf5bc1 |
24 | #include <BOPAlgo_Operation.hxx> |
42cf5bc1 |
25 | #include <BRepAlgoAPI_BuilderAlgo.hxx> |
26 | class BOPAlgo_PaveFiller; |
27 | class TopoDS_Shape; |
28 | |
948fe6ca |
29 | //! The root API class for performing Boolean Operations on arbitrary shapes. |
33ba8565 |
30 | //! |
948fe6ca |
31 | //! The arguments of the operation are divided in two groups - *Objects* and *Tools*. |
32 | //! Each group can contain any number of shapes, but each shape should be valid |
33 | //! in terms of *BRepCheck_Analyzer* and *BOPAlgo_ArgumentAnalyzer*. |
34 | //! The algorithm builds the splits of the given arguments using the intersection |
35 | //! results and combines the result of Boolean Operation of given type: |
36 | //! - *FUSE* - union of two groups of objects; |
37 | //! - *COMMON* - intersection of two groups of objects; |
38 | //! - *CUT* - subtraction of one group from the other; |
39 | //! - *SECTION* - section edges and vertices of all arguments; |
40 | //! |
41 | //! The rules for the arguments and type of the operation are the following: |
42 | //! - For Boolean operation *FUSE* all arguments should have equal dimensions; |
43 | //! - For Boolean operation *CUT* the minimal dimension of *Tools* should not be |
44 | //! less than the maximal dimension of *Objects*; |
45 | //! - For Boolean operation *COMMON* the arguments can have any dimension. |
46 | //! - For Boolean operation *SECTION* the arguments can be of any type. |
33ba8565 |
47 | //! |
948fe6ca |
48 | //! Additionally to the errors of the base class the algorithm returns |
49 | //! the following Errors:<br> |
50 | //! - *BOPAlgo_AlertBOPNotSet* - in case the type of Boolean Operation is not set.<br> |
42cf5bc1 |
51 | class BRepAlgoAPI_BooleanOperation : public BRepAlgoAPI_BuilderAlgo |
52 | { |
53 | public: |
54 | |
55 | DEFINE_STANDARD_ALLOC |
56 | |
948fe6ca |
57 | public: //! @name Constructors |
58 | |
42cf5bc1 |
59 | //! Empty constructor |
60 | Standard_EXPORT BRepAlgoAPI_BooleanOperation(); |
948fe6ca |
61 | |
62 | //! Constructor with precomputed intersections of arguments. |
63 | Standard_EXPORT BRepAlgoAPI_BooleanOperation(const BOPAlgo_PaveFiller& thePF); |
64 | |
65 | |
66 | public: //! @name Setting/getting arguments |
67 | |
68 | //! Returns the first argument involved in this Boolean operation. |
42cf5bc1 |
69 | //! Obsolete |
948fe6ca |
70 | const TopoDS_Shape& Shape1() const |
71 | { |
72 | return myArguments.First(); |
73 | } |
74 | |
75 | //! Returns the second argument involved in this Boolean operation. |
42cf5bc1 |
76 | //! Obsolete |
948fe6ca |
77 | const TopoDS_Shape& Shape2() const |
78 | { |
79 | return myTools.First(); |
80 | } |
42cf5bc1 |
81 | |
948fe6ca |
82 | //! Sets the Tool arguments |
83 | void SetTools(const TopTools_ListOfShape& theLS) |
84 | { |
85 | myTools = theLS; |
86 | } |
42cf5bc1 |
87 | |
948fe6ca |
88 | //! Returns the Tools arguments |
89 | const TopTools_ListOfShape& Tools() const |
90 | { |
91 | return myTools; |
92 | } |
42cf5bc1 |
93 | |
94 | |
948fe6ca |
95 | public: //! @name Setting/Getting the type of Boolean operation |
42cf5bc1 |
96 | |
948fe6ca |
97 | //! Sets the type of Boolean operation |
98 | void SetOperation(const BOPAlgo_Operation theBOP) |
99 | { |
100 | myOperation = theBOP; |
101 | } |
42cf5bc1 |
102 | |
948fe6ca |
103 | //! Returns the type of Boolean Operation |
104 | BOPAlgo_Operation Operation() const |
105 | { |
106 | return myOperation; |
107 | } |
42cf5bc1 |
108 | |
42cf5bc1 |
109 | |
948fe6ca |
110 | public: //! @name Performing the operation |
42cf5bc1 |
111 | |
948fe6ca |
112 | //! Performs the Boolean operation. |
113 | Standard_EXPORT virtual void Build() Standard_OVERRIDE; |
42cf5bc1 |
114 | |
115 | |
948fe6ca |
116 | protected: //! @name Constructors |
42cf5bc1 |
117 | |
948fe6ca |
118 | //! Constructor to perform Boolean operation on only two arguments. |
119 | //! Obsolete |
120 | Standard_EXPORT BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& theS1, |
121 | const TopoDS_Shape& theS2, |
122 | const BOPAlgo_Operation theOperation); |
42cf5bc1 |
123 | |
948fe6ca |
124 | //! Constructor to perform Boolean operation on only two arguments |
125 | //! with precomputed intersection results. |
126 | //! Obsolete |
127 | Standard_EXPORT BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& theS1, |
128 | const TopoDS_Shape& theS2, |
129 | const BOPAlgo_PaveFiller& thePF, |
130 | const BOPAlgo_Operation theOperation); |
42cf5bc1 |
131 | |
132 | |
948fe6ca |
133 | protected: //! @name Fields |
134 | |
135 | TopTools_ListOfShape myTools; //!< Tool arguments of operation |
136 | BOPAlgo_Operation myOperation; //!< Type of Boolean Operation |
137 | |
138 | }; |
42cf5bc1 |
139 | |
140 | #endif // _BRepAlgoAPI_BooleanOperation_HeaderFile |