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