Salome HOME
574b1e004c689e97edcb10810254c9b47bc48b4d
[modules/hydro.git] / src / HYDROData / HYDROData_LandCoverMap.cxx
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #include <HYDROData_LandCoverMap.h>
20 #include <HYDROData_Object.h>
21 #include <HYDROData_PolylineXY.h>
22 #include <HYDROData_Tool.h>
23
24 #include <BOPAlgo_BOP.hxx>
25 #include <BOPAlgo_Builder.hxx>
26 #include <BOPAlgo_PaveFiller.hxx>
27 #include <BOPCol_ListOfShape.hxx>
28 #include <BRep_Builder.hxx>
29 #include <BRepAdaptor_Curve.hxx>
30 #include <BRepAlgoAPI_Fuse.hxx>
31 #include <BRepBuilderAPI_MakeFace.hxx>
32 #include <GCPnts_QuasiUniformDeflection.hxx>
33 #include <NCollection_IndexedMap.hxx>
34 #include <TopoDS.hxx>
35 #include <TopoDS_Compound.hxx>
36 #include <TopoDS_Edge.hxx>
37 #include <TopoDS_Face.hxx>
38 #include <TopoDS_Iterator.hxx>
39 #include <TopoDS_Shell.hxx>
40 #include <TopExp_Explorer.hxx>
41 #include <TopTools_ListIteratorOfListOfShape.hxx>
42 #include <BOPAlgo_PaveFiller.hxx>
43 #include <BRepTools.hxx>
44 #include <TopExp_Explorer.hxx>
45 #include <ShapeUpgrade_UnifySameDomain.hxx>
46
47 #include <QFile>
48 #include <QString>
49 #include <QTextStream>
50
51 const char TELEMAC_FORMAT = 'f';
52 const int TELEMAC_PRECISION = 3;
53
54
55 IMPLEMENT_STANDARD_HANDLE(HYDROData_LandCoverMap, HYDROData_Entity)
56 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_LandCoverMap, HYDROData_Entity)
57
58 class HYDROData_MapOfFaceToStricklerType : public NCollection_IndexedDataMap<TopoDS_Face, QString>
59 {
60 };
61
62 /**
63   Constructor
64   @param theMap the land cover map to iterate through
65 */
66 HYDROData_LandCoverMap::Iterator::Iterator( const HYDROData_LandCoverMap& theMap )
67 {
68   Init( theMap );
69 }
70
71 HYDROData_LandCoverMap::Iterator::Iterator( const Handle( HYDROData_LandCoverMap )& theMap )
72 {
73   if( theMap.IsNull() )
74   {
75     myIterator = 0;
76     myIndex = -1;
77   }
78   else
79     Init( *theMap );
80 }
81
82 /**
83   Initialize the iterator
84   @param theMap the land cover map to iterate through
85 */
86 void HYDROData_LandCoverMap::Iterator::Init( const HYDROData_LandCoverMap& theMap )
87 {
88   TopoDS_Shape aShape = theMap.GetShape();
89   if( aShape.IsNull() )
90     myIterator = 0;
91   else
92     myIterator = new TopoDS_Iterator( aShape );
93   myIndex = 0;
94   theMap.myLab.FindChild( DataTag_Types ).FindAttribute( TDataStd_ExtStringArray::GetID(), myArray );
95 }
96
97 /**
98   Destructor
99 */
100 HYDROData_LandCoverMap::Iterator::~Iterator()
101 {
102   delete myIterator;
103 }
104
105 /**
106   Return if the iterator has more elements
107   @return if the iterator has more elements
108 */
109 bool HYDROData_LandCoverMap::Iterator::More() const
110 {
111   return !myArray.IsNull() && myIterator && myIterator->More();
112 }
113
114 /**
115   Move iterator to the next element
116 */
117 void HYDROData_LandCoverMap::Iterator::Next()
118 {
119   if( myIterator )
120   {
121     myIterator->Next();
122     myIndex++;
123   }
124 }
125
126 /**
127   Get the current land cover (face)
128   @return the land cover's face
129 */
130 TopoDS_Face HYDROData_LandCoverMap::Iterator::Face() const
131 {
132   if( myIterator )
133     return TopoDS::Face( myIterator->Value() );
134   else
135     return TopoDS_Face();
136 }
137
138 /**
139   Get the current land cover's Strickler type 
140   @return the land cover's Strickler type 
141 */
142 QString HYDROData_LandCoverMap::Iterator::StricklerType() const
143 {
144   if( myArray.IsNull() || myIndex < myArray->Lower() || myIndex > myArray->Upper() )
145     return "";
146   else
147     return HYDROData_Tool::toQString( myArray->Value( myIndex ) );
148 }
149
150 /**
151   Constructor
152 */
153 HYDROData_LandCoverMap::HYDROData_LandCoverMap()
154   : HYDROData_Entity( Geom_No )
155 {
156 }
157
158 /**
159   Destructor
160 */
161 HYDROData_LandCoverMap::~HYDROData_LandCoverMap()
162 {
163 }
164
165 /**
166   Get object's kind
167   @return object's kind
168 */
169 const ObjectKind HYDROData_LandCoverMap::GetKind() const
170 {
171   return KIND_LAND_COVER_MAP;
172 }
173
174 /**
175   Import the land cover map from QGIS
176   @param theFileName the name of file
177   @return if the import is successful
178 */
179 bool HYDROData_LandCoverMap::ImportQGIS( const QString& theFileName )
180 {
181   //TODO
182   return false;
183 }
184
185 /**
186   Export the land cover map to QGIS
187   @param theFileName the name of file
188   @return if the export is successful
189 */
190 bool HYDROData_LandCoverMap::ExportQGIS( const QString& theFileName ) const
191 {
192   //TODO
193   return false;
194 }
195
196 int HashCode( const gp_Pnt& thePoint, const Standard_Integer theUpper )
197 {
198   int aHashX = HashCode( thePoint.X(), theUpper );
199   int aHashY = HashCode( thePoint.Y(), theUpper );
200   return (aHashX^aHashY)%theUpper;
201 }
202
203 bool operator == ( const gp_Pnt& thePoint1, const gp_Pnt& thePoint2 )
204 {
205   return thePoint1.IsEqual( thePoint2, Precision::Confusion() );
206 }
207
208 bool EdgeDiscretization( const TopoDS_Edge& theEdge, 
209                          Standard_Real theDeflection,
210                          NCollection_IndexedMap<gp_Pnt>& theVerticesMap,
211                          QList<int>& theVerticesIds )
212 {
213   BRepAdaptor_Curve aCurve( theEdge );
214   GCPnts_QuasiUniformDeflection aDiscrete( aCurve, theDeflection );
215   if( !aDiscrete.IsDone() )
216     return false;
217
218   int n = aDiscrete.NbPoints();
219   for( int i=1; i<=n; i++ )
220   {
221     gp_Pnt aPnt = aDiscrete.Value( i );
222     int anId;
223     if( theVerticesMap.Contains( aPnt ) )
224       anId = theVerticesMap.FindIndex( aPnt );
225     else
226     {
227       anId = theVerticesMap.Size();
228       theVerticesMap.Add( aPnt );
229     }
230     theVerticesIds.append( anId );
231   }
232   return true;
233 }
234
235 /**
236   Export the land cover map for the solver (Telemac)
237   @param theFileName the name of file
238   @return if the export is successful
239 */
240 bool HYDROData_LandCoverMap::ExportTelemac( const QString& theFileName, Standard_Real theDeflection ) const
241 {
242   TopoDS_Shell aShell;  //TODO: unite all the faces of land covers into the shell
243
244   NCollection_IndexedMap<gp_Pnt> aVerticesMap;
245   NCollection_IndexedDataMap< TopoDS_Edge, QList<int> > anEdgesMap;
246   NCollection_IndexedDataMap< TopoDS_Face, QList<int> > aFacesMap;
247
248   // add into the map all edges existing in the shell
249   TopExp_Explorer anExp1( aShell, TopAbs_EDGE );
250   for( ; anExp1.More(); anExp1.Next() )
251   {
252     TopoDS_Edge anEdge = TopoDS::Edge( anExp1.Current() );
253     QList<int> aVerticesIdsList;
254     if( EdgeDiscretization( anEdge, theDeflection, aVerticesMap, aVerticesIdsList ) )
255       anEdgesMap.Add( anEdge, aVerticesIdsList );
256   }
257
258   // add into the map all faces existing in the shell and correspondence between face and edges ids
259   TopExp_Explorer anExp2( aShell, TopAbs_FACE );
260   for( ; anExp2.More(); anExp2.Next() )
261   {
262     TopoDS_Face aFace = TopoDS::Face( anExp2.Current() );
263     TopExp_Explorer anExp3( aFace, TopAbs_EDGE );
264     QList<int> anEdgesIdsList;
265     for( ; anExp3.More(); anExp3.Next() )
266     {
267       TopoDS_Edge anEdge = TopoDS::Edge( anExp3.Current() );
268       int anEdgeId = anEdgesMap.FindIndex( anEdge );
269       anEdgesIdsList.append( anEdgeId );
270     }
271     aFacesMap.Add( aFace, anEdgesIdsList );
272   }
273
274   QFile aFile( theFileName );
275   if( !aFile.open( QFile::WriteOnly | QFile::Text ) )
276     return false;
277
278   QTextStream aStream( &aFile );
279   aStream << "# nodes\n";
280   NCollection_IndexedMap<gp_Pnt>::Iterator anIt1( aVerticesMap );
281   for( ; anIt1.More(); anIt1.Next() )
282   {
283     gp_Pnt aPnt = anIt1.Value();
284     aStream << QString::number( aPnt.X(), TELEMAC_FORMAT, TELEMAC_PRECISION );
285     aStream << " ";
286     aStream << QString::number( aPnt.Y(), TELEMAC_FORMAT, TELEMAC_PRECISION );
287     aStream << " ";
288     aStream << QString::number( aPnt.Z(), TELEMAC_FORMAT, TELEMAC_PRECISION );
289     aStream << "\n";
290   }
291   aStream << "\n";
292
293   aStream << "# edges\n";
294   NCollection_IndexedDataMap< TopoDS_Edge, QList<int> >::Iterator anIt2( anEdgesMap );
295   for( ; anIt2.More(); anIt2.Next() )
296   {
297     QList<int> aVerticesIds = anIt2.Value();
298     foreach( int anId, aVerticesIds )
299       aStream << anId << " ";
300     aStream << "\n";
301   }
302   aStream << "\n";
303
304   aStream << "# faces\n";
305   NCollection_IndexedDataMap< TopoDS_Face, QList<int> >::Iterator anIt3( aFacesMap );
306   for( ; anIt3.More(); anIt3.Next() )
307   {
308     QList<int> anEdgesIds = anIt3.Value();
309     foreach( int anId, anEdgesIds )
310       aStream << anId << " ";
311     aStream << "\n";
312   }
313   aStream << "\n";
314
315   aFile.close();
316   return true;
317 }
318
319 /**
320   Add a new object as land cover
321   @param theObject the object to add as land cover
322   @param theType the Strickler type for the new land cover
323   @return if the addition is successful
324 */
325 bool HYDROData_LandCoverMap::Add( const Handle( HYDROData_Object )& theObject, const QString& theType )
326 {
327   if( theObject.IsNull() )
328     return false;
329
330   TopoDS_Shape aShape = theObject->GetTopShape();
331   if( aShape.ShapeType()!=TopAbs_FACE )
332     return false;
333
334   TopoDS_Face aFace = TopoDS::Face( aShape );
335   return LocalPartition( aFace, theType );
336 }
337
338 /**
339   Add a new polyline as land cover
340   @param thePolyline the polyline to add as land cover
341   @param theType the Strickler type for the new land cover
342   @return if the addition is successful
343 */
344 bool HYDROData_LandCoverMap::Add( const Handle( HYDROData_PolylineXY )& thePolyline, const QString& theType )
345 {
346   if( thePolyline.IsNull() )
347     return false;
348
349   TopoDS_Shape aShape = thePolyline->GetShape();
350   if( aShape.ShapeType()!=TopAbs_WIRE )
351     return false;
352
353   TopoDS_Wire aWire = TopoDS::Wire( aShape );
354   if( !aWire.Closed() )
355     return false;
356
357   TopoDS_Face aFace = BRepBuilderAPI_MakeFace( aWire, Standard_True ).Face();
358   return LocalPartition( aFace, theType );
359 }
360
361 /**
362   Remove the given face from land cover map
363   @param theFace the face to be removed
364   @return if the removing is successful
365 */
366 bool HYDROData_LandCoverMap::Remove( const TopoDS_Face& theFace )
367 {
368   TopTools_ListOfShape aList;
369   aList.Append( theFace );
370   return Remove( aList );
371 }
372
373 /**
374   Remove the given faces from land cover map
375   @param theFacesToRemove the face list to be removed
376   @return if the removing is successful
377 */
378 bool HYDROData_LandCoverMap::Remove( const TopTools_ListOfShape& theFacesToRemove )
379 {
380   HYDROData_MapOfFaceToStricklerType aFacesToRemove, aNewFaces;
381   TopTools_ListIteratorOfListOfShape aFIt( theFacesToRemove );
382   for( ; aFIt.More(); aFIt.Next() )
383   {
384     TopoDS_Shape aShape = aFIt.Value();
385     if( aShape.ShapeType()==TopAbs_FACE )
386       aFacesToRemove.Add( TopoDS::Face( aShape ), "" );
387   }
388
389   Iterator anIt( *this );
390   for( ; anIt.More(); anIt.Next() )
391     if( !aFacesToRemove.Contains( anIt.Face() ) )
392       aNewFaces.Add( anIt.Face(), anIt.StricklerType() );
393
394   StoreLandCovers( aNewFaces );
395   return true;
396 }
397
398 /**
399   Split the land cover map by the given polyline
400   @param thePolyline the tool polyline to split the land cover map
401   @return if the removing is successful
402 */
403 bool HYDROData_LandCoverMap::Split( const Handle( HYDROData_PolylineXY )& thePolyline )
404 {
405   if( thePolyline.IsNull() )
406     return false;
407
408   TopoDS_Shape aShape = thePolyline->GetShape();
409   return LocalPartition( aShape, "" );
410 }
411
412 /**
413   Merge the given faces in the land cover
414   @param theFaces the faces to merge in the land cover map
415   @param theType the Strickler type for the merged land cover
416   @return if the merge is successful
417 */
418 bool HYDROData_LandCoverMap::Merge( const TopTools_ListOfShape& theFaces, const QString& theType )
419 {
420   // 1. to remove the merged faces from the current map
421   Remove( theFaces );
422
423   // 2. to fuse the faces into the new face
424   /*BOPAlgo_PaveFiller aPF;
425   aPF.SetArguments( theFaces );
426   aPF.SetFuzzyValue( 1E-5 ); 
427   aPF.SetRunParallel( Standard_False );
428   aPF.Perform();
429   int iErr = aPF.ErrorStatus();
430   if( iErr )
431     return false;
432
433   BOPAlgo_BOP aBOP;
434   aBOP.SetArguments( theFaces );
435   aBOP.SetOperation( BOPAlgo_FUSE );
436   aBOP.SetRunParallel( Standard_False );
437   aBOP.PerformWithFiller(aPF);
438   iErr = aBOP.ErrorStatus();
439   if( iErr )
440     return false;
441
442   TopoDS_Shape aMergedShape = aBOP.Shape();
443   if( aMergedShape.ShapeType()!=TopAbs_FACE )
444     return false;*/
445
446  
447   ////
448   TopoDS_Shape MergedFace;
449   MergeFaces(theFaces, true, MergedFace);
450   //BRepTools::Write(aMergedShape, "c:/sh_.brep");
451
452   // 3. to add the face into the map
453   return LocalPartition( TopoDS_Face( /*aMergedShape*/ ), theType );
454 }
455
456 bool HYDROData_LandCoverMap::MergeFaces(const TopTools_ListOfShape& theFaces, bool IsToUnify, TopoDS_Shape& outSh)
457 {
458   int iErr;
459   TopTools_ListIteratorOfListOfShape aIt;
460   BOPCol_ListOfShape aLC;
461   aIt.Initialize(theFaces);
462   for (; aIt.More(); aIt.Next()) {
463     const TopoDS_Shape& aS=aIt.Value();
464     aLC.Append(aS);
465   }
466   BOPAlgo_PaveFiller aPF;
467   aPF.SetArguments(aLC);
468   aPF.SetRunParallel(Standard_False);
469   aPF.SetFuzzyValue(1e-02);
470
471   aPF.Perform();
472   iErr=aPF.ErrorStatus();
473   if (iErr)
474     return false;
475
476   BOPAlgo_Builder aBuilder;
477   aIt.Initialize(theFaces);
478   for (; aIt.More(); aIt.Next()) {
479     const TopoDS_Shape& aS=aIt.Value();
480     aBuilder.AddArgument(aS);
481   }
482
483   aBuilder.PerformWithFiller(aPF); 
484   iErr = aBuilder.ErrorStatus();
485   if (iErr)
486     return false;
487   const TopoDS_Shape& aMergedShape=aBuilder.Shape();
488
489   //
490   BRep_Builder BB;
491   TopoDS_Shell she; 
492   BB.MakeShell(she); 
493   she.Closed(Standard_False);
494   TopExp_Explorer ff(aMergedShape, TopAbs_FACE);
495   for(; ff.More(); ff.Next()) 
496   {
497     const TopoDS_Face& F = TopoDS::Face(ff.Current());
498     if (F.IsNull()) 
499       continue;
500     if (F.ShapeType() == TopAbs_FACE) {
501       BB.Add(she, F);
502       she.Closed (Standard_False);
503     }
504   }
505
506   if (IsToUnify)
507   {
508     ShapeUpgrade_UnifySameDomain USD;
509     USD.Initialize(she);
510     USD.Build();
511     outSh = USD.Shape();
512   }
513   else
514   {
515     outSh = she;
516   }
517
518   ff.Init(outSh, TopAbs_FACE);
519   int i = 0;
520   TopoDS_Face OneF;
521   for(; ff.More(); ff.Next(), i++) 
522     OneF = TopoDS::Face(ff.Current());
523   if (i == 1)
524     outSh = OneF;
525
526   return true;
527
528 }
529
530 /**
531   Get the shape of the land cover map
532 */
533 TopoDS_Shape HYDROData_LandCoverMap::GetShape() const
534 {
535   return HYDROData_Entity::GetShape( DataTag_Shape );
536 }
537
538 /**
539   Set the shape of the land cover map
540   @param theShape the new shape for the land cover map
541 */
542 void HYDROData_LandCoverMap::SetShape( const TopoDS_Shape& theShape )
543 {
544   HYDROData_Entity::SetShape( DataTag_Shape, theShape );
545 }
546
547 /**
548   Perform the local partition algorithm on the land cover
549   @param theNewShape the new shape to add into the land cover
550   @param theNewType the new Strickler type for the new land cover
551   @return if the local partition is successful
552 */
553 bool HYDROData_LandCoverMap::LocalPartition( const TopoDS_Shape& theNewShape, const QString& theNewType )
554 {
555   if( theNewShape.IsNull() )
556     return false;
557
558   BOPCol_ListOfShape aShapesList;
559   BOPAlgo_PaveFiller aPaveFiller;
560   HYDROData_MapOfFaceToStricklerType aNewFaces;
561
562   // add faces to shapes list
563   Iterator anIt( *this );
564   for( ; anIt.More(); anIt.Next() )
565     aShapesList.Append( anIt.Face() );
566   aShapesList.Append( theNewShape );
567
568   if( aShapesList.Size()==1 && theNewShape.ShapeType()==TopAbs_FACE )
569   {
570     aNewFaces.Add( TopoDS::Face( theNewShape ), theNewType );
571     StoreLandCovers( aNewFaces );
572     return true;
573   }
574
575   // prepare pave filler
576   aPaveFiller.SetArguments( aShapesList );
577   aPaveFiller.Perform();
578   Standard_Integer anError = aPaveFiller.ErrorStatus();
579   if( anError )
580     return false;
581
582   // add faces to builder
583   BOPAlgo_Builder aBuilder;
584   anIt.Init( *this );
585   for( ; anIt.More(); anIt.Next() )
586     aBuilder.AddArgument( anIt.Face() );
587   aBuilder.AddArgument( theNewShape );
588
589   // perform the partition with the pave filler
590   aBuilder.PerformWithFiller( aPaveFiller );
591   anError = aBuilder.ErrorStatus();
592   if( anError )
593     return false;
594
595   // analysis of the history
596   //     a. to fill map of shapes which come from the new face
597   NCollection_IndexedMap<TopoDS_Shape> aShapesFromNewFace;
598   //std::cout << "new: " << theNewShape << " " << theNewType << std::endl;
599   TopTools_ListOfShape aModified = aBuilder.Modified( theNewShape );
600   TopTools_ListIteratorOfListOfShape aMIt( aModified );
601   for( ; aMIt.More(); aMIt.Next() )
602   {
603     //std::cout << "   " << aMIt.Value() << std::endl;
604     aShapesFromNewFace.Add( aMIt.Value() );
605   }
606
607   //     b. to fill map of parts except parts from new face
608   anIt.Init( *this );
609   for( ; anIt.More(); anIt.Next() )
610   {
611     QString aSType = anIt.StricklerType();
612     //std::cout << anIt.Face() << " " << anIt.StricklerType() << std::endl;
613     TopTools_ListOfShape aModified = aBuilder.Modified( anIt.Face() );
614     TopTools_ListIteratorOfListOfShape aMIt( aModified );
615     for( ; aMIt.More(); aMIt.Next() )
616     {
617       TopoDS_Shape aShape = aMIt.Value();
618       bool isFace = aShape.ShapeType()==TopAbs_FACE;
619       bool isAlsoFromNew = aShapesFromNewFace.Contains( aShape );
620       //std::cout << "   " << aShape << " " << isAlsoFromNew << std::endl;
621       if( isFace && !isAlsoFromNew )
622         aNewFaces.Add( TopoDS::Face( aShape ), aSType );
623     }
624   }
625
626   //     c. add the new shape if it is face with its type
627   if( theNewShape.ShapeType()==TopAbs_FACE )
628     aNewFaces.Add( TopoDS::Face( theNewShape ), theNewType );
629   
630   // convert map of shape to type to compound and list of types
631   StoreLandCovers( aNewFaces );
632   return true;
633 }
634
635 /**
636   Replace the set of land covers in the land cover map
637   @param theMap the map of shape (face) to Strickler type (string)
638 */
639 void HYDROData_LandCoverMap::StoreLandCovers( const HYDROData_MapOfFaceToStricklerType& theMap )
640 {
641   TopoDS_Compound aCompound;
642   BRep_Builder aCompoundBuilder;
643   aCompoundBuilder.MakeCompound( aCompound );
644
645   int n = theMap.Size();
646   Handle( TDataStd_ExtStringArray ) aTypes = 
647     TDataStd_ExtStringArray::Set( myLab.FindChild( DataTag_Types ), 0, n-1, Standard_True );
648   HYDROData_MapOfFaceToStricklerType::Iterator aNFIt( theMap );
649   for( int i=0; aNFIt.More(); aNFIt.Next(), i++ )
650   {
651     TopoDS_Face aFace = aNFIt.Key();
652     QString aType = aNFIt.Value();
653     aCompoundBuilder.Add( aCompound, aFace );
654     aTypes->SetValue( i, HYDROData_Tool::toExtString( aType ) );
655   }
656
657   SetShape( aCompound );
658 }
659
660 /**
661   Find the land cover for the given point
662   @param thePoint the point laying in some land cover
663   @param theType the returned type
664   @return the found land cover's face
665 */
666 TopoDS_Face HYDROData_LandCoverMap::FindByPoint( const gp_Pnt2d& thePoint, QString& theType ) const
667 {
668   //TODO: some more optimal algorithm
669   Iterator anIt( *this );
670   for( ; anIt.More(); anIt.Next() )
671     if( HYDROData_Tool::ComputePointState( thePoint.XY(), anIt.Face() ) == TopAbs_IN )
672     {
673       theType = anIt.StricklerType();
674       return anIt.Face();
675     }
676
677   theType = "";
678   return TopoDS_Face();
679 }