0022312: Translation of french commentaries in OCCT files
[occt.git] / src / BRepFill / BRepFill_ACRLaw.cxx
CommitLineData
7fd59977 1// File: BRepFill_ACRLaw.cxx
2// Created: Tue Sep 1 14:13:11 1998
3// Author: Stephanie Humeau
4// <shu@sun17>
5
6
7#include <BRepFill_ACRLaw.ixx>
8
9#include <BRepTools_WireExplorer.hxx>
10#include <BRep_Tool.hxx>
11#include <TopoDS.hxx>
12#include <TopoDS_Edge.hxx>
13#include <TopExp.hxx>
14#include <TopTools_HArray1OfShape.hxx>
15#include <BRepFill.hxx>
16#include <GeomFill_LocationLaw.hxx>
17#include <GeomFill_LocationGuide.hxx>
18
19#include <GeomFill_HArray1OfLocationLaw.hxx>
20#include <Geom_Curve.hxx>
21#include <Geom_TrimmedCurve.hxx>
22#include <GeomAdaptor_HCurve.hxx>
23#include <Approx_CurvlinFunc.hxx>
24
25BRepFill_ACRLaw::BRepFill_ACRLaw(const TopoDS_Wire& Path,
26 const Handle(GeomFill_LocationGuide)& theLaw)
27{
28 Init(Path);
29
0d969553 30// calculate the nb of edge of the path
7fd59977 31 BRepTools_WireExplorer wexp;
32 Standard_Integer NbEdge = 0;
33 for (wexp.Init(myPath); wexp.More(); wexp.Next()) NbEdge++;
34
0d969553 35// tab to memorize ACR for each edge
7fd59977 36 OrigParam = new (TColStd_HArray1OfReal)(0,NbEdge);
37 TColStd_Array1OfReal Orig (0,NbEdge);
38 BRepFill::ComputeACR(Path, Orig);
39
40 Standard_Integer ipath;
41 TopAbs_Orientation Or;
42// Class BRep_Tool without fields and without Constructor :
43// BRep_Tool B;
44 TopoDS_Edge E;
45 Handle(Geom_Curve) C;
46 Handle(GeomAdaptor_HCurve) AC;
47 Standard_Real First, Last;
48
0d969553 49// return ACR of edges of the trajectory
7fd59977 50 OrigParam->SetValue(0,0);
51 for (ipath=1;ipath<=NbEdge;ipath++)
52 OrigParam->SetValue(ipath, Orig(ipath));
53
0d969553 54// process each edge of the trajectory
7fd59977 55 for (ipath=0, wexp.Init(myPath);
56 wexp.More(); wexp.Next()) {
57 E = wexp.Current();
58// if (!B.Degenerated(E)) {
59 if (!BRep_Tool::Degenerated(E)) {
60 ipath++;
61 myEdges->SetValue(ipath, E);
62 C = BRep_Tool::Curve(E,First,Last);
63 Or = E.Orientation();
64 if (Or == TopAbs_REVERSED) {
65 Handle(Geom_TrimmedCurve) CBis =
66 new (Geom_TrimmedCurve) (C, First, Last);
0d969553 67 CBis->Reverse(); // To avoid damaging the topology
7fd59977 68 C = CBis;
69 First = C->FirstParameter();
70 Last = C->LastParameter();
71 }
72 AC = new (GeomAdaptor_HCurve) (C, First, Last);
73
0d969553 74 // Set the parameters for the case multi-edges
7fd59977 75 Standard_Real t1 = OrigParam->Value(ipath-1);
76 Standard_Real t2 = OrigParam->Value(ipath);
77 Handle(GeomFill_LocationGuide) Loc;
78 Loc = Handle(GeomFill_LocationGuide)::DownCast(theLaw);
79 Loc->SetOrigine(t1,t2);
80
81 myLaws->SetValue(ipath, Loc->Copy());
82 myLaws->ChangeValue(ipath)->SetCurve(AC);
83 }
84 }
85}