Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_Builder.hxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
8 //
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19
20 #ifndef _GEOMAlgo_Builder_HeaderFile
21 #define _GEOMAlgo_Builder_HeaderFile
22
23 #ifndef _NMTTools_PPaveFiller_HeaderFile
24 #include <NMTTools_PPaveFiller.hxx>
25 #endif
26 #ifndef _TopTools_ListOfShape_HeaderFile
27 #include <TopTools_ListOfShape.hxx>
28 #endif
29 #ifndef _Standard_Integer_HeaderFile
30 #include <Standard_Integer.hxx>
31 #endif
32 #ifndef _TopTools_MapOfShape_HeaderFile
33 #include <TopTools_MapOfShape.hxx>
34 #endif
35 #ifndef _BRepAlgo_Image_HeaderFile
36 #include <BRepAlgo_Image.hxx>
37 #endif
38 #ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile
39 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
40 #endif
41 #ifndef _TopTools_IndexedDataMapOfShapeShape_HeaderFile
42 #include <TopTools_IndexedDataMapOfShapeShape.hxx>
43 #endif
44 #ifndef _GEOMAlgo_BuilderShape_HeaderFile
45 #include <GEOMAlgo_BuilderShape.hxx>
46 #endif
47 #ifndef _Standard_Boolean_HeaderFile
48 #include <Standard_Boolean.hxx>
49 #endif
50 #ifndef _TopAbs_ShapeEnum_HeaderFile
51 #include <TopAbs_ShapeEnum.hxx>
52 #endif
53 class NMTTools_PaveFiller;
54 class TopoDS_Shape;
55 class TopTools_ListOfShape;
56 class BRepAlgo_Image;
57
58
59 #ifndef _Standard_HeaderFile
60 #include <Standard.hxx>
61 #endif
62 #ifndef _Standard_Macro_HeaderFile
63 #include <Standard_Macro.hxx>
64 #endif
65
66
67 class GEOMAlgo_Builder  : public GEOMAlgo_BuilderShape {
68
69 public:
70
71     void* operator new(size_t,void* anAddress) 
72       {
73         return anAddress;
74       }
75     void* operator new(size_t size) 
76       { 
77         return Standard::Allocate(size); 
78       }
79     void  operator delete(void *anAddress) 
80       { 
81         if (anAddress) Standard::Free((Standard_Address&)anAddress); 
82       }
83  // Methods PUBLIC
84  // 
85
86 //!  Empty constructor <br>
87 Standard_EXPORT GEOMAlgo_Builder();
88 Standard_EXPORT virtual ~GEOMAlgo_Builder();
89
90 //!  Performs calculations <br>
91 Standard_EXPORT virtual  void Perform() ;
92
93 //!  Performs calculations using prepared PaveFiller <br>
94 //!           object theDSF <br>
95 Standard_EXPORT virtual  void PerformWithFiller(const NMTTools_PaveFiller& theDSF) ;
96
97 //!  Adds argument theShape of the operation <br>
98 Standard_EXPORT virtual  void AddShape(const TopoDS_Shape& theShape) ;
99
100 //!  Clears internal fields and arguments <br>
101 Standard_EXPORT virtual  void Clear() ;
102
103 //!  Returns the arguments of the operation <br>
104 Standard_EXPORT  const TopTools_ListOfShape& Shapes() const;
105
106 //! Returns the  list of shapes generated from the <br>
107 //!          shape theS. <br>
108 Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ;
109
110 //! Returns the list of shapes modified from the shape <br>
111 //!          theS. <br>
112 Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ;
113
114 //! Returns true if the shape theS has been deleted. <br>
115 Standard_EXPORT virtual  Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ;
116
117 //!  Adds arguments of the operation as <br>
118 //!           shapes of upper level of container shape theShape <br>
119 Standard_EXPORT   void AddCompound(const TopoDS_Shape& theShape) ;
120
121 //! Returns list of arguments of type theType <br>
122 Standard_EXPORT  const TopTools_ListOfShape& Shapes1(const Standard_Integer theType) const;
123
124 //! Returns image shapes <br>
125 Standard_EXPORT  const BRepAlgo_Image& Images() const;
126
127 //! Returns split-parts of shapes that have <br>
128 //!          state IN for the domain of shape theShape <br>
129 Standard_EXPORT  const TopTools_ListOfShape& InParts(const TopoDS_Shape& theShape) const;
130
131
132
133
134
135 protected:
136
137  // Methods PROTECTED
138  // 
139
140 //!  Performs calculations using prepared DSFiller <br>
141 //!           object theDSF <br>
142 Standard_EXPORT virtual  void PerformInternal(const NMTTools_PaveFiller& theDSF) ;
143
144 //!  Prepare information for history support <br>
145 Standard_EXPORT virtual  void PrepareHistory() ;
146
147 //!  Clears internal fields <br>
148 Standard_EXPORT virtual  void ClearInternals() ;
149
150 //!  Provides preparing actions <br>
151 Standard_EXPORT virtual  void Prepare() ;
152
153 //!  Provides post-tratment actions <br>
154 Standard_EXPORT virtual  void PostTreat() ;
155
156 //!  Append the argument theShape to <br>
157 //!           typified lists of arguments myShapes1 <br>
158 Standard_EXPORT   void AddShape1(const TopoDS_Shape& theShape) ;
159
160 //! Build the resulting shapes of type theType <br>
161 Standard_EXPORT virtual  void BuildResult(const TopAbs_ShapeEnum theType) ;
162
163 //! Fill Images for vertices <br>
164 Standard_EXPORT   void FillImagesVertices() ;
165
166 //! Fill Images for edges <br>
167 Standard_EXPORT   void FillImagesEdges() ;
168
169 //! Fill Images for faces <br>
170 Standard_EXPORT   void FillImagesFaces() ;
171
172 //! For each interferred face find split edges <br>
173 //!          that are in 2-D domain of the face <br>
174 Standard_EXPORT   void FillIn2DParts() ;
175
176 //! Build draft faces <br>
177 Standard_EXPORT   void BuildSplitFaces() ;
178
179 //! Among draft faces find same domain faces <br>
180 Standard_EXPORT   void FillSameDomainFaces() ;
181
182 //! Fill Images for faces <br>
183 //!          taking into account same domain faces <br>
184 Standard_EXPORT   void FillImagesFaces1() ;
185
186 //! Update Images for faces by <br>
187 //!          internal vertices <br>
188 Standard_EXPORT   void FillInternalVertices() ;
189
190 //!  Fill Images for Wires, Shells, Compsolids, Compounds <br>
191 Standard_EXPORT   void FillImagesContainers(const TopAbs_ShapeEnum theType) ;
192
193 //!  Fill Images for solids <br>
194 Standard_EXPORT   void FillImagesSolids() ;
195
196 //! For each interferred solid find split faces <br>
197 //!          that are in 3-D domain of the solid <br>
198 Standard_EXPORT   void FillIn3DParts() ;
199
200 //! Build draft solids <br>
201 Standard_EXPORT   void BuildSplitSolids() ;
202
203 //!  Update draft solids by <br>
204 //!           internal shells, edges, vertices <br>
205 Standard_EXPORT   void FillInternalShapes() ;
206
207 //!  Build solid theDraftSolid that consists of <br>
208 //!           non-internal split faces of the solid <br>
209 //!           theSolid. <br>
210 //!           All splits of internal faces of <br>
211 //!           theSolid are in the list: theInternalFaces <br>
212 Standard_EXPORT   void BuildDraftSolid(const TopoDS_Shape& theSolid,TopoDS_Shape& theDraftSolid,TopTools_ListOfShape& theInternalFaces) ;
213
214
215  // Fields PROTECTED
216  //
217 NMTTools_PPaveFiller myPaveFiller;
218 TopTools_ListOfShape myShapes;
219 Standard_Integer myNbTypes;
220 TopTools_MapOfShape myMapFence;
221 TopTools_ListOfShape myShapes1[9];
222 BRepAlgo_Image myImages;
223 TopTools_IndexedDataMapOfShapeListOfShape myInParts;
224 BRepAlgo_Image mySplitFaces;
225 TopTools_IndexedDataMapOfShapeShape mySameDomainShapes;
226 TopTools_IndexedDataMapOfShapeShape myDraftSolids;
227 Standard_Integer myEntryPoint;
228
229
230 private: 
231
232  // Methods PRIVATE
233  // 
234
235
236  // Fields PRIVATE
237  //
238
239
240 };
241
242
243
244
245
246 // other Inline functions and methods (like "C++: function call" methods)
247 //
248
249
250 #endif