Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_GetInPlace.hxx
1 // Copyright (C) 2007-2012  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 // File:        GEOMAlgo_GetInPlace.hxx
23 // Created:
24 // Author:      Peter KURNEV
25
26 #ifndef _GEOMAlgo_GetInPlace_HeaderFile
27 #define _GEOMAlgo_GetInPlace_HeaderFile
28
29 #include <Standard.hxx>
30 #include <Standard_Macro.hxx>
31 #include <Standard_Integer.hxx>
32 #include <Standard_Real.hxx>
33 #include <Standard_Boolean.hxx>
34
35 #include <TopAbs_ShapeEnum.hxx>
36 #include <TopoDS_Shape.hxx>
37
38 #include <NMTTools_CoupleOfShape.hxx>
39 #include <NMTTools_ListOfCoupleOfShape.hxx>
40 #include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
41
42 #include <GEOMAlgo_DataMapOfShapeMapOfShape.hxx>
43 #include <GEOMAlgo_GluerAlgo.hxx>
44 #include <GEOMAlgo_Algo.hxx>
45 #include <GEOMAlgo_DataMapOfShapePnt.hxx>
46
47
48 //=======================================================================
49 /**
50  * The implementation of iterator of intersected  shapes
51  * for Get In Place Algorithm.
52  * The intersection is in terms of 3D bounding boxes.
53  */
54 //=======================================================================
55 //class    : GEOMAlgo_GetInPlaceIterator
56 //purpose  :
57 //=======================================================================
58 class GEOMAlgo_GetInPlaceIterator  {
59  public:
60   /**
61    * Constructor.
62    */
63   //Standard_EXPORT
64     GEOMAlgo_GetInPlaceIterator();
65
66   /**
67    * Destructor.
68    */
69   //Standard_EXPORT
70     virtual ~GEOMAlgo_GetInPlaceIterator();
71
72   /**
73    * Clear the internal content.
74    */
75   //Standard_EXPORT
76     void Clear() ;
77
78   /**
79    * Append the pair of intersected shapes.
80    * @param theCS
81    *   The pair of intersected shapes.
82    */
83   //Standard_EXPORT
84     void AppendPair(const NMTTools_CoupleOfShape& theCS) ;
85
86   /**
87    * Initialize the iterator.
88    * @param theT1
89    *   The type of (sub)shape What.
90    * @param theT2
91    *   The type of (sub)shape Where.
92    */
93   //Standard_EXPORT
94     void Initialize(const TopAbs_ShapeEnum theT1,
95                     const TopAbs_ShapeEnum theT2) ;
96   /**
97    * Check the existence of pairs to iterare.
98    * @return
99    *   Standard_True if there are pairs to iterare.
100    */
101   //Standard_EXPORT
102     Standard_Boolean More() const;
103
104   /**
105    * Shift to the next pair.
106    */
107   //Standard_EXPORT
108     void Next() ;
109
110   /**
111    * Returns the pair of intersected shapes.
112    * @return
113    *   The pair of intersected shapes.
114    */
115   //Standard_EXPORT
116     const NMTTools_CoupleOfShape& Value() const;
117
118 protected:
119   Standard_Integer myDim;
120   NMTTools_ListOfCoupleOfShape myLists[10];
121   NMTTools_ListOfCoupleOfShape myEmptyList;
122   NMTTools_ListIteratorOfListOfCoupleOfShape myIterator;
123
124 private:
125 };
126
127
128 //=======================================================================
129 /**
130  * The implementation of Get In Place Algorithm.
131  * The algorithm provides the search the argument [What]
132  * in the shape [Where].
133  */
134 //=======================================================================
135 //class    : GEOMAlgo_GetInPlace
136 //purpose  :
137 //=======================================================================
138 class GEOMAlgo_GetInPlace  : public GEOMAlgo_GluerAlgo,
139                              public GEOMAlgo_Algo
140 {
141  public:
142   /**
143    * Constructor.
144    */
145   Standard_EXPORT
146     GEOMAlgo_GetInPlace();
147   /**
148    * Destructor.
149    */
150   Standard_EXPORT
151     virtual ~GEOMAlgo_GetInPlace();
152   /**
153    * Modifier. Sets the shape where the search is intended.
154    * @param theShape
155    *   The shape where the search is intended.
156    */
157   Standard_EXPORT
158     virtual void SetShapeWhere(const TopoDS_Shape& theShape) ;
159
160   /**
161    * Selector. Returns the shape where the search is intended.
162    * @return
163    *   The shape where the search is intended.
164    */
165   Standard_EXPORT
166     const TopoDS_Shape& ShapeWhere() const;
167
168   /**
169    * Modifier. Sets the tolerance of mass.
170    * @param theTol
171    *   The value tolerance of mass.
172    */
173   Standard_EXPORT
174     void SetTolMass(const Standard_Real theTol) ;
175
176   /**
177    * Selector. Returns the value tolerance of mass.
178    * @return
179    *   The value tolerance of mass.
180    */
181   Standard_EXPORT
182     Standard_Real TolMass() const;
183
184   /**
185    * Modifier. Sets the tolerance of center of gravily.
186    * @param theTol
187    *   The value tolerance of center of gravily.
188    */
189   Standard_EXPORT
190     void SetTolCG(const Standard_Real theTol) ;
191
192   /**
193    * Selector. Returns the tolerance of center of gravily.
194    * @return
195    *   The value tolerance of center of gravily.
196    */
197   Standard_EXPORT
198     Standard_Real TolCG() const;
199
200   /**
201    * Perform the algorithm.
202    */
203   Standard_EXPORT
204     virtual  void Perform() ;
205
206   /**
207    * Returns state of the search.
208    * @return
209    *   Standard_True if the argument is found.
210    */
211   Standard_EXPORT
212     Standard_Boolean IsFound() const;
213
214   /**
215    * Checks data
216    */
217   Standard_EXPORT
218     virtual  void CheckData() ;
219
220   /**
221    * Clear the internal content.
222    */
223   Standard_EXPORT
224     virtual  void Clear() ;
225
226   /**
227    * Returns the map of shapes IN.
228    * @return
229    ** Returns the map of shapes IN.
230    * The Key - the (sub)shape of the argument [What].
231    * The Item- the (sub)shapes of the shape [Where] that have
232    *           the state IN in respect of [What].
233   */
234   Standard_EXPORT
235     const GEOMAlgo_DataMapOfShapeMapOfShape& ShapesIn() const;
236
237   /**
238    * Returns the map of shapes ON.
239    * @return
240    * Returns the map of shapes ON.
241    * The Key - the (sub)shape of the argument [What].
242    * The Item- the (sub)shapes of the shape [Where] that have
243    *           the state ON in respect of [What].
244    */
245   Standard_EXPORT
246     const GEOMAlgo_DataMapOfShapeMapOfShape& ShapesOn() const;
247
248 protected:
249   Standard_EXPORT
250     void Intersect() ;
251
252   Standard_EXPORT
253     void PerformVV() ;
254
255   Standard_EXPORT
256     void PerformVE() ;
257
258   Standard_EXPORT
259     void PerformEE() ;
260
261   Standard_EXPORT
262     void PerformVF() ;
263
264   Standard_EXPORT
265     void PerformEF() ;
266
267   Standard_EXPORT
268     void PerformFF() ;
269
270   Standard_EXPORT
271     void FillEdgesOn() ;
272
273   Standard_EXPORT
274     void FillFacesOn() ;
275
276   Standard_EXPORT
277     void FillSolidsOn() ;
278
279   Standard_EXPORT
280     void PerformZF() ;
281
282   Standard_EXPORT
283     void PerformZZ() ;
284
285   Standard_EXPORT
286     void FillImages() ;
287
288   Standard_EXPORT
289     void FillImagesCompound(const TopoDS_Shape& theS) ;
290
291   Standard_EXPORT
292     void CheckGProps() ;
293
294   Standard_EXPORT
295     void CheckGProps(const TopoDS_Shape& theS) ;
296
297   Standard_EXPORT
298     void FillShapesIn(const TopoDS_Shape& theS1,
299                       const TopoDS_Shape& theS2) ;
300
301   Standard_EXPORT
302     void FillShapesOn(const TopoDS_Shape& theS1,
303                       const TopoDS_Shape& theS2) ;
304
305   Standard_EXPORT
306     Standard_Boolean CheckCoincidence(const TopoDS_Shape& theS1,
307                                       const TopoDS_Shape& theS2);
308
309
310   TopoDS_Shape myShapeWhere;
311   GEOMAlgo_GetInPlaceIterator myIterator;
312   GEOMAlgo_DataMapOfShapeMapOfShape myShapesIn;
313   GEOMAlgo_DataMapOfShapeMapOfShape myShapesOn;
314   Standard_Real myTolMass;
315   Standard_Real myTolCG;
316   Standard_Boolean myFound;
317   GEOMAlgo_DataMapOfShapePnt myMapShapePnt;
318
319 private:
320 };
321
322
323
324 #endif