0028966: Coding Rules - remove Adaptor2d_HCurve2d, Adaptor3d_HCurve and Adaptor3d_HSu...
[occt.git] / src / ChFi3d / ChFi3d_ChBuilder.hxx
1 // Created on: 1995-04-26
2 // Created by: Modelistation
3 // Copyright (c) 1995-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 #ifndef _ChFi3d_ChBuilder_HeaderFile
18 #define _ChFi3d_ChBuilder_HeaderFile
19
20 #include <BRepAdaptor_Curve2d.hxx>
21 #include <BRepAdaptor_Surface.hxx>
22 #include <ChFi3d_Builder.hxx>
23 #include <ChFiDS_ChamfMethod.hxx>
24 #include <ChFiDS_ChamfMode.hxx>
25 #include <ChFiDS_SecHArray1.hxx>
26 #include <ChFiDS_ListOfStripe.hxx>
27 #include <ChFiDS_SequenceOfSurfData.hxx>
28 #include <ChFiDS_ElSpine.hxx>
29 #include <math_Vector.hxx>
30 #include <TopAbs_Orientation.hxx>
31 #include <TopAbs_State.hxx>
32
33 class Standard_ConstructionError;
34 class Standard_DomainError;
35 class TopoDS_Shape;
36 class TopoDS_Edge;
37 class TopoDS_Face;
38 class ChFiDS_SurfData;
39 class ChFiDS_Spine;
40 class Adaptor3d_TopolTool;
41 class TopoDS_Vertex;
42 class ChFiDS_Stripe;
43
44
45 //! construction tool for 3D chamfers on edges (on a solid).
46 class ChFi3d_ChBuilder  : public ChFi3d_Builder
47 {
48 public:
49
50   DEFINE_STANDARD_ALLOC
51
52   
53   //! initializes the Builder with the Shape <S> for the
54   //! computation of chamfers
55   Standard_EXPORT ChFi3d_ChBuilder(const TopoDS_Shape& S, const Standard_Real Ta = 1.0e-2);
56   
57   //! initializes a contour with the edge <E> as first
58   //! (the next are found by propagation ).
59   //! The two distances (parameters of the chamfer) must
60   //! be set after.
61   //! if the edge <E> has more than 2 adjacent faces
62   Standard_EXPORT void Add (const TopoDS_Edge& E);
63   
64   //! initializes a new contour with the edge <E> as first
65   //! (the next are found by propagation ), and  the
66   //! distance <Dis>
67   //! if the edge <E> has more than 2 adjacent faces
68   Standard_EXPORT void Add (const Standard_Real Dis, const TopoDS_Edge& E);
69   
70   //! set the distance <Dis> of the fillet
71   //! contour of index <IC> in the DS with <Dis> on <F>.
72   //! if the face <F> is not one of common faces
73   //! of an edge of the contour <IC>
74   Standard_EXPORT void SetDist (const Standard_Real Dis,
75                                 const Standard_Integer IC,
76                                 const TopoDS_Face& F);
77   
78   //! gives the distances <Dis> of the fillet
79   //! contour of index <IC> in the DS
80   Standard_EXPORT void GetDist (const Standard_Integer IC, Standard_Real& Dis) const;
81   
82   //! initializes a new contour with the edge <E> as first
83   //! (the next are found by propagation ), and  the
84   //! distance <Dis1> and <Dis2>
85   //! if the edge <E> has more than 2 adjacent faces
86   Standard_EXPORT void Add (const Standard_Real Dis1,
87                             const Standard_Real Dis2,
88                             const TopoDS_Edge& E,
89                             const TopoDS_Face& F);
90   
91   //! set the distances <Dis1> and <Dis2> of the fillet
92   //! contour of index <IC> in the DS with <Dis1> on <F>.
93   //! if the face <F> is not one of common faces
94   //! of an edge of the contour <IC>
95   Standard_EXPORT void SetDists (const Standard_Real Dis1,
96                                  const Standard_Real Dis2,
97                                  const Standard_Integer IC,
98                                  const TopoDS_Face& F);
99   
100   //! gives the distances <Dis1> and <Dis2> of the fillet
101   //! contour of index <IC> in the DS
102   Standard_EXPORT void Dists (const Standard_Integer IC,
103                               Standard_Real& Dis1,
104                               Standard_Real& Dis2) const;
105   
106   //! initializes a new contour with the edge <E> as first
107   //! (the next are found by propagation ), and  the
108   //! distance <Dis1> and <Angle>
109   //! if the edge <E> has more than 2 adjacent faces
110   Standard_EXPORT void AddDA (const Standard_Real Dis,
111                               const Standard_Real Angle,
112                               const TopoDS_Edge& E,
113                               const TopoDS_Face& F);
114   
115   //! set the distance <Dis> and <Angle> of the fillet
116   //! contour of index <IC> in the DS with <Dis> on <F>.
117   //! if the face <F> is not one of common faces
118   //! of an edge of the contour <IC>
119   Standard_EXPORT void SetDistAngle (const Standard_Real Dis,
120                                      const Standard_Real Angle,
121                                      const Standard_Integer IC,
122                                      const TopoDS_Face& F);
123   
124   //! gives the distances <Dis> and <Angle> of the fillet
125   //! contour of index <IC> in the DS
126   Standard_EXPORT void GetDistAngle (const Standard_Integer IC,
127                                      Standard_Real& Dis,
128                                      Standard_Real& Angle) const;
129   
130   //! set the mode of shamfer
131   Standard_EXPORT void SetMode (const ChFiDS_ChamfMode theMode);
132   
133   //! renvoi la methode des chanfreins utilisee
134   Standard_EXPORT ChFiDS_ChamfMethod IsChamfer (const Standard_Integer IC) const;
135   
136   //! returns the mode of chamfer used
137   Standard_EXPORT ChFiDS_ChamfMode Mode () const;
138   
139   //! Reset tous rayons du contour IC.
140   Standard_EXPORT void ResetContour (const Standard_Integer IC);
141   
142   Standard_EXPORT void Simulate (const Standard_Integer IC);
143   
144   Standard_EXPORT Standard_Integer NbSurf (const Standard_Integer IC) const;
145   
146   Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect (const Standard_Integer IC,
147                                                   const Standard_Integer IS) const;
148   
149   Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data,
150                                           const Handle(ChFiDS_ElSpine)& Guide,
151                                           const Handle(ChFiDS_Spine)& Spine,
152                                           const Standard_Integer Choix,
153                                           const Handle(BRepAdaptor_Surface)& S1,
154                                           const Handle(Adaptor3d_TopolTool)& I1,
155                                           const Handle(BRepAdaptor_Curve2d)& PC1,
156                                           const Handle(BRepAdaptor_Surface)& Sref1,
157                                           const Handle(BRepAdaptor_Curve2d)& PCref1,
158                                           Standard_Boolean& Decroch1,
159                                           const Handle(BRepAdaptor_Surface)& S2,
160                                           const Handle(Adaptor3d_TopolTool)& I2,
161                                           const TopAbs_Orientation Or2,
162                                           const Standard_Real Fleche,
163                                           const Standard_Real TolGuide,
164                                           Standard_Real& First,
165                                           Standard_Real& Last,
166                                           const Standard_Boolean Inside,
167                                           const Standard_Boolean Appro,
168                                           const Standard_Boolean Forward,
169                                           const Standard_Boolean RecP,
170                                           const Standard_Boolean RecS,
171                                           const Standard_Boolean RecRst,
172                                           const math_Vector& Soldep) Standard_OVERRIDE;
173   
174   Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data,
175                                           const Handle(ChFiDS_ElSpine)& Guide,
176                                           const Handle(ChFiDS_Spine)& Spine,
177                                           const Standard_Integer Choix,
178                                           const Handle(BRepAdaptor_Surface)& S1,
179                                           const Handle(Adaptor3d_TopolTool)& I1,
180                                           const TopAbs_Orientation Or1,
181                                           const Handle(BRepAdaptor_Surface)& S2,
182                                           const Handle(Adaptor3d_TopolTool)& I2,
183                                           const Handle(BRepAdaptor_Curve2d)& PC2,
184                                           const Handle(BRepAdaptor_Surface)& Sref2,
185                                           const Handle(BRepAdaptor_Curve2d)& PCref2,
186                                           Standard_Boolean& Decroch2,
187                                           const Standard_Real Fleche,
188                                           const Standard_Real TolGuide,
189                                           Standard_Real& First,
190                                           Standard_Real& Last,
191                                           const Standard_Boolean Inside,
192                                           const Standard_Boolean Appro,
193                                           const Standard_Boolean Forward,
194                                           const Standard_Boolean RecP,
195                                           const Standard_Boolean RecS,
196                                           const Standard_Boolean RecRst,
197                                           const math_Vector& Soldep) Standard_OVERRIDE;
198   
199   Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data,
200                                           const Handle(ChFiDS_ElSpine)& Guide,
201                                           const Handle(ChFiDS_Spine)& Spine,
202                                           const Standard_Integer Choix,
203                                           const Handle(BRepAdaptor_Surface)& S1,
204                                           const Handle(Adaptor3d_TopolTool)& I1,
205                                           const Handle(BRepAdaptor_Curve2d)& PC1,
206                                           const Handle(BRepAdaptor_Surface)& Sref1,
207                                           const Handle(BRepAdaptor_Curve2d)& PCref1,
208                                           Standard_Boolean& Decroch1,
209                                           const TopAbs_Orientation Or1,
210                                           const Handle(BRepAdaptor_Surface)& S2,
211                                           const Handle(Adaptor3d_TopolTool)& I2,
212                                           const Handle(BRepAdaptor_Curve2d)& PC2,
213                                           const Handle(BRepAdaptor_Surface)& Sref2,
214                                           const Handle(BRepAdaptor_Curve2d)& PCref2,
215                                           Standard_Boolean& Decroch2,
216                                           const TopAbs_Orientation Or2,
217                                           const Standard_Real Fleche,
218                                           const Standard_Real TolGuide,
219                                           Standard_Real& First,
220                                           Standard_Real& Last,
221                                           const Standard_Boolean Inside,
222                                           const Standard_Boolean Appro,
223                                           const Standard_Boolean Forward,
224                                           const Standard_Boolean RecP1,
225                                           const Standard_Boolean RecRst1,
226                                           const Standard_Boolean RecP2,
227                                           const Standard_Boolean RecRst2,
228                                           const math_Vector& Soldep) Standard_OVERRIDE;
229   
230   //! Methode, implemented in inheritants, calculates
231   //! the elements of construction of  the surface (fillet
232   //! or chamfer).
233   Standard_EXPORT virtual Standard_Boolean PerformSurf (ChFiDS_SequenceOfSurfData& Data,
234                                                         const Handle(ChFiDS_ElSpine)& Guide,
235                                                         const Handle(ChFiDS_Spine)& Spine,
236                                                         const Standard_Integer Choix,
237                                                         const Handle(BRepAdaptor_Surface)& S1,
238                                                         const Handle(Adaptor3d_TopolTool)& I1,
239                                                         const Handle(BRepAdaptor_Surface)& S2,
240                                                         const Handle(Adaptor3d_TopolTool)& I2,
241                                                         const Standard_Real MaxStep,
242                                                         const Standard_Real Fleche,
243                                                         const Standard_Real TolGuide,
244                                                         Standard_Real& First,
245                                                         Standard_Real& Last,
246                                                         const Standard_Boolean Inside,
247                                                         const Standard_Boolean Appro,
248                                                         const Standard_Boolean Forward,
249                                                         const Standard_Boolean RecOnS1,
250                                                         const Standard_Boolean RecOnS2,
251                                                         const math_Vector& Soldep,
252                                                         Standard_Integer& Intf,
253                                                         Standard_Integer& Intl) Standard_OVERRIDE;
254   
255   //! Method, implemented in  the inheritants, calculates
256   //! the elements of construction of  the surface (fillet
257   //! or chamfer) contact edge/face.
258   Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data,
259                                             const Handle(ChFiDS_ElSpine)& Guide,
260                                             const Handle(ChFiDS_Spine)& Spine,
261                                             const Standard_Integer Choix,
262                                             const Handle(BRepAdaptor_Surface)& S1,
263                                             const Handle(Adaptor3d_TopolTool)& I1,
264                                             const Handle(BRepAdaptor_Curve2d)& PC1,
265                                             const Handle(BRepAdaptor_Surface)& Sref1,
266                                             const Handle(BRepAdaptor_Curve2d)& PCref1,
267                                             Standard_Boolean& Decroch1,
268                                             const Handle(BRepAdaptor_Surface)& S2,
269                                             const Handle(Adaptor3d_TopolTool)& I2,
270                                             const TopAbs_Orientation Or2,
271                                             const Standard_Real MaxStep,
272                                             const Standard_Real Fleche,
273                                             const Standard_Real TolGuide,
274                                             Standard_Real& First,
275                                             Standard_Real& Last,
276                                             const Standard_Boolean Inside,
277                                             const Standard_Boolean Appro,
278                                             const Standard_Boolean Forward,
279                                             const Standard_Boolean RecP,
280                                             const Standard_Boolean RecS,
281                                             const Standard_Boolean RecRst,
282                                             const math_Vector& Soldep) Standard_OVERRIDE;
283   
284   //! Method, implemented in inheritants, calculates
285   //! the elements of construction of  the surface (fillet
286   //! or chamfer) contact edge/face.
287   Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data,
288                                             const Handle(ChFiDS_ElSpine)& Guide,
289                                             const Handle(ChFiDS_Spine)& Spine,
290                                             const Standard_Integer Choix,
291                                             const Handle(BRepAdaptor_Surface)& S1,
292                                             const Handle(Adaptor3d_TopolTool)& I1,
293                                             const TopAbs_Orientation Or1,
294                                             const Handle(BRepAdaptor_Surface)& S2,
295                                             const Handle(Adaptor3d_TopolTool)& I2,
296                                             const Handle(BRepAdaptor_Curve2d)& PC2,
297                                             const Handle(BRepAdaptor_Surface)& Sref2,
298                                             const Handle(BRepAdaptor_Curve2d)& PCref2,
299                                             Standard_Boolean& Decroch2,
300                                             const Standard_Real MaxStep,
301                                             const Standard_Real Fleche,
302                                             const Standard_Real TolGuide,
303                                             Standard_Real& First,
304                                             Standard_Real& Last,
305                                             const Standard_Boolean Inside,
306                                             const Standard_Boolean Appro,
307                                             const Standard_Boolean Forward,
308                                             const Standard_Boolean RecP,
309                                             const Standard_Boolean RecS,
310                                             const Standard_Boolean RecRst,
311                                             const math_Vector& Soldep) Standard_OVERRIDE;
312   
313   //! Method, implemented in  inheritants, calculates
314   //! the elements of construction of  the surface (fillet
315   //! or chamfer) contact edge/edge.
316   Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data,
317                                             const Handle(ChFiDS_ElSpine)& Guide,
318                                             const Handle(ChFiDS_Spine)& Spine,
319                                             const Standard_Integer Choix,
320                                             const Handle(BRepAdaptor_Surface)& S1,
321                                             const Handle(Adaptor3d_TopolTool)& I1,
322                                             const Handle(BRepAdaptor_Curve2d)& PC1,
323                                             const Handle(BRepAdaptor_Surface)& Sref1,
324                                             const Handle(BRepAdaptor_Curve2d)& PCref1,
325                                             Standard_Boolean& Decroch1,
326                                             const TopAbs_Orientation Or1,
327                                             const Handle(BRepAdaptor_Surface)& S2,
328                                             const Handle(Adaptor3d_TopolTool)& I2,
329                                             const Handle(BRepAdaptor_Curve2d)& PC2,
330                                             const Handle(BRepAdaptor_Surface)& Sref2,
331                                             const Handle(BRepAdaptor_Curve2d)& PCref2,
332                                             Standard_Boolean& Decroch2,
333                                             const TopAbs_Orientation Or2,
334                                             const Standard_Real MaxStep,
335                                             const Standard_Real Fleche,
336                                             const Standard_Real TolGuide,
337                                             Standard_Real& First,
338                                             Standard_Real& Last,
339                                             const Standard_Boolean Inside,
340                                             const Standard_Boolean Appro,
341                                             const Standard_Boolean Forward,
342                                             const Standard_Boolean RecP1,
343                                             const Standard_Boolean RecRst1,
344                                             const Standard_Boolean RecP2,
345                                             const Standard_Boolean RecRst2,
346                                             const math_Vector& Soldep) Standard_OVERRIDE;
347   
348
349
350
351 protected:
352
353   
354   Standard_EXPORT void SimulKPart (const Handle(ChFiDS_SurfData)& SD) const Standard_OVERRIDE;
355   
356   Standard_EXPORT Standard_Boolean SimulSurf (Handle(ChFiDS_SurfData)& Data,
357                                               const Handle(ChFiDS_ElSpine)& Guide,
358                                               const Handle(ChFiDS_Spine)& Spine,
359                                               const Standard_Integer Choix,
360                                               const Handle(BRepAdaptor_Surface)& S1,
361                                               const Handle(Adaptor3d_TopolTool)& I1,
362                                               const Handle(BRepAdaptor_Surface)& S2,
363                                               const Handle(Adaptor3d_TopolTool)& I2,
364                                               const Standard_Real TolGuide,
365                                               Standard_Real& First,
366                                               Standard_Real& Last,
367                                               const Standard_Boolean Inside,
368                                               const Standard_Boolean Appro,
369                                               const Standard_Boolean Forward,
370                                               const Standard_Boolean RecOnS1,
371                                               const Standard_Boolean RecOnS2,
372                                               const math_Vector& Soldep,
373                                               Standard_Integer& Intf,
374                                               Standard_Integer& Intl) Standard_OVERRIDE;
375   
376   Standard_EXPORT Standard_Boolean PerformFirstSection (const Handle(ChFiDS_Spine)& S,
377                                                         const Handle(ChFiDS_ElSpine)& HGuide,
378                                                         const Standard_Integer Choix,
379                                                         Handle(BRepAdaptor_Surface)& S1,
380                                                         Handle(BRepAdaptor_Surface)& S2,
381                                                         const Handle(Adaptor3d_TopolTool)& I1,
382                                                         const Handle(Adaptor3d_TopolTool)& I2,
383                                                         const Standard_Real Par,
384                                                         math_Vector& SolDep,
385                                                         TopAbs_State& Pos1,
386                                                         TopAbs_State& Pos2) const Standard_OVERRIDE;
387   
388   //! computes  the  intersection of two chamfers on
389   //! the vertex of index <Index> in myVDataMap.
390   Standard_EXPORT void PerformTwoCorner (const Standard_Integer Index) Standard_OVERRIDE;
391   
392   //! computes the intersection of three chamfers on
393   //! the vertex of index <Index> in myVDataMap.
394   Standard_EXPORT void PerformThreeCorner (const Standard_Integer Index) Standard_OVERRIDE;
395   
396   //! extends  the spine  of  the Stripe  <S> at  the
397   //! extremity of the vertex <V>.
398   Standard_EXPORT void ExtentOneCorner (const TopoDS_Vertex& V,
399                                         const Handle(ChFiDS_Stripe)& S) Standard_OVERRIDE;
400   
401   //! extends the spine of the 2 stripes of <LS> at the
402   //! extremity of the vertex <V>
403   Standard_EXPORT void ExtentTwoCorner (const TopoDS_Vertex& V,
404                                         const ChFiDS_ListOfStripe& LS) Standard_OVERRIDE;
405   
406   //! extends the spine of the 2 stripes of <LS> at the
407   //! extremity of the vertex <V>
408   Standard_EXPORT void ExtentThreeCorner (const TopoDS_Vertex& V,
409                                           const ChFiDS_ListOfStripe& LS) Standard_OVERRIDE;
410   
411   //! set the regularities
412   Standard_EXPORT void SetRegul() Standard_OVERRIDE;
413
414
415
416
417 private:
418
419   
420   Standard_EXPORT void ConexFaces (const Handle(ChFiDS_Spine)& Sp,
421                                    const Standard_Integer IEdge,
422                                    TopoDS_Face& F1,
423                                    TopoDS_Face& F2) const;
424
425   ChFiDS_ChamfMode   myMode;
426
427
428 };
429
430
431
432
433
434
435
436 #endif // _ChFi3d_ChBuilder_HeaderFile