1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef _BOPAlgo_BOP_HeaderFile
16 #define _BOPAlgo_BOP_HeaderFile
18 #include <Standard.hxx>
19 #include <Standard_DefineAlloc.hxx>
20 #include <Standard_Handle.hxx>
22 #include <BOPAlgo_Operation.hxx>
23 #include <Standard_Integer.hxx>
24 #include <TopoDS_Shape.hxx>
25 #include <BOPCol_ListOfShape.hxx>
26 #include <BOPCol_MapOfShape.hxx>
27 #include <BOPAlgo_ToolsProvider.hxx>
28 #include <BOPCol_BaseAllocator.hxx>
29 #include <TopAbs_ShapeEnum.hxx>
30 #include <Standard_Boolean.hxx>
31 #include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
33 class BOPAlgo_PaveFiller;
36 //! The class represents the Building part of the Boolean Operations
38 //! The arguments of the algorithms are divided in two groups - *Objects*
40 //! The algorithm builds the splits of the given arguments using the intersection
41 //! results and combines the result of Boolean Operation of given type:<br>
42 //! - *FUSE* - union of two groups of objects;<br>
43 //! - *COMMON* - intersection of two groups of objects;<br>
44 //! - *CUT* - subtraction of one group from the other.<br>
46 //! The rules for the arguments and type of the operation are the following:<br>
47 //! - For Boolean operation *FUSE* all arguments should have equal dimensions;<br>
48 //! - For Boolean operation *CUT* the minimal dimension of *Tools* should not be
49 //! less than the maximal dimension of *Objects*;<br>
50 //! - For Boolean operation *COMMON* the arguments can have any dimension.<br>
52 //! The class is a General Fuse based algorithm. Thus, all options
53 //! of the General Fuse algorithm such as Fuzzy mode, safe processing mode,
54 //! parallel processing mode, gluing mode and history support are also
55 //! available in this algorithm.<br>
57 //! Additionally to the Warnings of the parent class the algorithm returns
58 //! the following warnings:
59 //! - *BOPAlgo_AlertEmptyShape* - in case some of the input shapes are empty shapes.
61 //! Additionally to Errors of the parent class the algorithm returns
62 //! the following Error statuses:
63 //! - *BOPAlgo_AlertBOPIsNotSet* - in case the type of Boolean operation is not set;
64 //! - *BOPAlgo_AlertBOPNotAllowed* - in case the operation of given type is not allowed on
66 //! - *BOPAlgo_AlertSolidBuilderFailed* - in case the BuilderSolid algorithm failed to
67 //! produce the Fused solid.
69 class BOPAlgo_BOP : public BOPAlgo_ToolsProvider
77 Standard_EXPORT BOPAlgo_BOP();
78 Standard_EXPORT virtual ~BOPAlgo_BOP();
80 Standard_EXPORT BOPAlgo_BOP(const BOPCol_BaseAllocator& theAllocator);
82 //! Clears internal fields and arguments
83 Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
85 Standard_EXPORT void SetOperation (const BOPAlgo_Operation theOperation);
87 Standard_EXPORT BOPAlgo_Operation Operation() const;
89 Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
93 Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
95 //! Performs calculations using prepared Filler
97 Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF) Standard_OVERRIDE;
99 Standard_EXPORT virtual void BuildResult (const TopAbs_ShapeEnum theType) Standard_OVERRIDE;
101 Standard_EXPORT void BuildShape();
103 Standard_EXPORT void BuildRC();
105 Standard_EXPORT void BuildSolid();
107 Standard_EXPORT Standard_Boolean IsBoundSplits (const TopoDS_Shape& theS, BOPCol_IndexedDataMapOfShapeListOfShape& theMEF);
109 //! Treatment of the cases with empty shapes.<br>
110 //! It returns TRUE if there is nothing to do, i.e.
111 //! all shapes in one of the groups are empty shapes.
112 Standard_EXPORT Standard_Boolean TreatEmptyShape();
116 BOPAlgo_Operation myOperation;
117 Standard_Integer myDims[2];
121 #endif // _BOPAlgo_BOP_HeaderFile