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 : SDumpRefOri
76 //=======================================================================
78 TCollection_AsciiString TopOpeBRepDS_Dumper::SDumpRefOri(const TopOpeBRepDS_Kind K,const Standard_Integer I) const
80 TCollection_AsciiString SS;
81 Standard_Boolean fk = Standard_False;
82 const TopOpeBRepDS_DataStructure& DS = myHDS->DS();
83 if ( ! TopOpeBRepDS::IsTopology(K) ) return SS;
84 TopAbs_ShapeEnum t = TopOpeBRepDS::KindToShape(K);
85 if ( DS.Shape(I,fk).ShapeType() != t ) return SS;
86 const TopoDS_Shape& S = myHDS->Shape(I,fk);
87 Standard_Integer r = myHDS->SameDomainReference(S);
88 TopOpeBRepDS_Config o = myHDS->SameDomainOrientation(S);
89 SS=SS+"("+SPrintShape(r)+","+TopOpeBRepDS::SPrint(o)+")";
93 //=======================================================================
94 //function : SDumpRefOri
96 //=======================================================================
98 TCollection_AsciiString TopOpeBRepDS_Dumper::SDumpRefOri(const TopoDS_Shape& S) const
100 TCollection_AsciiString SS;
101 TopOpeBRepDS_Kind k = TopOpeBRepDS::ShapeToKind(S.ShapeType());
102 Standard_Boolean fk = Standard_False;
103 Standard_Integer i = myHDS->Shape(S,fk);
104 SS = SDumpRefOri(k,i);
108 //=======================================================================
109 //function : SPrintShape
111 //=======================================================================
113 TCollection_AsciiString TopOpeBRepDS_Dumper::SPrintShape(const Standard_Integer IS) const
115 TCollection_AsciiString SS;
116 const TopOpeBRepDS_DataStructure& BDS = myHDS->DS(); if ( IS<1 || IS>BDS.NbShapes()) return SS;
117 SS = SPrintShape(BDS.Shape(IS));
121 //=======================================================================
122 //function : SPrintShape
124 //=======================================================================
126 TCollection_AsciiString TopOpeBRepDS_Dumper::SPrintShape(const TopoDS_Shape& S) const
128 const TopOpeBRepDS_DataStructure& BDS = myHDS->DS();
129 const Standard_Integer IS = myHDS->DS().Shape(S);
130 Standard_Integer rankIS = BDS.AncestorRank(IS);
131 //JR/Hp TCollection_AsciiString s1,s2;
132 Standard_CString s1,s2;
133 if(BDS.KeepShape(IS)) {
134 s1 = (Standard_CString ) ((rankIS == 1) ? "*" : "");
135 s2 = (Standard_CString ) ((rankIS == 2) ? "*" : "");
138 s1 = (Standard_CString ) ((rankIS == 1) ? "~" : "");
139 s2 = (Standard_CString ) ((rankIS == 2) ? "~" : "");
141 TCollection_AsciiString sse = TopOpeBRepDS::SPrint(TopOpeBRepDS::ShapeToKind(S.ShapeType()),IS,s1,s2);
145 //=======================================================================
146 //function : SPrintShapeRefOri
148 //=======================================================================
150 TCollection_AsciiString TopOpeBRepDS_Dumper::SPrintShapeRefOri(const TopoDS_Shape& S,const TCollection_AsciiString& astr) const
151 { TCollection_AsciiString SS=astr+SPrintShape(S)+" "+SDumpRefOri(S); return SS; }
153 //=======================================================================
154 //function : SPrintShapeRefOri
156 //=======================================================================
158 TCollection_AsciiString TopOpeBRepDS_Dumper::SPrintShapeRefOri(const TopTools_ListOfShape& L,const TCollection_AsciiString& astr) const
160 TCollection_AsciiString SS;TopTools_ListIteratorOfListOfShape it(L); if (!it.More()) return SS;
161 SS=SS+astr; TCollection_AsciiString bst(astr.Length(),' ');
162 for(Standard_Integer il = 0; it.More(); it.Next(),il++) {
163 TCollection_AsciiString ss=SPrintShapeRefOri(it.Value());if (il) ss=bst+ss; SS=SS+ss+"\n";