0032768: Coding - get rid of unused headers [BopAlgo to BRepBuilderAPI]
[occt.git] / src / BRepBuilderAPI / BRepBuilderAPI_MakePolygon.cxx
1 // Created on: 1993-07-29
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1993-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 <BRepBuilderAPI_MakePolygon.hxx>
19 #include <gp_Pnt.hxx>
20 #include <TopoDS_Edge.hxx>
21 #include <TopoDS_Vertex.hxx>
22 #include <TopoDS_Wire.hxx>
23
24 //=======================================================================
25 //function : BRepBuilderAPI_MakePolygon
26 //purpose  : 
27 //=======================================================================
28 BRepBuilderAPI_MakePolygon::BRepBuilderAPI_MakePolygon()
29 {
30 }
31
32
33 //=======================================================================
34 //function : BRepBuilderAPI_MakePolygon
35 //purpose  : 
36 //=======================================================================
37
38 BRepBuilderAPI_MakePolygon::BRepBuilderAPI_MakePolygon(const gp_Pnt& P1, const gp_Pnt& P2) 
39 : myMakePolygon(P1,P2)
40 {
41   if (myMakePolygon.IsDone()) {
42     Done();
43     myShape = myMakePolygon.Shape();
44   }
45 }
46
47
48 //=======================================================================
49 //function : BRepBuilderAPI_MakePolygon
50 //purpose  : 
51 //=======================================================================
52
53 BRepBuilderAPI_MakePolygon::BRepBuilderAPI_MakePolygon(const gp_Pnt& P1,
54                                          const gp_Pnt& P2,
55                                          const gp_Pnt& P3, 
56                                          const Standard_Boolean Cl)
57 : myMakePolygon(P1,P2,P3,Cl)
58 {
59   if (myMakePolygon.IsDone()) {
60     Done();
61     myShape = myMakePolygon.Shape();
62   }
63 }
64
65
66 //=======================================================================
67 //function : BRepBuilderAPI_MakePolygon
68 //purpose  : 
69 //=======================================================================
70
71 BRepBuilderAPI_MakePolygon::BRepBuilderAPI_MakePolygon(const gp_Pnt& P1, 
72                                          const gp_Pnt& P2, 
73                                          const gp_Pnt& P3,
74                                          const gp_Pnt& P4,
75                                          const Standard_Boolean Cl)
76 : myMakePolygon(P1,P2,P3,P4,Cl)
77 {
78   if (myMakePolygon.IsDone()) {
79     Done();
80     myShape = myMakePolygon.Shape();
81   }
82 }
83
84
85 //=======================================================================
86 //function : BRepBuilderAPI_MakePolygon
87 //purpose  : 
88 //=======================================================================
89
90 BRepBuilderAPI_MakePolygon::BRepBuilderAPI_MakePolygon(const TopoDS_Vertex& V1,
91                                          const TopoDS_Vertex& V2)
92 : myMakePolygon(V1,V2)
93 {
94   if (myMakePolygon.IsDone()) {
95     Done();
96     myShape = myMakePolygon.Shape();
97   }
98 }
99
100
101 //=======================================================================
102 //function : BRepBuilderAPI_MakePolygon
103 //purpose  : 
104 //=======================================================================
105
106 BRepBuilderAPI_MakePolygon::BRepBuilderAPI_MakePolygon(const TopoDS_Vertex& V1, 
107                                          const TopoDS_Vertex& V2, 
108                                          const TopoDS_Vertex& V3, 
109                                          const Standard_Boolean Cl)
110 : myMakePolygon(V1,V2,V3,Cl)
111 {
112   if (myMakePolygon.IsDone()) {
113     Done();
114     myShape = myMakePolygon.Shape();
115   }
116 }
117
118
119 //=======================================================================
120 //function : BRepBuilderAPI_MakePolygon
121 //purpose  : 
122 //=======================================================================
123
124 BRepBuilderAPI_MakePolygon::BRepBuilderAPI_MakePolygon(const TopoDS_Vertex& V1,
125                                          const TopoDS_Vertex& V2,
126                                          const TopoDS_Vertex& V3,
127                                          const TopoDS_Vertex& V4, 
128                                          const Standard_Boolean Cl)
129 : myMakePolygon(V1,V2,V3,V4,Cl)
130 {
131   if (myMakePolygon.IsDone()) {
132     Done();
133     myShape = myMakePolygon.Shape();
134   }
135 }
136
137
138 //=======================================================================
139 //function : Add
140 //purpose  : 
141 //=======================================================================
142
143 void  BRepBuilderAPI_MakePolygon::Add(const gp_Pnt& P)
144 {
145   myMakePolygon.Add(P);
146   if (myMakePolygon.IsDone())  {
147     Done();
148     if ( !LastVertex().IsNull())
149       myShape = myMakePolygon.Shape();
150   }
151 }
152
153
154 //=======================================================================
155 //function : Add
156 //purpose  : 
157 //=======================================================================
158
159 void  BRepBuilderAPI_MakePolygon::Add(const TopoDS_Vertex& V)
160 {
161   myMakePolygon.Add(V);
162   if (myMakePolygon.IsDone()) {
163     Done();
164     myShape = myMakePolygon.Shape();
165   }
166
167       
168 //=======================================================================
169 //function : Added
170 //purpose  : 
171 //=======================================================================
172
173 Standard_Boolean  BRepBuilderAPI_MakePolygon::Added()const 
174 {
175   return myMakePolygon.Added();
176 }
177
178
179 //=======================================================================
180 //function : Close
181 //purpose  : 
182 //=======================================================================
183
184 void  BRepBuilderAPI_MakePolygon::Close()
185 {
186   myMakePolygon.Close();
187   myShape = myMakePolygon.Shape();
188 }
189
190
191 //=======================================================================
192 //function : FirstVertex
193 //purpose  : 
194 //=======================================================================
195
196 const TopoDS_Vertex&  BRepBuilderAPI_MakePolygon::FirstVertex()const 
197 {
198   return myMakePolygon.FirstVertex();
199 }
200
201
202 //=======================================================================
203 //function : LastVertex
204 //purpose  : 
205 //=======================================================================
206
207 const TopoDS_Vertex&  BRepBuilderAPI_MakePolygon::LastVertex()const 
208 {
209   return myMakePolygon.LastVertex();
210 }
211
212 //=======================================================================
213 //function : IsDone
214 //purpose  : 
215 //=======================================================================
216
217 Standard_Boolean BRepBuilderAPI_MakePolygon::IsDone() const
218 {
219   return myMakePolygon.IsDone();
220 }
221
222
223 //=======================================================================
224 //function : Edge
225 //purpose  : 
226 //=======================================================================
227
228 const TopoDS_Edge&  BRepBuilderAPI_MakePolygon::Edge()const 
229 {
230   return myMakePolygon.Edge();
231 }
232
233 //=======================================================================
234 //function : Wire
235 //purpose  : 
236 //=======================================================================
237
238 const TopoDS_Wire&  BRepBuilderAPI_MakePolygon::Wire()
239 {
240   return myMakePolygon.Wire();
241 }
242
243 //=======================================================================
244 //function : operator
245 //purpose  : 
246 //=======================================================================
247
248 BRepBuilderAPI_MakePolygon::operator TopoDS_Edge() const
249 {
250   return Edge();
251 }
252
253 //=======================================================================
254 //function : operator
255 //purpose  : 
256 //=======================================================================
257
258 BRepBuilderAPI_MakePolygon::operator TopoDS_Wire()
259 {
260   return Wire();
261 }
262
263
264