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