0024428: Implementation of LGPL license
[occt.git] / src / BRepFilletAPI / BRepFilletAPI_MakeFillet2d.cxx
1 // Created on: 1995-08-31
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and / or modify it
9 // under the terms of the GNU Lesser General Public version 2.1 as published
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <BRepFilletAPI_MakeFillet2d.ixx>
18
19 //=======================================================================
20 //function : BRepFilletAPI_MakeFillet2d
21 //purpose  : 
22 //=======================================================================
23
24 BRepFilletAPI_MakeFillet2d::BRepFilletAPI_MakeFillet2d()
25 {
26 }
27
28 //=======================================================================
29 //function : BRepFilletAPI_MakeFillet2d
30 //purpose  : 
31 //=======================================================================
32
33 BRepFilletAPI_MakeFillet2d::BRepFilletAPI_MakeFillet2d(const TopoDS_Face& F)
34 {
35   myMakeChFi2d.Init(F);
36 }
37
38 //=======================================================================
39 //function : Init
40 //purpose  : 
41 //=======================================================================
42
43 void BRepFilletAPI_MakeFillet2d::Init(const TopoDS_Face& F)
44 {
45   myMakeChFi2d.Init(F);
46 }
47
48 //=======================================================================
49 //function : Init
50 //purpose  : 
51 //=======================================================================
52
53 void BRepFilletAPI_MakeFillet2d::Init(const TopoDS_Face& RefFace, const TopoDS_Face& ModFace)
54 {
55   myMakeChFi2d.Init(RefFace, ModFace);
56 }
57
58 //=======================================================================
59 //function : AddFillet
60 //purpose  : 
61 //=======================================================================
62
63 TopoDS_Edge BRepFilletAPI_MakeFillet2d::AddFillet(const TopoDS_Vertex& V, const Standard_Real Radius)
64 {
65   return myMakeChFi2d.AddFillet(V, Radius);
66 }
67
68 //=======================================================================
69 //function : ModifyFillet
70 //purpose  : 
71 //=======================================================================
72
73 TopoDS_Edge BRepFilletAPI_MakeFillet2d::ModifyFillet(const TopoDS_Edge& Fillet, const Standard_Real Radius)
74 {
75   return myMakeChFi2d.ModifyFillet(Fillet, Radius);
76 }
77
78 //=======================================================================
79 //function : RemoveFillet
80 //purpose  : 
81 //=======================================================================
82
83 TopoDS_Vertex BRepFilletAPI_MakeFillet2d::RemoveFillet(const TopoDS_Edge& Fillet)
84 {
85   return myMakeChFi2d.RemoveFillet(Fillet);
86 }
87
88 //=======================================================================
89 //function : AddChamfer
90 //purpose  : 
91 //=======================================================================
92
93 TopoDS_Edge BRepFilletAPI_MakeFillet2d::AddChamfer(const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2)
94 {
95   return myMakeChFi2d.AddChamfer(E1, E2, D1, D2);
96 }
97
98 //=======================================================================
99 //function : AddChamfer
100 //purpose  : 
101 //=======================================================================
102
103 TopoDS_Edge BRepFilletAPI_MakeFillet2d::AddChamfer(const TopoDS_Edge& E, const TopoDS_Vertex& V, const Standard_Real D, const Standard_Real Ang)
104 {
105   return myMakeChFi2d.AddChamfer(E, V, D, Ang);
106 }
107
108 //=======================================================================
109 //function : ModifyChamfer
110 //purpose  : 
111 //=======================================================================
112
113 TopoDS_Edge BRepFilletAPI_MakeFillet2d::ModifyChamfer(const TopoDS_Edge& Chamfer, const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2)
114 {
115   return myMakeChFi2d.ModifyChamfer(Chamfer, E1, E2, D1, D2);
116 }
117
118 //=======================================================================
119 //function : ModifyChamfer
120 //purpose  : 
121 //=======================================================================
122
123 TopoDS_Edge BRepFilletAPI_MakeFillet2d::ModifyChamfer(const TopoDS_Edge& Chamfer, const TopoDS_Edge& E, const Standard_Real D, const Standard_Real Ang)
124 {
125   return myMakeChFi2d.ModifyChamfer(Chamfer, E, D, Ang);
126 }
127
128 //=======================================================================
129 //function : RemoveChamfer
130 //purpose  : 
131 //=======================================================================
132
133 TopoDS_Vertex BRepFilletAPI_MakeFillet2d::RemoveChamfer(const TopoDS_Edge& Chamfer)
134 {
135   return myMakeChFi2d.RemoveChamfer(Chamfer);
136 }
137
138 //=======================================================================
139 //function : BasisEdge
140 //purpose  : 
141 //=======================================================================
142
143 const TopoDS_Edge& BRepFilletAPI_MakeFillet2d::BasisEdge(const TopoDS_Edge& E) const 
144 {
145   return myMakeChFi2d.BasisEdge(E);
146 }
147
148
149 //=======================================================================
150 //function : Build
151 //purpose  : 
152 //=======================================================================
153
154 void BRepFilletAPI_MakeFillet2d::Build()
155 {
156   // test if the operation is done
157   if (Status() == ChFi2d_IsDone) {
158     Done();
159     myShape = myMakeChFi2d.Result();
160   }
161   else
162     NotDone();
163 }
164
165 //=======================================================================
166 //function : Modified
167 //purpose  : 
168 //=======================================================================
169
170 const TopTools_ListOfShape& BRepFilletAPI_MakeFillet2d::Modified(const TopoDS_Shape& E)
171 {
172   myGenerated.Clear();
173   myGenerated.Append(DescendantEdge(TopoDS::Edge(E)));
174   return myGenerated;
175 }
176
177 //=======================================================================
178 //function : NbCurves
179 //purpose  : 
180 //=======================================================================
181
182 Standard_Integer BRepFilletAPI_MakeFillet2d::NbCurves() const 
183 {
184   return NbFillet() + NbChamfer();
185 }
186
187 //=======================================================================
188 //function : NewEdges
189 //purpose  : 
190 //=======================================================================
191
192 const TopTools_ListOfShape& BRepFilletAPI_MakeFillet2d::NewEdges(const Standard_Integer I)
193 {
194   myGenerated.Clear();
195   if (I <= NbFillet())
196     myGenerated.Append(FilletEdges()(I));
197   else
198     myGenerated.Append(ChamferEdges()(I-NbFillet()));
199
200   return myGenerated;
201 }
202
203