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