b311480e |
1 | // Created on: 1996-03-07 |
2 | // Created by: Jean Yves LEBEY |
3 | // Copyright (c) 1996-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 | #ifdef HAVE_CONFIG_H |
23 | # include <config.h> |
24 | #endif |
25 | #include <TopOpeBRepBuild_Builder.ixx> |
26 | #include <TopOpeBRepBuild_define.hxx> |
27 | #include <stdio.h> |
28 | |
29 | #ifdef DRAW |
30 | #include <DBRep.hxx> |
31 | #endif |
32 | |
33 | #include <TopOpeBRepBuild_GIter.hxx> |
34 | #include <TopOpeBRepBuild_GTool.hxx> |
35 | #include <TopOpeBRepDS_Surface.hxx> |
36 | #include <TopOpeBRepDS_Curve.hxx> |
37 | #include <TopOpeBRepDS_Point.hxx> |
38 | #include <TopOpeBRepDS_Interference.hxx> |
39 | #include <TopOpeBRepDS_Config.hxx> |
40 | #include <TopOpeBRepDS_Dumper.hxx> |
41 | #include <TopOpeBRepDS.hxx> |
42 | #include <TopOpeBRepTool_ShapeExplorer.hxx> |
43 | #include <Geom_Curve.hxx> |
44 | #include <Geom2d_Curve.hxx> |
45 | #include <BRep_Tool.hxx> |
46 | #include <TopoDS_Shell.hxx> |
47 | #include <TopoDS_Wire.hxx> |
48 | #include <TopoDS.hxx> |
49 | #include <TopExp.hxx> |
50 | #include <Geom_Plane.hxx> |
51 | #include <gp_Pnt.hxx> |
52 | #include <gp_Pnt2d.hxx> |
53 | #include <ElCLib.hxx> |
54 | #include <ElSLib.hxx> |
55 | #include <Geom2dAdaptor_Curve.hxx> |
56 | #include <BRepAdaptor_Surface.hxx> |
57 | #include <GeomAbs_CurveType.hxx> |
58 | #include <GeomAbs_SurfaceType.hxx> |
59 | #include <GeomAdaptor_Curve.hxx> |
60 | #include <Geom_Line.hxx> |
61 | #include <Geom_Circle.hxx> |
62 | #include <Geom_Ellipse.hxx> |
63 | #include <Geom_Hyperbola.hxx> |
64 | #include <Geom_Parabola.hxx> |
65 | #include <Geom_BezierCurve.hxx> |
66 | #include <Geom_BSplineCurve.hxx> |
67 | #include <TCollection_AsciiString.hxx> |
68 | #include <TopOpeBRepBuild_WireEdgeSet.hxx> |
69 | |
70 | #ifdef DEB |
71 | #ifdef HAVE_STRINGS_H |
72 | # include <strings.h> |
73 | #endif |
1d0a9d4d |
74 | extern Standard_Boolean TopOpeBRepDS_GettraceSPSX(const Standard_Integer); |
75 | extern Standard_Boolean TopOpeBRepDS_GettraceSPSXX(const Standard_Integer,const Standard_Integer); |
7fd59977 |
76 | static TCollection_AsciiString PRODINS("dins "); |
77 | #endif |
78 | |
79 | //======================================================================= |
80 | //function : GdumpLS |
81 | //purpose : |
82 | //======================================================================= |
83 | #ifdef DEB |
84 | void TopOpeBRepBuild_Builder::GdumpLS(const TopTools_ListOfShape& L) const |
85 | { |
86 | TopTools_ListIteratorOfListOfShape it(L); |
87 | for (; it.More(); it.Next() ) { |
88 | const TopoDS_Shape& SL = it.Value(); |
89 | GdumpSHA(SL); |
90 | } |
91 | } |
92 | #else |
93 | void TopOpeBRepBuild_Builder::GdumpLS(const TopTools_ListOfShape&) const |
94 | { |
95 | } |
96 | #endif |
97 | |
98 | //======================================================================= |
99 | //function : PrintGeo |
100 | //purpose : |
101 | //======================================================================= |
102 | #ifdef DEB |
103 | void TopOpeBRepBuild_Builder::PrintGeo(const TopoDS_Shape& S) |
104 | { |
105 | if (S.ShapeType() == TopAbs_VERTEX) PrintPnt(TopoDS::Vertex(S)); |
106 | else if (S.ShapeType() == TopAbs_EDGE) PrintCur(TopoDS::Edge(S)); |
107 | else if (S.ShapeType() == TopAbs_FACE) PrintSur(TopoDS::Face(S)); |
108 | } |
109 | #else |
110 | void TopOpeBRepBuild_Builder::PrintGeo(const TopoDS_Shape&) |
111 | { |
112 | } |
113 | #endif |
114 | |
115 | //======================================================================= |
116 | //function : PrintSur |
117 | //purpose : print the name of a surface |
118 | //======================================================================= |
119 | #ifdef DEB |
120 | void TopOpeBRepBuild_Builder::PrintSur(const TopoDS_Face& F) |
121 | { |
122 | BRepAdaptor_Surface STA_Surface(F); |
123 | GeomAbs_SurfaceType t = STA_Surface.GetType(); |
124 | switch(t) { |
125 | case GeomAbs_Plane : cout<<"PLANE"; break; |
126 | case GeomAbs_Cylinder : cout<<"CYLINDER"; break; |
127 | case GeomAbs_Cone : cout<<"CONE"; break; |
128 | case GeomAbs_Sphere : cout<<"SPHERE"; break; |
129 | case GeomAbs_Torus : cout<<"TORUS"; break; |
130 | case GeomAbs_BezierSurface : cout<<"BEZIERSURFACE"; break; |
131 | case GeomAbs_BSplineSurface : cout<<"BSPLINESURFACE"; break; |
132 | case GeomAbs_SurfaceOfRevolution : cout<<"SURFACEOFREVOLUTION"; break; |
133 | case GeomAbs_SurfaceOfExtrusion : cout<<"SURFACEOFEXTRUSION"; break; |
134 | case GeomAbs_OtherSurface : default : cout<<"OTHERSURFACE"; break; |
135 | } |
136 | cout.flush(); |
137 | } |
138 | #else |
139 | void TopOpeBRepBuild_Builder::PrintSur(const TopoDS_Face& ) |
140 | { |
141 | } |
142 | #endif |
143 | |
144 | //======================================================================= |
145 | //function : PrintCur |
146 | //purpose : print the name of a curve |
147 | //======================================================================= |
148 | #ifdef DEB |
149 | void TopOpeBRepBuild_Builder::PrintCur(const TopoDS_Edge& E) |
150 | { |
151 | TopLoc_Location L; Standard_Real f,l; |
152 | Handle(Geom_Curve) C = BRep_Tool::Curve(E,L,f,l); |
153 | if ( C.IsNull() ) return; |
154 | GeomAdaptor_Curve GC(C); |
155 | GeomAbs_CurveType t = GC.GetType(); |
156 | |
157 | switch(t) { |
158 | case GeomAbs_Line : cout<<"LINE"; break; |
159 | case GeomAbs_Circle : cout<<"CIRCLE"; break; |
160 | case GeomAbs_Ellipse : cout<<"ELLIPSE"; break; |
161 | case GeomAbs_Hyperbola : cout<<"HYPERBOLA"; break; |
162 | case GeomAbs_Parabola : cout<<"PARABOLA"; break; |
163 | case GeomAbs_BezierCurve : cout<<"BEZIERCURVE"; break; |
164 | case GeomAbs_BSplineCurve : cout<<"BSPLINECURVE "<<GC.BSpline()->Degree(); break; |
165 | case GeomAbs_OtherCurve : cout<<"OTHERCURVE"; break; |
166 | } |
167 | cout.flush(); |
168 | } |
169 | #else |
170 | void TopOpeBRepBuild_Builder::PrintCur(const TopoDS_Edge&) |
171 | { |
172 | } |
173 | #endif |
174 | |
175 | //======================================================================= |
176 | //function : PrintPnt |
177 | //purpose : |
178 | //======================================================================= |
179 | #ifdef DEB |
180 | void TopOpeBRepBuild_Builder::PrintPnt(const TopoDS_Vertex& V) |
181 | { |
182 | GdumpPNT(BRep_Tool::Pnt(V)); |
183 | } |
184 | #else |
185 | void TopOpeBRepBuild_Builder::PrintPnt(const TopoDS_Vertex&) |
186 | { |
187 | } |
188 | #endif |
189 | |
190 | //======================================================================= |
191 | //function : PrintOri |
192 | //purpose : |
193 | //======================================================================= |
194 | #ifdef DEB |
195 | void TopOpeBRepBuild_Builder::PrintOri(const TopoDS_Shape& S) |
196 | { |
197 | TopAbs::Print(S.Orientation(),cout); |
198 | cout.flush(); |
199 | } |
200 | #else |
201 | void TopOpeBRepBuild_Builder::PrintOri(const TopoDS_Shape& /*S*/) |
202 | { |
203 | } |
204 | #endif |
205 | |
206 | //======================================================================= |
207 | //function : StringState |
208 | //purpose : |
209 | //======================================================================= |
210 | #ifdef DEB |
211 | TCollection_AsciiString TopOpeBRepBuild_Builder::StringState(const TopAbs_State st) |
212 | #else |
213 | TCollection_AsciiString TopOpeBRepBuild_Builder::StringState(const TopAbs_State) |
214 | #endif |
215 | { |
216 | TCollection_AsciiString s; |
217 | #ifdef DEB |
218 | switch(st) { |
219 | case TopAbs_ON : s.AssignCat("ON"); break; |
220 | case TopAbs_IN : s.AssignCat("IN"); break; |
221 | case TopAbs_OUT : s.AssignCat("OUT"); break; |
222 | case TopAbs_UNKNOWN : s.AssignCat("UNKNOWN"); break; |
223 | } |
224 | #endif |
225 | return s; |
226 | } |
227 | |
228 | //======================================================================= |
229 | //function : GdumpPNT |
230 | //purpose : |
231 | //======================================================================= |
232 | #ifdef DEB |
233 | void TopOpeBRepBuild_Builder::GdumpPNT(const gp_Pnt& P) |
234 | { |
235 | cout<<P.X()<<" "<<P.Y()<<" "<<P.Z(); cout.flush(); |
236 | } |
237 | #else |
238 | void TopOpeBRepBuild_Builder::GdumpPNT(const gp_Pnt&) |
239 | { |
240 | } |
241 | #endif |
242 | |
243 | //======================================================================= |
244 | //function : GdumpORIPARPNT |
245 | //purpose : |
246 | //======================================================================= |
247 | #ifdef DEB |
248 | void TopOpeBRepBuild_Builder::GdumpORIPARPNT(const TopAbs_Orientation o, |
249 | const Standard_Real p, |
250 | const gp_Pnt& Pnt) |
251 | { |
252 | TopAbs::Print(o,cout); cout<<" "<<p<<" pnt "; GdumpPNT(Pnt); cout.flush(); |
253 | } |
254 | #else |
255 | void TopOpeBRepBuild_Builder::GdumpORIPARPNT(const TopAbs_Orientation, |
256 | const Standard_Real,const gp_Pnt&) |
257 | { |
258 | } |
259 | #endif |
260 | |
261 | //======================================================================= |
262 | //function : GdumpEDGVER |
263 | //purpose : |
264 | //======================================================================= |
265 | #ifdef DEB |
266 | void TopOpeBRepBuild_Builder::GdumpEDGVER(const TopoDS_Shape& E, |
267 | const TopoDS_Shape& V, |
268 | const Standard_Address s) const |
269 | { |
270 | char* c = (char*)s; if (c) cout<<c; |
271 | const TopoDS_Edge& EE = TopoDS::Edge(E); |
272 | const TopoDS_Vertex& VV = TopoDS::Vertex(V); |
273 | Standard_Real par = BRep_Tool::Parameter(VV,EE); |
274 | gp_Pnt P = BRep_Tool::Pnt(VV); |
275 | GdumpORIPARPNT(VV.Orientation(),par,P); |
276 | cout.flush(); |
277 | } |
278 | #else |
279 | void TopOpeBRepBuild_Builder::GdumpEDGVER(const TopoDS_Shape&, |
280 | const TopoDS_Shape&, |
281 | const Standard_Address) const |
282 | { |
283 | } |
284 | #endif |
285 | |
286 | //======================================================================= |
287 | //function : GdumpEDG |
288 | //purpose : |
289 | //======================================================================= |
290 | #ifdef DEB |
291 | void TopOpeBRepBuild_Builder::GdumpEDG(const TopoDS_Shape& E, |
292 | const Standard_Address s) const |
293 | { |
294 | char* c = (char*)s; if (c) cout<<c; |
295 | const TopoDS_Edge& EE = TopoDS::Edge(E); |
296 | Standard_Integer n = 0; |
297 | GdumpSHAORI(E, (char *) "vertices of ");cout<<endl; |
298 | TopOpeBRepTool_ShapeExplorer ex(E,TopAbs_VERTEX); |
299 | char strpar[256]; sprintf(strpar," #"); |
300 | for (; ex.More(); ex.Next()) { |
301 | const TopoDS_Vertex& VV = TopoDS::Vertex(ex.Current()); |
302 | TopAbs_Orientation o = VV.Orientation(); |
303 | cout<<"vertex v"; |
304 | if (o == TopAbs_FORWARD) cout<<"F"; |
305 | else if (o == TopAbs_REVERSED) cout<<"R"; |
306 | else if (o == TopAbs_INTERNAL) cout<<"I"; |
307 | else if (o == TopAbs_EXTERNAL) cout<<"E"; |
308 | cout<<++n<<" "; TopOpeBRepBuild_Builder::PrintPnt(VV); cout<<";"; |
309 | Standard_Real par = BRep_Tool::Parameter(VV,EE); |
310 | char spar[255];sprintf(spar," par%d %f",n,par); strcat(strpar,spar); |
311 | } |
312 | if(n) cout<<strpar<<endl; |
313 | cout.flush(); |
314 | } |
315 | #else |
316 | void TopOpeBRepBuild_Builder::GdumpEDG(const TopoDS_Shape&, |
317 | const Standard_Address) const |
318 | { |
319 | } |
320 | #endif |
321 | |
322 | //======================================================================= |
323 | //function : GdumpSAMDOM |
324 | //purpose : |
325 | //======================================================================= |
326 | void TopOpeBRepBuild_Builder::GdumpSAMDOM(const TopTools_ListOfShape& L, |
327 | const Standard_Address astr) const |
328 | { |
329 | TopOpeBRepDS_Dumper Dumper(myDataStructure); |
330 | cout<<Dumper.SPrintShapeRefOri(L,(char*)astr)<<endl; |
331 | cout.flush(); |
332 | } |
333 | |
334 | //======================================================================= |
335 | //function : GdumpSHA |
336 | //purpose : |
337 | //======================================================================= |
338 | #ifdef DEB |
339 | void TopOpeBRepBuild_Builder::GdumpSHA(const TopoDS_Shape& S, |
340 | const Standard_Address str) const |
341 | { |
342 | char* c = (char*)str; if (c) cout<<c; |
343 | if (S.IsNull()) return; |
344 | TopAbs_ShapeEnum tS = S.ShapeType(); Standard_Integer iS = 0; |
345 | if ( ! myDataStructure.IsNull() ) iS = myDataStructure->Shape(S); |
346 | TopOpeBRepDS::Print(tS,iS,cout); |
347 | cout.flush(); |
348 | } |
349 | #else |
350 | void TopOpeBRepBuild_Builder::GdumpSHA(const TopoDS_Shape&, |
351 | const Standard_Address) const |
352 | { |
353 | } |
354 | #endif |
355 | |
356 | //======================================================================= |
357 | //function : GdumpSHAORI |
358 | //purpose : |
359 | //======================================================================= |
360 | #ifdef DEB |
361 | void TopOpeBRepBuild_Builder::GdumpSHAORI(const TopoDS_Shape& S, |
362 | const Standard_Address str) const |
363 | { |
364 | char* c = (char*)str; if (c) cout<<c; |
365 | GdumpSHA(S,NULL); cout<<","; PrintOri(S); |
366 | cout.flush(); |
367 | } |
368 | #else |
369 | void TopOpeBRepBuild_Builder::GdumpSHAORI(const TopoDS_Shape& , |
370 | const Standard_Address ) const |
371 | { |
372 | } |
373 | #endif |
374 | //======================================================================= |
375 | //function : GdumpSHAORIGEO |
376 | //purpose : |
377 | //======================================================================= |
378 | #ifdef DEB |
379 | void TopOpeBRepBuild_Builder::GdumpSHAORIGEO(const TopoDS_Shape& S, |
380 | const Standard_Address str) const |
381 | { |
382 | char* c = (char*)str; if (c) cout<<c; |
383 | GdumpSHAORI(S,NULL); cout<<","; PrintGeo(S); |
384 | cout.flush(); |
385 | } |
386 | #else |
387 | void TopOpeBRepBuild_Builder::GdumpSHAORIGEO(const TopoDS_Shape& , |
388 | const Standard_Address ) const |
389 | { |
390 | } |
391 | #endif |
392 | //======================================================================= |
393 | //function : GdumpSHASTA |
394 | //purpose : |
395 | //======================================================================= |
396 | #ifdef DEB |
397 | void TopOpeBRepBuild_Builder::GdumpSHASTA(const TopoDS_Shape& S, |
398 | const TopAbs_State T, |
399 | const TCollection_AsciiString& a, |
400 | const TCollection_AsciiString& b) const |
401 | { |
402 | cout<<a; |
403 | GdumpSHAORIGEO(S,NULL); cout<<","<<StringState(T).ToCString(); |
404 | cout<<b; |
405 | cout.flush(); |
406 | } |
407 | #else |
408 | void TopOpeBRepBuild_Builder::GdumpSHASTA(const TopoDS_Shape& , |
409 | const TopAbs_State , |
410 | const TCollection_AsciiString& , |
411 | const TCollection_AsciiString& ) const |
412 | { |
413 | } |
414 | #endif |
415 | |
416 | //======================================================================= |
417 | //function : GdumpSHASTA |
418 | //purpose : |
419 | //======================================================================= |
420 | #ifdef DEB |
421 | void TopOpeBRepBuild_Builder::GdumpSHASTA(const Standard_Integer iS, |
422 | const TopAbs_State T, |
423 | const TCollection_AsciiString& a, |
424 | const TCollection_AsciiString& b) const |
425 | { |
426 | const TopoDS_Shape& S = myDataStructure->Shape(iS); |
427 | GdumpSHASTA(S,T,a,b); |
428 | cout.flush(); |
429 | } |
430 | #else |
431 | void TopOpeBRepBuild_Builder::GdumpSHASTA(const Standard_Integer , |
432 | const TopAbs_State , |
433 | const TCollection_AsciiString& , |
434 | const TCollection_AsciiString& ) const |
435 | { |
436 | } |
437 | #endif |
438 | |
439 | //======================================================================= |
440 | //function : GdumpSHASTA |
441 | //purpose : |
442 | //======================================================================= |
443 | #ifdef DEB |
444 | void TopOpeBRepBuild_Builder::GdumpSHASTA(const Standard_Integer iS, |
445 | const TopAbs_State T, |
446 | const TopOpeBRepBuild_ShapeSet& SS, |
447 | const TCollection_AsciiString& a, |
448 | const TCollection_AsciiString& b, |
449 | const TCollection_AsciiString& c)const |
450 | { |
451 | const TopoDS_Shape& S = myDataStructure->Shape(iS); |
452 | TCollection_AsciiString aib = a + " " + SS.DEBNumber() + " " + b; |
453 | GdumpSHASTA(S,T,aib,c); |
454 | cout.flush(); |
455 | } |
456 | #else |
457 | void TopOpeBRepBuild_Builder::GdumpSHASTA(const Standard_Integer , |
458 | const TopAbs_State , |
459 | const TopOpeBRepBuild_ShapeSet& , |
460 | const TCollection_AsciiString& , |
461 | const TCollection_AsciiString& , |
462 | const TCollection_AsciiString& )const |
463 | { |
464 | } |
465 | #endif |
466 | |
467 | //======================================================================= |
468 | //function : GdumpSHASETreset |
469 | //purpose : |
470 | //======================================================================= |
471 | void TopOpeBRepBuild_Builder::GdumpSHASETreset() |
472 | { |
473 | #ifdef DEB |
474 | mySHASETindex = 0; |
475 | #endif |
476 | } |
477 | |
478 | //======================================================================= |
479 | //function : GdumpSHASETindex |
480 | //purpose : |
481 | //======================================================================= |
482 | Standard_Integer TopOpeBRepBuild_Builder::GdumpSHASETindex() |
483 | { |
484 | Standard_Integer n = 0; |
485 | #ifdef DEB |
486 | n = ++mySHASETindex; |
487 | #endif |
488 | return n; |
489 | } |
490 | |
491 | //======================================================================= |
492 | //function : GdumpEXP |
493 | //purpose : |
494 | //======================================================================= |
495 | #ifdef DEB |
496 | void TopOpeBRepBuild_Builder::GdumpEXP(const TopOpeBRepTool_ShapeExplorer& Ex) const |
497 | { |
498 | if ( ! Ex.More() ) return; |
499 | TopAbs_ShapeEnum t = Ex.Current().ShapeType(); |
500 | if (t == TopAbs_SOLID) cout<<""; |
501 | else if (t == TopAbs_FACE) cout<<" "; |
502 | else if (t == TopAbs_EDGE) cout<<" "; |
503 | else cout<<"??"; |
504 | Ex.DumpCurrent(cout); |
505 | Standard_Integer I = myDataStructure->Shape(Ex.Current()); |
506 | if ( I != 0 ) cout<<" : shape "<<I; |
507 | cout<<endl; |
508 | cout.flush(); |
509 | } |
510 | #else |
511 | void TopOpeBRepBuild_Builder::GdumpEXP(const TopOpeBRepTool_ShapeExplorer& ) const |
512 | { |
513 | } |
514 | #endif |
515 | |
516 | //======================================================================= |
517 | //function : GdumpSOBU |
518 | //purpose : |
519 | //======================================================================= |
520 | void TopOpeBRepBuild_Builder::GdumpSOBU(TopOpeBRepBuild_SolidBuilder& /*ME*/) const |
521 | { |
522 | #ifdef DEB |
523 | #endif |
524 | } // GdumpSOBU |
525 | |
526 | #ifdef DEB |
527 | void* GFABUMAKEFACEPWES_DEB = NULL; |
528 | #endif |
529 | |
530 | //======================================================================= |
531 | //function : GdumpFABU |
532 | //purpose : |
533 | //======================================================================= |
534 | #ifdef DEB |
535 | void TopOpeBRepBuild_Builder::GdumpFABU(TopOpeBRepBuild_FaceBuilder& ME) const |
536 | { |
537 | const TopoDS_Shape& face = ME.Face(); |
538 | Standard_Integer iF; |
539 | // Standard_Boolean tSPS = |
540 | GtraceSPS(face,iF); |
541 | TopOpeBRepBuild_WireEdgeSet* PWES = (TopOpeBRepBuild_WireEdgeSet*)GFABUMAKEFACEPWES_DEB; |
542 | |
543 | Standard_Integer nf,nw,ne; |
544 | ME.InitFace(); |
545 | if ( ME.MoreFace() ) cout<<"clear;"<<endl; |
546 | for (nf=0;ME.MoreFace();ME.NextFace()) { |
547 | nf++; |
548 | cout<<"# face "<<nf<<endl; |
549 | for (nw=0,ME.InitWire();ME.MoreWire();ME.NextWire()) { |
550 | nw++; |
551 | Standard_Boolean ow = ME.IsOldWire(); |
552 | cout<<"# wire "<<nw;if(ow)cout<<" (old)";else cout<<" (new)";cout<<endl; |
553 | if (!ow) { |
554 | TCollection_AsciiString whatis("whatis"); |
555 | for(ne=0,ME.InitEdge();ME.MoreEdge();ME.NextEdge()) { |
556 | ne++; |
557 | const TopoDS_Edge& EE = TopoDS::Edge(ME.Edge()); |
558 | TCollection_AsciiString Enam("E"); |
559 | TCollection_AsciiString VFnam("VF"); |
560 | TCollection_AsciiString VRnam("VR"); |
561 | Enam = Enam + ne + "NF" + nf + "F" + iF; |
562 | if (PWES) Enam = Enam + PWES->DEBName() + PWES->DEBNumber(); |
563 | VFnam = VFnam + ne + "NF" + nf + "F" + iF; |
564 | VRnam = VRnam + ne + "NF" + nf + "F" + iF; |
565 | // cout<<" puts \"edge "<<ne<<" : "<<Enam<<"\"";cout<<"; "; |
566 | TopoDS_Vertex VF,VR; TopExp::Vertices(EE,VF,VR); |
567 | if ( ! VF.IsNull() && !VR.IsNull() && !EE.IsNull()) { |
568 | #ifdef DRAW |
569 | DBRep::Set(Enam.ToCString(),EE); |
570 | DBRep::Set(VFnam.ToCString(),VF); |
571 | DBRep::Set(VRnam.ToCString(),VR); |
572 | #endif |
573 | cout<<PRODINS<<"-O -p 0.5 "<<Enam; cout<<"; "; |
574 | // cout<<PRODINS<<VFnam; cout<<"; "; |
575 | // cout<<PRODINS<<VRnam; cout<<"; "; |
576 | // gp_Pnt PF = BRep_Tool::Pnt(VF); |
577 | // gp_Pnt PR = BRep_Tool::Pnt(VR); |
578 | // cout<<endl; |
579 | // cout<<"# "; |
580 | // cout<<"dinp "<<VFnam<<" ";TopOpeBRepBuild_Builder::PrintPnt(VF);cout<<"; "; |
581 | // cout<<"dinp "<<VRnam<<" ";TopOpeBRepBuild_Builder::PrintPnt(VR);cout<<"; "; |
582 | cout<<endl; |
583 | whatis += " "; whatis += Enam; |
584 | } |
585 | } |
586 | if (ne) cout<<" "<<whatis<<endl<<endl; |
587 | } |
588 | } |
589 | } |
590 | cout.flush(); |
591 | } // GdumpFABU |
592 | #else |
593 | void TopOpeBRepBuild_Builder::GdumpFABU(TopOpeBRepBuild_FaceBuilder& ) const |
594 | { |
595 | } |
596 | #endif |
597 | |
598 | //======================================================================= |
599 | //function : GdumpEDBU |
600 | //purpose : |
601 | //======================================================================= |
602 | void TopOpeBRepBuild_Builder::GdumpEDBU(TopOpeBRepBuild_EdgeBuilder& /*ME*/) const |
603 | { |
604 | #ifdef DEB |
605 | #endif |
606 | } // GdumpEDBU |
607 | |
608 | //======================================================================= |
609 | //function : GtraceSPS |
610 | //purpose : |
611 | //======================================================================= |
612 | #ifdef DEB |
613 | Standard_Boolean TopOpeBRepBuild_Builder::GtraceSPS(const Standard_Integer iS) const |
614 | #else |
615 | Standard_Boolean TopOpeBRepBuild_Builder::GtraceSPS(const Standard_Integer ) const |
616 | #endif |
617 | { |
618 | Standard_Boolean b = Standard_False; |
619 | #ifdef DEB |
620 | Standard_Integer ibid; |
621 | b = GtraceSPS(myDataStructure->Shape(iS),ibid); |
622 | #endif |
623 | return b; |
624 | } |
625 | |
626 | //======================================================================= |
627 | //function : GtraceSPS |
628 | //purpose : |
629 | //======================================================================= |
630 | #ifdef DEB |
631 | Standard_Boolean TopOpeBRepBuild_Builder::GtraceSPS(const Standard_Integer i, |
632 | const Standard_Integer j) const |
633 | #else |
634 | Standard_Boolean TopOpeBRepBuild_Builder::GtraceSPS(const Standard_Integer , |
635 | const Standard_Integer ) const |
636 | #endif |
637 | { |
638 | Standard_Boolean b = Standard_False; |
639 | #ifdef DEB |
640 | b = TopOpeBRepDS_GettraceSPSXX(i,j); |
641 | #endif |
642 | return b; |
643 | } |
644 | |
645 | //======================================================================= |
646 | //function : GtraceSPS |
647 | //purpose : |
648 | //======================================================================= |
649 | #ifdef DEB |
650 | Standard_Boolean TopOpeBRepBuild_Builder::GtraceSPS(const TopoDS_Shape& S) const |
651 | #else |
652 | Standard_Boolean TopOpeBRepBuild_Builder::GtraceSPS(const TopoDS_Shape& ) const |
653 | #endif |
654 | { |
655 | Standard_Boolean b = Standard_False; |
656 | #ifdef DEB |
657 | Standard_Integer iS; |
658 | b = GtraceSPS(S,iS); |
659 | #endif |
660 | return b; |
661 | } |
662 | |
663 | //======================================================================= |
664 | //function : GtraceSPS |
665 | //purpose : |
666 | //======================================================================= |
667 | #ifdef DEB |
668 | Standard_Boolean TopOpeBRepBuild_Builder::GtraceSPS(const TopoDS_Shape& S, |
669 | Standard_Integer& IS) const |
670 | #else |
671 | Standard_Boolean TopOpeBRepBuild_Builder::GtraceSPS(const TopoDS_Shape&, |
672 | Standard_Integer& IS) const |
673 | #endif |
674 | { |
675 | IS = 0; Standard_Boolean b = Standard_False; |
676 | #ifdef DEB |
677 | if ( ! myDataStructure.IsNull() ) { |
678 | if ( ! S.IsNull() ) { |
679 | IS = myDataStructure->Shape(S); |
680 | b = TopOpeBRepDS_GettraceSPSX(IS); |
681 | } |
682 | } |
683 | #endif |
684 | return b; |
685 | } |
686 | |
687 | |
688 | //======================================================================= |
689 | //function : GcheckNBOUNDS |
690 | //purpose : |
691 | //======================================================================= |
692 | #ifdef DEB |
693 | Standard_Boolean TopOpeBRepBuild_Builder::GcheckNBOUNDS(const TopoDS_Shape& E) |
694 | #else |
695 | Standard_Boolean TopOpeBRepBuild_Builder::GcheckNBOUNDS(const TopoDS_Shape& ) |
696 | #endif |
697 | { |
698 | Standard_Boolean res = Standard_False; |
699 | #ifdef DEB |
700 | Standard_Integer nf = 0, nr = 0; |
701 | TopOpeBRepTool_ShapeExplorer ex(E,TopAbs_VERTEX); |
702 | for(; ex.More(); ex.Next()) { |
703 | TopAbs_Orientation o = ex.Current().Orientation(); |
704 | if (o == TopAbs_FORWARD) nf++; |
705 | if (o == TopAbs_REVERSED) nr++; |
706 | } |
707 | if ( nf == 1 && nr == 1 ) res = Standard_True; |
708 | #endif |
709 | return res; |
710 | } |