1 // File: BRepFill_EdgeOnSurfLaw.cxx
2 // Created: Mon Jul 27 14:30:36 1998
3 // Author: Philippe MANGIN
7 #include <BRepFill_EdgeOnSurfLaw.ixx>
9 #include <BRepTools_WireExplorer.hxx>
10 #include <BRep_Tool.hxx>
12 #include <TopoDS_Edge.hxx>
13 #include <TopExp_Explorer.hxx>
14 #include <TopTools_HArray1OfShape.hxx>
16 #include <GeomFill_LocationLaw.hxx>
17 #include <GeomFill_HArray1OfLocationLaw.hxx>
18 #include <GeomFill_Darboux.hxx>
19 #include <GeomFill_CurveAndTrihedron.hxx>
21 #include <Geom2d_Curve.hxx>
22 #include <Geom2d_TrimmedCurve.hxx>
23 #include <Adaptor3d_CurveOnSurface.hxx>
24 #include <Adaptor3d_HCurveOnSurface.hxx>
25 #include <Geom2dAdaptor_HCurve.hxx>
26 #include <BRepAdaptor_HSurface.hxx>
29 BRepFill_EdgeOnSurfLaw::BRepFill_EdgeOnSurfLaw(const TopoDS_Wire& Path,
30 const TopoDS_Shape& Surf)
32 hasresult = Standard_True;
35 Standard_Boolean Trouve;
36 Standard_Integer ipath;// ,NbEdge;
37 TopAbs_Orientation Or;
38 BRepTools_WireExplorer wexp;
40 // Class BRep_Tool without fields and without Constructor :
43 Handle(Geom2d_Curve) C;
44 Handle(Geom2dAdaptor_HCurve) AC2d;
45 Handle(Adaptor3d_HCurveOnSurface) AC;
46 Handle(BRepAdaptor_HSurface) AS;
47 Standard_Real First, Last;
48 Handle(GeomFill_Darboux) TLaw = new (GeomFill_Darboux)() ;
49 Handle(GeomFill_CurveAndTrihedron) Law =
50 new (GeomFill_CurveAndTrihedron) (TLaw);
52 for (ipath=0, wexp.Init(myPath);
53 wexp.More(); wexp.Next()) {
55 // if (!B.Degenerated(E)) {
56 if (!BRep_Tool::Degenerated(E)) {
58 myEdges->SetValue(ipath, E);
59 for (Trouve=Standard_False, exp.Init(Surf, TopAbs_FACE);
60 exp.More() && !Trouve; exp.Next()) {
61 const TopoDS_Face& F = TopoDS::Face(exp.Current());
62 C = BRep_Tool::CurveOnSurface(E, F, First, Last);
65 AS = new (BRepAdaptor_HSurface) (F);
68 if (!Trouve) { // Impossible to construct the law.
69 hasresult = Standard_False;
75 if (Or == TopAbs_REVERSED) {
76 Handle(Geom2d_TrimmedCurve) CBis =
77 new (Geom2d_TrimmedCurve) (C, First, Last);
78 CBis->Reverse(); // To avoid spoiling the topology
80 First = C->FirstParameter();
81 Last = C->LastParameter();
84 AC2d = new (Geom2dAdaptor_HCurve) (C,First, Last);
85 AC = new (Adaptor3d_HCurveOnSurface)
86 (Adaptor3d_CurveOnSurface(AC2d, AS));
87 myLaws->SetValue(ipath, Law->Copy());
88 myLaws->ChangeValue(ipath)->SetCurve(AC);
93 Standard_Boolean BRepFill_EdgeOnSurfLaw::HasResult() const