1 // Created by: Peter KURNEV
2 // Copyright (c) 2010-2014 OPEN CASCADE SAS
3 // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4 // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
5 // EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 // This file is part of Open CASCADE Technology software library.
9 // This library is free software; you can redistribute it and/or modify it under
10 // the terms of the GNU Lesser General Public License version 2.1 as published
11 // by the Free Software Foundation, with special exception defined in the file
12 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
13 // distribution for complete text of the license and disclaimer of any warranty.
15 // Alternatively, this file may be used under the terms of Open CASCADE
16 // commercial license or contractual agreement.
18 #ifndef _BOPAlgo_Builder_HeaderFile
19 #define _BOPAlgo_Builder_HeaderFile
21 #include <Standard.hxx>
22 #include <Standard_DefineAlloc.hxx>
23 #include <Standard_Handle.hxx>
25 #include <BOPCol_ListOfShape.hxx>
26 #include <BOPCol_MapOfShape.hxx>
27 #include <BOPAlgo_PPaveFiller.hxx>
28 #include <BOPAlgo_GlueEnum.hxx>
29 #include <BOPDS_PDS.hxx>
30 #include <Standard_Integer.hxx>
31 #include <BOPCol_DataMapOfShapeListOfShape.hxx>
32 #include <BOPCol_DataMapOfShapeShape.hxx>
33 #include <Standard_Real.hxx>
34 #include <BOPAlgo_BuilderShape.hxx>
35 #include <BOPCol_BaseAllocator.hxx>
36 #include <TopTools_ListOfShape.hxx>
37 #include <Standard_Boolean.hxx>
38 #include <TopAbs_ShapeEnum.hxx>
39 class IntTools_Context;
41 class BOPAlgo_PaveFiller;
44 //! The class is a General Fuse algorithm - base algorithm for the
45 //! algorithms in the Boolean Component. Its main purpose is to build
46 //! the split parts of the argument shapes from which the result of
47 //! the operations is combined.<br>
48 //! The result of the General Fuse algorithm itself is a compound
49 //! containing all split parts of the arguments. <br>
51 //! Additionally to the options of the base classes, the algorithm has
52 //! the following options:<br>
53 //! - *Safe processing mode* - allows to avoid modification of the input
54 //! shapes during the operation (by default it is off);<br>
55 //! - *Gluing options* - allows to speed up the calculation of the intersections
56 //! on the special cases, in which some sub-shapes are coinciding.<br>
58 //! The algorithm returns the following Error statuses:
59 //! - *BOPAlgo_AlertTooFewArguments* - in case there are no enough arguments to perform the operation;
60 //! - *BOPAlgo_AlertNoFiller* - in case the intersection tool has not been created;
61 //! - *BOPAlgo_AlertIntersectionFailed* - in case the intersection of the arguments has failed;
62 //! - *BOPAlgo_AlertBuilderFailed* - in case building splits of arguments has failed with some unexpected error.
64 class BOPAlgo_Builder : public BOPAlgo_BuilderShape
71 Standard_EXPORT BOPAlgo_Builder();
72 Standard_EXPORT virtual ~BOPAlgo_Builder();
74 Standard_EXPORT BOPAlgo_Builder(const BOPCol_BaseAllocator& theAllocator);
76 Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
78 Standard_EXPORT BOPAlgo_PPaveFiller PPaveFiller();
80 Standard_EXPORT BOPDS_PDS PDS();
82 Standard_EXPORT virtual void AddArgument (const TopoDS_Shape& theShape);
84 Standard_EXPORT virtual void SetArguments (const BOPCol_ListOfShape& theLS);
86 Standard_EXPORT const BOPCol_ListOfShape& Arguments() const;
88 Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
90 Standard_EXPORT virtual void PerformWithFiller (const BOPAlgo_PaveFiller& theFiller);
92 //! Returns the list of shapes generated from the
94 Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& theS) Standard_OVERRIDE;
96 //! Returns the list of shapes modified from the shape
98 Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& theS) Standard_OVERRIDE;
100 //! Returns true if the shape theS has been deleted.
101 Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& theS) Standard_OVERRIDE;
103 Standard_EXPORT const BOPCol_DataMapOfShapeListOfShape& Images() const;
105 Standard_EXPORT Standard_Boolean IsInterferred (const TopoDS_Shape& theS) const;
107 //! Returns myOrigins.
108 Standard_EXPORT const BOPCol_DataMapOfShapeListOfShape& Origins() const;
110 //! Returns myShapesSD.
111 Standard_EXPORT const BOPCol_DataMapOfShapeShape& ShapesSD() const;
113 //! Returns mySplits.
114 Standard_EXPORT const BOPCol_DataMapOfShapeListOfShape& Splits() const;
117 //! Sets the flag that defines the mode of treatment.
118 //! In non-destructive mode the argument shapes are not modified. Instead
119 //! a copy of a sub-shape is created in the result if it is needed to be updated.
120 //! This flag is taken into account if internal PaveFiller is used only.
121 //! In the case of calling PerformWithFiller the corresponding flag of that PaveFiller
123 Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag);
125 //! Returns the flag that defines the mode of treatment.
126 //! In non-destructive mode the argument shapes are not modified. Instead
127 //! a copy of a sub-shape is created in the result if it is needed to be updated.
128 Standard_EXPORT Standard_Boolean NonDestructive() const;
130 //! Sets the glue option for the algorithm
131 Standard_EXPORT void SetGlue(const BOPAlgo_GlueEnum theGlue);
133 //! Returns the glue option of the algorithm
134 Standard_EXPORT BOPAlgo_GlueEnum Glue() const;
138 //! Prepare information for history support
139 Standard_EXPORT virtual void PrepareHistory() Standard_OVERRIDE;
141 Standard_EXPORT virtual void PerformInternal (const BOPAlgo_PaveFiller& thePF);
143 Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF);
145 Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
147 //! Checks if the intersection algorithm has Errors/Warnings
148 Standard_EXPORT void CheckFiller();
150 Standard_EXPORT virtual void Prepare();
152 Standard_EXPORT void FillImagesVertices();
154 Standard_EXPORT void FillImagesEdges();
156 Standard_EXPORT virtual void BuildResult (const TopAbs_ShapeEnum theType);
158 Standard_EXPORT void FillImagesContainers (const TopAbs_ShapeEnum theType);
160 Standard_EXPORT void FillImagesCompounds();
162 Standard_EXPORT void FillImagesContainer (const TopoDS_Shape& theS, const TopAbs_ShapeEnum theType);
164 Standard_EXPORT void FillImagesCompound (const TopoDS_Shape& theS, BOPCol_MapOfShape& theMF);
166 Standard_EXPORT void FillImagesFaces();
168 Standard_EXPORT virtual void BuildSplitFaces();
170 Standard_EXPORT void FillSameDomainFaces();
172 Standard_EXPORT void FillImagesFaces1();
174 Standard_EXPORT void FillImagesSolids();
176 Standard_EXPORT void BuildDraftSolid (const TopoDS_Shape& theSolid, TopoDS_Shape& theDraftSolid, BOPCol_ListOfShape& theLIF);
178 Standard_EXPORT virtual void FillIn3DParts (BOPCol_DataMapOfShapeListOfShape& theInParts, BOPCol_DataMapOfShapeShape& theDraftSolids, const BOPCol_BaseAllocator& theAllocator);
180 Standard_EXPORT void BuildSplitSolids (BOPCol_DataMapOfShapeListOfShape& theInParts, BOPCol_DataMapOfShapeShape& theDraftSolids, const BOPCol_BaseAllocator& theAllocator);
182 Standard_EXPORT void FillInternalShapes();
184 Standard_EXPORT virtual void PostTreat();
187 BOPCol_ListOfShape myArguments;
188 BOPCol_MapOfShape myMapFence;
189 BOPAlgo_PPaveFiller myPaveFiller;
191 Handle(IntTools_Context) myContext;
192 Standard_Integer myEntryPoint;
193 BOPCol_DataMapOfShapeListOfShape myImages;
194 BOPCol_DataMapOfShapeShape myShapesSD;
195 BOPCol_DataMapOfShapeListOfShape mySplits;
196 BOPCol_DataMapOfShapeListOfShape myOrigins;
197 Standard_Boolean myNonDestructive;
198 BOPAlgo_GlueEnum myGlue;
205 #endif // _BOPAlgo_Builder_HeaderFile