Salome HOME
Update copyright
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_Builder.hxx
1 // Copyright (C) 2007-2011  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
23 #ifndef _GEOMAlgo_Builder_HeaderFile
24 #define _GEOMAlgo_Builder_HeaderFile
25
26 #ifndef _NMTTools_PPaveFiller_HeaderFile
27 #include <NMTTools_PPaveFiller.hxx>
28 #endif
29 #ifndef _TopTools_ListOfShape_HeaderFile
30 #include <TopTools_ListOfShape.hxx>
31 #endif
32 #ifndef _Standard_Integer_HeaderFile
33 #include <Standard_Integer.hxx>
34 #endif
35 #ifndef _TopTools_MapOfShape_HeaderFile
36 #include <TopTools_MapOfShape.hxx>
37 #endif
38 #ifndef _BRepAlgo_Image_HeaderFile
39 #include <BRepAlgo_Image.hxx>
40 #endif
41 #ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile
42 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
43 #endif
44 #ifndef _TopTools_IndexedDataMapOfShapeShape_HeaderFile
45 #include <TopTools_IndexedDataMapOfShapeShape.hxx>
46 #endif
47 #ifndef _GEOMAlgo_BuilderShape_HeaderFile
48 #include <GEOMAlgo_BuilderShape.hxx>
49 #endif
50 #ifndef _Standard_Boolean_HeaderFile
51 #include <Standard_Boolean.hxx>
52 #endif
53 #ifndef _TopAbs_ShapeEnum_HeaderFile
54 #include <TopAbs_ShapeEnum.hxx>
55 #endif
56 class NMTTools_PaveFiller;
57 class TopoDS_Shape;
58 class TopTools_ListOfShape;
59 class BRepAlgo_Image;
60
61
62 #ifndef _Standard_HeaderFile
63 #include <Standard.hxx>
64 #endif
65 #ifndef _Standard_Macro_HeaderFile
66 #include <Standard_Macro.hxx>
67 #endif
68
69
70 class GEOMAlgo_Builder  : public GEOMAlgo_BuilderShape {
71
72 public:
73
74     void* operator new(size_t,void* anAddress) 
75       {
76         return anAddress;
77       }
78     void* operator new(size_t size) 
79       { 
80         return Standard::Allocate(size); 
81       }
82     void  operator delete(void *anAddress) 
83       { 
84         if (anAddress) Standard::Free((Standard_Address&)anAddress); 
85       }
86  // Methods PUBLIC
87  // 
88
89 //!  Empty constructor <br>
90 Standard_EXPORT GEOMAlgo_Builder();
91 Standard_EXPORT virtual ~GEOMAlgo_Builder();
92
93 //!  Performs calculations <br>
94 Standard_EXPORT virtual  void Perform() ;
95
96 //!  Performs calculations using prepared PaveFiller <br>
97 //!           object theDSF <br>
98 Standard_EXPORT virtual  void PerformWithFiller(const NMTTools_PaveFiller& theDSF) ;
99
100 //!  Adds argument theShape of the operation <br>
101 Standard_EXPORT virtual  void AddShape(const TopoDS_Shape& theShape) ;
102
103 //!  Clears internal fields and arguments <br>
104 Standard_EXPORT virtual  void Clear() ;
105
106 //!  Returns the arguments of the operation <br>
107 Standard_EXPORT  const TopTools_ListOfShape& Shapes() const;
108
109 //! Returns the  list of shapes generated from the <br>
110 //!          shape theS. <br>
111 Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ;
112
113 //! Returns the list of shapes modified from the shape <br>
114 //!          theS. <br>
115 Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ;
116
117 //! Returns true if the shape theS has been deleted. <br>
118 Standard_EXPORT virtual  Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ;
119
120 //!  Adds arguments of the operation as <br>
121 //!           shapes of upper level of container shape theShape <br>
122 Standard_EXPORT   void AddCompound(const TopoDS_Shape& theShape) ;
123
124 //! Returns list of arguments of type theType <br>
125 Standard_EXPORT  const TopTools_ListOfShape& Shapes1(const Standard_Integer theType) const;
126
127 //! Returns image shapes <br>
128 Standard_EXPORT  const BRepAlgo_Image& Images() const;
129
130 //! Returns split-parts of shapes that have <br>
131 //!          state IN for the domain of shape theShape <br>
132 Standard_EXPORT  const TopTools_ListOfShape& InParts(const TopoDS_Shape& theShape) const;
133
134
135
136
137
138 protected:
139
140  // Methods PROTECTED
141  // 
142
143 //!  Performs calculations using prepared DSFiller <br>
144 //!           object theDSF <br>
145 Standard_EXPORT virtual  void PerformInternal(const NMTTools_PaveFiller& theDSF) ;
146
147 //!  Prepare information for history support <br>
148 Standard_EXPORT virtual  void PrepareHistory() ;
149
150 //!  Clears internal fields <br>
151 Standard_EXPORT virtual  void ClearInternals() ;
152
153 //!  Provides preparing actions <br>
154 Standard_EXPORT virtual  void Prepare() ;
155
156 //!  Provides post-tratment actions <br>
157 Standard_EXPORT virtual  void PostTreat() ;
158
159 //!  Append the argument theShape to <br>
160 //!           typified lists of arguments myShapes1 <br>
161 Standard_EXPORT   void AddShape1(const TopoDS_Shape& theShape) ;
162
163 //! Build the resulting shapes of type theType <br>
164 Standard_EXPORT virtual  void BuildResult(const TopAbs_ShapeEnum theType) ;
165
166 //! Fill Images for vertices <br>
167 Standard_EXPORT   void FillImagesVertices() ;
168
169 //! Fill Images for edges <br>
170 Standard_EXPORT   void FillImagesEdges() ;
171
172 //! Fill Images for faces <br>
173 Standard_EXPORT   void FillImagesFaces() ;
174
175 //! For each interferred face find split edges <br>
176 //!          that are in 2-D domain of the face <br>
177 Standard_EXPORT   void FillIn2DParts() ;
178
179 //! Build draft faces <br>
180 Standard_EXPORT   void BuildSplitFaces() ;
181
182 //! Among draft faces find same domain faces <br>
183 Standard_EXPORT   void FillSameDomainFaces() ;
184
185 //! Fill Images for faces <br>
186 //!          taking into account same domain faces <br>
187 Standard_EXPORT   void FillImagesFaces1() ;
188
189 //! Update Images for faces by <br>
190 //!          internal vertices <br>
191 Standard_EXPORT   void FillInternalVertices() ;
192
193 //!  Fill Images for Wires, Shells, Compsolids, Compounds <br>
194 Standard_EXPORT   void FillImagesContainers(const TopAbs_ShapeEnum theType) ;
195
196 //!  Fill Images for solids <br>
197 Standard_EXPORT   void FillImagesSolids() ;
198
199 //! For each interferred solid find split faces <br>
200 //!          that are in 3-D domain of the solid <br>
201 Standard_EXPORT   void FillIn3DParts() ;
202
203 //! Build draft solids <br>
204 Standard_EXPORT   void BuildSplitSolids() ;
205
206 //!  Update draft solids by <br>
207 //!           internal shells, edges, vertices <br>
208 Standard_EXPORT   void FillInternalShapes() ;
209
210 //!  Build solid theDraftSolid that consists of <br>
211 //!           non-internal split faces of the solid <br>
212 //!           theSolid. <br>
213 //!           All splits of internal faces of <br>
214 //!           theSolid are in the list: theInternalFaces <br>
215 Standard_EXPORT   void BuildDraftSolid(const TopoDS_Shape& theSolid,TopoDS_Shape& theDraftSolid,TopTools_ListOfShape& theInternalFaces) ;
216
217
218  // Fields PROTECTED
219  //
220 NMTTools_PPaveFiller myPaveFiller;
221 TopTools_ListOfShape myShapes;
222 Standard_Integer myNbTypes;
223 TopTools_MapOfShape myMapFence;
224 TopTools_ListOfShape myShapes1[9];
225 BRepAlgo_Image myImages;
226 TopTools_IndexedDataMapOfShapeListOfShape myInParts;
227 BRepAlgo_Image mySplitFaces;
228 TopTools_IndexedDataMapOfShapeShape mySameDomainShapes;
229 TopTools_IndexedDataMapOfShapeShape myDraftSolids;
230 Standard_Integer myEntryPoint;
231
232
233 private: 
234
235  // Methods PRIVATE
236  // 
237
238
239  // Fields PRIVATE
240  //
241
242
243 };
244
245
246
247
248
249 // other Inline functions and methods (like "C++: function call" methods)
250 //
251
252
253 #endif