Integration of OCCT 6.5.0 from SVN
[occt.git] / src / TopOpeBRepBuild / TopOpeBRepBuild_HBuilder.cxx
1 // File:        TopOpeBRepBuild_HBuilder.cxx
2 // Created:     Mon Jun 14 11:48:36 1993
3 // Author:      Jean Yves LEBEY
4 //              <jyl@zerox>
5
6 #include <TopOpeBRepBuild_HBuilder.ixx>
7 #include <TopOpeBRepDS_ListOfShapeOn1State.hxx>
8 #include <TopOpeBRepDS_DataMapIteratorOfDataMapOfShapeListOfShapeOn1State.hxx>
9 #include <TopOpeBRepDS_CurveIterator.hxx>
10 #include <TopOpeBRepDS_CurveExplorer.hxx>
11 #include <TopOpeBRepDS_Interference.hxx>
12 #include <TopOpeBRepDS_ShapeShapeInterference.hxx>
13 #include <TopTools_ListOfShape.hxx>
14 #include <TopTools_ListIteratorOfListOfShape.hxx>
15 #include <TColStd_ListIteratorOfListOfInteger.hxx>
16 #include <TColStd_MapOfInteger.hxx>
17 #include <TopTools_MapOfShape.hxx>
18 #include <TopoDS.hxx>
19 #include <Standard_ProgramError.hxx>
20 #include <TopOpeBRepBuild_define.hxx>
21
22 //=======================================================================
23 //function : TopOpeBRepBuild_HBuilder
24 //purpose  : 
25 //=======================================================================
26 TopOpeBRepBuild_HBuilder::TopOpeBRepBuild_HBuilder
27 (const TopOpeBRepDS_BuildTool& BT) 
28 : myBuilder(BT),
29   myMakeEdgeAncestorIsDone(Standard_False),
30   myMakeCurveAncestorIsDone(Standard_False),
31   myMakePointAncestorIsDone(Standard_False)
32 {
33 }
34
35 //=======================================================================
36 //function : Perform
37 //purpose  : 
38 //=======================================================================
39 void TopOpeBRepBuild_HBuilder::Perform
40 (const Handle(TopOpeBRepDS_HDataStructure)& HDS)
41 {
42   myBuilder.Perform(HDS);
43 }
44
45 //=======================================================================
46 //function : Perform
47 //purpose  : 
48 //=======================================================================
49 void TopOpeBRepBuild_HBuilder::Perform(const Handle(TopOpeBRepDS_HDataStructure)& HDS,const TopoDS_Shape& S1, const TopoDS_Shape& S2)
50 {
51   myBuilder.Perform(HDS,S1,S2);
52 }
53
54 //=======================================================================
55 //function : Clear
56 //purpose  : 
57 //=======================================================================
58 void TopOpeBRepBuild_HBuilder::Clear()
59 {
60   myBuilder.Clear();
61   InitExtendedSectionDS();  
62 }
63
64 //=======================================================================
65 //function : DataStructure
66 //purpose  : 
67 //=======================================================================
68 Handle(TopOpeBRepDS_HDataStructure) TopOpeBRepBuild_HBuilder::DataStructure() const
69 {
70   return myBuilder.DataStructure();
71 }
72
73 //=======================================================================
74 //function : ChangeBuildTool
75 //purpose  : 
76 //=======================================================================
77 TopOpeBRepDS_BuildTool& TopOpeBRepBuild_HBuilder::ChangeBuildTool() 
78 {
79   TopOpeBRepDS_BuildTool& BT = myBuilder.ChangeBuildTool();
80   return BT;
81 }
82
83 //=======================================================================
84 //function : BuildTool
85 //purpose  : 
86 //=======================================================================
87 const TopOpeBRepDS_BuildTool& TopOpeBRepBuild_HBuilder::BuildTool() const
88 {
89   return myBuilder.BuildTool();
90 }
91
92 //=======================================================================
93 //function : MergeShapes
94 //purpose  : 
95 //=======================================================================
96
97 void TopOpeBRepBuild_HBuilder::MergeShapes
98 (const TopoDS_Shape& S1, const TopAbs_State ToBuild1,const TopoDS_Shape& S2, const TopAbs_State ToBuild2)
99 {
100   myBuilder.MergeShapes(S1,ToBuild1,S2,ToBuild2);
101 }
102
103
104 //=======================================================================
105 //function : MergeSolids
106 //purpose  : 
107 //=======================================================================
108
109 void TopOpeBRepBuild_HBuilder::MergeSolids
110 (const TopoDS_Shape& S1, const TopAbs_State ToBuild1,const TopoDS_Shape& S2, const TopAbs_State ToBuild2)
111 {
112   myBuilder.MergeSolids(S1,ToBuild1,S2,ToBuild2);
113 }
114
115
116 //=======================================================================
117 //function : MergeSolid
118 //purpose  : 
119 //=======================================================================
120
121 void TopOpeBRepBuild_HBuilder::MergeSolid(const TopoDS_Shape& S, const TopAbs_State ToBuild)
122 {
123   myBuilder.MergeSolid(S,ToBuild);
124 }
125
126
127 //=======================================================================
128 //function : IsSplit
129 //purpose  : 
130 //=======================================================================
131 Standard_Boolean TopOpeBRepBuild_HBuilder::IsSplit(const TopoDS_Shape& S, const TopAbs_State ToBuild) const
132 {
133   Standard_Boolean res = myBuilder.IsSplit(S,ToBuild);
134   return res;
135 }
136
137
138 //=======================================================================
139 //function : Splits
140 //purpose  : 
141 //=======================================================================
142 const TopTools_ListOfShape& TopOpeBRepBuild_HBuilder::Splits(const TopoDS_Shape& S, const TopAbs_State ToBuild) const
143 {
144   const TopTools_ListOfShape& L = myBuilder.Splits(S,ToBuild);
145   return L;
146 }
147
148
149 //=======================================================================
150 //function : IsMerged
151 //purpose  : 
152 //=======================================================================
153
154 Standard_Boolean TopOpeBRepBuild_HBuilder::IsMerged(const TopoDS_Shape& S, const TopAbs_State ToBuild) const
155 {
156   Standard_Boolean res = myBuilder.IsMerged(S,ToBuild);
157   return res;
158 }
159
160
161 //=======================================================================
162 //function : Merged
163 //purpose  : 
164 //=======================================================================
165
166 const TopTools_ListOfShape& TopOpeBRepBuild_HBuilder::Merged(const TopoDS_Shape& S, const TopAbs_State ToBuild) const
167 {
168   const TopTools_ListOfShape& L = myBuilder.Merged(S,ToBuild);
169   return L;
170 }
171
172
173 //=======================================================================
174 //function : NewVertex
175 //purpose  : 
176 //=======================================================================
177 const TopoDS_Shape& TopOpeBRepBuild_HBuilder::NewVertex(const Standard_Integer I) const
178 {
179   const TopoDS_Shape& V = myBuilder.NewVertex(I);
180   return V;
181 }
182
183
184 //=======================================================================
185 //function : NewEdges
186 //purpose  : 
187 //=======================================================================
188 const TopTools_ListOfShape& TopOpeBRepBuild_HBuilder::NewEdges(const Standard_Integer I) const
189 {
190   const TopTools_ListOfShape& L = myBuilder.NewEdges(I);
191   return L;
192 }
193
194 //=======================================================================
195 //function : ChangeNewEdges
196 //purpose  : 
197 //=======================================================================
198 TopTools_ListOfShape& TopOpeBRepBuild_HBuilder::ChangeNewEdges(const Standard_Integer I)
199 {
200   TopTools_ListOfShape& L = myBuilder.ChangeNewEdges(I);
201   return L;
202 }
203
204
205 //=======================================================================
206 //function : NewFaces
207 //purpose  : 
208 //=======================================================================
209 const TopTools_ListOfShape& TopOpeBRepBuild_HBuilder::NewFaces(const Standard_Integer I) const
210 {
211   const TopTools_ListOfShape& L = myBuilder.NewFaces(I);
212   return L;
213 }
214
215
216 //=======================================================================
217 //function : Section
218 //purpose  : 
219 //=======================================================================
220
221 const TopTools_ListOfShape& TopOpeBRepBuild_HBuilder::Section()
222 {
223   const TopTools_ListOfShape& L = myBuilder.Section();
224   return L;
225 }
226
227 static TopTools_ListOfShape* PLE = NULL;
228 static TopTools_ListIteratorOfListOfShape* PITLE = NULL;
229 //=======================================================================
230 //function : InitExtendedSectionDS
231 //purpose  : 
232 //=======================================================================
233
234 void TopOpeBRepBuild_HBuilder::InitExtendedSectionDS(const Standard_Integer k)
235 {
236   if      (k == 1) {
237     myMakeCurveAncestorIsDone = Standard_False;
238   }
239   else if (k == 2) {
240     myMakeEdgeAncestorIsDone = Standard_False;
241   }
242   else if (k == 3) {
243     myMakeEdgeAncestorIsDone = Standard_False;
244     myMakeCurveAncestorIsDone = Standard_False;
245   }
246   else return;
247 }
248
249 //=======================================================================
250 //function : InitSection
251 //purpose  : 
252 //=======================================================================
253
254 void TopOpeBRepBuild_HBuilder::InitSection(const Standard_Integer k)
255 {
256   if (PLE == NULL) PLE = new TopTools_ListOfShape();
257   if (PITLE == NULL) PITLE = new TopTools_ListIteratorOfListOfShape();
258   PLE->Clear(); PITLE->Initialize(*PLE);
259   InitExtendedSectionDS(k);
260   if      (k == 1) myBuilder.SectionCurves(*PLE);
261   else if (k == 2) myBuilder.SectionEdges(*PLE);
262   else if (k == 3) myBuilder.Section(*PLE);
263   else return;
264   PITLE->Initialize(*PLE);
265 }
266
267 //=======================================================================
268 //function : MoreSection
269 //purpose  : 
270 //=======================================================================
271
272 Standard_Boolean TopOpeBRepBuild_HBuilder::MoreSection() const
273 {
274   if (PITLE == NULL) return Standard_False;
275   Standard_Boolean b = PITLE->More();
276   return b;
277 }
278
279 //=======================================================================
280 //function : NextSection
281 //purpose  : 
282 //=======================================================================
283
284 void TopOpeBRepBuild_HBuilder::NextSection()
285 {
286   if (PITLE == NULL) return;
287   if (PITLE->More()) PITLE->Next();
288 }  
289
290 //=======================================================================
291 //function : CurrentSection
292 //purpose  : 
293 //=======================================================================
294
295 const TopoDS_Shape& TopOpeBRepBuild_HBuilder::CurrentSection() const
296 {
297   if (PITLE == NULL) Standard_ProgramError::Raise("no more CurrentSection");
298   if (!PITLE->More()) Standard_ProgramError::Raise("no more CurrentSection");
299   return PITLE->Value();
300 }
301
302 //=======================================================================
303 //function : MakeEdgeAncestorMap
304 //purpose  : private
305 //=======================================================================
306
307 void TopOpeBRepBuild_HBuilder::MakeEdgeAncestorMap()
308 {
309   if(myMakeEdgeAncestorIsDone)
310     return;
311   mySectEdgeDSEdges1.Clear();
312   mySectEdgeDSEdges2.Clear();
313   myDSEdgesDSFaces1.Clear();
314   myDSEdgesDSFaces2.Clear();
315   
316   myMakeEdgeAncestorIsDone = Standard_True;
317   TopTools_MapOfShape MF, ME;
318   
319   const TopOpeBRepDS_DataStructure& DS = DataStructure()->DS();  
320 //  Standard_Integer ns = DS.NbShapes(),is;
321   Standard_Integer ns = DS.NbShapes();
322 //  Standard_Integer ei, fi, re, rf ,gi, ise;
323   Standard_Integer ei, fi, re, rf ,gi;
324   
325   TopOpeBRepDS_DataMapIteratorOfDataMapOfShapeListOfShapeOn1State
326     it(myBuilder.mySplitON);
327   TopTools_ListIteratorOfListOfShape its;
328   for(;it.More(); it.Next()) {
329     const TopoDS_Shape& ShaSpl = it.Key();
330     ei = DS.Shape(ShaSpl);
331     re = DS.AncestorRank(ShaSpl);
332     if(!re) continue;
333     TopOpeBRepDS_ListOfShapeOn1State& losos1s = 
334       (*(TopOpeBRepDS_ListOfShapeOn1State*)&it.Value());
335     TopTools_ListOfShape& los = losos1s.ChangeListOnState();
336     its.Initialize(los);
337     if(re == 1)
338       for(; its.More(); its.Next()) {
339         TopoDS_Shape& SecEdg = its.Value();
340         if(!mySectEdgeDSEdges1.IsBound(SecEdg))
341           mySectEdgeDSEdges1.Bind(SecEdg, ei);
342       }
343     else if(re == 2)
344       for(; its.More(); its.Next()) {
345         TopoDS_Shape& SecEdg = its.Value();
346         if(!mySectEdgeDSEdges2.IsBound(SecEdg))
347           mySectEdgeDSEdges2.Bind(SecEdg,ei);
348       }
349   }
350   
351 //  Standard_Boolean gb;
352   TopOpeBRepDS_Kind gk;
353   for (fi=1;fi<=ns;fi++) {
354     const TopoDS_Shape& fds = DS.Shape(fi);
355     if(fds.IsNull())
356       continue;
357     if (fds.ShapeType() != TopAbs_FACE) continue;
358     TopOpeBRepDS_ListIteratorOfListOfInterference 
359       it1(DS.ShapeInterferences(fds));
360     for (;it1.More();it1.Next()) {
361       Handle(TopOpeBRepDS_ShapeShapeInterference) SSI = 
362         Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(it1.Value());
363       if (SSI.IsNull()) continue;
364       gk = SSI->GeometryType();
365       gi = SSI->Geometry();
366       if (gk != TopOpeBRepDS_EDGE) continue;
367       rf = DS.AncestorRank(fds);
368       if(!rf) continue;
369 //      if (!MF.Contains(fds) ) {
370 //      MF.Add(fds);
371       if(rf == 1) {
372         if(!myDSEdgesDSFaces1.IsBound(gi)) {
373           TColStd_ListOfInteger thelist;
374           myDSEdgesDSFaces1.Bind(gi,thelist );
375         }
376         myDSEdgesDSFaces1.ChangeFind(gi).Append(fi);
377       }
378       else if(rf == 2) {
379         if(!myDSEdgesDSFaces2.IsBound(gi)){
380           TColStd_ListOfInteger thelist1;
381           myDSEdgesDSFaces2.Bind(gi, thelist1);
382         }
383         myDSEdgesDSFaces2.ChangeFind(gi).Append(fi);
384       }
385       //      }
386     }
387   }
388 }
389
390 //=======================================================================
391 //function : GetDSEdgeFromSectEdge
392 //purpose  : 
393 //=======================================================================
394 Standard_Integer TopOpeBRepBuild_HBuilder::GetDSEdgeFromSectEdge(const TopoDS_Shape& E,const Standard_Integer rank)
395 {
396   if(!myMakeEdgeAncestorIsDone)
397     MakeEdgeAncestorMap();
398   
399   Standard_Integer i = 0;
400
401   if(rank == 1) { 
402     if(mySectEdgeDSEdges1.IsBound(E))
403       i = mySectEdgeDSEdges1.Find(E);
404   }
405
406   if(rank == 2) { 
407     if(mySectEdgeDSEdges2.IsBound(E))
408       i = mySectEdgeDSEdges2.Find(E);
409   }
410   return i;
411 }
412
413 //=======================================================================
414 //function : GetDSFaceFromDSEdge
415 //purpose  : 
416 //=======================================================================
417 TColStd_ListOfInteger& TopOpeBRepBuild_HBuilder::GetDSFaceFromDSEdge
418 (const Standard_Integer indexEdg, const Standard_Integer rank)
419 {
420   if(!myMakeEdgeAncestorIsDone)
421     MakeEdgeAncestorMap();
422
423   if(rank == 1) {
424     if(myDSEdgesDSFaces1.IsBound(indexEdg)) {
425       TColStd_ListOfInteger& loi = 
426         myDSEdgesDSFaces1.ChangeFind(indexEdg);
427       return loi;
428     }
429   }
430   
431   if(rank == 2) {
432     if(myDSEdgesDSFaces2.IsBound(indexEdg)) {
433       TColStd_ListOfInteger& loi = 
434         myDSEdgesDSFaces2.ChangeFind(indexEdg);
435       return loi;
436     }
437   }
438   
439   return myEmptyIntegerList;
440 }
441
442 //=======================================================================
443 //function : MakeCurveAncestorMap
444 //purpose  : 
445 //=======================================================================
446
447 void TopOpeBRepBuild_HBuilder::MakeCurveAncestorMap()
448 {
449   if(myMakeCurveAncestorIsDone)
450     return;
451   mySectEdgeDSCurve.Clear();
452   myMakeCurveAncestorIsDone = Standard_True;
453 #ifndef DEB  
454 //  static const TopOpeBRepDS_DataStructure& DS = DataStructure()->DS();
455   const TopOpeBRepDS_DataStructure& DS = DataStructure()->DS(); // How to do static <--> const
456 #else
457   const TopOpeBRepDS_DataStructure& DS = DataStructure()->DS();
458 #endif
459   TopTools_ListIteratorOfListOfShape itloe;
460   TopOpeBRepDS_CurveExplorer cex(DS,Standard_True);
461 //  Standard_Integer ic, icm;
462   Standard_Integer ic;
463   for (; cex.More(); cex.Next()) {
464     ic = cex.Index();
465     const TopTools_ListOfShape& LOS = myBuilder.myNewEdges.Find(ic);
466     itloe.Initialize(LOS);
467     for(;itloe.More();itloe.Next()) {
468       TopoDS_Shape& E = *((TopoDS_Shape*)(&itloe.Value()));
469       if(mySectEdgeDSCurve.IsBound(E)) {
470 #ifdef DEB
471         cout<<"BRepAlgo_DSAccess::MakeEdgeAncestorFromCurve : program error"<<endl;
472 #endif
473       }
474       mySectEdgeDSCurve.Bind(E, ic);
475     }
476   }
477 }
478
479 //=======================================================================
480 //function : GetDSCurveFromSectEdge
481 //purpose  : 
482 //=======================================================================
483
484 Standard_Integer TopOpeBRepBuild_HBuilder::GetDSCurveFromSectEdge(const TopoDS_Shape& SectEdge)
485 {
486   Standard_Integer i = 0;
487   if(!myMakeCurveAncestorIsDone)
488     MakeCurveAncestorMap();
489   
490   if(mySectEdgeDSCurve.IsBound(SectEdge)) {
491     i = mySectEdgeDSCurve.Find(SectEdge);
492   }
493   return i;
494 }
495
496 //=======================================================================
497 //function : GetDSFaceFromDSCurve
498 //purpose  : 
499 //=======================================================================
500
501 Standard_Integer TopOpeBRepBuild_HBuilder::GetDSFaceFromDSCurve(const Standard_Integer indexCur,const Standard_Integer rank)
502 {
503   Standard_Integer i = 0;
504   if(!myMakeCurveAncestorIsDone)
505     MakeCurveAncestorMap();
506
507   const TopOpeBRepDS_DataStructure& DS = DataStructure()->DS();
508   if(rank == 1) {
509     const TopOpeBRepDS_Curve& DSC = DS.Curve(indexCur);
510     const TopoDS_Shape& F1 = DSC.Shape1();
511     i = DS.Shape(F1);
512   }
513   
514   if(rank == 2) {
515     const TopOpeBRepDS_Curve& DSC = DS.Curve(indexCur);
516     const TopoDS_Shape& F2 = DSC.Shape2();
517     i = DS.Shape(F2);
518   }
519
520   return i;
521 }
522
523 //=======================================================================
524 //function : GetDSPointFromNewVertex
525 //purpose  : 
526 //=======================================================================
527
528 Standard_Integer TopOpeBRepBuild_HBuilder::GetDSPointFromNewVertex(const TopoDS_Shape& NewVert)
529 {
530   if(!myMakePointAncestorIsDone) {
531     myMakePointAncestorIsDone = Standard_True;
532     TopOpeBRepDS_DataStructure& DS = DataStructure()->ChangeDS();
533     Standard_Integer i, NbPoint = DS.NbPoints();
534     for(i = 1; i <= NbPoint; i++) {
535       const TopoDS_Shape& Vertex = NewVertex(i);
536       if(!Vertex.IsNull())
537         myNewVertexDSPoint.Bind(Vertex, i);
538     }
539   }
540   
541   Standard_Integer iPnt = 0;
542   if(myNewVertexDSPoint.IsBound(NewVert))
543     iPnt = myNewVertexDSPoint.Find(NewVert);
544   return iPnt;
545 }
546
547 //=======================================================================
548 //function : EdgeCurveAncestors
549 //purpose  : 
550 //=======================================================================
551
552 Standard_Boolean TopOpeBRepBuild_HBuilder::EdgeCurveAncestors(const TopoDS_Shape& E,TopoDS_Shape& F1,TopoDS_Shape& F2,Standard_Integer& IC)
553 {
554   F1.Nullify(); F2.Nullify(); IC = 0;
555
556   const Handle(TopOpeBRepDS_HDataStructure)& HDS = myBuilder.DataStructure();
557   const TopOpeBRepDS_DataStructure& DS = HDS->DS();
558
559 //  TopTools_ListIteratorOfListOfShape itloe;
560   IC = GetDSCurveFromSectEdge(E);
561   if(!IC)
562     return Standard_False;
563
564   Standard_Integer iF1, iF2;
565   iF1 = GetDSFaceFromDSCurve(IC, 1);
566   iF2 = GetDSFaceFromDSCurve(IC, 2);
567   
568   F1 = DS.Shape(iF1);
569   F2 = DS.Shape(iF2);
570   return Standard_True;
571 }
572
573 //=======================================================================
574 //function : EdgeSectionAncestors
575 //purpose  : 
576 //=======================================================================
577
578 Standard_Boolean TopOpeBRepBuild_HBuilder::EdgeSectionAncestors
579 (const TopoDS_Shape& E, TopTools_ListOfShape& LF1, TopTools_ListOfShape& LF2, TopTools_ListOfShape& LE1, TopTools_ListOfShape& LE2)
580 {
581   if (E.ShapeType() != TopAbs_EDGE) return Standard_False;
582
583   LF1.Clear(); LF2.Clear(); LE1.Clear(); LE2.Clear();
584   TColStd_ListOfInteger f1, f2;
585   f1.Clear(); f2.Clear();
586   Standard_Integer ie1, ie2, curr;
587   
588   ie1 = GetDSEdgeFromSectEdge(E,1);
589   ie2 = GetDSEdgeFromSectEdge(E,2);
590   TColStd_ListIteratorOfListOfInteger it;
591   
592   if(ie1 && ie2) {
593     TColStd_MapOfInteger moi;
594     
595     f1 = GetDSFaceFromDSEdge(ie1,1);
596     it.Initialize(f1);
597     moi.Clear();
598     for(; it.More(); it.Next()) {
599       moi.Add(it.Value());
600     }
601     it.Initialize(GetDSFaceFromDSEdge(ie2,1));
602     for(; it.More(); it.Next()) {
603       curr = it.Value();
604       if(!moi.Contains(curr)) {
605         moi.Add(curr);
606         f1.Append(curr);
607       }
608     }
609     f2 = GetDSFaceFromDSEdge(ie1,2);
610     it.Initialize(f2);
611     moi.Clear();
612     for(; it.More(); it.Next()) {
613       moi.Add(it.Value());
614     }
615     it.Initialize(GetDSFaceFromDSEdge(ie2,2));
616     for(; it.More(); it.Next()) {
617       curr = it.Value();
618       if(!moi.Contains(curr)) {
619         moi.Add(curr);
620         f2.Append(curr);
621       }
622     }
623   }
624   else {
625     if(ie1) {
626       f1 = GetDSFaceFromDSEdge(ie1,1);
627       f2 = GetDSFaceFromDSEdge(ie1,2);
628     }
629     else if(ie2) { 
630       f1 = GetDSFaceFromDSEdge(ie2,1);
631       f2 = GetDSFaceFromDSEdge(ie2,2);
632     }  
633   }
634   
635   const TopOpeBRepDS_DataStructure& DS = myBuilder.DataStructure()->DS();  
636
637   if(ie1)
638     LE1.Append(DS.Shape(ie1));
639   if(ie2)
640     LE2.Append(DS.Shape(ie2));
641
642   for(it.Initialize(f1); it.More(); it.Next()) {
643     curr = it.Value();
644     LF1.Append(DS.Shape(curr));
645   }
646   for(it.Initialize(f2); it.More(); it.Next()) {
647     curr = it.Value();
648     LF2.Append(DS.Shape(curr));
649   }
650   
651   Standard_Boolean r = (!LF1.IsEmpty() && !LF2.IsEmpty());
652   r = r && (!LE1.IsEmpty() || !LE2.IsEmpty());
653   return r;
654 }
655
656 //=======================================================================
657 //function : IsKPart
658 //purpose  : 
659 //=======================================================================
660
661 Standard_Integer TopOpeBRepBuild_HBuilder::IsKPart() 
662 {
663   Standard_Integer kp = myBuilder.IsKPart();
664   return kp;
665 }
666
667 //=======================================================================
668 //function : MergeKPart
669 //purpose  : 
670 //=======================================================================
671
672 void TopOpeBRepBuild_HBuilder::MergeKPart(const TopAbs_State TB1,const TopAbs_State TB2)
673 {
674   Standard_Integer kp = IsKPart();
675   if ( kp ) myBuilder.MergeKPart(TB1,TB2);
676 }
677
678 //=======================================================================
679 //function : ChangeBuilder
680 //purpose  : 
681 //=======================================================================
682
683 TopOpeBRepBuild_Builder& TopOpeBRepBuild_HBuilder::ChangeBuilder()
684 {
685   return myBuilder;
686 }