33278117eab72351391c0d3902d6e889eb064976
[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-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21
22
23 #include <BRepBuilderAPI_MakePolygon.ixx>
24
25 //=======================================================================
26 //function : BRepBuilderAPI_MakePolygon
27 //purpose  : 
28 //=======================================================================
29
30 BRepBuilderAPI_MakePolygon::BRepBuilderAPI_MakePolygon()
31 {
32 }
33
34
35 //=======================================================================
36 //function : BRepBuilderAPI_MakePolygon
37 //purpose  : 
38 //=======================================================================
39
40 BRepBuilderAPI_MakePolygon::BRepBuilderAPI_MakePolygon(const gp_Pnt& P1, const gp_Pnt& P2) 
41 : myMakePolygon(P1,P2)
42 {
43   if (myMakePolygon.IsDone()) {
44     Done();
45     myShape = myMakePolygon.Shape();
46   }
47 }
48
49
50 //=======================================================================
51 //function : BRepBuilderAPI_MakePolygon
52 //purpose  : 
53 //=======================================================================
54
55 BRepBuilderAPI_MakePolygon::BRepBuilderAPI_MakePolygon(const gp_Pnt& P1,
56                                          const gp_Pnt& P2,
57                                          const gp_Pnt& P3, 
58                                          const Standard_Boolean Cl)
59 : myMakePolygon(P1,P2,P3,Cl)
60 {
61   if (myMakePolygon.IsDone()) {
62     Done();
63     myShape = myMakePolygon.Shape();
64   }
65 }
66
67
68 //=======================================================================
69 //function : BRepBuilderAPI_MakePolygon
70 //purpose  : 
71 //=======================================================================
72
73 BRepBuilderAPI_MakePolygon::BRepBuilderAPI_MakePolygon(const gp_Pnt& P1, 
74                                          const gp_Pnt& P2, 
75                                          const gp_Pnt& P3,
76                                          const gp_Pnt& P4,
77                                          const Standard_Boolean Cl)
78 : myMakePolygon(P1,P2,P3,P4,Cl)
79 {
80   if (myMakePolygon.IsDone()) {
81     Done();
82     myShape = myMakePolygon.Shape();
83   }
84 }
85
86
87 //=======================================================================
88 //function : BRepBuilderAPI_MakePolygon
89 //purpose  : 
90 //=======================================================================
91
92 BRepBuilderAPI_MakePolygon::BRepBuilderAPI_MakePolygon(const TopoDS_Vertex& V1,
93                                          const TopoDS_Vertex& V2)
94 : myMakePolygon(V1,V2)
95 {
96   if (myMakePolygon.IsDone()) {
97     Done();
98     myShape = myMakePolygon.Shape();
99   }
100 }
101
102
103 //=======================================================================
104 //function : BRepBuilderAPI_MakePolygon
105 //purpose  : 
106 //=======================================================================
107
108 BRepBuilderAPI_MakePolygon::BRepBuilderAPI_MakePolygon(const TopoDS_Vertex& V1, 
109                                          const TopoDS_Vertex& V2, 
110                                          const TopoDS_Vertex& V3, 
111                                          const Standard_Boolean Cl)
112 : myMakePolygon(V1,V2,V3,Cl)
113 {
114   if (myMakePolygon.IsDone()) {
115     Done();
116     myShape = myMakePolygon.Shape();
117   }
118 }
119
120
121 //=======================================================================
122 //function : BRepBuilderAPI_MakePolygon
123 //purpose  : 
124 //=======================================================================
125
126 BRepBuilderAPI_MakePolygon::BRepBuilderAPI_MakePolygon(const TopoDS_Vertex& V1,
127                                          const TopoDS_Vertex& V2,
128                                          const TopoDS_Vertex& V3,
129                                          const TopoDS_Vertex& V4, 
130                                          const Standard_Boolean Cl)
131 : myMakePolygon(V1,V2,V3,V4,Cl)
132 {
133   if (myMakePolygon.IsDone()) {
134     Done();
135     myShape = myMakePolygon.Shape();
136   }
137 }
138
139
140 //=======================================================================
141 //function : Add
142 //purpose  : 
143 //=======================================================================
144
145 void  BRepBuilderAPI_MakePolygon::Add(const gp_Pnt& P)
146 {
147   myMakePolygon.Add(P);
148   if (myMakePolygon.IsDone())  {
149     Done();
150     if ( !LastVertex().IsNull())
151       myShape = myMakePolygon.Shape();
152   }
153 }
154
155
156 //=======================================================================
157 //function : Add
158 //purpose  : 
159 //=======================================================================
160
161 void  BRepBuilderAPI_MakePolygon::Add(const TopoDS_Vertex& V)
162 {
163   myMakePolygon.Add(V);
164   if (myMakePolygon.IsDone()) {
165     Done();
166     myShape = myMakePolygon.Shape();
167   }
168
169       
170 //=======================================================================
171 //function : Added
172 //purpose  : 
173 //=======================================================================
174
175 Standard_Boolean  BRepBuilderAPI_MakePolygon::Added()const 
176 {
177   return myMakePolygon.Added();
178 }
179
180
181 //=======================================================================
182 //function : Close
183 //purpose  : 
184 //=======================================================================
185
186 void  BRepBuilderAPI_MakePolygon::Close()
187 {
188   myMakePolygon.Close();
189   myShape = myMakePolygon.Shape();
190 }
191
192
193 //=======================================================================
194 //function : FirstVertex
195 //purpose  : 
196 //=======================================================================
197
198 const TopoDS_Vertex&  BRepBuilderAPI_MakePolygon::FirstVertex()const 
199 {
200   return myMakePolygon.FirstVertex();
201 }
202
203
204 //=======================================================================
205 //function : LastVertex
206 //purpose  : 
207 //=======================================================================
208
209 const TopoDS_Vertex&  BRepBuilderAPI_MakePolygon::LastVertex()const 
210 {
211   return myMakePolygon.LastVertex();
212 }
213
214 //=======================================================================
215 //function : IsDone
216 //purpose  : 
217 //=======================================================================
218
219 Standard_Boolean BRepBuilderAPI_MakePolygon::IsDone() const
220 {
221   return myMakePolygon.IsDone();
222 }
223
224
225 //=======================================================================
226 //function : Edge
227 //purpose  : 
228 //=======================================================================
229
230 const TopoDS_Edge&  BRepBuilderAPI_MakePolygon::Edge()const 
231 {
232   return myMakePolygon.Edge();
233 }
234
235 //=======================================================================
236 //function : Wire
237 //purpose  : 
238 //=======================================================================
239
240 const TopoDS_Wire&  BRepBuilderAPI_MakePolygon::Wire()const 
241 {
242   return myMakePolygon.Wire();
243 }
244
245 //=======================================================================
246 //function : operator
247 //purpose  : 
248 //=======================================================================
249
250 BRepBuilderAPI_MakePolygon::operator TopoDS_Edge() const
251 {
252   return Edge();
253 }
254
255 //=======================================================================
256 //function : operator
257 //purpose  : 
258 //=======================================================================
259
260 BRepBuilderAPI_MakePolygon::operator TopoDS_Wire() const
261 {
262   return Wire();
263 }
264
265
266