Salome HOME
This commit was generated by cvs2git to create tag 'TRIPOLI_323'.
[modules/geom.git] / src / NMTTools / NMTTools_Tools.cxx
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
23 // File:        NMTTools_Tools.cxx
24 // Created:     Mon Dec  8 10:35:15 2003
25 // Author:      Peter KURNEV
26 //              <pkv@irinox>
27 //
28 #include <NMTTools_Tools.hxx>
29
30 #include <TColStd_IndexedMapOfInteger.hxx>
31
32 #include <gp_Pnt.hxx>
33 #include <gp_XYZ.hxx>
34 #include <gp_Pnt2d.hxx>
35
36 #include <Geom_Surface.hxx>
37 #include <GeomAPI_ProjectPointOnSurf.hxx>
38
39 #include <TopoDS.hxx>
40 #include <TopoDS_Vertex.hxx>
41 #include <TopoDS_Shape.hxx>
42 #include <TopoDS_Edge.hxx>
43
44 #include <TopExp.hxx>
45
46 #include <TopTools_ListIteratorOfListOfShape.hxx>
47 #include <TopTools_IndexedMapOfShape.hxx>
48
49 #include <BRep_Tool.hxx>
50 #include <BRep_Builder.hxx>
51 #include <BRepTools.hxx>
52
53 #include <BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger.hxx>
54 #include <BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger.hxx>
55
56 #include <BOPTools_VVInterference.hxx>
57 #include <BOPTools_SSInterference.hxx>
58
59 #include <BOPTools_Tools2D.hxx>
60 #include <BOPTools_Tools.hxx>
61 #include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
62 #include <NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
63 #include <NMTTools_CoupleOfShape.hxx>
64 #include <TopTools_IndexedMapOfShape.hxx>
65 #include <Geom2d_Curve.hxx>
66 #include <Geom_Curve.hxx>
67 #include <Geom_TrimmedCurve.hxx>
68 #include <BOPTools_Tools2D.hxx>
69 #include <BRepLib.hxx>
70 #include <BOPTools_Tools3D.hxx>
71 #include <TopExp_Explorer.hxx>
72 //
73 #include <TopTools_MapOfShape.hxx>
74 #include <TopTools_MapIteratorOfMapOfShape.hxx>
75 #include <TopoDS_Iterator.hxx>
76
77 static
78   void ProcessBlock(const Standard_Integer iV,
79                     const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV,
80                     TColStd_IndexedMapOfInteger& aProcessed,
81                     TColStd_IndexedMapOfInteger& aChain);
82 static
83   void ProcessBlock(const TopoDS_Shape& aF,
84                     const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
85                     TopTools_IndexedMapOfShape& aProcessed,
86                     TopTools_IndexedMapOfShape& aChain);
87
88 //modified by NIZNHY-PKV Thu Nov 16 10:46:53 2006f SKL/PartC5
89 //=======================================================================
90 // function: UpdateEdge
91 // purpose:
92 //=======================================================================
93   void  NMTTools_Tools::UpdateEdge(const TopoDS_Edge& aE,
94                                    const Standard_Real aTolR)
95 {
96   Standard_Real aTolE, aTolES, aTolV;
97   TopoDS_Iterator aIt;
98   BRep_Builder aBB;
99   //
100   aTolE=BRep_Tool::Tolerance(aE);
101   aTolES=Max(aTolR, aTolE);
102   aBB.UpdateEdge(aE, aTolES);
103   //
104   aIt.Initialize(aE);
105   for (; aIt.More(); aIt.Next()) {
106     const TopoDS_Vertex& aV=TopoDS::Vertex(aIt.Value());
107     aTolV=BRep_Tool::Tolerance(aV);
108     if (aTolV<aTolES) {
109        aBB.UpdateVertex(aV, aTolES);
110     }
111   }
112 }
113 //=======================================================================
114 // function: MakePCurve
115 // purpose:
116 //=======================================================================
117   void  NMTTools_Tools::MakePCurve(const TopoDS_Edge& aE,
118                                     const TopoDS_Face& aF,
119                                     const Handle(Geom2d_Curve)& aC2Dx1)
120
121 {
122   Standard_Real aTolE, aT1, aT2, aOutFirst, aOutLast, aOutTol;
123   Handle(Geom2d_Curve) aC2D, aC2DA;
124   TopoDS_Face aFFWD;
125   BRep_Builder aBB;
126   //
127   aFFWD=aF;
128   aFFWD.Orientation(TopAbs_FORWARD);
129   //
130   aTolE=BRep_Tool::Tolerance(aE);
131   //
132   const Handle(Geom_Curve)& aC3DE=BRep_Tool::Curve(aE, aT1, aT2);
133   Handle(Geom_TrimmedCurve)aC3DETrim=new Geom_TrimmedCurve(aC3DE, aT1, aT2);
134   //
135   aC2D=aC2Dx1;
136   if (aC2D.IsNull()) { // ?
137     BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aFFWD);
138     BOPTools_Tools2D::CurveOnSurface(aE, aFFWD, aC2D, aOutFirst, aOutLast, aOutTol, Standard_True);
139   }
140   //
141   if (aC3DE->IsPeriodic()) {
142     BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2,  aC2D, aC2DA);
143   }
144   else {
145     BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D, aC2DA);
146   }
147   //
148   aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolE);
149   BRepLib::SameParameter(aE);
150 }
151 /*
152 //=======================================================================
153 // function: MakePCurve
154 // purpose:
155 //=======================================================================
156   void  NMTTools_Tools::MakePCurve(const TopoDS_Edge& aE,
157                                    const TopoDS_Face& aF,
158                                    const Handle(Geom2d_Curve)& aC2Dx,
159                                    const Standard_Real aTolR2D)
160 {
161   Standard_Integer k, aNbV;
162   Standard_Real aTolEdge, aTolFact, aTolV, aTolVmax;
163   Standard_Real aTFirst, aTLast, aOutFirst, aOutLast, aOutTol;
164   TopoDS_Face aFFWD;
165   TopTools_IndexedMapOfShape aVMap;
166   BRep_Builder aBB;
167   //
168   aFFWD=aF;
169   aFFWD.Orientation(TopAbs_FORWARD);
170   //
171   aTolEdge=BRep_Tool::Tolerance(aE);
172   aTolFact=Max(aTolEdge, aTolR2D);
173   //
174   TopExp::MapShapes(aE, TopAbs_VERTEX, aVMap);
175   //
176   aTolVmax=-1.;
177   aNbV=aVMap.Extent();
178   for (k=1; k<=aNbV; ++k) {
179     const TopoDS_Vertex& aV=TopoDS::Vertex(aVMap(k));
180     aTolV=BRep_Tool::Tolerance(aV);
181     if (aTolV>aTolVmax) {
182       aTolVmax=aTolV;
183     }
184   }
185   //
186   if (aTolFact>aTolVmax) {
187     aTolFact=aTolVmax;
188   }
189   //
190   const Handle(Geom_Curve)& aC3DE=BRep_Tool::Curve(aE, aTFirst, aTLast);
191   Handle(Geom_TrimmedCurve)aC3DETrim=new Geom_TrimmedCurve(aC3DE, aTFirst, aTLast);
192   //
193   Handle(Geom2d_Curve) aC2D, aC2DA;
194   //
195   aC2D=aC2Dx;
196   if (aC2D.IsNull()) {
197     BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aFFWD);
198     BOPTools_Tools2D::CurveOnSurface(aE, aFFWD, aC2D, aOutFirst, aOutLast, aOutTol, Standard_True);
199   }
200   if (aC3DE->IsPeriodic()) {
201     BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aTFirst, aTLast,  aC2D, aC2DA);
202   }
203   else {
204     BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D, aC2DA);
205   }
206   //
207   aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolFact);
208   BRepLib::SameParameter(aE);
209 }
210 */
211 //modified by NIZNHY-PKV Thu Nov 16 10:46:55 2006t
212 //=======================================================================
213 // function: IsSplitInOnFace
214 // purpose:
215 //=======================================================================
216   Standard_Boolean NMTTools_Tools::IsSplitInOnFace(const TopoDS_Edge& aE,
217                                                    const TopoDS_Face& aF,
218                                                    const Handle(IntTools_Context)& aContext)
219 {
220   Standard_Boolean bFlag;
221   Standard_Real aT, aTolE, aTolF, aTol, aDist, aU, aV;
222   gp_Pnt aP;
223   gp_Pnt2d aP2D;
224   //
225   aTolE=BRep_Tool::Tolerance(aE);
226   aTolF=BRep_Tool::Tolerance(aF);
227   aTol=aTolE+aTolF;
228   //
229   GeomAPI_ProjectPointOnSurf& aProjector=aContext->ProjPS(aF);
230   //
231   aT=BOPTools_Tools2D::IntermediatePoint(aE);
232   BOPTools_Tools::PointOnEdge(aE, aT, aP);
233   //
234   aProjector.Perform(aP);
235   bFlag=aProjector.IsDone();
236   if (!bFlag) {
237     return bFlag;
238   }
239   //
240   aDist=aProjector.LowerDistance();
241   bFlag=(aDist <= aTol);
242   if (!bFlag) {
243     return bFlag;
244   }
245   //
246   aProjector.LowerDistanceParameters(aU, aV);
247   aP2D.SetCoord(aU, aV);
248   bFlag=aContext->IsPointInOnFace (aF, aP2D);
249   return bFlag;
250 }
251 //=======================================================================
252 // function: NMTTools_Tools::MakeNewVertex
253 // purpose :
254 //=======================================================================
255   void NMTTools_Tools::MakeNewVertex(const TopTools_ListOfShape& aLVs,
256                                      TopoDS_Vertex& aNewVertex)
257 {
258   Standard_Integer aNb;
259   Standard_Real aTi, aDi, aDmax=-1.e5;
260   gp_Pnt aPi, aP;
261   gp_XYZ aXYZ(0.,0.,0.), aXYZi;
262   TopTools_ListIteratorOfListOfShape anIt;
263   //
264   aNb=aLVs.Extent();
265   if (!aNb) {
266     return;
267   }
268   //
269   anIt.Initialize(aLVs);
270   for (; anIt.More(); anIt.Next()) {
271     TopoDS_Vertex aVi=TopoDS::Vertex(anIt.Value());
272     aPi=BRep_Tool::Pnt(aVi);
273     aXYZi=aPi.XYZ();
274     aXYZ=aXYZ+aXYZi;
275   }
276   //
277   aXYZ.Divide((Standard_Real)aNb);
278   aP.SetXYZ(aXYZ);
279   //
280   anIt.Initialize(aLVs);
281   for (; anIt.More(); anIt.Next()) {
282     TopoDS_Vertex aVi=TopoDS::Vertex(anIt.Value());
283     aPi=BRep_Tool::Pnt(aVi);
284     aTi=BRep_Tool::Tolerance(aVi);
285     aDi=aP.Distance(aPi);
286     aDi=aDi+aTi;
287     if (aDi > aDmax) {
288       aDmax=aDi;
289     }
290   }
291   BRep_Builder aBB;
292   aBB.MakeVertex (aNewVertex, aP, aDmax);
293 }
294 //=======================================================================
295 // function: FindChains
296 // purpose :
297 //=======================================================================
298   void NMTTools_Tools::FindChains(const BOPTools_CArray1OfSSInterference& FFs,
299                                   BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains)
300 {
301   Standard_Boolean bIsTangentFaces;
302   Standard_Integer j, aNb, anIndex1, anIndex2;
303   BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMCV;
304   //
305   aNb=FFs.Extent();
306   for (j=1; j<=aNb; ++j) {
307     const BOPTools_SSInterference& aFF=FFs(j);
308     //
309     bIsTangentFaces=aFF.IsTangentFaces();
310     if (!bIsTangentFaces) {
311       continue;
312     }
313     //
314     aFF.Indices(anIndex1, anIndex2);
315     //
316     if (aMCV.Contains(anIndex1)) {
317       TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex1);
318       aMV.Add(anIndex1);
319       aMV.Add(anIndex2);
320     }
321     else {
322       TColStd_IndexedMapOfInteger aMV;
323       aMV.Add(anIndex1);
324       aMV.Add(anIndex2);
325       aMCV.Add(anIndex1, aMV);
326     }
327     //
328     if (aMCV.Contains(anIndex2)) {
329       TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex2);
330       aMV.Add(anIndex1);
331       aMV.Add(anIndex2);
332     }
333     else {
334       TColStd_IndexedMapOfInteger aMV;
335       aMV.Add(anIndex1);
336       aMV.Add(anIndex2);
337       aMCV.Add(anIndex2, aMV);
338     }
339   }
340   NMTTools_Tools::FindChains(aMCV, aMapChains);
341 }
342 //=======================================================================
343 // function: FindChains
344 // purpose :
345 //=======================================================================
346   void NMTTools_Tools::FindChains(const BOPTools_CArray1OfVVInterference& VVs,
347                                   BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains)
348 {
349   Standard_Integer j, aNb, anIndex1, anIndex2;
350   BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMCV;
351   //
352   aNb=VVs.Extent();
353   for (j=1; j<=aNb; ++j) {
354     const BOPTools_VVInterference& VV=VVs(j);
355     VV.Indices(anIndex1, anIndex2);
356     //
357     if (aMCV.Contains(anIndex1)) {
358       TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex1);
359       aMV.Add(anIndex1);
360       aMV.Add(anIndex2);
361     }
362     else {
363       TColStd_IndexedMapOfInteger aMV;
364       aMV.Add(anIndex1);
365       aMV.Add(anIndex2);
366       aMCV.Add(anIndex1, aMV);
367     }
368     //
369     if (aMCV.Contains(anIndex2)) {
370       TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex2);
371       aMV.Add(anIndex1);
372       aMV.Add(anIndex2);
373     }
374     else {
375       TColStd_IndexedMapOfInteger aMV;
376       aMV.Add(anIndex1);
377       aMV.Add(anIndex2);
378       aMCV.Add(anIndex2, aMV);
379     }
380   }
381   NMTTools_Tools::FindChains(aMCV, aMapChains);
382 }
383
384 //=======================================================================
385 // function: FindChains
386 // purpose :
387 //=======================================================================
388   void NMTTools_Tools::FindChains(const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV,
389                                   BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains)
390 {
391   Standard_Integer  i, j, aNbCV, aNbV, iV, iVx;
392   TColStd_IndexedMapOfInteger aProcessed, aChain;
393   //
394   aNbCV=aMCV.Extent();
395   for (i=1; i<=aNbCV; ++i) {
396     iV=aMCV.FindKey(i);
397     if (aProcessed.Contains(iV)) {
398       continue;
399     }
400     //
401     aProcessed.Add(iV);
402     aChain.Add(iV);
403     //
404     const TColStd_IndexedMapOfInteger& aMV=aMCV(i);
405     aNbV=aMV.Extent();
406     for (j=1; j<=aNbV; ++j) {
407       iVx=aMV(j);
408       ProcessBlock(iVx, aMCV, aProcessed, aChain);
409     }
410     aMapChains.Add(i, aChain);
411     aChain.Clear();
412   }
413 }
414 //=======================================================================
415 // function: ProcessBlock
416 // purpose:
417 //=======================================================================
418 void ProcessBlock(const Standard_Integer iV,
419                   const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV,
420                   TColStd_IndexedMapOfInteger& aProcessed,
421                   TColStd_IndexedMapOfInteger& aChain)
422 {
423   Standard_Integer j, aNbV, iVx;
424   //
425   if (aProcessed.Contains(iV)) {
426     return;
427   }
428   aProcessed.Add(iV);
429   aChain.Add(iV);
430   //
431   const TColStd_IndexedMapOfInteger& aMV=aMCV.FindFromKey(iV);
432   aNbV=aMV.Extent();
433   for (j=1; j<=aNbV; ++j) {
434     iVx=aMV(j);
435     ProcessBlock(iVx, aMCV, aProcessed, aChain);
436   }
437 }
438 //=======================================================================
439 // function: AreFacesSameDomain
440 // purpose :
441 //=======================================================================
442   Standard_Boolean NMTTools_Tools::AreFacesSameDomain(const TopoDS_Face& aF1x,
443                                                       const TopoDS_Face& aF2y,
444                                                       const Handle(IntTools_Context)& aCtx)
445 {
446   Standard_Boolean bFlag;
447   // Modified  Thu Sep 14 14:35:18 2006
448   // Contribution of Samtech www.samcef.com BEGIN
449   Standard_Integer aNbE1, aNbE2;
450   Standard_Real aTolF1, aTolF2, aTol;
451   gp_Pnt2d aP2D;
452   gp_Pnt aP;
453   TopoDS_Face aF1, aF2;
454   TopExp_Explorer aExp;
455   TopTools_MapOfShape aME1, aME2;
456   TopTools_MapIteratorOfMapOfShape aIt;
457   //
458   bFlag=Standard_False;
459   // Contribution of Samtech www.samcef.com END
460   //
461   aF1=aF1x;
462   aF1.Orientation(TopAbs_FORWARD);
463   aF2=aF2y;
464   aF2.Orientation(TopAbs_FORWARD);
465   //
466   // Modified  Thu Sep 14 14:35:18 2006
467   // Contribution of Samtech www.samcef.com BEGIN
468   //
469   // 1
470   aExp.Init(aF1, TopAbs_EDGE);
471   for (; aExp.More(); aExp.Next()) {
472     const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
473     if (!BRep_Tool::Degenerated(aE)) {
474       aME1.Add(aE);
475     }
476   }
477   //
478   aExp.Init(aF2, TopAbs_EDGE);
479   for (; aExp.More(); aExp.Next()) {
480     const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
481     if (!BRep_Tool::Degenerated(aE)) {
482       if (!aME1.Contains(aE)) {
483         return bFlag;
484       }
485       aME2.Add(aE);
486     }
487   }
488   //
489   // Contribution of Samtech www.samcef.com END
490   //
491   aNbE1=aME1.Extent();
492   aNbE2=aME2.Extent();
493   //
494   if(!aNbE1 || !aNbE2){
495     return bFlag;
496   }
497   //
498   if(aNbE1!=aNbE2) {
499     return bFlag;
500   }
501   //
502   // 2
503   aTolF1=BRep_Tool::Tolerance(aF1);
504   aTolF2=BRep_Tool::Tolerance(aF2);
505   aTol=aTolF1+aTolF2;
506   //
507   aIt.Initialize(aME1);
508   for (; aIt.More(); aIt.Next()) {
509     const TopoDS_Edge& aE=TopoDS::Edge(aIt.Key());
510     BOPTools_Tools3D::PointNearEdge(aE, aF1, aP2D, aP);
511     bFlag=aCtx->IsValidPointForFace(aP, aF2, aTol);
512     break;
513   }
514   //
515   return bFlag;
516 }
517 //=======================================================================
518 // function: FindChains
519 // purpose :
520 //=======================================================================
521   void NMTTools_Tools::FindChains(const NMTTools_ListOfCoupleOfShape& aLCS,
522                                   NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains)
523 {
524   NMTTools_ListIteratorOfListOfCoupleOfShape aItCS;
525   NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMCV;
526   //
527   aItCS.Initialize(aLCS);
528   for (; aItCS.More(); aItCS.Next()) {
529     const NMTTools_CoupleOfShape& aCS=aItCS.Value();
530     //
531     const TopoDS_Shape& aF1=aCS.Shape1();
532     const TopoDS_Shape& aF2=aCS.Shape2();
533     //
534     //
535     if (aMCV.Contains(aF1)) {
536       TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF1);
537       aMV.Add(aF1);
538       aMV.Add(aF2);
539     }
540     else {
541       TopTools_IndexedMapOfShape aMV;
542       aMV.Add(aF1);
543       aMV.Add(aF2);
544       aMCV.Add(aF1, aMV);
545     }
546     //
547     if (aMCV.Contains(aF2)) {
548       TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF2);
549       aMV.Add(aF1);
550       aMV.Add(aF2);
551     }
552     else {
553       TopTools_IndexedMapOfShape aMV;
554       aMV.Add(aF1);
555       aMV.Add(aF2);
556       aMCV.Add(aF2, aMV);
557     }
558   }
559   NMTTools_Tools::FindChains(aMCV, aMapChains);
560 }
561 //=======================================================================
562 // function: FindChains
563 // purpose :
564 //=======================================================================
565   void NMTTools_Tools::FindChains(const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
566                                   NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains)
567 {
568   Standard_Integer  i, j, aNbCV, aNbV;
569   TopTools_IndexedMapOfShape aProcessed, aChain;
570   //
571   aNbCV=aMCV.Extent();
572   for (i=1; i<=aNbCV; ++i) {
573     const TopoDS_Shape& aF=aMCV.FindKey(i);
574     if (aProcessed.Contains(aF)) {
575       continue;
576     }
577     //
578     aProcessed.Add(aF);
579     aChain.Add(aF);
580     //
581     const TopTools_IndexedMapOfShape& aMV=aMCV(i);
582     aNbV=aMV.Extent();
583     for (j=1; j<=aNbV; ++j) {
584       const TopoDS_Shape& aFx=aMV(j);
585       ProcessBlock(aFx, aMCV, aProcessed, aChain);
586     }
587     aMapChains.Add(aF, aChain);
588     aChain.Clear();
589   }
590 }
591 //=======================================================================
592 // function: ProcessBlock
593 // purpose:
594 //=======================================================================
595 void ProcessBlock(const TopoDS_Shape& aF,
596                   const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
597                   TopTools_IndexedMapOfShape& aProcessed,
598                   TopTools_IndexedMapOfShape& aChain)
599 {
600   Standard_Integer j, aNbV;
601   //
602   if (aProcessed.Contains(aF)) {
603     return;
604   }
605   aProcessed.Add(aF);
606   aChain.Add(aF);
607   //
608   const TopTools_IndexedMapOfShape& aMV=aMCV.FindFromKey(aF);
609   aNbV=aMV.Extent();
610   for (j=1; j<=aNbV; ++j) {
611     const TopoDS_Shape& aFx=aMV(j);
612     ProcessBlock(aFx, aMCV, aProcessed, aChain);
613   }
614 }