0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / BRepFeat / BRepFeat_Builder.hxx
CommitLineData
42cf5bc1 1// Created on: 2012-06-01
2// Created by: Eugeny MALTCHIKOV
3// Copyright (c) 1999-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
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.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _BRepFeat_Builder_HeaderFile
17#define _BRepFeat_Builder_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_DefineAlloc.hxx>
21#include <Standard_Handle.hxx>
22
42cf5bc1 23#include <BOPAlgo_BOP.hxx>
1155d05a 24#include <NCollection_BaseAllocator.hxx>
42cf5bc1 25#include <Standard_Boolean.hxx>
1155d05a 26#include <Standard_Integer.hxx>
27#include <TopTools_DataMapOfShapeListOfShape.hxx>
28#include <TopTools_DataMapOfShapeShape.hxx>
42cf5bc1 29#include <TopTools_ListOfShape.hxx>
1155d05a 30#include <TopTools_MapOfShape.hxx>
42cf5bc1 31class TopoDS_Shape;
32class TopoDS_Face;
33
34
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.
50class BRepFeat_Builder : public BOPAlgo_BOP
51{
52public:
53
54 DEFINE_STANDARD_ALLOC
55
56
57 Standard_EXPORT BRepFeat_Builder();
58Standard_EXPORT virtual ~BRepFeat_Builder();
59
60 //! Clears internal fields and arguments.
61 Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
62
63 //! Initialyzes the object of local boolean operation.
64 Standard_EXPORT void Init (const TopoDS_Shape& theShape);
65
66 //! Initialyzes the arguments of local boolean operation.
67 Standard_EXPORT void Init (const TopoDS_Shape& theShape, const TopoDS_Shape& theTool);
68
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);
72
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);
79
80 //! Collects parts of the tool.
81 Standard_EXPORT void PartsOfTool (TopTools_ListOfShape& theLT);
82
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);
86
87 //! Adds shape theS and all its sub-shapes into myShapes map.
88 Standard_EXPORT void KeepPart (const TopoDS_Shape& theS);
89
90 //! Main function to build the result of the
91 //! local operation required.
92 Standard_EXPORT void PerformResult();
93
94 //! Rebuilds faces in accordance with the kept parts of the tool.
95 Standard_EXPORT void RebuildFaces();
96
97 //! Rebuilds edges in accordance with the kept parts of the tool.
1155d05a 98 Standard_EXPORT void RebuildEdge (const TopoDS_Shape& theE, const TopoDS_Face& theF, const TopTools_MapOfShape& theME, TopTools_ListOfShape& aLEIm);
42cf5bc1 99
100 //! Collects the images of the object, that contains in
101 //! the images of the tool.
102 Standard_EXPORT void CheckSolidImages();
103
104 //! Collects the removed parts of the tool into myRemoved map.
105 Standard_EXPORT void FillRemoved();
106
107 //! Adds the shape S and its sub-shapes into myRemoved map.
1155d05a 108 Standard_EXPORT void FillRemoved (const TopoDS_Shape& theS, TopTools_MapOfShape& theM);
42cf5bc1 109
110
111
112
113protected:
114
115
116 //! Prepares builder of local operation.
117 Standard_EXPORT virtual void Prepare() Standard_OVERRIDE;
118
119 //! Function is redefined to avoid the usage of removed faces.
13c0e402 120 Standard_EXPORT virtual void FillIn3DParts (TopTools_DataMapOfShapeShape& theDraftSolids) Standard_OVERRIDE;
121
122 //! Avoid the check for open solids and always use the splits
123 //! of solids for building the result shape.
124 virtual Standard_Boolean CheckArgsForOpenSolid() Standard_OVERRIDE
125 {
126 return Standard_False;
127 }
42cf5bc1 128
129
1155d05a 130 TopTools_MapOfShape myShapes;
131 TopTools_MapOfShape myRemoved;
42cf5bc1 132 Standard_Integer myFuse;
133
134
135private:
136
137
138
139
140
141};
142
143
144
145
146
147
148
149#endif // _BRepFeat_Builder_HeaderFile