7fd59977 |
1 | // File: BRepFilletAPI_MakeChamfer.cxx |
2 | // Created: Thu Jun 22 13:49:13 1995 |
3 | // Author: Flore Lantheaume |
4 | // <fla@phylox> |
5 | |
6 | |
7 | #include <BRepFilletAPI_MakeChamfer.ixx> |
8 | #include <TopOpeBRepDS_HDataStructure.hxx> |
9 | #include <TopTools_ListIteratorOfListOfShape.hxx> |
10 | #include <ChFiDS_Spine.hxx> |
11 | #include <TopExp_Explorer.hxx> |
12 | |
13 | |
14 | |
15 | //======================================================================= |
16 | //function : BRepFilletAPI_MakeChamfer |
17 | //purpose : |
18 | //======================================================================= |
19 | BRepFilletAPI_MakeChamfer::BRepFilletAPI_MakeChamfer(const TopoDS_Shape &S):myBuilder(S) |
20 | { |
21 | } |
22 | |
23 | |
24 | |
25 | //======================================================================= |
26 | //function : Add |
27 | //purpose : |
28 | //======================================================================= |
29 | |
30 | void BRepFilletAPI_MakeChamfer::Add(const TopoDS_Edge &E ) |
31 | { |
32 | myBuilder.Add(E); |
33 | } |
34 | |
35 | |
36 | |
37 | //======================================================================= |
38 | //function : Add |
39 | //purpose : |
40 | //======================================================================= |
41 | |
42 | void BRepFilletAPI_MakeChamfer::Add(const Standard_Real Dis, |
43 | const TopoDS_Edge &E, |
44 | const TopoDS_Face &F) |
45 | { |
46 | myBuilder.Add(Dis, E, F); |
47 | } |
48 | |
49 | |
50 | //======================================================================= |
51 | //function : SetDist |
52 | //purpose : |
53 | //======================================================================= |
54 | |
55 | void BRepFilletAPI_MakeChamfer::SetDist(const Standard_Real Dis, |
56 | const Standard_Integer IC, |
57 | const TopoDS_Face &F) |
58 | { |
59 | myBuilder.SetDist(Dis, IC, F); |
60 | } |
61 | |
62 | //======================================================================= |
63 | //function : GetDist |
64 | //purpose : |
65 | //================================================================ |
66 | |
67 | void BRepFilletAPI_MakeChamfer::GetDist(const Standard_Integer IC, |
68 | Standard_Real& Dis) const |
69 | { |
70 | myBuilder.GetDist(IC, Dis); |
71 | |
72 | } |
73 | |
74 | //======================================================================= |
75 | //function : Add |
76 | //purpose : |
77 | //======================================================================= |
78 | |
79 | void BRepFilletAPI_MakeChamfer::Add(const Standard_Real Dis1, |
80 | const Standard_Real Dis2, |
81 | const TopoDS_Edge &E, |
82 | const TopoDS_Face &F) |
83 | { |
84 | myBuilder.Add(Dis1,Dis2,E,F); |
85 | } |
86 | |
87 | |
88 | //======================================================================= |
89 | //function : SetDists |
90 | //purpose : |
91 | //======================================================================= |
92 | |
93 | void BRepFilletAPI_MakeChamfer::SetDists(const Standard_Real Dis1, |
94 | const Standard_Real Dis2, |
95 | const Standard_Integer IC, |
96 | const TopoDS_Face &F) |
97 | { |
98 | myBuilder.SetDists(Dis1,Dis2,IC,F); |
99 | } |
100 | |
101 | //======================================================================= |
102 | //function : Dists |
103 | //purpose : |
104 | //================================================================ |
105 | |
106 | void BRepFilletAPI_MakeChamfer::Dists(const Standard_Integer IC, |
107 | Standard_Real& Dis1, |
108 | Standard_Real& Dis2) const |
109 | { |
110 | Standard_Real temp1, temp2; |
111 | myBuilder.Dists(IC,temp1,temp2); |
112 | Dis1 = temp1; |
113 | Dis2 = temp2; |
114 | |
115 | } |
116 | |
117 | |
118 | //======================================================================= |
119 | //function : Add |
120 | //purpose : |
121 | //======================================================================= |
122 | |
123 | void BRepFilletAPI_MakeChamfer::AddDA(const Standard_Real Dis, |
124 | const Standard_Real Angle, |
125 | const TopoDS_Edge &E, |
126 | const TopoDS_Face &F) |
127 | { |
128 | myBuilder.AddDA(Dis, Angle, E, F); |
129 | } |
130 | |
131 | //======================================================================= |
132 | //function : SetDist |
133 | //purpose : |
134 | //======================================================================= |
135 | |
136 | void BRepFilletAPI_MakeChamfer::SetDistAngle(const Standard_Real Dis, |
137 | const Standard_Real Angle, |
138 | const Standard_Integer IC, |
139 | const TopoDS_Face &F) |
140 | { |
141 | myBuilder.SetDistAngle(Dis, Angle, IC, F); |
142 | } |
143 | |
144 | //======================================================================= |
145 | //function : GetDistAngle |
146 | //purpose : |
147 | //================================================================ |
148 | |
149 | void BRepFilletAPI_MakeChamfer::GetDistAngle(const Standard_Integer IC, |
150 | Standard_Real& Dis, |
151 | Standard_Real& Angle, |
152 | Standard_Boolean& DisOnFace1) const |
153 | { |
154 | myBuilder.GetDistAngle(IC, Dis, Angle, DisOnFace1); |
155 | |
156 | } |
157 | |
158 | //======================================================================= |
159 | //function : IsSymetric |
160 | //purpose : |
161 | //=============================================================== |
162 | |
163 | Standard_Boolean BRepFilletAPI_MakeChamfer::IsSymetric(const Standard_Integer IC) const |
164 | { |
165 | ChFiDS_ChamfMethod ChamfMeth = myBuilder.IsChamfer(IC); |
166 | Standard_Boolean ret = Standard_False; |
167 | |
168 | if (ChamfMeth == ChFiDS_Sym) ret = Standard_True; |
169 | |
170 | return ret; |
171 | } |
172 | |
173 | |
174 | //======================================================================= |
175 | //function : IsTwoDistances |
176 | //purpose : |
177 | //=============================================================== |
178 | |
179 | Standard_Boolean BRepFilletAPI_MakeChamfer::IsTwoDistances(const Standard_Integer IC) const |
180 | { |
181 | ChFiDS_ChamfMethod ChamfMeth = myBuilder.IsChamfer(IC); |
182 | Standard_Boolean ret = Standard_False; |
183 | |
184 | if (ChamfMeth == ChFiDS_TwoDist) ret = Standard_True; |
185 | |
186 | return ret; |
187 | } |
188 | |
189 | |
190 | |
191 | //======================================================================= |
192 | //function : IsDistanceAngle |
193 | //purpose : |
194 | //=============================================================== |
195 | |
196 | Standard_Boolean BRepFilletAPI_MakeChamfer::IsDistanceAngle(const Standard_Integer IC) const |
197 | { |
198 | ChFiDS_ChamfMethod ChamfMeth = myBuilder.IsChamfer(IC); |
199 | Standard_Boolean ret = Standard_False; |
200 | |
201 | if (ChamfMeth == ChFiDS_DistAngle) ret = Standard_True; |
202 | |
203 | return ret; |
204 | } |
205 | |
206 | |
207 | |
208 | //======================================================================= |
209 | //function : ResetContour |
210 | //purpose : |
211 | //=============================================================== |
212 | |
213 | void BRepFilletAPI_MakeChamfer::ResetContour(const Standard_Integer IC) |
214 | { |
215 | myBuilder.ResetContour(IC); |
216 | } |
217 | |
218 | |
219 | //======================================================================= |
220 | //function : NbContours |
221 | //purpose : |
222 | //======================================================================= |
223 | |
224 | Standard_Integer BRepFilletAPI_MakeChamfer::NbContours()const |
225 | { |
226 | return myBuilder.NbElements(); |
227 | } |
228 | |
229 | |
230 | |
231 | //======================================================================= |
232 | //function : Contour |
233 | //purpose : |
234 | //======================================================================= |
235 | |
236 | Standard_Integer BRepFilletAPI_MakeChamfer::Contour(const TopoDS_Edge &E)const |
237 | { |
238 | return myBuilder.Contains(E); |
239 | } |
240 | |
241 | |
242 | |
243 | //======================================================================= |
244 | //function : NbEdges |
245 | //purpose : |
246 | //======================================================================= |
247 | |
248 | Standard_Integer BRepFilletAPI_MakeChamfer::NbEdges(const Standard_Integer I)const |
249 | |
250 | { |
251 | const Handle(ChFiDS_Spine)& Spine = myBuilder.Value(I); |
252 | return (Spine->NbEdges()); |
253 | } |
254 | |
255 | |
256 | //======================================================================= |
257 | //function : Edge |
258 | //purpose : |
259 | //======================================================================= |
260 | |
261 | const TopoDS_Edge& BRepFilletAPI_MakeChamfer::Edge(const Standard_Integer I, |
262 | const Standard_Integer J)const |
263 | { |
264 | const Handle(ChFiDS_Spine)& Spine = myBuilder.Value(I); |
265 | const TopoDS_Edge& E = Spine->Edges(J); |
266 | return E; |
267 | } |
268 | |
269 | //======================================================================= |
270 | //function : Remove |
271 | //purpose : |
272 | //======================================================================= |
273 | |
274 | void BRepFilletAPI_MakeChamfer::Remove(const TopoDS_Edge& E) |
275 | { |
276 | myBuilder.Remove(E); |
277 | } |
278 | |
279 | //======================================================================= |
280 | //function : Length |
281 | //purpose : |
282 | //======================================================================= |
283 | |
284 | Standard_Real BRepFilletAPI_MakeChamfer::Length(const Standard_Integer IC)const |
285 | { |
286 | return myBuilder.Length(IC); |
287 | } |
288 | |
289 | //======================================================================= |
290 | //function : FirstVertex |
291 | //purpose : |
292 | //======================================================================= |
293 | |
294 | TopoDS_Vertex BRepFilletAPI_MakeChamfer::FirstVertex(const Standard_Integer IC)const |
295 | { |
296 | return myBuilder.FirstVertex(IC); |
297 | } |
298 | |
299 | |
300 | //======================================================================= |
301 | //function : LastVertex |
302 | //purpose : |
303 | //======================================================================= |
304 | |
305 | TopoDS_Vertex BRepFilletAPI_MakeChamfer::LastVertex(const Standard_Integer IC)const |
306 | { |
307 | return myBuilder.LastVertex(IC); |
308 | } |
309 | |
310 | |
311 | //======================================================================= |
312 | //function : Abscissa |
313 | //purpose : |
314 | //======================================================================= |
315 | |
316 | Standard_Real BRepFilletAPI_MakeChamfer::Abscissa(const Standard_Integer IC, |
317 | const TopoDS_Vertex& V)const |
318 | { |
319 | return myBuilder.Abscissa(IC,V); |
320 | } |
321 | |
322 | |
323 | //======================================================================= |
324 | //function : RelativeAbscissa |
325 | //purpose : |
326 | //======================================================================= |
327 | |
328 | Standard_Real BRepFilletAPI_MakeChamfer::RelativeAbscissa(const Standard_Integer IC, |
329 | const TopoDS_Vertex& V)const |
330 | { |
331 | return myBuilder.RelativeAbscissa(IC,V); |
332 | } |
333 | |
334 | //======================================================================= |
335 | //function : ClosedAndTangent |
336 | //purpose : |
337 | //======================================================================= |
338 | |
339 | Standard_Boolean BRepFilletAPI_MakeChamfer::ClosedAndTangent |
340 | (const Standard_Integer IC)const |
341 | { |
342 | return myBuilder.ClosedAndTangent(IC); |
343 | } |
344 | |
345 | |
346 | //======================================================================= |
347 | //function : Closed |
348 | //purpose : |
349 | //======================================================================= |
350 | |
351 | Standard_Boolean BRepFilletAPI_MakeChamfer::Closed |
352 | (const Standard_Integer IC)const |
353 | { |
354 | return myBuilder.Closed(IC); |
355 | } |
356 | |
357 | //======================================================================= |
358 | //function : Builder |
359 | //purpose : |
360 | //======================================================================= |
361 | |
362 | Handle(TopOpeBRepBuild_HBuilder) BRepFilletAPI_MakeChamfer::Builder()const |
363 | { |
364 | return myBuilder.Builder(); |
365 | } |
366 | |
367 | //======================================================================= |
368 | //function : Build |
369 | //purpose : |
370 | //======================================================================= |
371 | |
372 | void BRepFilletAPI_MakeChamfer::Build() |
373 | { |
374 | myBuilder.Compute(); |
375 | if (myBuilder.IsDone()){ |
376 | Done(); |
377 | myShape = myBuilder.Shape(); |
378 | |
379 | //creation of the Map. |
380 | TopExp_Explorer ex; |
381 | for (ex.Init(myShape, TopAbs_FACE); ex.More(); ex.Next()) { |
382 | myMap.Add(ex.Current()); |
383 | } |
384 | } |
385 | } |
386 | |
387 | //======================================================================= |
388 | //function : Reset |
389 | //purpose : |
390 | //======================================================================= |
391 | |
392 | void BRepFilletAPI_MakeChamfer::Reset() |
393 | { |
394 | NotDone(); |
395 | myBuilder.Reset(); |
396 | myMap.Clear(); |
397 | } |
398 | |
399 | //======================================================================= |
400 | //function : Generated |
401 | //purpose : |
402 | //======================================================================= |
403 | |
404 | const TopTools_ListOfShape& BRepFilletAPI_MakeChamfer::Generated |
405 | (const TopoDS_Shape& EorV) |
406 | { |
407 | return myBuilder.Generated(EorV); |
408 | } |
409 | |
410 | //======================================================================= |
411 | //function : Modified |
412 | //purpose : |
413 | //======================================================================= |
414 | |
415 | const TopTools_ListOfShape& BRepFilletAPI_MakeChamfer::Modified |
416 | (const TopoDS_Shape& F) |
417 | { |
418 | myGenerated.Clear(); |
419 | |
420 | if (myBuilder.Builder()->IsSplit(F, TopAbs_OUT)) { |
421 | TopTools_ListIteratorOfListOfShape It(myBuilder.Builder()->Splits(F, TopAbs_OUT)); |
422 | for(;It.More();It.Next()) { |
423 | myGenerated.Append(It.Value()); |
424 | } |
425 | } |
426 | if (myBuilder.Builder()->IsSplit(F, TopAbs_IN)) { |
427 | TopTools_ListIteratorOfListOfShape It(myBuilder.Builder()->Splits(F, TopAbs_IN)); |
428 | for(;It.More();It.Next()) { |
429 | myGenerated.Append(It.Value()); |
430 | } |
431 | } |
432 | if (myBuilder.Builder()->IsSplit(F, TopAbs_ON)) { |
433 | TopTools_ListIteratorOfListOfShape It(myBuilder.Builder()->Splits(F, TopAbs_ON)); |
434 | for(;It.More();It.Next()) { |
435 | myGenerated.Append(It.Value()); |
436 | } |
437 | } |
438 | return myGenerated; |
439 | } |
440 | |
441 | //======================================================================= |
442 | //function : IsDeleted |
443 | //purpose : |
444 | //======================================================================= |
445 | |
446 | Standard_Boolean BRepFilletAPI_MakeChamfer::IsDeleted(const TopoDS_Shape& F) |
447 | { |
448 | if (myMap.Contains(F) || |
449 | myBuilder.Builder()->IsSplit (F, TopAbs_OUT) || |
450 | myBuilder.Builder()->IsSplit (F, TopAbs_IN) || |
451 | myBuilder.Builder()->IsSplit (F, TopAbs_ON)) |
452 | return Standard_False; |
453 | |
454 | return Standard_True; |
455 | } |
456 | |
457 | //======================================================================= |
458 | //function : Simulate |
459 | //purpose : |
460 | //======================================================================= |
461 | |
462 | void BRepFilletAPI_MakeChamfer::Simulate(const Standard_Integer IC) |
463 | { |
464 | myBuilder.Simulate(IC); |
465 | } |
466 | |
467 | |
468 | //======================================================================= |
469 | //function : NbSurf |
470 | //purpose : |
471 | //======================================================================= |
472 | |
473 | Standard_Integer BRepFilletAPI_MakeChamfer::NbSurf(const Standard_Integer IC)const |
474 | { |
475 | return myBuilder.NbSurf(IC); |
476 | } |
477 | |
478 | |
479 | //======================================================================= |
480 | //function : Sect |
481 | //purpose : |
482 | //======================================================================= |
483 | |
484 | Handle(ChFiDS_SecHArray1) BRepFilletAPI_MakeChamfer::Sect(const Standard_Integer IC, |
485 | const Standard_Integer IS)const |
486 | { |
487 | return myBuilder.Sect(IC, IS); |
488 | } |