1 // Created on: 1994-08-04
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1994-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.
18 #include <Geom2d_BezierCurve.hxx>
19 #include <Geom2d_BSplineCurve.hxx>
20 #include <Geom2d_Circle.hxx>
21 #include <Geom2d_Curve.hxx>
22 #include <Geom2d_Ellipse.hxx>
23 #include <Geom2d_Hyperbola.hxx>
24 #include <Geom2d_Line.hxx>
25 #include <Geom2d_OffsetCurve.hxx>
26 #include <Geom2d_Parabola.hxx>
27 #include <Geom2d_TrimmedCurve.hxx>
28 #include <Geom_BezierCurve.hxx>
29 #include <Geom_BSplineCurve.hxx>
30 #include <Geom_Circle.hxx>
31 #include <Geom_Curve.hxx>
32 #include <Geom_Ellipse.hxx>
33 #include <Geom_Hyperbola.hxx>
34 #include <Geom_Line.hxx>
35 #include <Geom_OffsetCurve.hxx>
36 #include <Geom_Parabola.hxx>
37 #include <Geom_TrimmedCurve.hxx>
38 #include <GeomTools_Curve2dSet.hxx>
39 #include <GeomTools_CurveSet.hxx>
41 #include <gp_Pnt2d.hxx>
42 #include <Standard_Stream.hxx>
43 #include <TCollection_AsciiString.hxx>
45 #include <TopoDS_Edge.hxx>
46 #include <TopoDS_Shape.hxx>
47 #include <TopOpeBRepDS.hxx>
48 #include <TopOpeBRepDS_Curve.hxx>
49 #include <TopOpeBRepDS_CurveExplorer.hxx>
50 #include <TopOpeBRepDS_CurveIterator.hxx>
51 #include <TopOpeBRepDS_define.hxx>
52 #include <TopOpeBRepDS_Dumper.hxx>
53 #include <TopOpeBRepDS_HDataStructure.hxx>
54 #include <TopOpeBRepDS_Interference.hxx>
55 #include <TopOpeBRepDS_Point.hxx>
56 #include <TopOpeBRepDS_PointExplorer.hxx>
57 #include <TopOpeBRepDS_ShapeShapeInterference.hxx>
58 #include <TopOpeBRepDS_Surface.hxx>
59 #include <TopOpeBRepDS_SurfaceCurveInterference.hxx>
60 #include <TopOpeBRepDS_SurfaceExplorer.hxx>
61 #include <TopOpeBRepTool_ShapeTool.hxx>
64 //=======================================================================
65 //function : TopOpeBRepDS_Dumper::TopOpeBRepDS_Dumper
67 //=======================================================================
68 TopOpeBRepDS_Dumper::TopOpeBRepDS_Dumper(const Handle(TopOpeBRepDS_HDataStructure)& HDS)
73 //=======================================================================
74 //function : PrintType
76 //=======================================================================
78 Standard_OStream& TopOpeBRepDS_Dumper::PrintType(const Handle(Geom_Curve)&
82 ,Standard_OStream& OS)
89 Handle(Standard_Type) T = C->DynamicType();
90 if (T==STANDARD_TYPE(Geom_Circle)) OS<<"CIRCLE";
91 else if (T==STANDARD_TYPE(Geom_Line)) OS<<"LINE";
92 else if (T==STANDARD_TYPE(Geom_Ellipse)) OS<<"ELLIPSE";
93 else if (T==STANDARD_TYPE(Geom_Parabola)) OS<<"ELLIPSE";
94 else if (T==STANDARD_TYPE(Geom_Hyperbola)) OS<<"HYPERBOLA";
95 else if (T==STANDARD_TYPE(Geom_BezierCurve)) OS<<"BEZIER";
96 else if (T==STANDARD_TYPE(Geom_BSplineCurve))
97 OS<<"BSPLINE("<<Handle(Geom_BSplineCurve)::DownCast (C)->Degree()<<")";
98 else if (T==STANDARD_TYPE(Geom_TrimmedCurve))
99 {OS<<"TRIMMED ";PrintType(Handle(Geom_TrimmedCurve)::DownCast(C)->BasisCurve(),OS);}
100 else if (T==STANDARD_TYPE(Geom_OffsetCurve)) OS<<"OFFSETCURVE";
101 else OS<<"***UNKNOWN***";
102 if (T!=STANDARD_TYPE(Geom_TrimmedCurve)) OS<<"3D";
108 //=======================================================================
109 //function : PrintType
111 //=======================================================================
113 Standard_OStream& TopOpeBRepDS_Dumper::PrintType(const Handle(Geom2d_Curve)&
117 ,Standard_OStream& OS)
124 Handle(Standard_Type) T = C->DynamicType();
125 if (T==STANDARD_TYPE(Geom2d_Circle)) OS<<"CIRCLE";
126 else if (T==STANDARD_TYPE(Geom2d_Line)) OS<<"LINE";
127 else if (T==STANDARD_TYPE(Geom2d_Ellipse)) OS<<"ELLIPSE";
128 else if (T==STANDARD_TYPE(Geom2d_Parabola)) OS<<"ELLIPSE";
129 else if (T==STANDARD_TYPE(Geom2d_Hyperbola)) OS<<"HYPERBOLA";
130 else if (T==STANDARD_TYPE(Geom2d_BezierCurve)) OS<<"BEZIER";
131 else if (T==STANDARD_TYPE(Geom2d_BSplineCurve))
132 OS<<"BSPLINE("<<Handle(Geom2d_BSplineCurve)::DownCast (C)->Degree()<<")";
133 else if (T==STANDARD_TYPE(Geom2d_TrimmedCurve))
134 {OS<<"TRIMMED ";PrintType(Handle(Geom2d_TrimmedCurve)::DownCast(C)->BasisCurve(),OS);}
135 else if (T==STANDARD_TYPE(Geom2d_OffsetCurve)) OS<<"OFFSETCURVE";
136 else OS<<"***UNKNOWN***";
137 if (T!=STANDARD_TYPE(Geom2d_TrimmedCurve)) OS<<"2D";
143 //=======================================================================
146 //=======================================================================
148 Standard_OStream& TopOpeBRepDS_Dumper::Print(const gp_Pnt&
152 ,Standard_OStream& OS)
155 OS<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<" ";
162 //=======================================================================
165 //=======================================================================
167 Standard_OStream& TopOpeBRepDS_Dumper::Print(const gp_Pnt2d&
171 ,Standard_OStream& OS)
174 OS<<P.X()<<" "<<P.Y()<<" ";
181 //=======================================================================
184 //=======================================================================
186 Standard_OStream& TopOpeBRepDS_Dumper::Print(const Handle(Geom_BSplineCurve)&
190 ,Standard_OStream& OS
191 ,const Standard_Boolean
198 Standard_Integer i,l,lb = 0,n;
200 Standard_Integer degree = B->Degree();
201 Standard_Integer nbpoles = B->NbPoles();
202 Standard_Integer nbknots = B->NbKnots();
203 Standard_Boolean rational = B->IsRational();
204 Standard_Boolean periodic = B->IsPeriodic();
206 OS<<"BSplineCurve : ";
207 if (periodic) OS<<"periodic, ";
208 OS<<"degree "<<degree<<", "<<nbpoles<<" poles, "<<nbknots<<" knots"<<endl;
210 //l = strlen("poles : ") + 1
211 for (i = 1,OS<<"poles : ",l = 9,n = nbpoles;
214 if (!compact) { if (i == 1) lb = 0; else lb = l; }
215 else if (i == 1) lb = 0;
216 else if (i == 2) lb = l;
219 if(n > 4) OS << setw(lb) << "\t ...\n";
221 else if (i == n) lb = l;
224 OS<<setw(lb)<<i<<" : ";
225 TopOpeBRepDS_Dumper::Print(B->Pole(i),OS);
226 if (rational) OS<<" "<<B->Weight(i);
231 //l = strlen("knots : ") + 1
232 for (i = 1,OS<<"knots : ",l = 9,n = nbknots;
235 if (!compact) { if (i == 1) lb = 0; else lb = l; }
236 else if (i == 1) lb = 0;
237 else if (i == 2) lb = l;
239 if(n > 4) OS << setw(lb) << "\t ...\n";
242 else if (i == n) lb = l;
245 OS<<setw(lb)<<i<<" : ";
246 OS<<B->Knot(i)<<" "<<B->Multiplicity(i);
256 //=======================================================================
259 //=======================================================================
261 Standard_OStream& TopOpeBRepDS_Dumper::Print(const Handle(Geom2d_BSplineCurve)&
265 ,Standard_OStream& OS
266 ,const Standard_Boolean
273 Standard_Integer i,l,lb=-1,n;
275 Standard_Integer degree = B->Degree();
276 Standard_Integer nbpoles = B->NbPoles();
277 Standard_Integer nbknots = B->NbKnots();
278 Standard_Boolean rational = B->IsRational();
279 Standard_Boolean periodic = B->IsPeriodic();
281 OS<<"BSplineCurve : ";
282 if (periodic) OS<<"periodic, ";
283 OS<<"degree "<<degree<<", "<<nbpoles<<" poles, "<<nbknots<<" knots"<<endl;
285 //l = strlen("poles : ") + 1
286 for (i = 1,OS<<"poles : ",l = 9,n = nbpoles;
289 if (!compact) { if (i == 1) lb = 0; else lb = l; }
290 else if (i == 1) lb = 0;
291 else if (i == 2) lb = l;
294 if(n > 4) OS << setw(lb) << "\t ...\n";
296 else if (i == n) lb = l;
299 OS<<setw(lb)<<i<<" : ";
300 TopOpeBRepDS_Dumper::Print(B->Pole(i),OS);
301 if (rational) OS<<" "<<B->Weight(i);
306 //l = strlen("knots : ") + 1
307 for (i = 1,OS<<"knots : ",l = 9,n = nbknots;
310 if (!compact) { if (i == 1) lb = 0; else lb = l; }
311 else if (i == 1) lb = 0;
312 else if (i == 2) lb = l;
315 if(n > 4) OS << setw(lb) << "\t ...\n";
317 else if (i == n) lb = l;
320 OS<<setw(lb)<<i<<" : ";
321 OS<<B->Knot(i)<<" "<<B->Multiplicity(i);
331 //=======================================================================
334 //=======================================================================
336 Standard_OStream& TopOpeBRepDS_Dumper::Print(const Handle(Geom_Curve)&
340 ,Standard_OStream& OS
341 ,const Standard_Boolean
348 #define DBSP3D(tut) (*((Handle(Geom_BSplineCurve)*)&(tut)))
350 if (C->DynamicType() == STANDARD_TYPE(Geom_BSplineCurve))
351 TopOpeBRepDS_Dumper::Print(DBSP3D(C),OS,compact);
353 GeomTools_CurveSet::PrintCurve(C,OS,Standard_False);
361 //=======================================================================
364 //=======================================================================
367 Standard_OStream& TopOpeBRepDS_Dumper::Print(const Handle(Geom2d_Curve)& C,
368 Standard_OStream& OS,const Standard_Boolean compact)
370 #define DBSP2D(tut) (*((Handle(Geom2d_BSplineCurve)*)&(tut)))
372 if (C->DynamicType() == STANDARD_TYPE(Geom2d_BSplineCurve))
373 TopOpeBRepDS_Dumper::Print(DBSP2D(C),OS,compact);
375 GeomTools_Curve2dSet::PrintCurve2d(C,OS,Standard_False);
382 // DUMP OF HDATASTRUCTURE
384 //-----------------------------------------------------------------------
386 //unreferenced function, commented
387 /*static void souligne(const TCollection_AsciiString& t,Standard_OStream& OS,const char c = '-')
388 { for(char i=0;i<t.Length();i++)OS<<c; }*/
389 //-----------------------------------------------------------------------
390 // print the name of a Kind on a AsciiString.
391 static TCollection_AsciiString& Print(const TopOpeBRepDS_Kind k,TCollection_AsciiString& s)
394 case TopOpeBRepDS_SURFACE : s.AssignCat("SURFACE");break;
395 case TopOpeBRepDS_CURVE : s.AssignCat("CURVE");break;
396 case TopOpeBRepDS_POINT : s.AssignCat("POINT");break;
397 case TopOpeBRepDS_SOLID : s.AssignCat("SOLID");break;
398 case TopOpeBRepDS_SHELL : s.AssignCat("SHELL");break;
399 case TopOpeBRepDS_FACE : s.AssignCat("FACE");break;
400 case TopOpeBRepDS_WIRE : s.AssignCat("WIRE");break;
401 case TopOpeBRepDS_EDGE : s.AssignCat("EDGE");break;
402 case TopOpeBRepDS_VERTEX : s.AssignCat("VERTEX");break;
411 //=======================================================================
414 //=======================================================================
416 Standard_OStream& TopOpeBRepDS_Dumper::Dump(Standard_OStream& OS
417 ,const Standard_Boolean
421 ,const Standard_Boolean
428 OS<<endl<<"==== HDS start filling resume"<<endl;
429 DumpGeometry(OS,findkeep,compact);
431 OS<<endl<<"==== HDS end filling resume"<<endl;
437 //=======================================================================
438 //function : DumpGeometry
440 //=======================================================================
441 Standard_OStream& TopOpeBRepDS_Dumper::DumpGeometry(Standard_OStream& OS
442 ,const Standard_Boolean
446 ,const Standard_Boolean
453 DumpGeometry(TopOpeBRepDS_POINT,OS,findkeep,compact);
454 DumpGeometry(TopOpeBRepDS_CURVE,OS,findkeep,compact);
455 DumpGeometry(TopOpeBRepDS_SURFACE,OS,findkeep,compact);
461 //=======================================================================
462 //function : DumpGeometry
464 //=======================================================================
466 Standard_OStream& TopOpeBRepDS_Dumper::DumpGeometry
467 (const TopOpeBRepDS_Kind
471 ,Standard_OStream& OS
472 ,const Standard_Boolean
476 ,const Standard_Boolean
483 if ( ! TopOpeBRepDS::IsGeometry(K) ) return OS;
484 Standard_Integer nt = myHDS->NbGeometry(K);
487 Standard_Integer n=0;
488 if (K==TopOpeBRepDS_POINT){TopOpeBRepDS_PointExplorer ex(myHDS->DS(),findkeep);n=ex.NbPoint();}
489 else if(K==TopOpeBRepDS_CURVE){TopOpeBRepDS_CurveExplorer ex(myHDS->DS());n=ex.NbCurve();}
490 else if(K==TopOpeBRepDS_SURFACE){TopOpeBRepDS_SurfaceExplorer ex(myHDS->DS());n=ex.NbSurface();}
492 TCollection_AsciiString s = "---- "; ::Print(K,s);
493 OS<<endl<<s<<" : "<<n<<endl;
494 for(Standard_Integer i=1;i<=nt;i++) DumpGeometry(K,i,OS,findkeep,compact);
499 //=======================================================================
500 //function : DumpGeometry
502 //=======================================================================
504 Standard_OStream& TopOpeBRepDS_Dumper::DumpGeometry(const TopOpeBRepDS_Kind
508 ,const Standard_Integer
512 ,Standard_OStream& OS,
513 const Standard_Boolean
517 ,const Standard_Boolean
524 if ( ! TopOpeBRepDS::IsGeometry(K) ) return OS;
526 if ( K == TopOpeBRepDS_POINT ) {
527 TopOpeBRepDS_PointExplorer pex(myHDS->DS());
528 Standard_Boolean isp = pex.IsPoint(I);
529 Standard_Boolean isk = pex.IsPointKeep(I);
530 if(!findkeep || isk) {
531 TCollection_AsciiString kstr;::Print(K,kstr);kstr=kstr+" "+I+" :";
532 Standard_Integer lk = kstr.Length();
535 const TopOpeBRepDS_Point& PDS = pex.Point(I);
536 OS<<" (K:"<<((isk)?"1":"0") <<")"<<endl;
537 OS<<"tol = "<<PDS.Tolerance()<<endl;
538 TCollection_AsciiString istr(lk,' ');
539 const gp_Pnt& P = PDS.Point();
540 OS<<istr; OS<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<endl;
542 else OS<<"unbounded"<<endl;
545 else if ( K == TopOpeBRepDS_CURVE ) {
546 TopOpeBRepDS_CurveExplorer cex(myHDS->DS());
547 Standard_Boolean isc = cex.IsCurve(I);
548 Standard_Boolean isk = cex.IsCurveKeep(I);
549 if(!findkeep || isk) {
550 TCollection_AsciiString kstr;::Print(K,kstr);kstr=kstr+" "+I+" :";
551 Standard_Integer lk = kstr.Length();
554 const TopOpeBRepDS_Curve& CDS = cex.Curve(I);
555 OS<<" (K:"<<((isk)?"1":"0")<<")";
556 OS<<" (M:"<<CDS.Mother()<<")"<<endl;
557 TCollection_AsciiString istr(lk+1,' ');
558 OS<<istr;PrintType(CDS.Curve(),OS);
559 OS<<" tol = "<<CDS.Tolerance()<<endl;
560 Standard_Real first,last;
561 if(CDS.Range(first,last))
562 OS<<istr<<"first = "<<first<<" last = "<<last<<endl;
563 TopOpeBRepDS_InterferenceIterator it(myHDS->DS().CurveInterferences(I));
564 for (;it.More();it.Next()) it.Value()->Dump(OS,istr,"\n");
566 const Handle(TopOpeBRepDS_Interference)& SCI1 = CDS.GetSCI1();
567 const Handle(TopOpeBRepDS_Interference)& SCI2 = CDS.GetSCI2();
568 Handle(Geom2d_Curve) PC1,PC2;
570 PC1 = Handle(TopOpeBRepDS_SurfaceCurveInterference)::DownCast(SCI1)->PCurve();
572 PC2 = Handle(TopOpeBRepDS_SurfaceCurveInterference)::DownCast(SCI2)->PCurve();
574 OS<<istr;OS<<"PC(SCI1) : ";Print(PC1,cout,compact);
575 OS<<istr;OS<<"PC(SCI2) : ";Print(PC2,cout,compact);
579 else OS<<"unbounded"<<endl;
583 else if ( K == TopOpeBRepDS_SURFACE ) {
584 TopOpeBRepDS_SurfaceExplorer sex(myHDS->DS());
585 Standard_Boolean iss = sex.IsSurface(I);
586 Standard_Boolean isk = sex.IsSurfaceKeep(I);
587 if(!findkeep || isk) {
588 TCollection_AsciiString kstr; ::Print(K,kstr); kstr=kstr+" "+I+" : ";
589 Standard_Integer lk = kstr.Length();
592 const TopOpeBRepDS_Surface& SDS = sex.Surface(I);
593 OS<<" (K:"<<((isk)?"1":"0") <<")"<<endl;
594 OS<<"tol = "<<SDS.Tolerance()<<endl;
596 TCollection_AsciiString istr(lk,' ');
597 TopOpeBRepDS_InterferenceIterator it(myHDS->SurfaceCurves(I));
598 for (;it.More();it.Next()) {
599 OS<<istr; it.Value()->Dump(OS);OS<<endl;
603 else OS<<"unbounded"<<endl;
614 // = = = = = = = T O P O L O G Y
616 //=======================================================================
617 //function : DumpTopology
619 //=======================================================================
620 Standard_OStream& TopOpeBRepDS_Dumper::DumpTopology(Standard_OStream& OS) const
623 DumpTopology(TopOpeBRepDS_VERTEX,OS);
624 DumpTopology(TopOpeBRepDS_EDGE,OS);
625 DumpTopology(TopOpeBRepDS_WIRE,OS);
626 DumpTopology(TopOpeBRepDS_FACE,OS);
627 DumpTopology(TopOpeBRepDS_SHELL,OS);
628 DumpTopology(TopOpeBRepDS_SOLID,OS);
629 DumpSectionEdge(TopOpeBRepDS_EDGE,OS);
634 //=======================================================================
635 //function : DumpTopology
637 //=======================================================================
638 Standard_OStream& TopOpeBRepDS_Dumper::DumpTopology(const TopOpeBRepDS_Kind
642 ,Standard_OStream& OS) const
645 if ( ! TopOpeBRepDS::IsTopology(K) ) return OS;
646 Standard_Integer nk = myHDS->NbTopology(K);
647 if ( ! nk ) return OS;
650 TCollection_AsciiString s = "---- "; ::Print(K,s);
651 Standard_Integer nt = myHDS->NbTopology();
652 OS<<s<<" : "<<nk<<"/"<<nt<<" shapes"<<endl;
653 for(Standard_Integer i = 1; i <= nt; i++) DumpTopology(K,i,OS);
658 //=======================================================================
659 //function : DumpTopology
661 //=======================================================================
662 Standard_OStream& TopOpeBRepDS_Dumper::DumpTopology(const TopAbs_ShapeEnum
666 ,Standard_OStream& OS) const
669 DumpTopology(TopOpeBRepDS::ShapeToKind(T),OS);
674 //=======================================================================
675 //function : DumpSectionEdge
677 //=======================================================================
679 Standard_OStream& TopOpeBRepDS_Dumper::DumpSectionEdge(const TopOpeBRepDS_Kind
683 ,Standard_OStream& OS) const
686 Standard_Integer nse = myHDS->DS().NbSectionEdges();
687 if ( ! nse ) return OS;
690 TCollection_AsciiString s = "---- ";
691 OS<<s<<"Section Edges : "<<nse<<" edges"<<endl;
692 for(Standard_Integer i = 1; i <= nse; i++) {
693 DumpSectionEdge(K,i,OS);
699 //=======================================================================
700 //function : DumpSectionEdge
702 //=======================================================================
703 Standard_OStream& TopOpeBRepDS_Dumper::DumpSectionEdge(const TopOpeBRepDS_Kind K,const Standard_Integer I,Standard_OStream& OS) const
705 Standard_Boolean SEFindKeep = Standard_False;
706 const TopOpeBRepDS_DataStructure& DS = myHDS->DS();
707 const TopoDS_Shape& E = DS.SectionEdge(I,SEFindKeep);
708 if(E.IsNull()) return OS;
709 Standard_Integer it = myHDS->DS().Shape(E,SEFindKeep);
711 // E trouvee "Restriction" par les intersections n'est pas dans la DS.
712 OS<<endl<<"EDGE section "<<I<<" non Shape()"<<endl;
714 else DumpTopology(K,it,OS);
718 Standard_EXPORT Standard_Integer TopOpeBRepDS_GLOBALHDSinterfselector = 0; // NYI arg of Dump method
720 //=======================================================================
721 //function : DumpTopology
723 //=======================================================================
724 Standard_OStream& TopOpeBRepDS_Dumper::DumpTopology(const TopOpeBRepDS_Kind
728 ,const Standard_Integer
732 ,Standard_OStream& OS) const
735 Standard_Boolean fk = Standard_False;
736 const TopOpeBRepDS_DataStructure& DS = myHDS->DS();
737 if ( ! TopOpeBRepDS::IsTopology(K) ) return OS;
738 if ( I <= 0 ) return OS;
739 TopAbs_ShapeEnum t = TopOpeBRepDS::KindToShape(K);
741 if ( DS.Shape(I,fk).ShapeType() != t ) return OS;
742 Standard_Integer rankI = DS.AncestorRank(I);
743 TCollection_AsciiString s1,s2;
744 if(DS.KeepShape(I)) {
745 s1 = ((rankI == 1) ? (char*) "*" : (char*) "");
746 s2 = ((rankI == 2) ? (char*) "*" : (char*) "");
749 s1 = ((rankI == 1) ? (char*) "~" : (char*) "");
750 s2 = ((rankI == 2) ? (char*) "~" : (char*) "");
752 TCollection_AsciiString ss = TopOpeBRepDS::SPrint(K,I,s1,s2);
754 if ( t == TopAbs_VERTEX ) {
755 Standard_Integer lk = ss.Length() + 3;
756 TCollection_AsciiString istr(lk,' ');
757 gp_Pnt P = TopOpeBRepTool_ShapeTool::Pnt(DS.Shape(I,fk));
758 Standard_Real tol = TopOpeBRepTool_ShapeTool::Tolerance(DS.Shape(I,fk));
760 OS<<"tol = "<<tol<<endl;
761 OS<<istr; OS<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<endl;
764 Standard_Integer lss = ss.Length();TCollection_AsciiString bss(lss,' ');
768 TopOpeBRepDS_InterferenceIterator it; it.Init(DS.ShapeInterferences(I));
770 OS<<" interferences :\n";
771 for (;it.More();it.Next()) {
772 const Handle(TopOpeBRepDS_Interference)& IR = it.Value(); Standard_Boolean s = Standard_True;
773 if (TopOpeBRepDS_GLOBALHDSinterfselector == 1)
774 s = !(Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(IR)).IsNull();
775 if (s) IR->Dump(OS,"","\n");
778 else OS<<" has no interference\n";
781 const TopoDS_Shape& S = myHDS->Shape(I,fk);
782 if ( myHDS->HasSameDomain(S) ) {
783 const TopTools_ListOfShape& L = myHDS->DS().ShapeSameDomain(S);
785 OS<<ss<<" same domain (r,o) : "<<SDumpRefOri(S)<<endl;
786 OS<<SPrintShapeRefOri(L,bss+" same domain shapes : ");
795 //=======================================================================
796 //function : DumpTopology
798 //=======================================================================
799 Standard_OStream& TopOpeBRepDS_Dumper::DumpTopology(const TopAbs_ShapeEnum
803 ,const Standard_Integer
807 ,Standard_OStream& OS) const
810 DumpTopology(TopOpeBRepDS::ShapeToKind(T),I,OS);
815 //=======================================================================
816 //function : SDumpRefOri
818 //=======================================================================
820 TCollection_AsciiString TopOpeBRepDS_Dumper::SDumpRefOri(const TopOpeBRepDS_Kind K,const Standard_Integer I) const
822 TCollection_AsciiString SS;
823 Standard_Boolean fk = Standard_False;
824 const TopOpeBRepDS_DataStructure& DS = myHDS->DS();
825 if ( ! TopOpeBRepDS::IsTopology(K) ) return SS;
826 TopAbs_ShapeEnum t = TopOpeBRepDS::KindToShape(K);
827 if ( DS.Shape(I,fk).ShapeType() != t ) return SS;
828 const TopoDS_Shape& S = myHDS->Shape(I,fk);
829 Standard_Integer r = myHDS->SameDomainReference(S);
830 TopOpeBRepDS_Config o = myHDS->SameDomainOrientation(S);
831 SS=SS+"("+SPrintShape(r)+","+TopOpeBRepDS::SPrint(o)+")";
835 //=======================================================================
836 //function : SDumpRefOri
838 //=======================================================================
840 TCollection_AsciiString TopOpeBRepDS_Dumper::SDumpRefOri(const TopoDS_Shape& S) const
842 TCollection_AsciiString SS;
843 TopOpeBRepDS_Kind k = TopOpeBRepDS::ShapeToKind(S.ShapeType());
844 Standard_Boolean fk = Standard_False;
845 Standard_Integer i = myHDS->Shape(S,fk);
846 SS = SDumpRefOri(k,i);
850 //=======================================================================
851 //function : DumpRefOri
853 //=======================================================================
855 Standard_OStream& TopOpeBRepDS_Dumper::DumpRefOri(const TopOpeBRepDS_Kind
859 ,const Standard_Integer
863 ,Standard_OStream& OS) const
866 OS<<SDumpRefOri(K,I);OS.flush();
871 //=======================================================================
872 //function : DumpRefOri
874 //=======================================================================
876 Standard_OStream& TopOpeBRepDS_Dumper::DumpRefOri(const TopoDS_Shape&
880 ,Standard_OStream& OS) const
883 OS<<SDumpRefOri(S);OS.flush();
888 //=======================================================================
891 //=======================================================================
893 Standard_OStream& TopOpeBRepDS_Dumper::DumpLOI(
894 const TopOpeBRepDS_ListOfInterference&
898 ,Standard_OStream& OS,
899 const TCollection_AsciiString&
907 TopOpeBRepDS_InterferenceIterator IT(L); if (!IT.More()) { OS<<"NO INTERFERENCE"<<endl; return OS; }
909 for (Standard_Integer ip = 1; IT.More(); IT.Next(),ip++ ) {
910 const Handle(TopOpeBRepDS_Interference)& I = IT.Value();
911 TCollection_AsciiString s(ip); s = s + "/ ";
919 //=======================================================================
922 //=======================================================================
923 Standard_OStream& TopOpeBRepDS_Dumper::DumpI(
924 const Handle(TopOpeBRepDS_Interference)&
928 ,Standard_OStream& OS
929 ,const TCollection_AsciiString&
933 ,const TCollection_AsciiString&
940 Standard_Boolean fk = Standard_False;
942 if (I.IsNull()) { OS<<"NULL INTERFERENCE"<<str2; return OS; }
943 Standard_Integer G = I->Geometry(); TopOpeBRepDS_Kind GK = I->GeometryType();
945 if (GK == TopOpeBRepDS_POINT) {
946 gp_Pnt P = myHDS->Point(G).Point();
947 OS<<" P = "<<P.X()<<" "<<P.Y()<<" "<<P.Z();
949 else if (GK == TopOpeBRepDS_VERTEX) {
950 gp_Pnt P = TopOpeBRepTool_ShapeTool::Pnt(myHDS->Shape(G,fk));
951 OS<<" V = "<<P.X()<<" "<<P.Y()<<" "<<P.Z();
959 //=======================================================================
960 //function : SPrintShape
962 //=======================================================================
964 TCollection_AsciiString TopOpeBRepDS_Dumper::SPrintShape(const Standard_Integer IS) const
966 TCollection_AsciiString SS;
967 const TopOpeBRepDS_DataStructure& BDS = myHDS->DS(); if ( IS<1 || IS>BDS.NbShapes()) return SS;
968 SS = SPrintShape(BDS.Shape(IS));
972 //=======================================================================
973 //function : SPrintShape
975 //=======================================================================
977 TCollection_AsciiString TopOpeBRepDS_Dumper::SPrintShape(const TopoDS_Shape& S) const
979 const TopOpeBRepDS_DataStructure& BDS = myHDS->DS();
980 const Standard_Integer IS = myHDS->DS().Shape(S);
981 Standard_Integer rankIS = BDS.AncestorRank(IS);
982 //JR/Hp TCollection_AsciiString s1,s2;
983 Standard_CString s1,s2;
984 if(BDS.KeepShape(IS)) {
985 s1 = (Standard_CString ) ((rankIS == 1) ? "*" : "");
986 s2 = (Standard_CString ) ((rankIS == 2) ? "*" : "");
989 s1 = (Standard_CString ) ((rankIS == 1) ? "~" : "");
990 s2 = (Standard_CString ) ((rankIS == 2) ? "~" : "");
992 TCollection_AsciiString sse = TopOpeBRepDS::SPrint(TopOpeBRepDS::ShapeToKind(S.ShapeType()),IS,s1,s2);
996 //=======================================================================
997 //function : SPrintShapeRefOri
999 //=======================================================================
1001 TCollection_AsciiString TopOpeBRepDS_Dumper::SPrintShapeRefOri(const TopoDS_Shape& S,const TCollection_AsciiString& astr) const
1002 { TCollection_AsciiString SS=astr+SPrintShape(S)+" "+SDumpRefOri(S); return SS; }
1004 //=======================================================================
1005 //function : SPrintShapeRefOri
1007 //=======================================================================
1009 TCollection_AsciiString TopOpeBRepDS_Dumper::SPrintShapeRefOri(const TopTools_ListOfShape& L,const TCollection_AsciiString& astr) const
1011 TCollection_AsciiString SS;TopTools_ListIteratorOfListOfShape it(L); if (!it.More()) return SS;
1012 SS=SS+astr; TCollection_AsciiString bst(astr.Length(),' ');
1013 for(Standard_Integer il = 0; it.More(); it.Next(),il++) {
1014 TCollection_AsciiString ss=SPrintShapeRefOri(it.Value());if (il) ss=bst+ss; SS=SS+ss+"\n";