1 // Created on: 2012-06-01
2 // Created by: Eugeny MALTCHIKOV
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _BRepFeat_Builder_HeaderFile
17 #define _BRepFeat_Builder_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
23 #include <BOPAlgo_BOP.hxx>
24 #include <NCollection_BaseAllocator.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <Standard_Integer.hxx>
27 #include <TopTools_DataMapOfShapeListOfShape.hxx>
28 #include <TopTools_DataMapOfShapeShape.hxx>
29 #include <TopTools_ListOfShape.hxx>
30 #include <TopTools_MapOfShape.hxx>
35 //! Provides a basic tool to implement features topological
36 //! operations. The main goal of the algorithm is to perform
37 //! the result of the operation according to the
38 //! kept parts of the tool.
39 //! Input data: a) DS;
40 //! b) The kept parts of the tool;
41 //! If the map of the kept parts of the tool
42 //! is not filled boolean operation of the
43 //! given type will be performed;
44 //! c) Operation required.
45 //! Steps: a) Fill myShapes, myRemoved maps;
46 //! b) Rebuild edges and faces;
47 //! c) Build images of the object;
48 //! d) Build the result of the operation.
49 //! Result: Result shape of the operation required.
50 class BRepFeat_Builder : public BOPAlgo_BOP
57 Standard_EXPORT BRepFeat_Builder();
58 Standard_EXPORT virtual ~BRepFeat_Builder();
60 //! Clears internal fields and arguments.
61 Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
63 //! Initialyzes the object of local boolean operation.
64 Standard_EXPORT void Init (const TopoDS_Shape& theShape);
66 //! Initialyzes the arguments of local boolean operation.
67 Standard_EXPORT void Init (const TopoDS_Shape& theShape, const TopoDS_Shape& theTool);
69 //! Sets the operation of local boolean operation.
70 //! If theFuse = 0 than the operation is CUT, otherwise FUSE.
71 Standard_EXPORT void SetOperation (const Standard_Integer theFuse);
73 //! Sets the operation of local boolean operation.
74 //! If theFlag = TRUE it means that no selection of parts
75 //! of the tool is needed, t.e. no second part. In that case
76 //! if theFuse = 0 than operation is COMMON, otherwise CUT21.
77 //! If theFlag = FALSE SetOperation(theFuse) function is called.
78 Standard_EXPORT void SetOperation (const Standard_Integer theFuse, const Standard_Boolean theFlag);
80 //! Collects parts of the tool.
81 Standard_EXPORT void PartsOfTool (TopTools_ListOfShape& theLT);
83 //! Initialyzes parts of the tool for second step of algorithm.
84 //! Collects shapes and all sub-shapes into myShapes map.
85 Standard_EXPORT void KeepParts (const TopTools_ListOfShape& theIm);
87 //! Adds shape theS and all its sub-shapes into myShapes map.
88 Standard_EXPORT void KeepPart (const TopoDS_Shape& theS);
90 //! Main function to build the result of the
91 //! local operation required.
92 Standard_EXPORT void PerformResult();
94 //! Rebuilds faces in accordance with the kept parts of the tool.
95 Standard_EXPORT void RebuildFaces();
97 //! Rebuilds edges in accordance with the kept parts of the tool.
98 Standard_EXPORT void RebuildEdge (const TopoDS_Shape& theE, const TopoDS_Face& theF, const TopTools_MapOfShape& theME, TopTools_ListOfShape& aLEIm);
100 //! Collects the images of the object, that contains in
101 //! the images of the tool.
102 Standard_EXPORT void CheckSolidImages();
104 //! Collects the removed parts of the tool into myRemoved map.
105 Standard_EXPORT void FillRemoved();
107 //! Adds the shape S and its sub-shapes into myRemoved map.
108 Standard_EXPORT void FillRemoved (const TopoDS_Shape& theS, TopTools_MapOfShape& theM);
116 //! Prepares builder of local operation.
117 Standard_EXPORT virtual void Prepare() Standard_OVERRIDE;
119 //! Function is redefined to avoid the usage of removed faces.
120 Standard_EXPORT virtual void FillIn3DParts (TopTools_DataMapOfShapeListOfShape& theInParts, TopTools_DataMapOfShapeShape& theDraftSolids, const Handle(NCollection_BaseAllocator)& theAllocator) Standard_OVERRIDE;
123 TopTools_MapOfShape myShapes;
124 TopTools_MapOfShape myRemoved;
125 Standard_Integer myFuse;
142 #endif // _BRepFeat_Builder_HeaderFile