0022312: Translation of french commentaries in OCCT files
[occt.git] / src / BRepFill / BRepFill_EdgeOnSurfLaw.cxx
CommitLineData
7fd59977 1// File: BRepFill_EdgeOnSurfLaw.cxx
2// Created: Mon Jul 27 14:30:36 1998
3// Author: Philippe MANGIN
4// <pmn@sgi29>
5
6
7#include <BRepFill_EdgeOnSurfLaw.ixx>
8
9#include <BRepTools_WireExplorer.hxx>
10#include <BRep_Tool.hxx>
11#include <TopoDS.hxx>
12#include <TopoDS_Edge.hxx>
13#include <TopExp_Explorer.hxx>
14#include <TopTools_HArray1OfShape.hxx>
15
16#include <GeomFill_LocationLaw.hxx>
17#include <GeomFill_HArray1OfLocationLaw.hxx>
18#include <GeomFill_Darboux.hxx>
19#include <GeomFill_CurveAndTrihedron.hxx>
20
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>
27
28
29BRepFill_EdgeOnSurfLaw::BRepFill_EdgeOnSurfLaw(const TopoDS_Wire& Path,
30 const TopoDS_Shape& Surf)
31{
32 hasresult = Standard_True;
33 Init(Path);
34
35 Standard_Boolean Trouve;
36 Standard_Integer ipath;// ,NbEdge;
37 TopAbs_Orientation Or;
38 BRepTools_WireExplorer wexp;
39 TopExp_Explorer exp;
40// Class BRep_Tool without fields and without Constructor :
41// BRep_Tool B;
42 TopoDS_Edge E;
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);
51
52 for (ipath=0, wexp.Init(myPath);
53 wexp.More(); wexp.Next()) {
54 E = wexp.Current();
55// if (!B.Degenerated(E)) {
56 if (!BRep_Tool::Degenerated(E)) {
57 ipath++;
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);
63 if (!C.IsNull()) {
64 Trouve=Standard_True;
65 AS = new (BRepAdaptor_HSurface) (F);
66 }
67 }
68 if (!Trouve) { // Impossible de construire la loi.
69 hasresult = Standard_False;
70 myLaws.Nullify();
71 return;
72 }
73
74 Or = E.Orientation();
75 if (Or == TopAbs_REVERSED) {
76 Handle(Geom2d_TrimmedCurve) CBis =
77 new (Geom2d_TrimmedCurve) (C, First, Last);
78 CBis->Reverse(); // Pour eviter de deteriorer la topologie
79 C = CBis;
80 First = C->FirstParameter();
81 Last = C->LastParameter();
82 }
83
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);
89 }
90 }
91}
92
93 Standard_Boolean BRepFill_EdgeOnSurfLaw::HasResult() const
94{
95 return hasresult;
96}
97