0022627: Change OCCT memory management defaults
[occt.git] / src / BRepFill / BRepFill_Edge3DLaw.cxx
1 // File:        BRepFill_Edge3DLaw.cxx
2 // Created:     Mon Jul 27 14:13:11 1998
3 // Author:      Philippe MANGIN
4 //              <pmn@sgi29>
5
6
7 #include <BRepFill_Edge3DLaw.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
16 #include <GeomFill_LocationLaw.hxx>
17 #include <GeomFill_HArray1OfLocationLaw.hxx>
18 #include <Geom_Curve.hxx>
19 #include <Geom_TrimmedCurve.hxx>
20 #include <GeomAdaptor_HCurve.hxx>
21
22 BRepFill_Edge3DLaw::BRepFill_Edge3DLaw(const TopoDS_Wire& Path,
23                                      const Handle(GeomFill_LocationLaw)& Law)
24 {
25   Init(Path);
26
27   Standard_Integer ipath;
28   TopAbs_Orientation Or;
29   BRepTools_WireExplorer wexp;
30 // Class BRep_Tool without fields and without Constructor :
31 //  BRep_Tool B;
32   TopoDS_Edge E;
33   Handle(Geom_Curve) C;
34   Handle(GeomAdaptor_HCurve) AC;
35   Standard_Real First, Last;
36
37   for (ipath=0, wexp.Init(myPath); 
38        wexp.More(); wexp.Next()) {
39     E = wexp.Current();
40 //    if (!B.Degenerated(E)) {
41     if (!BRep_Tool::Degenerated(E)) {
42       ipath++;
43       myEdges->SetValue(ipath, E);
44       C = BRep_Tool::Curve(E,First,Last);
45       Or = E.Orientation();
46       if (Or == TopAbs_REVERSED) {
47         Handle(Geom_TrimmedCurve) CBis = 
48           new (Geom_TrimmedCurve) (C, First, Last);
49         CBis->Reverse(); // Pour eviter de deteriorer la topologie
50         C = CBis;
51         First =  C->FirstParameter();
52         Last  =  C->LastParameter();
53       }
54
55       AC = new  (GeomAdaptor_HCurve) (C,First, Last);
56       myLaws->SetValue(ipath, Law->Copy());
57       myLaws->ChangeValue(ipath)->SetCurve(AC);
58     }  
59   }
60 }
61
62
63
64