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
9 // under the terms of the GNU Lesser General Public version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <Standard_Stream.hxx>
18 #include <TopOpeBRepDS_Dumper.ixx>
19 #include <TopoDS_Edge.hxx>
21 #include <TopOpeBRepDS_SurfaceCurveInterference.hxx>
22 #include <TopOpeBRepDS_CurveIterator.hxx>
23 #include <TopOpeBRepDS_Point.hxx>
24 #include <TopOpeBRepDS_Curve.hxx>
25 #include <TopOpeBRepDS_Surface.hxx>
26 #include <TopOpeBRepDS_PointExplorer.hxx>
27 #include <TopOpeBRepDS_CurveExplorer.hxx>
28 #include <TopOpeBRepDS_SurfaceExplorer.hxx>
29 #include <TopOpeBRepDS.hxx>
31 #include <TopoDS_Edge.hxx>
32 #include <TopoDS_Shape.hxx>
33 #include <TopOpeBRepTool_ShapeTool.hxx>
35 #include <Geom_Circle.hxx>
36 #include <Geom_Line.hxx>
37 #include <Geom_Ellipse.hxx>
38 #include <Geom_Parabola.hxx>
39 #include <Geom_Hyperbola.hxx>
40 #include <Geom_BezierCurve.hxx>
41 #include <Geom_BSplineCurve.hxx>
42 #include <Geom_TrimmedCurve.hxx>
43 #include <Geom_OffsetCurve.hxx>
44 #include <Geom2d_Circle.hxx>
45 #include <Geom2d_Line.hxx>
46 #include <Geom2d_Ellipse.hxx>
47 #include <Geom2d_Parabola.hxx>
48 #include <Geom2d_Hyperbola.hxx>
49 #include <Geom2d_BezierCurve.hxx>
50 #include <Geom2d_BSplineCurve.hxx>
51 #include <Geom2d_TrimmedCurve.hxx>
52 #include <Geom2d_OffsetCurve.hxx>
53 #include <GeomTools_CurveSet.hxx>
54 #include <GeomTools_Curve2dSet.hxx>
57 #include <TopOpeBRepDS_define.hxx>
59 //=======================================================================
60 //function : TopOpeBRepDS_Dumper::TopOpeBRepDS_Dumper
62 //=======================================================================
64 TopOpeBRepDS_Dumper::TopOpeBRepDS_Dumper(const Handle(TopOpeBRepDS_HDataStructure)& HDS)
69 //=======================================================================
70 //function : PrintType
72 //=======================================================================
74 Standard_OStream& TopOpeBRepDS_Dumper::PrintType(const Handle(Geom_Curve)&
78 ,Standard_OStream& OS)
85 Handle(Standard_Type) T = C->DynamicType();
86 if (T==STANDARD_TYPE(Geom_Circle)) OS<<"CIRCLE";
87 else if (T==STANDARD_TYPE(Geom_Line)) OS<<"LINE";
88 else if (T==STANDARD_TYPE(Geom_Ellipse)) OS<<"ELLIPSE";
89 else if (T==STANDARD_TYPE(Geom_Parabola)) OS<<"ELLIPSE";
90 else if (T==STANDARD_TYPE(Geom_Hyperbola)) OS<<"HYPERBOLA";
91 else if (T==STANDARD_TYPE(Geom_BezierCurve)) OS<<"BEZIER";
92 else if (T==STANDARD_TYPE(Geom_BSplineCurve))
93 OS<<"BSPLINE("<<(*((Handle(Geom_BSplineCurve)*)&C))->Degree()<<")";
94 else if (T==STANDARD_TYPE(Geom_TrimmedCurve))
95 {OS<<"TRIMMED ";PrintType(Handle(Geom_TrimmedCurve)::DownCast(C)->BasisCurve(),OS);}
96 else if (T==STANDARD_TYPE(Geom_OffsetCurve)) OS<<"OFFSETCURVE";
97 else OS<<"***UNKNOWN***";
98 if (T!=STANDARD_TYPE(Geom_TrimmedCurve)) OS<<"3D";
104 //=======================================================================
105 //function : PrintType
107 //=======================================================================
109 Standard_OStream& TopOpeBRepDS_Dumper::PrintType(const Handle(Geom2d_Curve)&
113 ,Standard_OStream& OS)
120 Handle(Standard_Type) T = C->DynamicType();
121 if (T==STANDARD_TYPE(Geom2d_Circle)) OS<<"CIRCLE";
122 else if (T==STANDARD_TYPE(Geom2d_Line)) OS<<"LINE";
123 else if (T==STANDARD_TYPE(Geom2d_Ellipse)) OS<<"ELLIPSE";
124 else if (T==STANDARD_TYPE(Geom2d_Parabola)) OS<<"ELLIPSE";
125 else if (T==STANDARD_TYPE(Geom2d_Hyperbola)) OS<<"HYPERBOLA";
126 else if (T==STANDARD_TYPE(Geom2d_BezierCurve)) OS<<"BEZIER";
127 else if (T==STANDARD_TYPE(Geom2d_BSplineCurve))
128 OS<<"BSPLINE("<<(*((Handle(Geom2d_BSplineCurve)*)&C))->Degree()<<")";
129 else if (T==STANDARD_TYPE(Geom2d_TrimmedCurve))
130 {OS<<"TRIMMED ";PrintType(Handle(Geom2d_TrimmedCurve)::DownCast(C)->BasisCurve(),OS);}
131 else if (T==STANDARD_TYPE(Geom2d_OffsetCurve)) OS<<"OFFSETCURVE";
132 else OS<<"***UNKNOWN***";
133 if (T!=STANDARD_TYPE(Geom2d_TrimmedCurve)) OS<<"2D";
139 //=======================================================================
142 //=======================================================================
144 Standard_OStream& TopOpeBRepDS_Dumper::Print(const gp_Pnt&
148 ,Standard_OStream& OS)
151 OS<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<" ";
158 //=======================================================================
161 //=======================================================================
163 Standard_OStream& TopOpeBRepDS_Dumper::Print(const gp_Pnt2d&
167 ,Standard_OStream& OS)
170 OS<<P.X()<<" "<<P.Y()<<" ";
177 //=======================================================================
180 //=======================================================================
182 Standard_OStream& TopOpeBRepDS_Dumper::Print(const Handle(Geom_BSplineCurve)&
186 ,Standard_OStream& OS
187 ,const Standard_Boolean
194 Standard_Integer i,l,lb = 0,n;
196 Standard_Integer degree = B->Degree();
197 Standard_Integer nbpoles = B->NbPoles();
198 Standard_Integer nbknots = B->NbKnots();
199 Standard_Boolean rational = B->IsRational();
200 Standard_Boolean periodic = B->IsPeriodic();
202 OS<<"BSplineCurve : ";
203 if (periodic) OS<<"periodic, ";
204 OS<<"degree "<<degree<<", "<<nbpoles<<" poles, "<<nbknots<<" knots"<<endl;
206 //l = strlen("poles : ") + 1
207 for (i = 1,OS<<"poles : ",l = 9,n = nbpoles;
210 if (!compact) { if (i == 1) lb = 0; else lb = l; }
211 else if (i == 1) lb = 0;
212 else if (i == 2) lb = l;
215 if(n > 4) OS << setw(lb) << "\t ...\n";
217 else if (i == n) lb = l;
220 OS<<setw(lb)<<i<<" : ";
221 TopOpeBRepDS_Dumper::Print(B->Pole(i),OS);
222 if (rational) OS<<" "<<B->Weight(i);
227 //l = strlen("knots : ") + 1
228 for (i = 1,OS<<"knots : ",l = 9,n = nbknots;
231 if (!compact) { if (i == 1) lb = 0; else lb = l; }
232 else if (i == 1) lb = 0;
233 else if (i == 2) lb = l;
235 if(n > 4) OS << setw(lb) << "\t ...\n";
238 else if (i == n) lb = l;
241 OS<<setw(lb)<<i<<" : ";
242 OS<<B->Knot(i)<<" "<<B->Multiplicity(i);
252 //=======================================================================
255 //=======================================================================
257 Standard_OStream& TopOpeBRepDS_Dumper::Print(const Handle(Geom2d_BSplineCurve)&
261 ,Standard_OStream& OS
262 ,const Standard_Boolean
269 Standard_Integer i,l,lb=-1,n;
271 Standard_Integer degree = B->Degree();
272 Standard_Integer nbpoles = B->NbPoles();
273 Standard_Integer nbknots = B->NbKnots();
274 Standard_Boolean rational = B->IsRational();
275 Standard_Boolean periodic = B->IsPeriodic();
277 OS<<"BSplineCurve : ";
278 if (periodic) OS<<"periodic, ";
279 OS<<"degree "<<degree<<", "<<nbpoles<<" poles, "<<nbknots<<" knots"<<endl;
281 //l = strlen("poles : ") + 1
282 for (i = 1,OS<<"poles : ",l = 9,n = nbpoles;
285 if (!compact) { if (i == 1) lb = 0; else lb = l; }
286 else if (i == 1) lb = 0;
287 else if (i == 2) lb = l;
290 if(n > 4) OS << setw(lb) << "\t ...\n";
292 else if (i == n) lb = l;
295 OS<<setw(lb)<<i<<" : ";
296 TopOpeBRepDS_Dumper::Print(B->Pole(i),OS);
297 if (rational) OS<<" "<<B->Weight(i);
302 //l = strlen("knots : ") + 1
303 for (i = 1,OS<<"knots : ",l = 9,n = nbknots;
306 if (!compact) { if (i == 1) lb = 0; else lb = l; }
307 else if (i == 1) lb = 0;
308 else if (i == 2) lb = l;
311 if(n > 4) OS << setw(lb) << "\t ...\n";
313 else if (i == n) lb = l;
316 OS<<setw(lb)<<i<<" : ";
317 OS<<B->Knot(i)<<" "<<B->Multiplicity(i);
327 //=======================================================================
330 //=======================================================================
332 Standard_OStream& TopOpeBRepDS_Dumper::Print(const Handle(Geom_Curve)&
336 ,Standard_OStream& OS
337 ,const Standard_Boolean
344 #define DBSP3D(tut) (*((Handle(Geom_BSplineCurve)*)&(tut)))
346 if (C->DynamicType() == STANDARD_TYPE(Geom_BSplineCurve))
347 TopOpeBRepDS_Dumper::Print(DBSP3D(C),OS,compact);
349 GeomTools_CurveSet::PrintCurve(C,OS,Standard_False);
357 //=======================================================================
360 //=======================================================================
363 Standard_OStream& TopOpeBRepDS_Dumper::Print(const Handle(Geom2d_Curve)& C,
364 Standard_OStream& OS,const Standard_Boolean compact)
366 #define DBSP2D(tut) (*((Handle(Geom2d_BSplineCurve)*)&(tut)))
368 if (C->DynamicType() == STANDARD_TYPE(Geom2d_BSplineCurve))
369 TopOpeBRepDS_Dumper::Print(DBSP2D(C),OS,compact);
371 GeomTools_Curve2dSet::PrintCurve2d(C,OS,Standard_False);
378 // DUMP OF HDATASTRUCTURE
380 //-----------------------------------------------------------------------
382 //unreferenced function, commented
383 /*static void souligne(const TCollection_AsciiString& t,Standard_OStream& OS,const char c = '-')
384 { for(char i=0;i<t.Length();i++)OS<<c; }*/
385 //-----------------------------------------------------------------------
386 // print the name of a Kind on a AsciiString.
387 static TCollection_AsciiString& Print(const TopOpeBRepDS_Kind k,TCollection_AsciiString& s)
390 case TopOpeBRepDS_SURFACE : s.AssignCat("SURFACE");break;
391 case TopOpeBRepDS_CURVE : s.AssignCat("CURVE");break;
392 case TopOpeBRepDS_POINT : s.AssignCat("POINT");break;
393 case TopOpeBRepDS_SOLID : s.AssignCat("SOLID");break;
394 case TopOpeBRepDS_SHELL : s.AssignCat("SHELL");break;
395 case TopOpeBRepDS_FACE : s.AssignCat("FACE");break;
396 case TopOpeBRepDS_WIRE : s.AssignCat("WIRE");break;
397 case TopOpeBRepDS_EDGE : s.AssignCat("EDGE");break;
398 case TopOpeBRepDS_VERTEX : s.AssignCat("VERTEX");break;
407 //=======================================================================
410 //=======================================================================
412 Standard_OStream& TopOpeBRepDS_Dumper::Dump(Standard_OStream& OS
413 ,const Standard_Boolean
417 ,const Standard_Boolean
424 OS<<endl<<"==== HDS start filling resume"<<endl;
425 DumpGeometry(OS,findkeep,compact);
427 OS<<endl<<"==== HDS end filling resume"<<endl;
433 //=======================================================================
434 //function : DumpGeometry
436 //=======================================================================
437 Standard_OStream& TopOpeBRepDS_Dumper::DumpGeometry(Standard_OStream& OS
438 ,const Standard_Boolean
442 ,const Standard_Boolean
449 DumpGeometry(TopOpeBRepDS_POINT,OS,findkeep,compact);
450 DumpGeometry(TopOpeBRepDS_CURVE,OS,findkeep,compact);
451 DumpGeometry(TopOpeBRepDS_SURFACE,OS,findkeep,compact);
457 //=======================================================================
458 //function : DumpGeometry
460 //=======================================================================
462 Standard_OStream& TopOpeBRepDS_Dumper::DumpGeometry
463 (const TopOpeBRepDS_Kind
467 ,Standard_OStream& OS
468 ,const Standard_Boolean
472 ,const Standard_Boolean
479 if ( ! TopOpeBRepDS::IsGeometry(K) ) return OS;
480 Standard_Integer nt = myHDS->NbGeometry(K);
483 Standard_Integer n=0;
484 if (K==TopOpeBRepDS_POINT){TopOpeBRepDS_PointExplorer ex(myHDS->DS(),findkeep);n=ex.NbPoint();}
485 else if(K==TopOpeBRepDS_CURVE){TopOpeBRepDS_CurveExplorer ex(myHDS->DS());n=ex.NbCurve();}
486 else if(K==TopOpeBRepDS_SURFACE){TopOpeBRepDS_SurfaceExplorer ex(myHDS->DS());n=ex.NbSurface();}
488 TCollection_AsciiString s = "---- "; ::Print(K,s);
489 OS<<endl<<s<<" : "<<n<<endl;
490 for(Standard_Integer i=1;i<=nt;i++) DumpGeometry(K,i,OS,findkeep,compact);
495 //=======================================================================
496 //function : DumpGeometry
498 //=======================================================================
500 Standard_OStream& TopOpeBRepDS_Dumper::DumpGeometry(const TopOpeBRepDS_Kind
504 ,const Standard_Integer
508 ,Standard_OStream& OS,
509 const Standard_Boolean
513 ,const Standard_Boolean
520 if ( ! TopOpeBRepDS::IsGeometry(K) ) return OS;
522 if ( K == TopOpeBRepDS_POINT ) {
523 TopOpeBRepDS_PointExplorer pex(myHDS->DS());
524 Standard_Boolean isp = pex.IsPoint(I);
525 Standard_Boolean isk = pex.IsPointKeep(I);
526 if(!findkeep || isk) {
527 TCollection_AsciiString kstr;::Print(K,kstr);kstr=kstr+" "+I+" :";
528 Standard_Integer lk = kstr.Length();
531 const TopOpeBRepDS_Point& PDS = pex.Point(I);
532 OS<<" (K:"<<((isk)?"1":"0") <<")"<<endl;
533 OS<<"tol = "<<PDS.Tolerance()<<endl;
534 TCollection_AsciiString istr(lk,' ');
535 const gp_Pnt& P = PDS.Point();
536 OS<<istr; OS<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<endl;
538 else OS<<"unbounded"<<endl;
541 else if ( K == TopOpeBRepDS_CURVE ) {
542 TopOpeBRepDS_CurveExplorer cex(myHDS->DS());
543 Standard_Boolean isc = cex.IsCurve(I);
544 Standard_Boolean isk = cex.IsCurveKeep(I);
545 if(!findkeep || isk) {
546 TCollection_AsciiString kstr;::Print(K,kstr);kstr=kstr+" "+I+" :";
547 Standard_Integer lk = kstr.Length();
550 const TopOpeBRepDS_Curve& CDS = cex.Curve(I);
551 OS<<" (K:"<<((isk)?"1":"0")<<")";
552 OS<<" (M:"<<CDS.Mother()<<")"<<endl;
553 TCollection_AsciiString istr(lk+1,' ');
554 OS<<istr;PrintType(CDS.Curve(),OS);
555 OS<<" tol = "<<CDS.Tolerance()<<endl;
556 Standard_Real first,last;
557 if(CDS.Range(first,last))
558 OS<<istr<<"first = "<<first<<" last = "<<last<<endl;
559 TopOpeBRepDS_InterferenceIterator it(myHDS->DS().CurveInterferences(I));
560 for (;it.More();it.Next()) it.Value()->Dump(OS,istr,"\n");
562 const Handle(TopOpeBRepDS_Interference)& SCI1 = CDS.GetSCI1();
563 const Handle(TopOpeBRepDS_Interference)& SCI2 = CDS.GetSCI2();
564 Handle(Geom2d_Curve) PC1,PC2;
566 PC1 = Handle(TopOpeBRepDS_SurfaceCurveInterference)::DownCast(SCI1)->PCurve();
568 PC2 = Handle(TopOpeBRepDS_SurfaceCurveInterference)::DownCast(SCI2)->PCurve();
570 OS<<istr;OS<<"PC(SCI1) : ";Print(PC1,cout,compact);
571 OS<<istr;OS<<"PC(SCI2) : ";Print(PC2,cout,compact);
575 else OS<<"unbounded"<<endl;
579 else if ( K == TopOpeBRepDS_SURFACE ) {
580 TopOpeBRepDS_SurfaceExplorer sex(myHDS->DS());
581 Standard_Boolean iss = sex.IsSurface(I);
582 Standard_Boolean isk = sex.IsSurfaceKeep(I);
583 if(!findkeep || isk) {
584 TCollection_AsciiString kstr; ::Print(K,kstr); kstr=kstr+" "+I+" : ";
585 Standard_Integer lk = kstr.Length();
588 const TopOpeBRepDS_Surface& SDS = sex.Surface(I);
589 OS<<" (K:"<<((isk)?"1":"0") <<")"<<endl;
590 OS<<"tol = "<<SDS.Tolerance()<<endl;
592 TCollection_AsciiString istr(lk,' ');
593 TopOpeBRepDS_InterferenceIterator it(myHDS->SurfaceCurves(I));
594 for (;it.More();it.Next()) {
595 OS<<istr; it.Value()->Dump(OS);OS<<endl;
599 else OS<<"unbounded"<<endl;
610 // = = = = = = = T O P O L O G Y
612 //=======================================================================
613 //function : DumpTopology
615 //=======================================================================
616 Standard_OStream& TopOpeBRepDS_Dumper::DumpTopology(Standard_OStream& OS) const
619 DumpTopology(TopOpeBRepDS_VERTEX,OS);
620 DumpTopology(TopOpeBRepDS_EDGE,OS);
621 DumpTopology(TopOpeBRepDS_WIRE,OS);
622 DumpTopology(TopOpeBRepDS_FACE,OS);
623 DumpTopology(TopOpeBRepDS_SHELL,OS);
624 DumpTopology(TopOpeBRepDS_SOLID,OS);
625 DumpSectionEdge(TopOpeBRepDS_EDGE,OS);
630 //=======================================================================
631 //function : DumpTopology
633 //=======================================================================
634 Standard_OStream& TopOpeBRepDS_Dumper::DumpTopology(const TopOpeBRepDS_Kind
638 ,Standard_OStream& OS) const
641 if ( ! TopOpeBRepDS::IsTopology(K) ) return OS;
642 Standard_Integer nk = myHDS->NbTopology(K);
643 if ( ! nk ) return OS;
646 TCollection_AsciiString s = "---- "; ::Print(K,s);
647 Standard_Integer nt = myHDS->NbTopology();
648 OS<<s<<" : "<<nk<<"/"<<nt<<" shapes"<<endl;
649 for(Standard_Integer i = 1; i <= nt; i++) DumpTopology(K,i,OS);
654 //=======================================================================
655 //function : DumpTopology
657 //=======================================================================
658 Standard_OStream& TopOpeBRepDS_Dumper::DumpTopology(const TopAbs_ShapeEnum
662 ,Standard_OStream& OS) const
665 DumpTopology(TopOpeBRepDS::ShapeToKind(T),OS);
670 //=======================================================================
671 //function : DumpSectionEdge
673 //=======================================================================
675 Standard_OStream& TopOpeBRepDS_Dumper::DumpSectionEdge(const TopOpeBRepDS_Kind
679 ,Standard_OStream& OS) const
682 Standard_Integer nse = myHDS->DS().NbSectionEdges();
683 if ( ! nse ) return OS;
686 TCollection_AsciiString s = "---- ";
687 OS<<s<<"Section Edges"<<" : "<<nse<<" edges"<<endl;
688 for(Standard_Integer i = 1; i <= nse; i++) {
689 DumpSectionEdge(K,i,OS);
695 //=======================================================================
696 //function : DumpSectionEdge
698 //=======================================================================
699 Standard_OStream& TopOpeBRepDS_Dumper::DumpSectionEdge(const TopOpeBRepDS_Kind K,const Standard_Integer I,Standard_OStream& OS) const
701 Standard_Boolean SEFindKeep = Standard_False;
702 const TopOpeBRepDS_DataStructure& DS = myHDS->DS();
703 const TopoDS_Shape& E = DS.SectionEdge(I,SEFindKeep);
704 if(E.IsNull()) return OS;
705 Standard_Integer it = myHDS->DS().Shape(E,SEFindKeep);
707 // E trouvee "Restriction" par les intersections n'est pas dans la DS.
708 OS<<endl<<"EDGE section "<<I<<" non Shape()"<<endl;
710 else DumpTopology(K,it,OS);
714 Standard_EXPORT Standard_Integer TopOpeBRepDS_GLOBALHDSinterfselector = 0; // NYI arg of Dump method
716 //=======================================================================
717 //function : DumpTopology
719 //=======================================================================
720 Standard_OStream& TopOpeBRepDS_Dumper::DumpTopology(const TopOpeBRepDS_Kind
724 ,const Standard_Integer
728 ,Standard_OStream& OS) const
731 Standard_Boolean fk = Standard_False;
732 const TopOpeBRepDS_DataStructure& DS = myHDS->DS();
733 if ( ! TopOpeBRepDS::IsTopology(K) ) return OS;
734 if ( I <= 0 ) return OS;
735 TopAbs_ShapeEnum t = TopOpeBRepDS::KindToShape(K);
737 if ( DS.Shape(I,fk).ShapeType() != t ) return OS;
738 Standard_Integer rankI = DS.AncestorRank(I);
739 TCollection_AsciiString s1,s2;
740 if(DS.KeepShape(I)) {
741 s1 = ((rankI == 1) ? (char*) "*" : (char*) "");
742 s2 = ((rankI == 2) ? (char*) "*" : (char*) "");
745 s1 = ((rankI == 1) ? (char*) "~" : (char*) "");
746 s2 = ((rankI == 2) ? (char*) "~" : (char*) "");
748 TCollection_AsciiString ss = TopOpeBRepDS::SPrint(K,I,s1,s2);
750 if ( t == TopAbs_VERTEX ) {
751 Standard_Integer lk = ss.Length() + 3;
752 TCollection_AsciiString istr(lk,' ');
753 gp_Pnt P = TopOpeBRepTool_ShapeTool::Pnt(DS.Shape(I,fk));
754 Standard_Real tol = TopOpeBRepTool_ShapeTool::Tolerance(DS.Shape(I,fk));
756 OS<<"tol = "<<tol<<endl;
757 OS<<istr; OS<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<endl;
760 Standard_Integer lss = ss.Length();TCollection_AsciiString bss(lss,' ');
764 TopOpeBRepDS_InterferenceIterator it; it.Init(DS.ShapeInterferences(I));
766 OS<<" interferences :\n";
767 for (;it.More();it.Next()) {
768 const Handle(TopOpeBRepDS_Interference)& IR = it.Value(); Standard_Boolean s = Standard_True;
769 if (TopOpeBRepDS_GLOBALHDSinterfselector == 1)
770 s = !(Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(IR)).IsNull();
771 if (s) IR->Dump(OS,"","\n");
774 else OS<<" has no interference\n";
777 const TopoDS_Shape& S = myHDS->Shape(I,fk);
778 if ( myHDS->HasSameDomain(S) ) {
779 const TopTools_ListOfShape& L = myHDS->DS().ShapeSameDomain(S);
781 OS<<ss<<" same domain (r,o) : "<<SDumpRefOri(S)<<endl;
782 OS<<SPrintShapeRefOri(L,bss+" same domain shapes : ");
791 //=======================================================================
792 //function : DumpTopology
794 //=======================================================================
795 Standard_OStream& TopOpeBRepDS_Dumper::DumpTopology(const TopAbs_ShapeEnum
799 ,const Standard_Integer
803 ,Standard_OStream& OS) const
806 DumpTopology(TopOpeBRepDS::ShapeToKind(T),I,OS);
811 //=======================================================================
812 //function : SDumpRefOri
814 //=======================================================================
816 TCollection_AsciiString TopOpeBRepDS_Dumper::SDumpRefOri(const TopOpeBRepDS_Kind K,const Standard_Integer I) const
818 TCollection_AsciiString SS;
819 Standard_Boolean fk = Standard_False;
820 const TopOpeBRepDS_DataStructure& DS = myHDS->DS();
821 if ( ! TopOpeBRepDS::IsTopology(K) ) return SS;
822 TopAbs_ShapeEnum t = TopOpeBRepDS::KindToShape(K);
823 if ( DS.Shape(I,fk).ShapeType() != t ) return SS;
824 const TopoDS_Shape& S = myHDS->Shape(I,fk);
825 Standard_Integer r = myHDS->SameDomainReference(S);
826 TopOpeBRepDS_Config o = myHDS->SameDomainOrientation(S);
827 SS=SS+"("+SPrintShape(r)+","+TopOpeBRepDS::SPrint(o)+")";
831 //=======================================================================
832 //function : SDumpRefOri
834 //=======================================================================
836 TCollection_AsciiString TopOpeBRepDS_Dumper::SDumpRefOri(const TopoDS_Shape& S) const
838 TCollection_AsciiString SS;
839 TopOpeBRepDS_Kind k = TopOpeBRepDS::ShapeToKind(S.ShapeType());
840 Standard_Boolean fk = Standard_False;
841 Standard_Integer i = myHDS->Shape(S,fk);
842 SS = SDumpRefOri(k,i);
846 //=======================================================================
847 //function : DumpRefOri
849 //=======================================================================
851 Standard_OStream& TopOpeBRepDS_Dumper::DumpRefOri(const TopOpeBRepDS_Kind
855 ,const Standard_Integer
859 ,Standard_OStream& OS) const
862 OS<<SDumpRefOri(K,I);OS.flush();
867 //=======================================================================
868 //function : DumpRefOri
870 //=======================================================================
872 Standard_OStream& TopOpeBRepDS_Dumper::DumpRefOri(const TopoDS_Shape&
876 ,Standard_OStream& OS) const
879 OS<<SDumpRefOri(S);OS.flush();
884 //=======================================================================
887 //=======================================================================
889 Standard_OStream& TopOpeBRepDS_Dumper::DumpLOI(
890 const TopOpeBRepDS_ListOfInterference&
894 ,Standard_OStream& OS,
895 const TCollection_AsciiString&
903 TopOpeBRepDS_InterferenceIterator IT(L); if (!IT.More()) { OS<<"NO INTERFERENCE"<<endl; return OS; }
905 for (Standard_Integer ip = 1; IT.More(); IT.Next(),ip++ ) {
906 const Handle(TopOpeBRepDS_Interference)& I = IT.Value();
907 TCollection_AsciiString s(ip); s = s + "/ ";
915 //=======================================================================
918 //=======================================================================
919 Standard_OStream& TopOpeBRepDS_Dumper::DumpI(
920 const Handle(TopOpeBRepDS_Interference)&
924 ,Standard_OStream& OS
925 ,const TCollection_AsciiString&
929 ,const TCollection_AsciiString&
936 Standard_Boolean fk = Standard_False;
938 if (I.IsNull()) { OS<<"NULL INTERFERENCE"<<str2; return OS; }
939 Standard_Integer G = I->Geometry(); TopOpeBRepDS_Kind GK = I->GeometryType();
941 if (GK == TopOpeBRepDS_POINT) {
942 gp_Pnt P = myHDS->Point(G).Point();
943 OS<<" P = "<<P.X()<<" "<<P.Y()<<" "<<P.Z();
945 else if (GK == TopOpeBRepDS_VERTEX) {
946 gp_Pnt P = TopOpeBRepTool_ShapeTool::Pnt(myHDS->Shape(G,fk));
947 OS<<" V = "<<P.X()<<" "<<P.Y()<<" "<<P.Z();
955 //=======================================================================
956 //function : SPrintShape
958 //=======================================================================
960 TCollection_AsciiString TopOpeBRepDS_Dumper::SPrintShape(const Standard_Integer IS) const
962 TCollection_AsciiString SS;
963 const TopOpeBRepDS_DataStructure& BDS = myHDS->DS(); if ( IS<1 || IS>BDS.NbShapes()) return SS;
964 SS = SPrintShape(BDS.Shape(IS));
968 //=======================================================================
969 //function : SPrintShape
971 //=======================================================================
973 TCollection_AsciiString TopOpeBRepDS_Dumper::SPrintShape(const TopoDS_Shape& S) const
975 const TopOpeBRepDS_DataStructure& BDS = myHDS->DS();
976 const Standard_Integer IS = myHDS->DS().Shape(S);
977 Standard_Integer rankIS = BDS.AncestorRank(IS);
978 //JR/Hp TCollection_AsciiString s1,s2;
979 Standard_CString s1,s2;
980 if(BDS.KeepShape(IS)) {
981 s1 = (Standard_CString ) ((rankIS == 1) ? "*" : "");
982 s2 = (Standard_CString ) ((rankIS == 2) ? "*" : "");
985 s1 = (Standard_CString ) ((rankIS == 1) ? "~" : "");
986 s2 = (Standard_CString ) ((rankIS == 2) ? "~" : "");
988 TCollection_AsciiString sse = TopOpeBRepDS::SPrint(TopOpeBRepDS::ShapeToKind(S.ShapeType()),IS,s1,s2);
992 //=======================================================================
993 //function : SPrintShapeRefOri
995 //=======================================================================
997 TCollection_AsciiString TopOpeBRepDS_Dumper::SPrintShapeRefOri(const TopoDS_Shape& S,const TCollection_AsciiString& astr) const
998 { TCollection_AsciiString SS=astr+SPrintShape(S)+" "+SDumpRefOri(S); return SS; }
1000 //=======================================================================
1001 //function : SPrintShapeRefOri
1003 //=======================================================================
1005 TCollection_AsciiString TopOpeBRepDS_Dumper::SPrintShapeRefOri(const TopTools_ListOfShape& L,const TCollection_AsciiString& astr) const
1007 TCollection_AsciiString SS;TopTools_ListIteratorOfListOfShape it(L); if (!it.More()) return SS;
1008 SS=SS+astr; TCollection_AsciiString bst(astr.Length(),' ');
1009 for(Standard_Integer il = 0; it.More(); it.Next(),il++) {
1010 TCollection_AsciiString ss=SPrintShapeRefOri(it.Value());if (il) ss=bst+ss; SS=SS+ss+"\n";