// File: TopOpeBRepDS_DRAW.cxx // Created: Wed Nov 26 14:31:09 1997 // Author: Jean Yves LEBEY // #ifdef DRAW #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include Standard_EXPORT void FUN_draw (const TopoDS_Shape& s) { char* nnn = TCollection_AsciiString("name").ToCString(); if (s.IsNull()) cout<<"nullshape"<Curves(); BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr); Standard_Boolean iscurveonS = Standard_False; for (;itcr.More();itcr.Next()) { const Handle(BRep_CurveRepresentation)& cr = itcr.Value(); Standard_Boolean iscurveonsurface = cr->IsCurveOnSurface(); if (!iscurveonsurface) continue; iscurveonS = cr->IsCurveOnSurface(S,L); if (iscurveonS) break; } return iscurveonS; } Standard_EXPORT void FUN_draw2de (const TopoDS_Shape& ed,const TopoDS_Shape& fa) { char* nnn = TCollection_AsciiString("name").ToCString(); Standard_Real f,l; if (ed.IsNull()) return; if (fa.IsNull()) return; TopoDS_Edge edge = TopoDS::Edge(ed); TopoDS_Face face = TopoDS::Face(fa); Standard_Boolean hascons = FUN_hascurveonsurf(edge,face); if (!hascons) return; TopAbs_Orientation ori = edge.Orientation(); Standard_Boolean sense = (ori == TopAbs_FORWARD)? Standard_True :Standard_False; Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(edge, face,f,l); Handle(Geom2d_TrimmedCurve) tC2d = new Geom2d_TrimmedCurve(C2d,f,l,sense); DrawTrSurf::Set(nnn,tC2d); } // FUN_draw2de Standard_EXPORT void FUN_draw2d(const Standard_Real& par,const TopoDS_Edge& E,const TopoDS_Edge& Eref,const TopoDS_Face& Fref) { TopAbs_Orientation oriE = E.Orientation(); TopAbs_Orientation oriEref = Eref.Orientation(); Standard_Boolean ErefonFref = Standard_False; Standard_Boolean EonFref = Standard_False; TopExp_Explorer ex; Standard_Integer ne = 0; for (ex.Init(Fref,TopAbs_EDGE); ex.More(); ex.Next()) ne++; if (ne < 1) return; for (ex.Init(Fref,TopAbs_EDGE); ex.More(); ex.Next()) { const TopoDS_Edge ed = TopoDS::Edge(ex.Current()); if (ed.IsSame(Eref)) {ErefonFref = Standard_True; break;} if (ed.IsSame(E)) {EonFref = Standard_True; break;} } gp_Pnt2d p2d; if (ErefonFref || EonFref) { Standard_Real f,l; Handle(Geom2d_Curve) C2d; if (ErefonFref) { C2d = BRep_Tool::CurveOnSurface(Eref,Fref,f,l); FUN_draw2de(Eref,Fref); } if (EonFref) { C2d = BRep_Tool::CurveOnSurface(E,Fref,f,l); FUN_draw2de(E,Fref); } C2d->D0(par,p2d); } else { Standard_Real f,l; Handle(Geom_Curve) C3d = BRep_Tool::Curve(Eref,f,l); gp_Pnt P; C3d->D0(par,P); Handle(Geom_Surface) S = BRep_Tool::Surface(Fref); GeomAPI_ProjectPointOnSurf PonS(P, S); if (!PonS.Extrema().IsDone()) return; if (PonS.NbPoints() == 0) return; Standard_Real u,v; PonS.Parameters(1,u,v); p2d = gp_Pnt2d(u,v); } FUN_draw(p2d); } // FUN_draw2d #endif