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