a7bdc75a96114e8b69708a5beb9fc10eb3336751
[occt.git] / src / BRepAlgoAPI / BRepAlgoAPI_BooleanOperation.hxx
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
24 #include <TopTools_ListOfShape.hxx>
25 #include <BOPAlgo_Operation.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <TopTools_DataMapOfShapeShape.hxx>
28 #include <BRepAlgoAPI_BuilderAlgo.hxx>
29 class BOPAlgo_PaveFiller;
30 class TopoDS_Shape;
31
32
33
34 //! The abstract class BooleanOperation is the root
35 //! class of Boolean Operations (see Overview).
36 //! Boolean Operations algorithm is divided onto two parts.
37 //! - The first one is computing interference between arguments.
38 //! - The second one is building the result of operation.
39 //! The class BooleanOperation provides API level of both parts
40 class BRepAlgoAPI_BooleanOperation  : public BRepAlgoAPI_BuilderAlgo
41 {
42 public:
43
44   DEFINE_STANDARD_ALLOC
45
46   
47   //! Returns the first argument involved in this Boolean operation.
48   //! Obsolete
49   Standard_EXPORT const TopoDS_Shape& Shape1() const;
50   
51   //! Returns the second argument involved in this Boolean operation.
52   //! Obsolete
53   Standard_EXPORT const TopoDS_Shape& Shape2() const;
54   
55   //! Sets the tools
56   Standard_EXPORT void SetTools (const TopTools_ListOfShape& theLS);
57   
58   //! Gets the tools
59   Standard_EXPORT const TopTools_ListOfShape& Tools() const;
60   
61   //! Sets the type of Boolean operation
62   Standard_EXPORT void SetOperation (const BOPAlgo_Operation anOp);
63   
64   //! Returns the type of Boolean Operation
65   Standard_EXPORT BOPAlgo_Operation Operation() const;
66 Standard_EXPORT virtual ~BRepAlgoAPI_BooleanOperation();
67   
68   //! Performs the algorithm
69   //! Filling interference Data Structure (if it is necessary)
70   //! Building the result of the operation.
71   Standard_EXPORT virtual void Build() Standard_OVERRIDE;
72   
73   //! Returns True if there was no errors occured
74   //! obsolete
75   Standard_EXPORT Standard_Boolean BuilderCanWork() const;
76   
77   //! Returns the flag of edge refining
78   Standard_EXPORT Standard_Boolean FuseEdges() const;
79   
80   //! Fuse C1 edges
81   Standard_EXPORT void RefineEdges();
82   
83   //! Returns a list of section edges.
84   //! The edges represent the result of intersection between arguments of
85   //! Boolean Operation. They are computed during operation execution.
86   Standard_EXPORT const TopTools_ListOfShape& SectionEdges();
87   
88   //! Returns the list  of shapes modified from the shape <S>.
89   Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& aS) Standard_OVERRIDE;
90   
91   //! Returns true if the shape S has been deleted. The
92   //! result shape of the operation does not contain the shape S.
93   Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& aS) Standard_OVERRIDE;
94   
95   //! Returns the list  of shapes generated from the shape <S>.
96   //! For use in BRepNaming.
97   Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
98   
99   //! Returns true if there is at least one modified shape.
100   //! For use in BRepNaming.
101   Standard_EXPORT virtual Standard_Boolean HasModified() const Standard_OVERRIDE;
102   
103   //! Returns true if there is at least one generated shape.
104   //! For use in BRepNaming.
105   Standard_EXPORT virtual Standard_Boolean HasGenerated() const Standard_OVERRIDE;
106   
107   //! Returns true if there is at least one deleted shape.
108   //! For use in BRepNaming.
109   Standard_EXPORT virtual Standard_Boolean HasDeleted() const Standard_OVERRIDE;
110
111
112
113
114 protected:
115
116   
117   //! Empty constructor
118   Standard_EXPORT BRepAlgoAPI_BooleanOperation();
119   
120   //! Empty constructor
121   //! <PF> - PaveFiller object that is carried out
122   Standard_EXPORT BRepAlgoAPI_BooleanOperation(const BOPAlgo_PaveFiller& PF);
123   
124   //! Constructor with two arguments
125   //! <S1>, <S2>  -arguments
126   //! <anOperation> - the type of the operation
127   //! Obsolete
128   Standard_EXPORT BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_Operation anOperation);
129   
130   //! Constructor with two arguments
131   //! <S1>, <S2>  -arguments
132   //! <anOperation> - the type of the operation
133   //! <PF> - PaveFiller object that is carried out
134   //! Obsolete
135   Standard_EXPORT BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& PF, const BOPAlgo_Operation anOperation);
136   
137   Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
138   
139   Standard_EXPORT virtual void SetAttributes();
140   
141   //! Returns the list  of shapes generated from the shape <S>.
142   //! For use in BRepNaming.
143   Standard_EXPORT const TopTools_ListOfShape& RefinedList (const TopTools_ListOfShape& theL);
144
145
146   TopTools_ListOfShape myTools;
147   BOPAlgo_Operation myOperation;
148   Standard_Boolean myBuilderCanWork;
149
150
151 private:
152
153
154
155   Standard_Boolean myFuseEdges;
156   TopTools_DataMapOfShapeShape myModifFaces;
157   TopTools_DataMapOfShapeShape myEdgeMap;
158
159
160 };
161
162
163
164
165
166
167
168 #endif // _BRepAlgoAPI_BooleanOperation_HeaderFile