1 // Created on: 1996-03-21
2 // Created by: Modelistation
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <TopOpeBRepDS_EXPORT.hxx>
18 #include <TopOpeBRepDS_EdgeInterferenceTool.hxx>
19 #include <TopOpeBRepDS_EdgeVertexInterference.hxx>
20 #include <TopOpeBRepDS_CurvePointInterference.hxx>
21 #include <TopOpeBRepDS_TKI.hxx>
23 #include <TopoDS_Shell.hxx>
24 #include <TopoDS_Solid.hxx>
25 #include <TopExp_Explorer.hxx>
27 #include <TopOpeBRepDS_ProcessInterferencesTool.hxx>
28 #include <BRep_Tool.hxx>
29 #include <Precision.hxx>
30 #include <Geom_Curve.hxx>
31 #include <BRep_Builder.hxx>
32 #include <TopOpeBRepDS_define.hxx>
33 #include <TopOpeBRepTool_EXPORT.hxx>
34 #include <TopOpeBRepDS_connex.hxx>
35 #include <TopOpeBRepTool_SC.hxx>
38 extern Standard_Boolean TopOpeBRepDS_GettracePEI();
39 extern Standard_Boolean TopOpeBRepDS_GettracePI();
40 extern Standard_Boolean TopOpeBRepDS_GettraceSPSX(const Standard_Integer);
41 extern Standard_Boolean TopOpeBRepDS_GettraceEDPR();
42 static Standard_Boolean TRCE(const Standard_Integer SIX) {
43 Standard_Boolean b1 = TopOpeBRepDS_GettracePEI();
44 Standard_Boolean b2 = TopOpeBRepDS_GettracePI();
45 Standard_Boolean b3 = TopOpeBRepDS_GettraceSPSX(SIX);
46 return (b1 || b2 || b3);
48 Standard_EXPORT void debredunke(const Standard_Integer i){cout<<"++ debredunke e"<<i<<endl;};
49 Standard_EXPORT void debpurse (const Standard_Integer i){cout<<"++ debpurse e"<<i<<endl;};
52 #define MDShcpi Handle(TopOpeBRepDS_CurvePointInterference)
53 #define MAKECPI(IJKLM) (Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(IJKLM))
55 //------------------------------------------------------
56 Standard_EXPORT Standard_Boolean FUN_vertexofedge
57 //------------------------------------------------------
58 // FUN_vertexofedge : True si le vertex V est un vertex de E
59 (const TopoDS_Shape& V, const TopoDS_Shape& E)
61 Standard_Boolean isv = Standard_False;
63 for (ex.Init(E,TopAbs_VERTEX); ex.More(); ex.Next())
64 // for (TopExp_Explorer ex(E,TopAbs_VERTEX); ex.More(); ex.Next())
65 if (ex.Current().IsSame(V) ) {
72 //------------------------------------------------------
73 static Standard_Boolean FUN_keepEinterference
74 //------------------------------------------------------
75 (const TopOpeBRepDS_DataStructure& DS,const Handle(TopOpeBRepDS_Interference)& I,const TopoDS_Shape& E)
77 TopOpeBRepDS_Kind GT1,ST1; Standard_Integer G1,S1; FDS_data(I,GT1,G1,ST1,S1);
79 Standard_Boolean res = Standard_True;
80 if ( I->IsKind(STANDARD_TYPE(TopOpeBRepDS_EdgeVertexInterference)) ) {
81 // EVI I rejetee si son arete-support est E accedant I
82 Standard_Boolean k1 = ! ::FUN_interfhassupport(DS,I,E);
85 // EVI rejetee si transition ON EDGE before ou after
86 const TopOpeBRepDS_Transition& T = I->Transition();
87 TopAbs_ShapeEnum shab = T.ShapeBefore(),shaa = T.ShapeAfter();
88 TopAbs_State stab = T.Before(),staa = T.After();
89 Standard_Boolean k2 = ! (((shab == TopAbs_EDGE) && (stab == TopAbs_ON)) ||
90 ((shaa == TopAbs_EDGE) && (staa == TopAbs_ON)));
93 const TopoDS_Shape& VG = DS.Shape(I->Geometry());
96 // EVI I rejetee si son vertex-geometrie est un vertex de l'arete
98 Standard_Boolean k3 = ! ::FUN_vertexofedge(VG,E);
102 // EVI rejetee si OUT FACE before et after
103 // et si le vertex-geometrie de l'interference collisionne avec
104 // un des vertex de l'arete (E) accedant l'interference (I)
106 // Standard_Boolean k4I = (((shab == TopAbs_FACE) && (stab == TopAbs_OUT)) &&
107 // ((shaa == TopAbs_FACE) && (staa == TopAbs_OUT)));
110 TopoDS_Vertex Vf,Vr; TopExp::Vertices(TopoDS::Edge(E),Vf,Vr);
111 TopTools_ListIteratorOfListOfShape it(DS.ShapeSameDomain(VG));
112 for (; it.More(); it.Next()) {
113 const TopoDS_Shape& Vsd = it.Value();
114 if ( Vsd.IsSame(Vf) ) { break; }
115 else if ( Vsd.IsSame(Vr) ) { break; }
119 // Standard_Boolean k4 = ! ( k4I && k4C );
124 else if ( I->IsKind(STANDARD_TYPE(TopOpeBRepDS_CurvePointInterference)) ) {
125 Handle(TopOpeBRepDS_CurvePointInterference) aCPI =
126 Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I);
128 // MSV Oct 4, 2001: reject interference having the parameter coinciding with
129 // one of sides of the edge range
131 Standard_Real eps = Precision::PConfusion();
132 Standard_Real par = aCPI->Parameter();
134 BRep_Tool::Range(TopoDS::Edge(E), f,l);
135 if (Abs(par-f) < eps || Abs(par-l) < eps)
136 res = Standard_False;
142 //------------------------------------------------------
143 Standard_EXPORT Standard_Integer FUN_unkeepEinterferences
144 //------------------------------------------------------
145 (TopOpeBRepDS_ListOfInterference& LI,const TopOpeBRepDS_DataStructure& BDS,const Standard_Integer SIX)
148 Standard_Boolean TRC=TRCE(SIX);
151 const TopoDS_Shape& E = BDS.Shape(SIX);
152 Standard_Boolean isEd;
153 isEd = BRep_Tool::Degenerated(TopoDS::Edge(E));
156 if (TRC) {cout<<"FUN_unkeepEinterferences on "<<SIX<<" nI = "<<LI.Extent()<<endl;}
163 TopOpeBRepDS_ListIteratorOfListOfInterference it1(LI);
164 while (it1.More() ) {
165 Handle(TopOpeBRepDS_Interference)& I1 = it1.Value();
166 Standard_Boolean k1 = ::FUN_keepEinterference(BDS,I1,E);
170 if(TRC) {cout<<endl<<"rejet d'interference "<<SIX<<endl;I1->Dump(cout);cout<<endl;}
180 Standard_Integer n = LI.Extent();
183 if (TRC) cout<<"FUN_unkeepEinterferences on "<<SIX<<" returns nI = "<<n<<endl;
187 } // FUN_unkeepEinterferences
190 //------------------------------------------------------
191 Standard_EXPORT void FUN_changeFOUT
192 //------------------------------------------------------
193 (TopOpeBRepDS_ListOfInterference& LF,const TopOpeBRepDS_ListOfInterference& LE,const TopOpeBRepDS_DataStructure& BDS,const Standard_Integer SIX)
196 Standard_Boolean TRC=TRCE(SIX);
197 if (TRC) cout<<"FUN_changeFOUT on "<<SIX<<" nI = "<<LE.Extent()<<endl;
200 const TopoDS_Shape& E = BDS.Shape(SIX);
202 // reduction du cas OUT(FACE),OUT(FACE) par un vertex si on
203 // trouve une transition EDGE par ce meme vertex.
204 // pour toute interference Fi de LF = OUT(FACE),OUT(FACE) par vertex V
205 // chercher une interference Ei de LE :
206 // 1/ Ei = IN(EDGE),OUT(EDGE) par vertex V <==> ON(FACE),OUT(EDGE) par vertex V
207 // 2/ Ei = OUT(EDGE),IN(EDGE) par vertex V <==> OUT(EDGE),ON(EDGE) par vertex V
208 // si trouve 1/ : Fi devient IN(FACE),OUT(FACE)
209 // si trouve 2/ : Fe devient OUT(FACE),IN(FACE)
211 TopOpeBRepDS_ListIteratorOfListOfInterference it1(LF);
213 Handle(TopOpeBRepDS_Interference)& I1 = it1.Value();
214 TopOpeBRepDS_Kind GT1,ST1; Standard_Integer G1,S1; FDS_data(I1,GT1,G1,ST1,S1);
216 if ( GT1 == TopOpeBRepDS_VERTEX ) {
217 TopOpeBRepDS_Transition& T1 = I1->ChangeTransition();
218 TopAbs_ShapeEnum shab1 = T1.ShapeBefore(), shaa1 = T1.ShapeAfter();
219 TopAbs_State stab1 = T1.Before(), staa1 = T1.After();
220 const Standard_Boolean foub = (shab1 == TopAbs_FACE) && (stab1 == TopAbs_OUT);
221 const Standard_Boolean foua = (shaa1 == TopAbs_FACE) && (staa1 == TopAbs_OUT);
222 const Standard_Boolean foufou = foub && foua;
228 TopOpeBRepDS_ListIteratorOfListOfInterference it2(LE);
230 const Handle(TopOpeBRepDS_Interference)& I2 = it2.Value();
231 TopOpeBRepDS_Kind GT2,ST2; Standard_Integer G2,S2; FDS_data(I2,GT2,G2,ST2,S2);
233 Standard_Boolean memver = ((GT2 == GT1) && (G2 == G1));
239 const TopOpeBRepDS_Transition& T2 = I2->Transition();
240 TopAbs_ShapeEnum shab2 = T2.ShapeBefore(), shaa2 = T2.ShapeAfter();
241 TopAbs_State stab2 = T2.Before(), staa2 = T2.After();
242 const Standard_Boolean eoub = (shab2 == TopAbs_EDGE) && (stab2 == TopAbs_OUT);
243 const Standard_Boolean einb = (shab2 == TopAbs_EDGE) && (stab2 == TopAbs_IN);
244 const Standard_Boolean eoua = (shaa2 == TopAbs_EDGE) && (staa2 == TopAbs_OUT);
245 const Standard_Boolean eina = (shaa2 == TopAbs_EDGE) && (staa2 == TopAbs_IN);
246 const Standard_Boolean eouein = (eoub && eina);
247 const Standard_Boolean eineou = (einb && eoua);
248 Standard_Boolean changeFi = (eouein || eineou);
254 // on modifie T1 de I1 et on arrete la pour I1
255 if (eouein) T1.After(TopAbs_IN,TopAbs_FACE);
256 else if (eineou) T1.Before(TopAbs_IN,TopAbs_FACE);
266 if (TRC) cout<<" FUN_changeFOUT on "<<SIX<<"returns nI = "<<LE.Extent()<<endl;
271 //------------------------------------------------------
272 Standard_EXPORT void FUN_unkeepEsymetrictransitions
273 //------------------------------------------------------
274 // unkeepEsymetric : pour pallier au fonctionnement limite du TopTrans_CurveTransition
275 // qui ne peut pas gerer correctement deux fois la meme arete (FORWARD,REVERSED)
276 // incidentes en un vertex. (cas d'un shell fait de deux faces partageant une arete.)
277 (TopOpeBRepDS_ListOfInterference& LI,const TopOpeBRepDS_DataStructure& BDS,const Standard_Integer SIX)
280 Standard_Boolean TRC=TRCE(SIX);
283 const TopoDS_Shape& E = BDS.Shape(SIX);
285 Standard_Boolean isEd;
286 isEd = BRep_Tool::Degenerated(TopoDS::Edge(E));
290 cout<<"FUN_unkeepEsymetrictransitions on "<<SIX<<" nI = "<<LI.Extent()<<endl;
291 ::FDS_dumpLI(LI,"debut : ");
297 TopOpeBRepDS_ListIteratorOfListOfInterference it1;
299 // process interferences of LI with VERTEX geometry
302 while (it1.More() ) {
303 Standard_Boolean it1toremove = Standard_False;
304 Handle(TopOpeBRepDS_Interference)& I1 = it1.Value();
305 TopOpeBRepDS_Kind GT1,ST1; Standard_Integer G1,S1; FDS_data(I1,GT1,G1,ST1,S1);
306 TopAbs_ShapeEnum tsb1,tsa1; Standard_Integer isb1,isa1; ::FDS_Tdata(I1,tsb1,isb1,tsa1,isa1);
307 const TopOpeBRepDS_Transition T1 = I1->Transition();
309 TopOpeBRepDS_ListIteratorOfListOfInterference it2(it1);
311 while ( it2.More() ) {
312 const Handle(TopOpeBRepDS_Interference)& I2 = it2.Value();
313 TopOpeBRepDS_Kind GT2,ST2; Standard_Integer G2,S2; FDS_data(I2,GT2,G2,ST2,S2);
314 TopAbs_ShapeEnum tsb2,tsa2; Standard_Integer isb2,isa2; ::FDS_Tdata(I2,tsb2,isb2,tsa2,isa2);
315 const TopOpeBRepDS_Transition T2 = I2->Transition(); // + 03-03-97
316 Standard_Boolean idGS = (GT2 == GT1 && G2 == G1 && ST2 == ST1 && S2 == S1);
317 Standard_Boolean idiba = (isb1 == isb2 && isa1 == isa2);
318 Standard_Boolean cond = idGS;
319 cond = cond && idiba; // ++971219
322 Standard_Boolean idshape = ::FUN_transitionSHAPEEQUAL(T1,T2);
323 Standard_Boolean idstate = ::FUN_transitionSTATEEQUAL(T1,T2);
324 Standard_Boolean newV = Standard_True;
325 Standard_Boolean oppostate = Standard_False;
328 // sym is not precise enough (croix3_3-> OUT/IN; ON/OUT)
329 #define M_OUTIN(st1,st2) ((st1 == TopAbs_OUT)&&(st2 == TopAbs_IN))
330 TopAbs_State t1b = T1.Before(), t2b = T2.Before();
331 TopAbs_State t1a = T1.After(), t2a = T2.After();
332 oppostate = M_OUTIN(t1b,t2b) || M_OUTIN(t2b,t1b);
333 oppostate = oppostate && (M_OUTIN(t1a,t2a) || M_OUTIN(t2a,t1a));
336 Standard_Boolean sym;
337 if (newV) sym = idshape && oppostate;
338 else sym = idshape && !idstate;
340 if ( sym ) { // les 2 interferences ne different que leurs etats (symetriques)
342 // cout<<"TopOpeBRepDS FUN_unkeepEsymetrictransitions on edge "<<SIX<<endl;
344 cout<<"edge "<<SIX<<" : symetrique ";I1->Dump(cout);cout<<endl;
345 cout<<" ";I2->Dump(cout);cout<<endl;
349 it1toremove = Standard_True;
365 ::FDS_dumpLI(LI,"apres elim. des sym. : ");
366 cout<<"FUN_unkeepEsymetrictransitions on "<<SIX<<" returns nI = "<<LI.Extent()<<endl;
372 void deborderFF(const Standard_Integer) {};
373 void deborderFF1(const Standard_Integer) {};
374 void deborderFF2(const Standard_Integer) {};
377 //------------------------------------------------------
378 Standard_EXPORT void FUN_orderFFsamedomain
379 //------------------------------------------------------
380 // partition de LI en deux sous listes :
381 // L1/ = interfs dont la transition est definie / face samedomain
382 // L2/ = les autres interfs
384 (TopOpeBRepDS_ListOfInterference& LI,
385 const Handle(TopOpeBRepDS_HDataStructure)& HDS,
387 const Standard_Integer SIX)
389 const Standard_Integer )
393 Standard_Boolean TRC=TRCE(SIX);
394 if (TRC) deborderFF(SIX);
395 Standard_Boolean modif = Standard_False;
398 TopOpeBRepDS_DataStructure& BDS = HDS->ChangeDS();
399 TopOpeBRepDS_ListOfInterference LIffsd,LIother;
401 TopOpeBRepDS_ListIteratorOfListOfInterference it1;
404 while (it1.More() ) {
405 Handle(TopOpeBRepDS_Interference)& I1 = it1.Value();
406 TopOpeBRepDS_Kind GT1,ST1; Standard_Integer G1,S1; FDS_data(I1,GT1,G1,ST1,S1);
407 TopAbs_ShapeEnum tsb1,tsa1; Standard_Integer isb1,isa1; FDS_Tdata(I1,tsb1,isb1,tsa1,isa1);
411 if (TRC) deborderFF1(SIX);
414 Standard_Boolean ffsd = Standard_False;
415 if (tsb1 == TopAbs_FACE && tsa1 == TopAbs_FACE) {
416 // T1 states are defined on FACEs
417 const TopoDS_Shape& fb = BDS.Shape(isb1);
418 const TopoDS_Shape& fa = BDS.Shape(isa1);
419 Standard_Boolean ffsd1 = HDS->HasSameDomain(fb);
420 Standard_Boolean ffsd2 = HDS->HasSameDomain(fa);
421 ffsd = ffsd1 && ffsd2;
424 if (ffsd) LIffsd.Append(I1);
425 else LIother.Append(I1);
435 if(TRC && modif){ FDS_dumpLI(LI,"apres groupage fsd : "); }
437 } // FUN_orderFFsamedomain
441 void deborderSTATETRANS(const Standard_Integer) {};
444 //------------------------------------------------------
445 Standard_EXPORT void FUN_orderSTATETRANSonG
446 //------------------------------------------------------
447 // LI : liste d'interf en une meme Geometrie (K,G)
448 // partition de LI en deux sous listes :
449 // L1/ = interfs dont la transition a des etats egaux
450 // L2/ = les autres interfs
452 (TopOpeBRepDS_ListOfInterference& LI,const Handle(TopOpeBRepDS_HDataStructure)& /*HDS*/,
454 const Standard_Integer SIX)
456 const Standard_Integer)
460 Standard_Boolean TRC=TRCE(SIX);
461 if (TRC) deborderSTATETRANS(SIX);
462 Standard_Boolean modif = Standard_False;
465 // TopOpeBRepDS_DataStructure& BDS = HDS->ChangeDS();
466 TopOpeBRepDS_ListOfInterference L1,L2;
467 TopOpeBRepDS_ListIteratorOfListOfInterference it1;
470 while (it1.More() ) {
471 Handle(TopOpeBRepDS_Interference)& I1 = it1.Value();
472 TopOpeBRepDS_Kind GT1,ST1; Standard_Integer G1,S1; TopAbs_ShapeEnum tsb1,tsa1; Standard_Integer isb1,isa1;
473 FDS_Idata(I1,tsb1,isb1,tsa1,isa1,GT1,G1,ST1,S1);
474 const TopOpeBRepDS_Transition& T1 = I1->Transition();
475 TopAbs_State stab1 = T1.Before();
476 TopAbs_State staa1 = T1.After();
478 Standard_Boolean steq = (tsb1 == tsa1 && isb1 == isa1 && stab1 == staa1);
479 if (steq) L1.Append(I1);
489 if(TRC && modif){ FDS_dumpLI(LI,"apres groupage STATETRANS : "); }
491 } // FUN_orderSTATETRANSonG
493 //------------------------------------------------------
494 Standard_EXPORT void FUN_orderSTATETRANS
495 //------------------------------------------------------
496 // partition de LI en deux sous listes :
497 // L1/ = interfs dont la transition a des etats egaux
498 // L2/ = les autres interfs
500 (TopOpeBRepDS_ListOfInterference& LI,const Handle(TopOpeBRepDS_HDataStructure)& HDS,const Standard_Integer SIX)
503 Standard_Boolean TRC=TRCE(SIX);
504 if (TRC) deborderSTATETRANS(SIX);
507 TopOpeBRepDS_TKI tki;
508 tki.FillOnGeometry(LI);
510 for (; tki.More(); tki.Next()) {
511 TopOpeBRepDS_Kind K; Standard_Integer G; TopOpeBRepDS_ListOfInterference& loi = tki.ChangeValue(K,G);
512 ::FUN_orderSTATETRANSonG(loi,HDS,SIX);
517 for (; tki.More(); tki.Next()) {
518 TopOpeBRepDS_Kind K; Standard_Integer G; TopOpeBRepDS_ListOfInterference& loi = tki.ChangeValue(K,G);
521 } // FUN_orderSTATETRANS
523 //------------------------------------------------------
524 Standard_EXPORT void FUN_resolveEUNKNOWN
525 //------------------------------------------------------
526 (TopOpeBRepDS_ListOfInterference& LI,TopOpeBRepDS_DataStructure& BDS,const Standard_Integer SIX)
529 Standard_Boolean TRC=TRCE(SIX); if (TRC) debredunke(SIX);
530 Standard_Boolean modif = Standard_False;
533 const TopoDS_Shape& E = BDS.Shape(SIX);
534 TopOpeBRepDS_ListIteratorOfListOfInterference it1;
536 const TopoDS_Edge& EE = TopoDS::Edge(E);
537 Standard_Real fE,lE; BRep_Tool::Range(EE,fE,lE);
539 // process interferences of LI with UNKNOWN transition
541 for (it1.Initialize(LI); it1.More(); it1.Next() ) {
542 Handle(TopOpeBRepDS_Interference)& I1 = it1.Value();
543 const TopOpeBRepDS_Transition& T1 = I1->Transition();
544 Standard_Boolean isunk = T1.IsUnknown();
545 if (!isunk) continue;
548 modif = Standard_True;
549 if(TRC){debredunke(SIX);TCollection_AsciiString s="E";s=s+SIX+" T UNKNOWN ";I1->Dump(cout,s,"\n");}
552 TopOpeBRepDS_Kind GT1,ST1; Standard_Integer G1,S1; TopAbs_ShapeEnum tsb1,tsa1; Standard_Integer isb1,isa1;
553 FDS_Idata(I1,tsb1,isb1,tsa1,isa1,GT1,G1,ST1,S1);
554 Standard_Boolean idt = (tsb1==TopAbs_FACE && tsa1==TopAbs_FACE
555 && GT1==TopOpeBRepDS_POINT && ST1==TopOpeBRepDS_FACE);
556 Standard_Boolean idi = (isb1==S1 && isa1==S1);
557 Standard_Boolean etgf = idt && idi; // edge tangent a une face en 1 point
561 if(TRC){debredunke(SIX);TCollection_AsciiString s="E";s=s+SIX+" etgf ";I1->Dump(cout,s,"\n");}
564 Handle(TopOpeBRepDS_CurvePointInterference) cpi = MAKECPI(I1);
565 if (cpi.IsNull()) continue;
567 Standard_Real bid; Handle(Geom_Curve) CE = BRep_Tool::Curve(EE,bid,bid);
568 if (CE.IsNull()) continue; // NYI : get points from 2d curve
570 Standard_Real parcpi = cpi->Parameter();
571 Standard_Real ttb = 0.8; Standard_Real parb = (1-ttb)*fE + ttb*parcpi;
572 Standard_Real tta = 0.2; Standard_Real para = (1-tta)*parcpi + tta*lE;
573 gp_Pnt Pb;CE->D0(parb,Pb);
574 gp_Pnt Pa;CE->D0(para,Pa);
577 const TopoDS_Face& FS = TopoDS::Face(BDS.Shape(S1));
578 TopoDS_Shell sh; BB.MakeShell(sh);
579 TopoDS_Solid so; BB.MakeSolid(so);
580 BB.Add(sh,FS);BB.Add(so,sh);
581 TopOpeBRepTool_ShapeClassifier& PSC = FSC_GetPSC(so);
582 PSC.StateP3DReference(Pb);
583 TopAbs_State stateb = PSC.State();
584 PSC.StateP3DReference(Pa);
585 TopAbs_State statea = PSC.State();
586 if (stateb==TopAbs_UNKNOWN || statea==TopAbs_UNKNOWN) continue;
588 TopOpeBRepDS_Transition& newT1 = I1->ChangeTransition();
589 newT1.Set(stateb,statea,tsb1,tsa1);
592 if(TRC){debredunke(SIX);TCollection_AsciiString s="E";s=s+SIX+" T corrected ";I1->Dump(cout,s,"\n");}
598 if(TRC && modif){ FDS_dumpLI(LI,"apres correction UNKNOWN : "); }
601 FUN_unkeepUNKNOWN(LI,BDS,SIX);
604 if(TRC && modif){ FDS_dumpLI(LI,"sans suppression UNKNOWN residuels : "); }
608 // ----------------------------------------------------------------------
609 Standard_EXPORT void FUN_purgeDSonSE(const Handle(TopOpeBRepDS_HDataStructure)& HDS,const Standard_Integer EIX,TopOpeBRepDS_ListOfInterference& LI)
610 // ----------------------------------------------------------------------
613 Standard_Boolean trc = TopOpeBRepDS_GettraceSPSX(EIX);
614 if (trc) {cout<<endl<<"FUN_purgeDSonSE on "<<EIX<<" nI = "<<LI.Extent()<<endl;}
617 // recall : (I1,I2) / I1=(T(F),G,S=edge), I2=(T(F),G,S=F) describes a 3d interference
619 // purpose : attached to EIX (section egde SE), I=(T(Fsdm),G,S) /
620 // Fsdm shares same domain with Fanc ancestor face of SE
621 // => SE has split ON near G =>
622 // I'=(T(Fsdm),G,S=Fsdm) gives bad information (3d information whereas
623 // we should only have 2d information)
624 // - PRO12660 for spON(e48) -
626 TopOpeBRepDS_DataStructure& BDS = HDS->ChangeDS();
627 const TopoDS_Edge& SE = TopoDS::Edge(BDS.Shape(EIX));
628 Standard_Integer rkSE = BDS.AncestorRank(SE);
629 Standard_Boolean isse = BDS.IsSectionEdge(SE);
633 if (trc) debpurse(EIX);
636 TopTools_MapOfShape fsdmFancSE;
638 const TopTools_ListOfShape& lFancSE = FDSCNX_EdgeConnexitySameShape(SE,HDS);
639 for (TopTools_ListIteratorOfListOfShape itf(lFancSE); itf.More(); itf.Next()){
640 const TopTools_ListOfShape& fsdm = BDS.ShapeSameDomain(itf.Value());
641 for (TopTools_ListIteratorOfListOfShape itsdm(fsdm); itsdm.More(); itsdm.Next()){
642 const TopoDS_Shape& sdmf = itsdm.Value();
643 Standard_Integer sdmrk = BDS.AncestorRank(sdmf);
644 if (sdmrk == rkSE) continue;
645 fsdmFancSE.Add(sdmf);
648 if (fsdmFancSE.IsEmpty()) return;
650 TopOpeBRepDS_ListOfInterference newLI;
652 TopOpeBRepDS_TKI tki;
653 tki.FillOnGeometry(LI);
654 for (tki.Init(); tki.More(); tki.Next()) {
656 TopOpeBRepDS_Kind Kcur; Standard_Integer Gcur; TopOpeBRepDS_ListOfInterference& loi = tki.ChangeValue(Kcur,Gcur);
658 // Standard_Boolean hasfsdmFanc = Standard_False;
660 TopOpeBRepDS_ListIteratorOfListOfInterference it(loi);
661 // for (; it.More(); it.Next()){
662 // const Handle(TopOpeBRepDS_Interference)& I = it.Value();
663 // TopAbs_ShapeEnum tsb,tsa; Standard_Integer isb,isa; FDS_Tdata(I,tsb,isb,tsa,isa);
664 // if (tsb != TopAbs_FACE) continue;
665 // const TopoDS_Shape& f = BDS.Shape(isb); Standard_Integer ifa = BDS.Shape(f); // DEB
666 // Standard_Boolean isbound = fsdmFancSE.Contains(f);
667 // if (isbound) {hasfsdmFanc = Standard_True; break;}
670 // {newLI.Append(loi); continue;}
671 // TopOpeBRepDS_ListOfInterference LIface; Standard_Integer nfound = FUN_selectSIinterference(loi,TopOpeBRepDS_FACE,LIface);
673 // - cto 900 D1 - : we need interference I''=(T(face),G,face), face !sdmFancSE
674 // to compute spOUT(e9)
676 TopOpeBRepDS_ListOfInterference LIface;
677 for (; it.More(); it.Next()){
678 const Handle(TopOpeBRepDS_Interference)& I = it.Value();
679 TopOpeBRepDS_Kind GT,ST; Standard_Integer G,S; FDS_data(I,GT,G,ST,S);
680 TopAbs_ShapeEnum tsb,tsa; Standard_Integer isb,isa; FDS_Tdata(I,tsb,isb,tsa,isa);
682 if (tsb != TopAbs_FACE) {newLI.Append(I); continue;}
683 if (ST != TopOpeBRepDS_FACE) {newLI.Append(I); continue;}
685 const TopoDS_Shape& f = BDS.Shape(isb);
686 Standard_Boolean isbound = fsdmFancSE.Contains(f);
687 if (isbound) LIface.Append(I);
688 else newLI.Append(I);
693 for (TopOpeBRepDS_ListIteratorOfListOfInterference itt(LIface); itt.More(); itt.Next())
694 {cout<<"rejet d'interference "<<EIX<<" ";itt.Value()->Dump(cout);cout<<endl;}
696 // newLI.Append(loi);
703 if (trc) cout<<"FUN_purgeDSonSE on "<<EIX<<" returns nI = "<<LI.Extent()<<endl;