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