0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BRepFill / BRepFill_Edge3DLaw.cxx
CommitLineData
b311480e 1// Created on: 1998-07-27
2// Created by: Philippe MANGIN
3// Copyright (c) 1998-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
7fd59977 17
7fd59977 18#include <BRep_Tool.hxx>
42cf5bc1 19#include <BRepFill_Edge3DLaw.hxx>
20#include <BRepTools_WireExplorer.hxx>
7fd59977 21#include <Geom_Curve.hxx>
22#include <Geom_TrimmedCurve.hxx>
23#include <GeomAdaptor_HCurve.hxx>
42cf5bc1 24#include <GeomFill_HArray1OfLocationLaw.hxx>
25#include <GeomFill_LocationLaw.hxx>
26#include <Standard_Type.hxx>
27#include <TopExp.hxx>
28#include <TopoDS.hxx>
29#include <TopoDS_Edge.hxx>
30#include <TopoDS_Wire.hxx>
31#include <TopTools_HArray1OfShape.hxx>
7fd59977 32
33BRepFill_Edge3DLaw::BRepFill_Edge3DLaw(const TopoDS_Wire& Path,
34 const Handle(GeomFill_LocationLaw)& Law)
35{
36 Init(Path);
37
38 Standard_Integer ipath;
39 TopAbs_Orientation Or;
40 BRepTools_WireExplorer wexp;
41// Class BRep_Tool without fields and without Constructor :
42// BRep_Tool B;
43 TopoDS_Edge E;
44 Handle(Geom_Curve) C;
45 Handle(GeomAdaptor_HCurve) AC;
46 Standard_Real First, Last;
47
48 for (ipath=0, wexp.Init(myPath);
49 wexp.More(); wexp.Next()) {
50 E = wexp.Current();
51// if (!B.Degenerated(E)) {
52 if (!BRep_Tool::Degenerated(E)) {
53 ipath++;
54 myEdges->SetValue(ipath, E);
55 C = BRep_Tool::Curve(E,First,Last);
56 Or = E.Orientation();
57 if (Or == TopAbs_REVERSED) {
58 Handle(Geom_TrimmedCurve) CBis =
59 new (Geom_TrimmedCurve) (C, First, Last);
60 CBis->Reverse(); // Pour eviter de deteriorer la topologie
61 C = CBis;
62 First = C->FirstParameter();
63 Last = C->LastParameter();
64 }
65
66 AC = new (GeomAdaptor_HCurve) (C,First, Last);
67 myLaws->SetValue(ipath, Law->Copy());
68 myLaws->ChangeValue(ipath)->SetCurve(AC);
69 }
70 }
71}
72
73
74
75