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.
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
47 //! Returns the first argument involved in this Boolean operation.
49 Standard_EXPORT const TopoDS_Shape& Shape1() const;
51 //! Returns the second argument involved in this Boolean operation.
53 Standard_EXPORT const TopoDS_Shape& Shape2() const;
56 Standard_EXPORT void SetTools (const TopTools_ListOfShape& theLS);
59 Standard_EXPORT const TopTools_ListOfShape& Tools() const;
61 //! Sets the type of Boolean operation
62 Standard_EXPORT void SetOperation (const BOPAlgo_Operation anOp);
64 //! Returns the type of Boolean Operation
65 Standard_EXPORT BOPAlgo_Operation Operation() const;
66 Standard_EXPORT virtual ~BRepAlgoAPI_BooleanOperation();
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;
73 //! Returns True if there was no errors occured
75 Standard_EXPORT Standard_Boolean BuilderCanWork() const;
77 //! Returns the flag of edge refining
78 Standard_EXPORT Standard_Boolean FuseEdges() const;
81 Standard_EXPORT void RefineEdges();
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();
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;
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;
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;
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;
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;
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;
117 //! Empty constructor
118 Standard_EXPORT BRepAlgoAPI_BooleanOperation();
120 //! Empty constructor
121 //! <PF> - PaveFiller object that is carried out
122 Standard_EXPORT BRepAlgoAPI_BooleanOperation(const BOPAlgo_PaveFiller& PF);
124 //! Constructor with two arguments
125 //! <S1>, <S2> -arguments
126 //! <anOperation> - the type of the operation
128 Standard_EXPORT BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_Operation anOperation);
130 //! Constructor with two arguments
131 //! <S1>, <S2> -arguments
132 //! <anOperation> - the type of the operation
133 //! <PF> - PaveFiller object that is carried out
135 Standard_EXPORT BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& PF, const BOPAlgo_Operation anOperation);
137 Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
139 Standard_EXPORT virtual void SetAttributes();
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);
146 TopTools_ListOfShape myTools;
147 BOPAlgo_Operation myOperation;
148 Standard_Boolean myBuilderCanWork;
155 Standard_Boolean myFuseEdges;
156 TopTools_DataMapOfShapeShape myModifFaces;
157 TopTools_DataMapOfShapeShape myEdgeMap;
168 #endif // _BRepAlgoAPI_BooleanOperation_HeaderFile