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