// Created on: 1996-03-07 // Created by: Jean Yves LEBEY // Copyright (c) 1996-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and / or modify it // under the terms of the GNU Lesser General Public version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #ifdef HAVE_CONFIG_H # include #endif #include #include #include #ifdef DRAW #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef DEB #ifdef HAVE_STRINGS_H # include #endif extern Standard_Boolean TopOpeBRepDS_GettraceSPSX(const Standard_Integer); extern Standard_Boolean TopOpeBRepDS_GettraceSPSXX(const Standard_Integer,const Standard_Integer); static TCollection_AsciiString PRODINS("dins "); #endif //======================================================================= //function : GdumpLS //purpose : //======================================================================= #ifdef DEB void TopOpeBRepBuild_Builder::GdumpLS(const TopTools_ListOfShape& L) const { TopTools_ListIteratorOfListOfShape it(L); for (; it.More(); it.Next() ) { const TopoDS_Shape& SL = it.Value(); GdumpSHA(SL); } } #else void TopOpeBRepBuild_Builder::GdumpLS(const TopTools_ListOfShape&) const { } #endif //======================================================================= //function : PrintGeo //purpose : //======================================================================= #ifdef DEB void TopOpeBRepBuild_Builder::PrintGeo(const TopoDS_Shape& S) { if (S.ShapeType() == TopAbs_VERTEX) PrintPnt(TopoDS::Vertex(S)); else if (S.ShapeType() == TopAbs_EDGE) PrintCur(TopoDS::Edge(S)); else if (S.ShapeType() == TopAbs_FACE) PrintSur(TopoDS::Face(S)); } #else void TopOpeBRepBuild_Builder::PrintGeo(const TopoDS_Shape&) { } #endif //======================================================================= //function : PrintSur //purpose : print the name of a surface //======================================================================= #ifdef DEB void TopOpeBRepBuild_Builder::PrintSur(const TopoDS_Face& F) { BRepAdaptor_Surface STA_Surface(F); GeomAbs_SurfaceType t = STA_Surface.GetType(); switch(t) { case GeomAbs_Plane : cout<<"PLANE"; break; case GeomAbs_Cylinder : cout<<"CYLINDER"; break; case GeomAbs_Cone : cout<<"CONE"; break; case GeomAbs_Sphere : cout<<"SPHERE"; break; case GeomAbs_Torus : cout<<"TORUS"; break; case GeomAbs_BezierSurface : cout<<"BEZIERSURFACE"; break; case GeomAbs_BSplineSurface : cout<<"BSPLINESURFACE"; break; case GeomAbs_SurfaceOfRevolution : cout<<"SURFACEOFREVOLUTION"; break; case GeomAbs_SurfaceOfExtrusion : cout<<"SURFACEOFEXTRUSION"; break; case GeomAbs_OtherSurface : default : cout<<"OTHERSURFACE"; break; } cout.flush(); } #else void TopOpeBRepBuild_Builder::PrintSur(const TopoDS_Face& ) { } #endif //======================================================================= //function : PrintCur //purpose : print the name of a curve //======================================================================= #ifdef DEB void TopOpeBRepBuild_Builder::PrintCur(const TopoDS_Edge& E) { TopLoc_Location L; Standard_Real f,l; Handle(Geom_Curve) C = BRep_Tool::Curve(E,L,f,l); if ( C.IsNull() ) return; GeomAdaptor_Curve GC(C); GeomAbs_CurveType t = GC.GetType(); switch(t) { case GeomAbs_Line : cout<<"LINE"; break; case GeomAbs_Circle : cout<<"CIRCLE"; break; case GeomAbs_Ellipse : cout<<"ELLIPSE"; break; case GeomAbs_Hyperbola : cout<<"HYPERBOLA"; break; case GeomAbs_Parabola : cout<<"PARABOLA"; break; case GeomAbs_BezierCurve : cout<<"BEZIERCURVE"; break; case GeomAbs_BSplineCurve : cout<<"BSPLINECURVE "<Degree(); break; case GeomAbs_OtherCurve : cout<<"OTHERCURVE"; break; } cout.flush(); } #else void TopOpeBRepBuild_Builder::PrintCur(const TopoDS_Edge&) { } #endif //======================================================================= //function : PrintPnt //purpose : //======================================================================= #ifdef DEB void TopOpeBRepBuild_Builder::PrintPnt(const TopoDS_Vertex& V) { GdumpPNT(BRep_Tool::Pnt(V)); } #else void TopOpeBRepBuild_Builder::PrintPnt(const TopoDS_Vertex&) { } #endif //======================================================================= //function : PrintOri //purpose : //======================================================================= #ifdef DEB void TopOpeBRepBuild_Builder::PrintOri(const TopoDS_Shape& S) { TopAbs::Print(S.Orientation(),cout); cout.flush(); } #else void TopOpeBRepBuild_Builder::PrintOri(const TopoDS_Shape& /*S*/) { } #endif //======================================================================= //function : StringState //purpose : //======================================================================= #ifdef DEB TCollection_AsciiString TopOpeBRepBuild_Builder::StringState(const TopAbs_State st) #else TCollection_AsciiString TopOpeBRepBuild_Builder::StringState(const TopAbs_State) #endif { TCollection_AsciiString s; #ifdef DEB switch(st) { case TopAbs_ON : s.AssignCat("ON"); break; case TopAbs_IN : s.AssignCat("IN"); break; case TopAbs_OUT : s.AssignCat("OUT"); break; case TopAbs_UNKNOWN : s.AssignCat("UNKNOWN"); break; } #endif return s; } //======================================================================= //function : GdumpPNT //purpose : //======================================================================= #ifdef DEB void TopOpeBRepBuild_Builder::GdumpPNT(const gp_Pnt& P) { cout<Shape(S); TopOpeBRepDS::Print(tS,iS,cout); cout.flush(); } #else void TopOpeBRepBuild_Builder::GdumpSHA(const TopoDS_Shape&, const Standard_Address) const { } #endif //======================================================================= //function : GdumpSHAORI //purpose : //======================================================================= #ifdef DEB void TopOpeBRepBuild_Builder::GdumpSHAORI(const TopoDS_Shape& S, const Standard_Address str) const { char* c = (char*)str; if (c) cout<Shape(iS); GdumpSHASTA(S,T,a,b); cout.flush(); } #else void TopOpeBRepBuild_Builder::GdumpSHASTA(const Standard_Integer , const TopAbs_State , const TCollection_AsciiString& , const TCollection_AsciiString& ) const { } #endif //======================================================================= //function : GdumpSHASTA //purpose : //======================================================================= #ifdef DEB void TopOpeBRepBuild_Builder::GdumpSHASTA(const Standard_Integer iS, const TopAbs_State T, const TopOpeBRepBuild_ShapeSet& SS, const TCollection_AsciiString& a, const TCollection_AsciiString& b, const TCollection_AsciiString& c)const { const TopoDS_Shape& S = myDataStructure->Shape(iS); TCollection_AsciiString aib = a + " " + SS.DEBNumber() + " " + b; GdumpSHASTA(S,T,aib,c); cout.flush(); } #else void TopOpeBRepBuild_Builder::GdumpSHASTA(const Standard_Integer , const TopAbs_State , const TopOpeBRepBuild_ShapeSet& , const TCollection_AsciiString& , const TCollection_AsciiString& , const TCollection_AsciiString& )const { } #endif //======================================================================= //function : GdumpSHASETreset //purpose : //======================================================================= void TopOpeBRepBuild_Builder::GdumpSHASETreset() { #ifdef DEB mySHASETindex = 0; #endif } //======================================================================= //function : GdumpSHASETindex //purpose : //======================================================================= Standard_Integer TopOpeBRepBuild_Builder::GdumpSHASETindex() { Standard_Integer n = 0; #ifdef DEB n = ++mySHASETindex; #endif return n; } //======================================================================= //function : GdumpEXP //purpose : //======================================================================= #ifdef DEB void TopOpeBRepBuild_Builder::GdumpEXP(const TopOpeBRepTool_ShapeExplorer& Ex) const { if ( ! Ex.More() ) return; TopAbs_ShapeEnum t = Ex.Current().ShapeType(); if (t == TopAbs_SOLID) cout<<""; else if (t == TopAbs_FACE) cout<<" "; else if (t == TopAbs_EDGE) cout<<" "; else cout<<"??"; Ex.DumpCurrent(cout); Standard_Integer I = myDataStructure->Shape(Ex.Current()); if ( I != 0 ) cout<<" : shape "<DEBName() + PWES->DEBNumber(); VFnam = VFnam + ne + "NF" + nf + "F" + iF; VRnam = VRnam + ne + "NF" + nf + "F" + iF; // cout<<" puts \"edge "<Shape(iS),ibid); #endif return b; } //======================================================================= //function : GtraceSPS //purpose : //======================================================================= #ifdef DEB Standard_Boolean TopOpeBRepBuild_Builder::GtraceSPS(const Standard_Integer i, const Standard_Integer j) const #else Standard_Boolean TopOpeBRepBuild_Builder::GtraceSPS(const Standard_Integer , const Standard_Integer ) const #endif { Standard_Boolean b = Standard_False; #ifdef DEB b = TopOpeBRepDS_GettraceSPSXX(i,j); #endif return b; } //======================================================================= //function : GtraceSPS //purpose : //======================================================================= #ifdef DEB Standard_Boolean TopOpeBRepBuild_Builder::GtraceSPS(const TopoDS_Shape& S) const #else Standard_Boolean TopOpeBRepBuild_Builder::GtraceSPS(const TopoDS_Shape& ) const #endif { Standard_Boolean b = Standard_False; #ifdef DEB Standard_Integer iS; b = GtraceSPS(S,iS); #endif return b; } //======================================================================= //function : GtraceSPS //purpose : //======================================================================= #ifdef DEB Standard_Boolean TopOpeBRepBuild_Builder::GtraceSPS(const TopoDS_Shape& S, Standard_Integer& IS) const #else Standard_Boolean TopOpeBRepBuild_Builder::GtraceSPS(const TopoDS_Shape&, Standard_Integer& IS) const #endif { IS = 0; Standard_Boolean b = Standard_False; #ifdef DEB if ( ! myDataStructure.IsNull() ) { if ( ! S.IsNull() ) { IS = myDataStructure->Shape(S); b = TopOpeBRepDS_GettraceSPSX(IS); } } #endif return b; } //======================================================================= //function : GcheckNBOUNDS //purpose : //======================================================================= #ifdef DEB Standard_Boolean TopOpeBRepBuild_Builder::GcheckNBOUNDS(const TopoDS_Shape& E) #else Standard_Boolean TopOpeBRepBuild_Builder::GcheckNBOUNDS(const TopoDS_Shape& ) #endif { Standard_Boolean res = Standard_False; #ifdef DEB Standard_Integer nf = 0, nr = 0; TopOpeBRepTool_ShapeExplorer ex(E,TopAbs_VERTEX); for(; ex.More(); ex.Next()) { TopAbs_Orientation o = ex.Current().Orientation(); if (o == TopAbs_FORWARD) nf++; if (o == TopAbs_REVERSED) nr++; } if ( nf == 1 && nr == 1 ) res = Standard_True; #endif return res; }