b311480e |
1 | // Created on: 1998-01-07 |
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> |
19 | #include <BRepAdaptor_Curve.hxx> |
42cf5bc1 |
20 | #include <BRepFill_SectionLaw.hxx> |
7fd59977 |
21 | #include <BRepLProp.hxx> |
42cf5bc1 |
22 | #include <BRepTools_WireExplorer.hxx> |
23 | #include <Geom_BSplineCurve.hxx> |
7fd59977 |
24 | #include <Geom_Curve.hxx> |
25 | #include <Geom_Line.hxx> |
26 | #include <Geom_TrimmedCurve.hxx> |
42cf5bc1 |
27 | #include <GeomFill_SectionLaw.hxx> |
7fd59977 |
28 | #include <GeomFill_UniformSection.hxx> |
42cf5bc1 |
29 | #include <Precision.hxx> |
30 | #include <Standard_Type.hxx> |
7fd59977 |
31 | #include <TColgp_HArray1OfPnt.hxx> |
7fd59977 |
32 | #include <TColStd_HArray1OfInteger.hxx> |
42cf5bc1 |
33 | #include <TColStd_HArray1OfReal.hxx> |
34 | #include <TopExp.hxx> |
35 | #include <TopoDS.hxx> |
36 | #include <TopoDS_Edge.hxx> |
37 | #include <TopoDS_Shape.hxx> |
38 | #include <TopoDS_Vertex.hxx> |
39 | #include <TopoDS_Wire.hxx> |
7fd59977 |
40 | |
92efcf78 |
41 | IMPLEMENT_STANDARD_RTTIEXT(BRepFill_SectionLaw,MMgt_TShared) |
42 | |
7fd59977 |
43 | //======================================================================= |
44 | //function : NbLaw |
0d969553 |
45 | //purpose : Gives the number of elementary (or Geometric) law |
7fd59977 |
46 | //======================================================================= |
b311480e |
47 | Standard_Integer BRepFill_SectionLaw::NbLaw() const |
7fd59977 |
48 | { |
49 | return myLaws->Length(); |
50 | } |
51 | |
52 | |
53 | //======================================================================= |
54 | //function : Law |
55 | //purpose : |
56 | //======================================================================= |
57 | const Handle(GeomFill_SectionLaw)& |
58 | BRepFill_SectionLaw::Law(const Standard_Integer Index) const |
59 | { |
60 | return myLaws->Value(Index); |
61 | } |
62 | |
953d87f3 |
63 | //======================================================================= |
64 | //function : Indices |
65 | //purpose : |
66 | //======================================================================= |
67 | Standard_Integer BRepFill_SectionLaw::IndexOfEdge(const TopoDS_Shape& anEdge) const |
68 | { |
69 | return myIndices(anEdge); |
70 | } |
71 | |
7fd59977 |
72 | //======================================================================= |
73 | //function : IsUClosed |
74 | //purpose : |
75 | //======================================================================= |
76 | Standard_Boolean BRepFill_SectionLaw::IsUClosed() const |
77 | { |
78 | return uclosed; |
79 | } |
80 | |
81 | //======================================================================= |
82 | //function : IsVClosed |
83 | //purpose : |
84 | //======================================================================= |
85 | Standard_Boolean BRepFill_SectionLaw::IsVClosed() const |
86 | { |
87 | return vclosed; |
88 | } |
89 | |
5da00540 |
90 | //======================================================================= |
91 | //function : IsDone |
92 | //purpose : |
93 | //======================================================================= |
94 | Standard_Boolean BRepFill_SectionLaw::IsDone() const |
95 | { |
96 | return myDone; |
97 | } |
98 | |
7fd59977 |
99 | //======================================================================= |
100 | //function : Init |
0d969553 |
101 | //purpose : Prepare the parsing of a wire |
7fd59977 |
102 | //======================================================================= |
103 | void BRepFill_SectionLaw::Init(const TopoDS_Wire& W) |
104 | { |
105 | myIterator.Init(W); |
106 | } |
107 | |
108 | //======================================================================= |
109 | //function : |
0d969553 |
110 | //purpose : Parses the wire omitting the degenerated Edges |
7fd59977 |
111 | //======================================================================= |
112 | TopoDS_Edge BRepFill_SectionLaw::CurrentEdge() |
113 | { |
114 | TopoDS_Edge E; |
115 | // Class BRep_Tool without fields and without Constructor : |
116 | // BRep_Tool B; |
117 | Standard_Boolean Suivant = Standard_False; |
118 | if (myIterator.More()) { |
119 | E = myIterator.Current(); |
0d969553 |
120 | // Next = (B.Degenerated(E)); |
7fd59977 |
121 | Suivant = (BRep_Tool::Degenerated(E)); |
122 | } |
123 | |
124 | while (Suivant) { |
125 | myIterator.Next(); |
126 | E = myIterator.Current(); |
0d969553 |
127 | // Next = (B.Degenerated(E) && myIterator.More()); |
7fd59977 |
128 | Suivant = (BRep_Tool::Degenerated(E) && myIterator.More()); |
129 | } |
130 | |
131 | if (myIterator.More()) myIterator.Next(); |
132 | return E; |
133 | } |
134 | |