0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BRepBuilderAPI / BRepBuilderAPI_MakeWire.cxx
1 // Created on: 1993-07-23
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_MakeWire.hxx>
19 #include <StdFail_NotDone.hxx>
20 #include <TopoDS_Edge.hxx>
21 #include <TopoDS_Vertex.hxx>
22 #include <TopoDS_Wire.hxx>
23
24 //=======================================================================
25 //function : BRepBuilderAPI_MakeWire
26 //purpose  : 
27 //=======================================================================
28 BRepBuilderAPI_MakeWire::BRepBuilderAPI_MakeWire()
29 {
30 }
31
32
33 //=======================================================================
34 //function : BRepBuilderAPI_MakeWire
35 //purpose  : 
36 //=======================================================================
37
38 BRepBuilderAPI_MakeWire::BRepBuilderAPI_MakeWire(const TopoDS_Edge& E)
39 : myMakeWire(E)
40 {
41   if ( myMakeWire.IsDone()) {
42     Done();
43     myShape = myMakeWire.Wire();
44   }
45 }
46
47
48 //=======================================================================
49 //function : BRepBuilderAPI_MakeWire
50 //purpose  : 
51 //=======================================================================
52
53 BRepBuilderAPI_MakeWire::BRepBuilderAPI_MakeWire(const TopoDS_Edge& E1, 
54                                    const TopoDS_Edge& E2)
55 : myMakeWire(E1,E2)
56 {
57   if ( myMakeWire.IsDone()) {
58     Done();
59     myShape = myMakeWire.Wire();
60   }
61 }
62
63
64 //=======================================================================
65 //function : BRepBuilderAPI_MakeWire
66 //purpose  : 
67 //=======================================================================
68
69 BRepBuilderAPI_MakeWire::BRepBuilderAPI_MakeWire(const TopoDS_Edge& E1,
70                                    const TopoDS_Edge& E2, 
71                                    const TopoDS_Edge& E3)
72 : myMakeWire(E1,E2,E3)
73 {
74   if ( myMakeWire.IsDone()) {
75     Done();
76     myShape = myMakeWire.Wire();
77   }
78 }
79
80
81 //=======================================================================
82 //function : BRepBuilderAPI_MakeWire
83 //purpose  : 
84 //=======================================================================
85
86 BRepBuilderAPI_MakeWire::BRepBuilderAPI_MakeWire(const TopoDS_Edge& E1, 
87                                    const TopoDS_Edge& E2,
88                                    const TopoDS_Edge& E3, 
89                                    const TopoDS_Edge& E4)
90 : myMakeWire(E1,E2,E3,E4)
91 {
92   if ( myMakeWire.IsDone()) {
93     Done();
94     myShape = myMakeWire.Wire();
95   }
96 }
97
98
99 //=======================================================================
100 //function : BRepBuilderAPI_MakeWire
101 //purpose  : 
102 //=======================================================================
103
104 BRepBuilderAPI_MakeWire::BRepBuilderAPI_MakeWire(const TopoDS_Wire& W)
105 : myMakeWire(W)
106 {
107   if ( myMakeWire.IsDone()) {
108     Done();
109     myShape = myMakeWire.Wire();
110   }
111 }
112
113
114 //=======================================================================
115 //function : BRepBuilderAPI_MakeWire
116 //purpose  : 
117 //=======================================================================
118
119 BRepBuilderAPI_MakeWire::BRepBuilderAPI_MakeWire(const TopoDS_Wire& W, 
120                                    const TopoDS_Edge& E)
121 : myMakeWire(W,E)
122 {
123   if ( myMakeWire.IsDone()) {
124     Done();
125     myShape = myMakeWire.Wire();
126   }
127 }
128
129
130 //=======================================================================
131 //function : Add
132 //purpose  : 
133 //=======================================================================
134
135 void  BRepBuilderAPI_MakeWire::Add(const TopoDS_Wire& W)
136 {
137   myMakeWire.Add(W);
138   if ( myMakeWire.IsDone()) {
139     Done();
140     myShape = myMakeWire.Wire();
141   }
142 }
143
144 //=======================================================================
145 //function : Add
146 //purpose  : 
147 //=======================================================================
148
149 void  BRepBuilderAPI_MakeWire::Add(const TopoDS_Edge& E)
150 {
151   myMakeWire.Add(E);
152   if ( myMakeWire.IsDone()) {
153     Done();
154     myShape = myMakeWire.Wire();
155   }
156 }
157
158 //=======================================================================
159 //function : Add
160 //purpose  : 
161 //=======================================================================
162
163 void  BRepBuilderAPI_MakeWire::Add(const TopTools_ListOfShape& L)
164 {
165   myMakeWire.Add(L);
166   if ( myMakeWire.IsDone()) {
167     Done();
168     myShape = myMakeWire.Wire();
169   }
170 }
171
172
173 //=======================================================================
174 //function : Wire
175 //purpose  : 
176 //=======================================================================
177
178 const TopoDS_Wire&  BRepBuilderAPI_MakeWire::Wire()const 
179 {
180   return myMakeWire.Wire();
181 }
182
183
184 //=======================================================================
185 //function : Edge
186 //purpose  : 
187 //=======================================================================
188
189 const TopoDS_Edge&  BRepBuilderAPI_MakeWire::Edge()const 
190 {
191   return myMakeWire.Edge();
192 }
193
194
195 //=======================================================================
196 //function : Vertex
197 //purpose  : 
198 //=======================================================================
199
200 const TopoDS_Vertex&  BRepBuilderAPI_MakeWire::Vertex()const 
201 {
202   return myMakeWire.Vertex();
203 }
204
205
206 //=======================================================================
207 //function : operator
208 //purpose  : 
209 //=======================================================================
210
211 BRepBuilderAPI_MakeWire::operator TopoDS_Wire() const
212 {
213   return Wire();
214 }
215
216
217 //=======================================================================
218 //function : IsDone
219 //purpose  : 
220 //=======================================================================
221
222 Standard_Boolean BRepBuilderAPI_MakeWire::IsDone() const
223 {
224   return myMakeWire.IsDone();
225 }
226
227
228
229 //=======================================================================
230 //function : Error
231 //purpose  : 
232 //=======================================================================
233
234 BRepBuilderAPI_WireError BRepBuilderAPI_MakeWire::Error() const
235 {
236   switch ( myMakeWire.Error()) {
237
238   case BRepLib_WireDone: 
239     return BRepBuilderAPI_WireDone;
240
241   case BRepLib_EmptyWire:
242     return BRepBuilderAPI_EmptyWire;
243
244   case BRepLib_DisconnectedWire:
245     return BRepBuilderAPI_DisconnectedWire;
246
247   case BRepLib_NonManifoldWire:
248     return BRepBuilderAPI_NonManifoldWire;
249   }
250
251   // portage WNT
252   return BRepBuilderAPI_WireDone;
253 }