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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _BRepAlgoAPI_BooleanOperation_HeaderFile
18 #define _BRepAlgoAPI_BooleanOperation_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
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;
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>
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>
46 class BRepAlgoAPI_BooleanOperation : public BRepAlgoAPI_BuilderAlgo
53 //! Returns the first argument involved in this Boolean operation.
55 Standard_EXPORT const TopoDS_Shape& Shape1() const;
57 //! Returns the second argument involved in this Boolean operation.
59 Standard_EXPORT const TopoDS_Shape& Shape2() const;
62 Standard_EXPORT void SetTools (const TopTools_ListOfShape& theLS);
65 Standard_EXPORT const TopTools_ListOfShape& Tools() const;
67 //! Sets the type of Boolean operation
68 Standard_EXPORT void SetOperation (const BOPAlgo_Operation anOp);
70 //! Returns the type of Boolean Operation
71 Standard_EXPORT BOPAlgo_Operation Operation() const;
72 Standard_EXPORT virtual ~BRepAlgoAPI_BooleanOperation();
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;
79 //! Returns True if there was no errors occured
81 Standard_EXPORT Standard_Boolean BuilderCanWork() const;
83 //! Returns the flag of edge refining
84 Standard_EXPORT Standard_Boolean FuseEdges() const;
87 Standard_EXPORT void RefineEdges();
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();
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;
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;
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;
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;
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;
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;
119 //! Empty constructor
120 Standard_EXPORT BRepAlgoAPI_BooleanOperation();
122 //! Empty constructor
123 //! <PF> - PaveFiller object that is carried out
124 Standard_EXPORT BRepAlgoAPI_BooleanOperation(const BOPAlgo_PaveFiller& PF);
126 //! Constructor with two arguments
127 //! <S1>, <S2> -arguments
128 //! <anOperation> - the type of the operation
130 Standard_EXPORT BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_Operation anOperation);
132 //! Constructor with two arguments
133 //! <S1>, <S2> -arguments
134 //! <anOperation> - the type of the operation
135 //! <PF> - PaveFiller object that is carried out
137 Standard_EXPORT BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& PF, const BOPAlgo_Operation anOperation);
139 Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
141 Standard_EXPORT virtual void SetAttributes();
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);
148 TopTools_ListOfShape myTools;
149 BOPAlgo_Operation myOperation;
150 Standard_Boolean myBuilderCanWork;
157 Standard_Boolean myFuseEdges;
158 TopTools_DataMapOfShapeShape myModifFaces;
159 TopTools_DataMapOfShapeShape myEdgeMap;
170 #endif // _BRepAlgoAPI_BooleanOperation_HeaderFile