7fd59977 |
1 | // File: TopOpeBRep_EdgesFiller.cxx |
2 | // Created: Wed Oct 12 16:18:53 1994 |
3 | // Author: Jean Yves LEBEY |
4 | // <jyl@bravox> |
5 | |
6 | #include <TopOpeBRep_EdgesFiller.ixx> |
7 | #include <TopOpeBRep_PointGeomTool.hxx> |
8 | #include <TopOpeBRep_Point2d.hxx> |
9 | |
10 | #include <TopOpeBRepDS_Transition.hxx> |
11 | #include <TopOpeBRepDS_Config.hxx> |
12 | #include <TopOpeBRepDS_Point.hxx> |
13 | #include <TopOpeBRepDS_EXPORT.hxx> |
14 | #include <TopOpeBRepDS_TKI.hxx> |
15 | #include <TopOpeBRepDS_InterferenceTool.hxx> |
16 | #include <TopOpeBRepTool_EXPORT.hxx> |
17 | #include <TopOpeBRepDS.hxx> |
18 | #include <BRep_Tool.hxx> |
19 | #include <TopoDS.hxx> |
20 | |
21 | #include <TopOpeBRep_define.hxx> |
22 | |
23 | #ifdef DEB |
24 | #include <TopOpeBRepDS_reDEB.hxx> |
25 | Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceEDSF(); |
26 | Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceDSF(); |
27 | Standard_IMPORT Standard_Boolean TopOpeBRep_GettraceEEFF(); |
28 | Standard_EXPORT void debefre(const Standard_Integer IE) {cout<<"+++ debefre E"<<IE<<endl;} |
29 | Standard_EXPORT void debposesd(void) {/*cout<<"+++ debposesd"<<endl;*/} |
30 | Standard_EXPORT void debposnesd(void) {cout<<"+++ debposnesd"<<endl;} |
31 | Standard_EXPORT void debeeff() {} |
32 | #endif |
33 | |
34 | #define M_REVERSED(O) (O == TopAbs_REVERSED) |
35 | #define M_FORWARD( O) (O == TopAbs_FORWARD) |
36 | #define M_INTERNAL(O) (O == TopAbs_INTERNAL) |
37 | #define M_EXTERNAL(O) (O == TopAbs_EXTERNAL) |
38 | |
39 | //======================================================================= |
40 | //function : TopOpeBRep_EdgesFiller |
41 | //purpose : |
42 | //======================================================================= |
43 | TopOpeBRep_EdgesFiller::TopOpeBRep_EdgesFiller() : myPDS(NULL),myPEI(NULL) {} |
44 | |
45 | void rototo() {} |
46 | |
47 | //======================================================================= |
48 | //function : Insert |
49 | //purpose : |
50 | //======================================================================= |
51 | void TopOpeBRep_EdgesFiller::Insert(const TopoDS_Shape& E1,const TopoDS_Shape& E2,TopOpeBRep_EdgesIntersector& EDGINT,const Handle(TopOpeBRepDS_HDataStructure)& HDS) |
52 | { |
53 | myPEI = &EDGINT; |
54 | myPDS = &(HDS->ChangeDS()); |
55 | myE1 = TopoDS::Edge(E1); |
56 | myE2 = TopoDS::Edge(E2); |
57 | myLI1.Clear(); |
58 | myLI2.Clear(); |
59 | myHDS = HDS; |
60 | |
61 | #ifdef DEB |
62 | Standard_Boolean trc = TopOpeBRepDS_GettraceDSF(); |
63 | trc = trc || TopOpeBRepDS_GettraceEDSF(); |
64 | trc = trc || TopOpeBRep_GettraceEEFF(); |
65 | if (trc) { |
66 | if (TopOpeBRep_GettraceEEFF()) debeeff(); |
67 | TCollection_AsciiString str="EdgesFiller dim";str=str+myPEI->Dimension(); |
68 | myPEI->Dump(str,myPDS->Shape(myE1),myPDS->Shape(myE2)); |
69 | } |
70 | #endif |
71 | |
72 | #ifdef DEB |
73 | Standard_Boolean hs = |
74 | #endif |
75 | myPEI->HasSegment(); |
76 | Standard_Boolean esd = myPEI->SameDomain(); |
77 | if (esd) myPDS->FillShapesSameDomain(E1,E2); |
78 | |
79 | // exit if no point. |
80 | myPEI->InitPoint(); if ( !myPEI->MorePoint() ) return; |
81 | |
82 | #ifdef DEB |
83 | Standard_Boolean reducesegment = (hs && !esd); |
84 | #endif |
85 | |
7fd59977 |
86 | // --- Add <E1,E2> in BDS |
87 | Standard_Integer E1index = myPDS->AddShape(E1,1); |
88 | Standard_Integer E2index = myPDS->AddShape(E2,2); |
89 | |
90 | // --- get list of interferences connected to edges <E1>,<E2> |
91 | TopOpeBRepDS_ListOfInterference& EIL1 = myPDS->ChangeShapeInterferences(E1); |
7fd59977 |
92 | |
93 | Handle(TopOpeBRepDS_Interference) EPI; //edge/point interference |
94 | Handle(TopOpeBRepDS_Interference) EVI; //edge/vertex interference |
95 | |
96 | // TopOpeBRepDS_Transition TposF,TposL; |
97 | |
98 | for (; myPEI->MorePoint(); myPEI->NextPoint() ) { |
99 | const TopOpeBRep_Point2d P2D = myPEI->Point(); |
100 | Standard_Real par1 = P2D.Parameter(1); |
101 | Standard_Real par2 = P2D.Parameter(2); |
102 | Standard_Integer if1 = 0; if ( ! myF1.IsNull() ) if1 = myPDS->AddShape(myF1,1); |
103 | Standard_Integer if2 = 0; if ( ! myF2.IsNull() ) if2 = myPDS->AddShape(myF2,2); |
104 | |
105 | #ifdef DEB |
106 | Standard_Boolean pointofsegment = |
107 | #endif |
108 | P2D.IsPointOfSegment(); |
7fd59977 |
109 | |
110 | #ifdef DEB |
111 | if (trc) { |
112 | if (pointofsegment && esd) debposesd(); |
113 | else if (pointofsegment && !esd) debposnesd(); |
114 | } |
115 | #endif |
116 | |
117 | TopOpeBRepDS_Transition T1 = P2D.Transition(1); |
118 | TopOpeBRepDS_Transition T2 = P2D.Transition(2); |
119 | |
120 | SetShapeTransition(P2D,T1,T2); |
121 | |
122 | Standard_Boolean isvertex1 = P2D.IsVertex(1); |
123 | TopoDS_Vertex V1; if (isvertex1) V1 = P2D.Vertex(1); |
124 | Standard_Boolean isvertex2 = P2D.IsVertex(2); |
125 | TopoDS_Vertex V2; if (isvertex2) V2 = P2D.Vertex(2); |
126 | Standard_Boolean isvertex = isvertex1 || isvertex2; |
127 | |
128 | #ifdef DEB |
129 | if (isvertex1 && isvertex2) { |
130 | gp_Pnt P3D1 = BRep_Tool::Pnt(V1); |
131 | gp_Pnt P3D2 = BRep_Tool::Pnt(V2); |
132 | Standard_Real tol1 = BRep_Tool::Tolerance(V1); |
133 | Standard_Real tol2 = BRep_Tool::Tolerance(V2); |
134 | Standard_Real dpp = P3D1.Distance(P3D2); |
135 | if (dpp> tol1+tol2) { |
136 | cout<<endl; |
137 | cout<<"*** TopOpeBRep_EdgesFiller : isvertex1 && isvertex2 : P3D non confondus"<<endl; |
138 | cout<<"point PV1 "<<P3D1.X()<<" "<<P3D1.Y()<<" "<<P3D1.Z()<<endl; |
139 | cout<<"point PV2 "<<P3D2.X()<<" "<<P3D2.Y()<<" "<<P3D2.Z()<<endl; |
140 | cout<<endl; |
141 | } |
142 | } |
143 | #endif |
144 | |
145 | // xpu : 080498 : CTS20072 (e12,e3,p8) |
146 | // edgesintersector called for tolerances = 0. |
147 | // facesintersector called for greater tolerances |
148 | // we assume facesintersector's ouput data to be valid |
149 | // and we use it for correcting edgesintersector's ouput data |
150 | TopOpeBRepDS_ListIteratorOfListOfInterference itloI1( myPDS->ShapeInterferences(E1) ); |
151 | Standard_Integer G; TopOpeBRepDS_Kind K; |
152 | Standard_Boolean found = GetGeometry(itloI1,P2D,G,K); |
153 | if (!found) MakeGeometry(P2D,G,K); |
154 | |
155 | Standard_Boolean foundpoint = (found) && (K == TopOpeBRepDS_POINT); |
156 | #ifdef DEB |
157 | Standard_Boolean foundvertex = (found) && (K == TopOpeBRepDS_VERTEX); |
158 | #endif |
159 | Standard_Boolean isnewpoint = (!found) && (K == TopOpeBRepDS_POINT); |
160 | Standard_Boolean isnewvertex = (!found) && (K == TopOpeBRepDS_VERTEX); |
161 | |
162 | Standard_Boolean faulty = (isvertex && isnewpoint) || (!isvertex && isnewvertex); |
163 | if (faulty) { |
164 | #ifdef DEB |
165 | cout<<"- - - faulty EdgesFiller : G "<<G<<" K ";TopOpeBRepDS::Print(K,cout);cout.flush(); |
166 | cout<<" isvertex="<<isvertex;cout.flush(); |
167 | cout<<" isop="<<foundpoint<<" isov="<<foundvertex;cout.flush(); |
168 | cout<<" isnp="<<isnewpoint<<" isnv="<<isnewvertex<<endl;cout.flush(); |
169 | #endif |
170 | } |
171 | |
172 | if (isvertex && foundpoint) { |
173 | Standard_Integer is = 1, ns = myPDS->NbShapes(); |
174 | for (;is<=ns;is++) { |
175 | const TopoDS_Shape& s = myPDS->Shape(is); |
176 | if (s.ShapeType() != TopAbs_EDGE) continue; |
177 | const TopoDS_Edge& e = TopoDS::Edge(s); |
178 | |
179 | TopOpeBRepDS_ListOfInterference linew; |
180 | TopOpeBRepDS_ListOfInterference& li = myPDS->ChangeShapeInterferences(e); TopOpeBRepDS_ListIteratorOfListOfInterference it(li); |
181 | while (it.More()) { |
182 | |
183 | Handle(TopOpeBRepDS_Interference) I=it.Value(); TopOpeBRepDS_Kind ki=I->GeometryType(); Standard_Integer gi=I->Geometry(); |
184 | Handle(Standard_Type) DTI = I->DynamicType(); |
185 | Standard_Boolean iscpi = (DTI == STANDARD_TYPE(TopOpeBRepDS_CurvePointInterference)) ; |
186 | Standard_Boolean condcpi = ((ki==TopOpeBRepDS_POINT) && (gi==G) && iscpi); |
187 | if (condcpi) { // remplacer G,K de I par le vertex courant |
188 | |
189 | #ifdef DEB |
190 | rototo(); |
191 | #endif |
192 | Handle(TopOpeBRepDS_CurvePointInterference) epi = Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I); |
193 | const TopOpeBRepDS_Transition& tevi = epi->Transition(); |
194 | Standard_Integer sevi = epi->Support(); |
195 | #ifdef DEB |
196 | Standard_Integer gevi; |
197 | #else |
198 | Standard_Integer gevi=0; |
199 | #endif |
200 | if (isvertex1) gevi = myPDS->AddShape(V1,1); |
201 | else if (isvertex2) gevi = myPDS->AddShape(V2,2); |
202 | Standard_Boolean bevi = Standard_False; |
203 | TopOpeBRepDS_Config cevi = TopOpeBRepDS_UNSHGEOMETRY; |
204 | Standard_Real pevi = epi->Parameter(); |
205 | |
206 | Handle(TopOpeBRepDS_Interference) evi; |
207 | evi = TopOpeBRepDS_InterferenceTool::MakeEdgeVertexInterference(tevi,sevi,gevi,bevi,cevi,pevi); |
208 | const TopOpeBRepDS_Kind& kevi = epi->SupportType(); |
209 | evi->SupportType(kevi); |
210 | |
211 | #ifdef DEB |
212 | TopOpeBRepDS::Print(K,G,cout,"TopOpeBRep_EdgesFiller : remplacer "," "); |
213 | TopOpeBRepDS::Print(TopOpeBRepDS_VERTEX,gevi,cout,"par "," dans les courbes NYI\n"); |
214 | #endif |
215 | linew.Append(evi); |
216 | li.Remove(it); |
217 | } // cond |
218 | else { |
219 | it.Next(); |
220 | } |
221 | } // it.More() |
222 | if (!linew.IsEmpty()) { |
223 | myHDS->StoreInterferences(linew,is,"EdgesFiller modif : "); |
224 | } |
225 | } // (is<=ns) |
226 | } // (isvertex && foundpoint) |
227 | |
228 | if (isvertex1) { |
229 | const TopoDS_Vertex& VV1 = V1; |
230 | // const TopoDS_Vertex& VV1 = TopoDS::Vertex(V1); |
231 | const TopoDS_Edge& EE1 = TopoDS::Edge(E1); |
232 | par1 = BRep_Tool::Parameter(VV1,EE1); |
233 | } |
234 | |
235 | if (isvertex2) { |
236 | const TopoDS_Vertex& VV2 = V2; |
237 | // const TopoDS_Vertex& VV2 = TopoDS::Vertex(V2); |
238 | const TopoDS_Edge& EE2 = TopoDS::Edge(E2); |
239 | par2 = BRep_Tool::Parameter(VV2,EE2); |
240 | } |
241 | |
242 | if ( isvertex1 && isvertex2 ) { |
243 | myPDS->FillShapesSameDomain(V1,V2); |
244 | } |
245 | |
246 | Standard_Integer DSPindex; |
247 | Standard_Boolean EPIfound; |
248 | |
249 | if ( ! isvertex ) { |
250 | |
251 | TopOpeBRepDS_Kind KKK; |
252 | TopOpeBRepDS_ListIteratorOfListOfInterference itEIL1(EIL1); |
253 | EPIfound = GetGeometry(itEIL1,P2D,DSPindex,KKK); |
254 | if ( ! EPIfound ) MakeGeometry(P2D,DSPindex,KKK); |
255 | |
256 | SetShapeTransition(P2D,T1,T2); |
257 | |
258 | if (KKK == TopOpeBRepDS_POINT) { |
259 | EPI = StorePI(P2D,T1,E2index,DSPindex,par1,1); |
260 | EPI = StorePI(P2D,T2,E1index,DSPindex,par2,2); |
261 | } |
262 | else if ( KKK == TopOpeBRepDS_VERTEX) { |
263 | Standard_Integer Vindex = DSPindex; |
264 | Standard_Boolean bevi = Standard_False; |
265 | TopOpeBRepDS_Config cevi = TopOpeBRepDS_UNSHGEOMETRY; |
266 | EVI = StoreVI(P2D,T1,E2index,Vindex,bevi,cevi,par1,1); |
267 | EVI = StoreVI(P2D,T2,E1index,Vindex,bevi,cevi,par2,2); |
268 | } |
269 | |
270 | } // ( ! isvertex ) |
271 | |
272 | else { |
273 | |
274 | SetShapeTransition(P2D,T1,T2); |
275 | |
276 | if (isvertex1) { |
277 | const TopoDS_Shape V = V1; |
278 | Standard_Integer Vindex = myPDS->AddShape(V,1); |
279 | TopOpeBRepDS_Config SSC = P2D.EdgesConfig(); |
280 | EVI = StoreVI(P2D,T1,E2index,Vindex,Standard_True,SSC,par1,1); |
281 | EVI = StoreVI(P2D,T2,E1index,Vindex,Standard_False,SSC,par2,2); |
282 | } |
283 | |
284 | if (isvertex2) { |
285 | const TopoDS_Shape V = V2; |
286 | Standard_Integer Vindex = myPDS->AddShape(V,2); |
287 | TopOpeBRepDS_Config SSC = P2D.EdgesConfig(); |
288 | EVI = StoreVI(P2D,T1,E2index,Vindex,Standard_False,SSC,par1,1); |
289 | EVI = StoreVI(P2D,T2,E1index,Vindex,Standard_True,SSC,par2,2); |
290 | } |
291 | |
292 | } // ( isvertex ) |
293 | |
294 | } // MorePoint() |
295 | |
296 | RecomputeInterferences(myE1,myLI1); |
297 | RecomputeInterferences(myE2,myLI2); |
298 | |
299 | } // Insert |
300 | |
301 | // =============== |
302 | // private methods |
303 | // =============== |
304 | |
305 | //======================================================================= |
306 | //function : SetShapeTransition |
307 | //purpose : |
308 | //======================================================================= |
309 | void TopOpeBRep_EdgesFiller::SetShapeTransition(const TopOpeBRep_Point2d& P2D, |
310 | TopOpeBRepDS_Transition& T1,TopOpeBRepDS_Transition& T2) const |
311 | { |
312 | Standard_Boolean pointofsegment = P2D.IsPointOfSegment(); |
313 | Standard_Boolean esd = myPEI->SameDomain(); |
314 | Standard_Integer ie1=0,ie2=0,if1=0,if2=0; |
315 | |
316 | if (pointofsegment && esd) { |
317 | T1.ShapeBefore(TopAbs_EDGE);T1.ShapeAfter(TopAbs_EDGE); |
318 | T2.ShapeBefore(TopAbs_EDGE);T2.ShapeAfter(TopAbs_EDGE); |
319 | if ( ! myE1.IsNull() ) ie1 = myPDS->AddShape(myE1,1); |
320 | if ( ! myE2.IsNull() ) ie2 = myPDS->AddShape(myE2,2); |
321 | if ( ! myE2.IsNull() ) T1.Index(ie2); |
322 | if ( ! myE1.IsNull() ) T2.Index(ie1); |
323 | } |
324 | else if (pointofsegment && !esd) { |
325 | T1.ShapeBefore(TopAbs_FACE);T1.ShapeAfter(TopAbs_FACE); |
326 | T2.ShapeBefore(TopAbs_FACE);T2.ShapeAfter(TopAbs_FACE); |
327 | if ( ! myF1.IsNull() ) if1 = myPDS->AddShape(myF1,1); |
328 | if ( ! myF2.IsNull() ) if2 = myPDS->AddShape(myF2,2); |
329 | if ( ! myF1.IsNull() ) T2.Index(if1); |
330 | if ( ! myF2.IsNull() ) T1.Index(if2); |
331 | } |
332 | else { |
333 | T1.ShapeBefore(TopAbs_FACE);T1.ShapeAfter(TopAbs_FACE); |
334 | T2.ShapeBefore(TopAbs_FACE);T2.ShapeAfter(TopAbs_FACE); |
335 | if ( ! myF1.IsNull() ) if1 = myPDS->AddShape(myF1,1); |
336 | if ( ! myF2.IsNull() ) if2 = myPDS->AddShape(myF2,2); |
337 | if ( ! myF1.IsNull() ) T2.Index(if1); |
338 | if ( ! myF2.IsNull() ) T1.Index(if2); |
339 | } |
340 | } |
341 | |
342 | //======================================================================= |
343 | //function : GetGeometry |
344 | //purpose : private |
345 | //======================================================================= |
346 | Standard_Boolean TopOpeBRep_EdgesFiller::GetGeometry(TopOpeBRepDS_ListIteratorOfListOfInterference& IT,const TopOpeBRep_Point2d& P2D,Standard_Integer& G,TopOpeBRepDS_Kind& K) const |
347 | |
348 | { |
349 | TopOpeBRepDS_Point DSP = TopOpeBRep_PointGeomTool::MakePoint(P2D); |
350 | Standard_Boolean b = myHDS->GetGeometry(IT,DSP,G,K); |
351 | return b; |
352 | } |
353 | |
354 | //======================================================================= |
355 | //function : MakeGeometry |
356 | //purpose : |
357 | //======================================================================= |
358 | Standard_Boolean TopOpeBRep_EdgesFiller::MakeGeometry(const TopOpeBRep_Point2d& P2D,Standard_Integer& G,TopOpeBRepDS_Kind& K) const |
359 | { |
360 | Standard_Boolean isvertex1 = P2D.IsVertex(1); |
361 | Standard_Boolean isvertex2 = P2D.IsVertex(2); |
362 | if (isvertex1 && isvertex2) { |
363 | Standard_Integer G1 = myPDS->AddShape(P2D.Vertex(1),1); |
6e6cd5d9 |
364 | myPDS->AddShape(P2D.Vertex(2),2); |
7fd59977 |
365 | G = G1; |
366 | K = TopOpeBRepDS_VERTEX; |
367 | } |
368 | else if (isvertex1) { |
369 | G = myPDS->AddShape(P2D.Vertex(1),1); |
370 | K = TopOpeBRepDS_VERTEX; |
371 | } |
372 | else if (isvertex2) { |
373 | G = myPDS->AddShape(P2D.Vertex(2),2); |
374 | K = TopOpeBRepDS_VERTEX; |
375 | } |
376 | else { |
377 | G = myPDS->AddPoint(TopOpeBRep_PointGeomTool::MakePoint(P2D)); |
378 | K = TopOpeBRepDS_POINT; |
379 | } |
380 | return Standard_True; |
381 | } |
382 | |
383 | //======================================================================= |
384 | //function : Face |
385 | //purpose : |
386 | //======================================================================= |
387 | void TopOpeBRep_EdgesFiller::Face(const Standard_Integer ISI,const TopoDS_Shape& F) |
388 | { |
389 | if (ISI == 1) myF1 = TopoDS::Face(F); |
390 | else if (ISI == 2) myF2 = TopoDS::Face(F); |
391 | else Standard_Failure::Raise("Face(i,f) : ISI incorrect"); |
392 | } |
393 | |
394 | //======================================================================= |
395 | //function : Face |
396 | //purpose : |
397 | //======================================================================= |
398 | const TopoDS_Shape& TopOpeBRep_EdgesFiller::Face(const Standard_Integer ISI) const |
399 | { |
400 | if (ISI == 1) return myF1; |
401 | else if (ISI == 2) return myF2; |
402 | else Standard_Failure::Raise("Face(i) : ISI incorrect"); |
403 | return myF1; |
404 | } |
405 | |
406 | //======================================================================= |
407 | //function : StorePI |
408 | //purpose : |
409 | //======================================================================= |
410 | Handle(TopOpeBRepDS_Interference) TopOpeBRep_EdgesFiller::StorePI(const TopOpeBRep_Point2d& P2D, |
411 | const TopOpeBRepDS_Transition& T,const Standard_Integer SI,const Standard_Integer GI, |
412 | const Standard_Real param,const Standard_Integer IEmother) |
413 | { |
414 | Handle(TopOpeBRepDS_Interference) I = TopOpeBRepDS_InterferenceTool::MakeEdgeInterference(T,TopOpeBRepDS_EDGE,SI,TopOpeBRepDS_POINT,GI,param); |
415 | TopoDS_Shape Emother; |
416 | if (IEmother == 1) Emother = myE1; |
417 | else if (IEmother == 2) Emother = myE2; |
418 | myHDS->StoreInterference(I,Emother); |
419 | Standard_Boolean b = ToRecompute(P2D,I,IEmother); |
420 | if (b) StoreRecompute(I,IEmother); |
421 | return I; |
422 | } |
423 | |
424 | //======================================================================= |
425 | //function : StoreVI |
426 | //purpose : |
427 | //======================================================================= |
428 | Handle(TopOpeBRepDS_Interference) TopOpeBRep_EdgesFiller::StoreVI(const TopOpeBRep_Point2d& P2D, |
429 | const TopOpeBRepDS_Transition& T,const Standard_Integer EI,const Standard_Integer VI, |
430 | const Standard_Boolean VisB,const TopOpeBRepDS_Config C, |
431 | const Standard_Real param,const Standard_Integer IEmother) |
432 | { |
433 | Handle(TopOpeBRepDS_Interference) I = TopOpeBRepDS_InterferenceTool::MakeEdgeVertexInterference(T,EI,VI,VisB,C,param); |
434 | TopoDS_Shape Emother; |
435 | if (IEmother == 1) Emother = myE1; |
436 | else if (IEmother == 2) Emother = myE2; |
437 | myHDS->StoreInterference(I,Emother); |
438 | Standard_Boolean b = ToRecompute(P2D,I,IEmother); |
439 | if (b) StoreRecompute(I,IEmother); |
440 | return I; |
441 | } |
442 | |
443 | //======================================================================= |
444 | //function : ToRecompute |
445 | //purpose : |
446 | //======================================================================= |
447 | Standard_Boolean TopOpeBRep_EdgesFiller::ToRecompute(const TopOpeBRep_Point2d& P2D,const Handle(TopOpeBRepDS_Interference)& I,const Standard_Integer IEmother) |
448 | { |
449 | Standard_Boolean b = Standard_True; |
7fd59977 |
450 | Standard_Boolean pointofsegment = P2D.IsPointOfSegment(); |
451 | Standard_Boolean esd = myPEI->SameDomain(); |
452 | b = b && (pointofsegment && !esd); |
453 | return b; |
454 | } |
455 | |
456 | //======================================================================= |
457 | //function : StoreRecompute |
458 | //purpose : |
459 | //======================================================================= |
460 | void TopOpeBRep_EdgesFiller::StoreRecompute(const Handle(TopOpeBRepDS_Interference)& I,const Standard_Integer IEmother) |
461 | { |
462 | if (IEmother == 1) myLI1.Append(I); |
463 | else if (IEmother == 2) myLI2.Append(I); |
464 | } |
465 | |
466 | //======================================================================= |
467 | //function : RecomputeInterferences |
468 | //purpose : |
469 | //======================================================================= |
470 | void TopOpeBRep_EdgesFiller::RecomputeInterferences(const TopoDS_Edge& E,TopOpeBRepDS_ListOfInterference& LI) |
471 | { |
472 | if (LI.IsEmpty()) return; |
473 | |
474 | TopOpeBRepDS_TKI tki; tki.FillOnGeometry(LI); |
475 | |
476 | #ifdef DEB |
477 | Standard_Integer EIX = myPDS->Shape(E); Standard_Boolean TRC=DSREDUEDGETRCE(EIX); |
478 | if (TRC) cout<<endl<<"RecomputeInterferences E"<<EIX<<" <- "<<LI.Extent()<<endl; |
479 | if (TRC) tki.DumpTKIIterator("","\n"); |
480 | if (TRC) debefre(EIX); |
481 | #endif |
482 | |
483 | for (tki.Init(); tki.More(); tki.Next()) { |
484 | TopOpeBRepDS_Kind K; Standard_Integer G; tki.Value(K,G); |
485 | TopOpeBRepDS_ListOfInterference& loi = tki.ChangeValue(K,G); TopOpeBRepDS_ListOfInterference Rloi; |
486 | Standard_Integer nloi = loi.Extent(); |
487 | if (nloi == 0) continue; |
488 | |
489 | #ifdef DEB |
490 | if (nloi > 1) {cout<<"TopOpeBRep_EdgesFiller : > 1 I on UNUN/F on E"<<EIX<<" A FAIRE"<<endl;} |
491 | #endif |
492 | |
493 | Handle(TopOpeBRepDS_Interference)& iloi = loi.First(); |
494 | TopOpeBRepDS_Transition& TU = iloi->ChangeTransition(); |
495 | Standard_Integer ifb = TU.IndexBefore(); |
496 | Standard_Integer ifa = TU.IndexAfter(); |
497 | const TopoDS_Face& fb = TopoDS::Face(myPDS->Shape(ifb)); |
498 | #ifdef DEB |
499 | const TopoDS_Face& fa = |
500 | #endif |
501 | TopoDS::Face(myPDS->Shape(ifa)); |
502 | |
503 | #ifdef DEB |
504 | if (ifb != ifa) {cout<<"TopOpeBRep_EdgesFiller : ifb != ifa on E"<<EIX<<" NYI"<<endl;} |
505 | #endif |
506 | |
507 | Standard_Real pE = FDS_Parameter(iloi); TopOpeBRepDS_Transition TN; |
508 | TN.ShapeBefore(TU.ShapeBefore());TN.IndexBefore(TU.IndexBefore()); |
509 | TN.ShapeAfter(TU.ShapeAfter());TN.IndexAfter(TU.IndexAfter()); |
510 | #ifdef DEB |
511 | Standard_Boolean ok = |
512 | #endif |
513 | FDS_stateEwithF2d(*myPDS,E,pE,K,G,fb,TN); |
514 | |
515 | #ifdef DEB |
516 | if (TRC) { |
517 | TopOpeBRepDS_ListOfInterference l1;l1.Append(iloi); |
518 | TopOpeBRepDS_TKI dt;dt.FillOnGeometry(l1);dt.DumpTKIIterator("",""); |
519 | if (ok) { |
520 | cout<<" ";TU.Dump(cout);cout<<endl; |
521 | cout<<"--> ";TN.Dump(cout);cout<<endl; |
522 | } |
523 | else { |
524 | cout<<"--> TN ko"<<endl; |
525 | } |
526 | } |
527 | #endif |
528 | |
529 | } // tki.More |
530 | } // RecomputeInterferences |