0024023: Revamp the OCCT Handle -- ambiguity
[occt.git] / src / BRepOffsetAPI / BRepOffsetAPI_MakePipeShell.cxx
1 // Created on: 1998-04-08
2 // Created by: Philippe MANGIN
3 // Copyright (c) 1998-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 #include <BRepOffsetAPI_MakePipeShell.ixx>
18
19 #include <GeomFill_PipeError.hxx>
20 #include <Standard_NotImplemented.hxx>
21 #include <StdFail_NotDone.hxx>
22
23 //=======================================================================
24 //function :
25 //purpose  : 
26 //=======================================================================
27 BRepOffsetAPI_MakePipeShell::BRepOffsetAPI_MakePipeShell(const TopoDS_Wire& Spine)
28                       
29
30 {
31   myPipe = new (BRepFill_PipeShell) (Spine);
32   SetTolerance();
33   SetTransitionMode();
34   NotDone();
35 }
36
37 //=======================================================================
38 //function : SetMode
39 //purpose  : 
40 //=======================================================================
41  void BRepOffsetAPI_MakePipeShell::SetMode(const Standard_Boolean IsFrenet) 
42 {
43   myPipe->Set(IsFrenet);
44 }
45
46 //=======================================================================
47 //function : SetDiscreteMode
48 //purpose  : 
49 //=======================================================================
50  void BRepOffsetAPI_MakePipeShell::SetDiscreteMode() 
51 {
52   myPipe->SetDiscrete();
53 }
54
55 //=======================================================================
56 //function : SetMode
57 //purpose  : 
58 //=======================================================================
59  void BRepOffsetAPI_MakePipeShell::SetMode(const gp_Ax2& Axe) 
60 {
61   myPipe->Set(Axe);
62 }
63
64 //=======================================================================
65 //function : SetMode
66 //purpose  : 
67 //=======================================================================
68  void BRepOffsetAPI_MakePipeShell::SetMode(const gp_Dir& BiNormal) 
69 {
70   myPipe->Set(BiNormal);
71 }
72
73 //=======================================================================
74 //function : SetMode
75 //purpose  : 
76 //=======================================================================
77  Standard_Boolean BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Shape& SpineSupport) 
78 {
79   return myPipe->Set(SpineSupport);
80 }
81
82 //=======================================================================
83 //function : SetMode
84 //purpose  : 
85 //=======================================================================
86  void BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Wire& AuxiliarySpine,
87                                            const Standard_Boolean CurvilinearEquivalence,
88                                            const BRepFill_TypeOfContact KeepContact) 
89 {
90    myPipe->Set(AuxiliarySpine, CurvilinearEquivalence, KeepContact);
91 }
92
93 //=======================================================================
94 //function :Add
95 //purpose  : 
96 //=======================================================================
97  void BRepOffsetAPI_MakePipeShell::Add(const TopoDS_Shape& Profile,
98                                        const Standard_Boolean WithContact,
99                                        const Standard_Boolean WithCorrection) 
100 {
101   myPipe->Add(Profile, WithContact, WithCorrection);
102 }
103
104 //=======================================================================
105 //function : Add
106 //purpose  : 
107 //=======================================================================
108  void BRepOffsetAPI_MakePipeShell::Add(const TopoDS_Shape& Profile,
109                                        const TopoDS_Vertex& Location,
110                                        const Standard_Boolean WithContact,
111                                        const Standard_Boolean WithCorrection) 
112 {
113   myPipe->Add(Profile, Location, WithContact, WithCorrection);
114 }
115
116 //=======================================================================
117 //function : SetLaw
118 //purpose  : 
119 //=======================================================================
120  void BRepOffsetAPI_MakePipeShell::SetLaw(const TopoDS_Shape& Profile,
121                                           const Handle(Law_Function)& L,
122                                           const Standard_Boolean WithContact,
123                                           const Standard_Boolean WithCorrection) 
124 {
125   myPipe->SetLaw(Profile, L, WithContact, WithCorrection);
126 }
127
128 //=======================================================================
129 //function : SetLaw
130 //purpose  : 
131 //=======================================================================
132  void BRepOffsetAPI_MakePipeShell::SetLaw(const TopoDS_Shape& Profile,
133                                           const Handle(Law_Function)& L,
134                                           const TopoDS_Vertex& Location,
135                                           const Standard_Boolean WithContact,
136                                           const Standard_Boolean WithCorrection) 
137 {
138   myPipe->SetLaw(Profile, L, Location, WithContact, WithCorrection);
139 }
140
141 //=======================================================================
142 //function : Delete
143 //purpose  : 
144 //=======================================================================
145
146 void BRepOffsetAPI_MakePipeShell::Delete( const TopoDS_Shape& Profile)
147 {
148   myPipe->Delete(Profile);
149 }
150
151
152 //=======================================================================
153 //function : IsReady
154 //purpose  : 
155 //=======================================================================
156  Standard_Boolean BRepOffsetAPI_MakePipeShell::IsReady() const
157 {
158   return myPipe->IsReady();
159 }
160
161 //=======================================================================
162 //function : GetStatus
163 //purpose  : 
164 //=======================================================================
165  BRepBuilderAPI_PipeError BRepOffsetAPI_MakePipeShell::GetStatus() const
166 {
167   BRepBuilderAPI_PipeError Status;
168   GeomFill_PipeError stat;
169   stat = myPipe->GetStatus();
170   switch (stat) {
171   case GeomFill_PipeOk :
172     {
173       Status = BRepBuilderAPI_PipeDone;
174       break;
175     }
176   case  GeomFill_PlaneNotIntersectGuide :
177     {
178       Status = BRepBuilderAPI_PlaneNotIntersectGuide;
179       break;
180     }
181   case  GeomFill_ImpossibleContact :
182     {
183       Status = BRepBuilderAPI_ImpossibleContact;
184       break;
185     }
186     default :
187       Status = BRepBuilderAPI_PipeNotDone; 
188   }
189   return Status;
190 }
191
192 //=======================================================================
193 //function : SetTolerance
194 //purpose  : 
195 //=======================================================================
196  void BRepOffsetAPI_MakePipeShell::SetTolerance(const Standard_Real Tol3d,
197                                          const Standard_Real BoundTol,
198                                          const Standard_Real TolAngular)
199 {
200  myPipe->SetTolerance(Tol3d, BoundTol, TolAngular);
201 }
202
203 //=======================================================================
204 //function : SetMaxDegree
205 //purpose  : 
206 //=======================================================================
207 void BRepOffsetAPI_MakePipeShell::SetMaxDegree(const Standard_Integer NewMaxDegree)
208 {
209   myPipe->SetMaxDegree(NewMaxDegree);
210 }
211
212 //=======================================================================
213 //function : SetMaxSegments
214 //purpose  : 
215 //=======================================================================
216 void BRepOffsetAPI_MakePipeShell::SetMaxSegments(const Standard_Integer NewMaxSegments)
217 {
218   myPipe->SetMaxSegments(NewMaxSegments);
219 }
220
221 //=======================================================================
222 //function : SetForceApproxC1
223 //purpose  : Set the flag that indicates attempt to approximate
224 //           a C1-continuous surface if a swept surface proved
225 //           to be C0.
226 //=======================================================================
227  void BRepOffsetAPI_MakePipeShell::SetForceApproxC1(const Standard_Boolean ForceApproxC1)
228 {
229   myPipe->SetForceApproxC1(ForceApproxC1);
230 }
231
232 //=======================================================================
233 //function : SetTransitionMode
234 //purpose  : 
235 //=======================================================================
236  void BRepOffsetAPI_MakePipeShell::SetTransitionMode(const BRepBuilderAPI_TransitionMode Mode)
237 {
238   myPipe->SetTransition( (BRepFill_TransitionStyle)Mode );
239 }
240
241 //=======================================================================
242 //function :Simulate
243 //purpose  : 
244 //=======================================================================
245  void BRepOffsetAPI_MakePipeShell::Simulate(const Standard_Integer N,
246                                      TopTools_ListOfShape& R) 
247 {
248  myPipe->Simulate(N, R); 
249 }
250
251 //=======================================================================
252 //function :Build() 
253 //purpose  : 
254 //=======================================================================
255  void BRepOffsetAPI_MakePipeShell::Build() 
256 {
257   Standard_Boolean Ok;
258   Ok = myPipe->Build();
259   if (Ok) {
260     myShape = myPipe->Shape();
261     Done();
262   }
263   else NotDone(); 
264 }
265
266 //=======================================================================
267 //function : MakeSolid
268 //purpose  : 
269 //=======================================================================
270  Standard_Boolean BRepOffsetAPI_MakePipeShell::MakeSolid() 
271 {
272   if (!IsDone()) StdFail_NotDone::Raise("BRepOffsetAPI_MakePipeShell::MakeSolid");
273   Standard_Boolean Ok;
274   Ok = myPipe->MakeSolid();
275   if (Ok) myShape = myPipe->Shape();
276   return Ok;
277 }
278
279 //=======================================================================
280 //function :FirstShape()
281 //purpose  : 
282 //=======================================================================
283  TopoDS_Shape BRepOffsetAPI_MakePipeShell::FirstShape() 
284 {
285   return myPipe->FirstShape();
286 }
287
288 //=======================================================================
289 //function : LastShape()
290 //purpose  : 
291 //=======================================================================
292  TopoDS_Shape BRepOffsetAPI_MakePipeShell::LastShape() 
293 {
294   return myPipe->LastShape();
295 }
296
297 //=======================================================================
298 //function : Generated
299 //purpose  : 
300 //=======================================================================
301 const TopTools_ListOfShape& 
302 BRepOffsetAPI_MakePipeShell::Generated(const TopoDS_Shape& S) 
303 {
304   myPipe->Generated(S, myGenerated);
305   return myGenerated;
306 }
307
308 //=======================================================================
309 //function : ErrorOnSurface
310 //purpose  : 
311 //=======================================================================
312
313 Standard_Real BRepOffsetAPI_MakePipeShell::ErrorOnSurface() const
314 {
315   return myPipe->ErrorOnSurface();
316 }