0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BiTgte / BiTgte_Blend.hxx
1 // Created on: 1996-12-16
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1996-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 _BiTgte_Blend_HeaderFile
18 #define _BiTgte_Blend_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Real.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <TopoDS_Shape.hxx>
27 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
28 #include <BRepFill_DataMapOfShapeDataMapOfShapeListOfShape.hxx>
29 #include <TopTools_DataMapOfShapeListOfShape.hxx>
30 #include <TopTools_IndexedMapOfShape.hxx>
31 #include <TopTools_MapOfShape.hxx>
32 #include <BRepOffset_Analyse.hxx>
33 #include <BRepOffset_DataMapOfShapeOffset.hxx>
34 #include <BRepAlgo_Image.hxx>
35 #include <Standard_Integer.hxx>
36 #include <TColStd_HArray1OfInteger.hxx>
37 #include <TopTools_ListOfShape.hxx>
38 #include <BiTgte_ContactType.hxx>
39 #include <BiTgte_DataMapOfShapeBox.hxx>
40 class BRepAlgo_AsDes;
41 class StdFail_NotDone;
42 class Standard_OutOfRange;
43 class TopoDS_Shape;
44 class TopoDS_Face;
45 class TopoDS_Edge;
46 class Geom_Surface;
47 class Geom_Curve;
48 class Geom2d_Curve;
49 class BRepOffset_Offset;
50 class BRepOffset_Inter3d;
51
52
53 //! Root class
54 class BiTgte_Blend 
55 {
56 public:
57
58   DEFINE_STANDARD_ALLOC
59
60   
61   Standard_EXPORT BiTgte_Blend();
62   
63   //! <S>: Shape to be rounded
64   //! <Radius>: radius of the fillet
65   //! <Tol>: Tol3d used in approximations
66   //! <NUBS>: if true,  generate only NUBS surfaces,
67   //! if false, generate analytical surfaces if possible
68   Standard_EXPORT BiTgte_Blend(const TopoDS_Shape& S, const Standard_Real Radius, const Standard_Real Tol, const Standard_Boolean NUBS);
69   
70   Standard_EXPORT void Init (const TopoDS_Shape& S, const Standard_Real Radius, const Standard_Real Tol, const Standard_Boolean NUBS);
71   
72   //! Clear all the Fields.
73   Standard_EXPORT void Clear();
74   
75   //! Set two faces   of <myShape> on which the  Sphere
76   //! must roll.
77   Standard_EXPORT void SetFaces (const TopoDS_Face& F1, const TopoDS_Face& F2);
78   
79   //! Set an edge of <myShape> to be rounded.
80   Standard_EXPORT void SetEdge (const TopoDS_Edge& Edge);
81   
82   //! Set a face on which the fillet must stop.
83   Standard_EXPORT void SetStoppingFace (const TopoDS_Face& Face);
84   
85   //! Compute the generated surfaces.
86   //! If <BuildShape> is true, compute the resulting Shape.
87   //! If false, only the blending surfaces are computed.
88   Standard_EXPORT void Perform (const Standard_Boolean BuildShape = Standard_True);
89   
90   Standard_EXPORT Standard_Boolean IsDone() const;
91   
92   //! returns the result
93   Standard_EXPORT const TopoDS_Shape& Shape() const;
94   
95   //! returns the Number of generated surfaces.
96   Standard_EXPORT Standard_Integer NbSurfaces() const;
97   
98   //! returns the surface of range Index
99   Standard_EXPORT Handle(Geom_Surface) Surface (const Standard_Integer Index) const;
100   
101   //! returns the surface of range Index
102   Standard_EXPORT const TopoDS_Face& Face (const Standard_Integer Index) const;
103   
104   //! set in <LC> all the center lines
105   Standard_EXPORT void CenterLines (TopTools_ListOfShape& LC) const;
106   
107   //! returns  the surface generated  by the centerline.
108   //! <CenterLine> may be
109   //! - an edge  : generate a pipe.
110   //! - a vertex : generate a sphere.
111   //! Warning: returns a Null Handle if <CenterLine> generates
112   //! no surface.
113   Standard_EXPORT Handle(Geom_Surface) Surface (const TopoDS_Shape& CenterLine) const;
114   
115   //! returns  the face generated  by the centerline.
116   //! <CenterLine> may be
117   //! - an edge  : generate a pipe.
118   //! - a vertex : generate a sphere.
119   //! Warning: returns a Null Shape if <CenterLine> generates
120   //! no surface.
121   Standard_EXPORT const TopoDS_Face& Face (const TopoDS_Shape& CenterLine) const;
122   
123   //! returns the type of contact
124   Standard_EXPORT BiTgte_ContactType ContactType (const Standard_Integer Index) const;
125   
126   //! gives the first support shape relative to
127   //! SurfaceFillet(Index);
128   Standard_EXPORT const TopoDS_Shape& SupportShape1 (const Standard_Integer Index) const;
129   
130   //! gives the second support shape relative to
131   //! SurfaceFillet(Index);
132   Standard_EXPORT const TopoDS_Shape& SupportShape2 (const Standard_Integer Index) const;
133   
134   //! gives the 3d curve of SurfaceFillet(Index)
135   //! on SupportShape1(Index)
136   Standard_EXPORT Handle(Geom_Curve) CurveOnShape1 (const Standard_Integer Index) const;
137   
138   //! gives the 3d curve of SurfaceFillet(Index)
139   //! on SupportShape2(Index)
140   Standard_EXPORT Handle(Geom_Curve) CurveOnShape2 (const Standard_Integer Index) const;
141   
142   //! gives the PCurve associated to CurvOnShape1(Index)
143   //! on the support face
144   //! Warning: returns a Null Handle if SupportShape1 is not a Face
145   Standard_EXPORT Handle(Geom2d_Curve) PCurveOnFace1 (const Standard_Integer Index) const;
146   
147   //! gives the PCurve associated to CurveOnShape1(Index)
148   //! on the Fillet
149   Standard_EXPORT Handle(Geom2d_Curve) PCurve1OnFillet (const Standard_Integer Index) const;
150   
151   //! gives the PCurve  associated to CurveOnShape2(Index)
152   //! on the  support face
153   //! Warning: returns a Null Handle if SupportShape2 is not a Face
154   Standard_EXPORT Handle(Geom2d_Curve) PCurveOnFace2 (const Standard_Integer Index) const;
155   
156   //! gives the PCurve associated to CurveOnShape2(Index)
157   //! on the fillet
158   Standard_EXPORT Handle(Geom2d_Curve) PCurve2OnFillet (const Standard_Integer Index) const;
159   
160   Standard_EXPORT Standard_Integer NbBranches();
161   
162   //! Set in <From>,<To>   the indices of the faces  of
163   //! the branche <Index>.
164   //!
165   //! i.e: Branche<Index> = Face(From) + Face(From+1) + ..+ Face(To)
166   Standard_EXPORT void IndicesOfBranche (const Standard_Integer Index, Standard_Integer& From, Standard_Integer& To) const;
167   
168   //! Computes the center lines
169   Standard_EXPORT void ComputeCenters();
170
171
172
173
174 protected:
175
176
177
178
179
180 private:
181
182   
183   //! Perform the generated surfaces.
184   Standard_EXPORT void ComputeSurfaces();
185   
186   //! Build the resulting shape
187   //! All the faces must be computed
188   Standard_EXPORT void ComputeShape();
189   
190   //! Computes the intersections with <Face> and all the
191   //! OffsetFaces stored  in <myMapSF>.  Returns <True>
192   //! if an intersections ends on a boundary of a Face.
193   Standard_EXPORT Standard_Boolean Intersect (const TopoDS_Shape& Init, const TopoDS_Face& Face, const BiTgte_DataMapOfShapeBox& MapSBox, const BRepOffset_Offset& OF1, BRepOffset_Inter3d& Inter);
194
195
196   Standard_Real myRadius;
197   Standard_Real myTol;
198   Standard_Boolean myNubs;
199   TopoDS_Shape myShape;
200   TopoDS_Shape myResult;
201   Standard_Boolean myBuildShape;
202   TopTools_IndexedDataMapOfShapeListOfShape myAncestors;
203   BRepFill_DataMapOfShapeDataMapOfShapeListOfShape myCreated;
204   TopTools_DataMapOfShapeListOfShape myCutEdges;
205   TopTools_IndexedMapOfShape myFaces;
206   TopTools_IndexedMapOfShape myEdges;
207   TopTools_MapOfShape myStopFaces;
208   BRepOffset_Analyse myAnalyse;
209   TopTools_IndexedMapOfShape myCenters;
210   BRepOffset_DataMapOfShapeOffset myMapSF;
211   BRepAlgo_Image myInitOffsetFace;
212   BRepAlgo_Image myImage;
213   BRepAlgo_Image myImageOffset;
214   Handle(BRepAlgo_AsDes) myAsDes;
215   Standard_Integer myNbBranches;
216   Handle(TColStd_HArray1OfInteger) myIndices;
217   Standard_Boolean myDone;
218
219
220 };
221
222
223
224
225
226
227
228 #endif // _BiTgte_Blend_HeaderFile