0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[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 under
9 // the terms of the GNU Lesser General Public License 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
18 #include <BRepFilletAPI_MakeFillet2d.hxx>
19 #include <TopoDS_Edge.hxx>
20 #include <TopoDS_Face.hxx>
21 #include <TopoDS_Shape.hxx>
22 #include <TopoDS_Vertex.hxx>
23
24 //=======================================================================
25 //function : BRepFilletAPI_MakeFillet2d
26 //purpose  : 
27 //=======================================================================
28 BRepFilletAPI_MakeFillet2d::BRepFilletAPI_MakeFillet2d()
29 {
30 }
31
32 //=======================================================================
33 //function : BRepFilletAPI_MakeFillet2d
34 //purpose  : 
35 //=======================================================================
36
37 BRepFilletAPI_MakeFillet2d::BRepFilletAPI_MakeFillet2d(const TopoDS_Face& F)
38 {
39   myMakeChFi2d.Init(F);
40 }
41
42 //=======================================================================
43 //function : Init
44 //purpose  : 
45 //=======================================================================
46
47 void BRepFilletAPI_MakeFillet2d::Init(const TopoDS_Face& F)
48 {
49   myMakeChFi2d.Init(F);
50 }
51
52 //=======================================================================
53 //function : Init
54 //purpose  : 
55 //=======================================================================
56
57 void BRepFilletAPI_MakeFillet2d::Init(const TopoDS_Face& RefFace, const TopoDS_Face& ModFace)
58 {
59   myMakeChFi2d.Init(RefFace, ModFace);
60 }
61
62 //=======================================================================
63 //function : AddFillet
64 //purpose  : 
65 //=======================================================================
66
67 TopoDS_Edge BRepFilletAPI_MakeFillet2d::AddFillet(const TopoDS_Vertex& V, const Standard_Real Radius)
68 {
69   return myMakeChFi2d.AddFillet(V, Radius);
70 }
71
72 //=======================================================================
73 //function : ModifyFillet
74 //purpose  : 
75 //=======================================================================
76
77 TopoDS_Edge BRepFilletAPI_MakeFillet2d::ModifyFillet(const TopoDS_Edge& Fillet, const Standard_Real Radius)
78 {
79   return myMakeChFi2d.ModifyFillet(Fillet, Radius);
80 }
81
82 //=======================================================================
83 //function : RemoveFillet
84 //purpose  : 
85 //=======================================================================
86
87 TopoDS_Vertex BRepFilletAPI_MakeFillet2d::RemoveFillet(const TopoDS_Edge& Fillet)
88 {
89   return myMakeChFi2d.RemoveFillet(Fillet);
90 }
91
92 //=======================================================================
93 //function : AddChamfer
94 //purpose  : 
95 //=======================================================================
96
97 TopoDS_Edge BRepFilletAPI_MakeFillet2d::AddChamfer(const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2)
98 {
99   return myMakeChFi2d.AddChamfer(E1, E2, D1, D2);
100 }
101
102 //=======================================================================
103 //function : AddChamfer
104 //purpose  : 
105 //=======================================================================
106
107 TopoDS_Edge BRepFilletAPI_MakeFillet2d::AddChamfer(const TopoDS_Edge& E, const TopoDS_Vertex& V, const Standard_Real D, const Standard_Real Ang)
108 {
109   return myMakeChFi2d.AddChamfer(E, V, D, Ang);
110 }
111
112 //=======================================================================
113 //function : ModifyChamfer
114 //purpose  : 
115 //=======================================================================
116
117 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)
118 {
119   return myMakeChFi2d.ModifyChamfer(Chamfer, E1, E2, D1, D2);
120 }
121
122 //=======================================================================
123 //function : ModifyChamfer
124 //purpose  : 
125 //=======================================================================
126
127 TopoDS_Edge BRepFilletAPI_MakeFillet2d::ModifyChamfer(const TopoDS_Edge& Chamfer, const TopoDS_Edge& E, const Standard_Real D, const Standard_Real Ang)
128 {
129   return myMakeChFi2d.ModifyChamfer(Chamfer, E, D, Ang);
130 }
131
132 //=======================================================================
133 //function : RemoveChamfer
134 //purpose  : 
135 //=======================================================================
136
137 TopoDS_Vertex BRepFilletAPI_MakeFillet2d::RemoveChamfer(const TopoDS_Edge& Chamfer)
138 {
139   return myMakeChFi2d.RemoveChamfer(Chamfer);
140 }
141
142 //=======================================================================
143 //function : BasisEdge
144 //purpose  : 
145 //=======================================================================
146
147 const TopoDS_Edge& BRepFilletAPI_MakeFillet2d::BasisEdge(const TopoDS_Edge& E) const 
148 {
149   return myMakeChFi2d.BasisEdge(E);
150 }
151
152
153 //=======================================================================
154 //function : Build
155 //purpose  : 
156 //=======================================================================
157
158 void BRepFilletAPI_MakeFillet2d::Build()
159 {
160   // test if the operation is done
161   if (Status() == ChFi2d_IsDone) {
162     Done();
163     myShape = myMakeChFi2d.Result();
164   }
165   else
166     NotDone();
167 }
168
169 //=======================================================================
170 //function : Modified
171 //purpose  : 
172 //=======================================================================
173
174 const TopTools_ListOfShape& BRepFilletAPI_MakeFillet2d::Modified(const TopoDS_Shape& E)
175 {
176   myGenerated.Clear();
177   myGenerated.Append(DescendantEdge(TopoDS::Edge(E)));
178   return myGenerated;
179 }
180
181 //=======================================================================
182 //function : NbCurves
183 //purpose  : 
184 //=======================================================================
185
186 Standard_Integer BRepFilletAPI_MakeFillet2d::NbCurves() const 
187 {
188   return NbFillet() + NbChamfer();
189 }
190
191 //=======================================================================
192 //function : NewEdges
193 //purpose  : 
194 //=======================================================================
195
196 const TopTools_ListOfShape& BRepFilletAPI_MakeFillet2d::NewEdges(const Standard_Integer I)
197 {
198   myGenerated.Clear();
199   if (I <= NbFillet())
200     myGenerated.Append(FilletEdges()(I));
201   else
202     myGenerated.Append(ChamferEdges()(I-NbFillet()));
203
204   return myGenerated;
205 }
206
207