c1949989354ba8aa579d9082c4d79581ec15ac2e
[occt.git] / src / BRepOffset / BRepOffset_MakeOffset.hxx
1 // Created on: 1995-10-26
2 // Created by: Yves FRICAUD
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 _BRepOffset_MakeOffset_HeaderFile
18 #define _BRepOffset_MakeOffset_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Real.hxx>
25 #include <TopoDS_Shape.hxx>
26 #include <BRepOffset_Mode.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <GeomAbs_JoinType.hxx>
29 #include <TopTools_DataMapOfShapeReal.hxx>
30 #include <TopTools_IndexedMapOfShape.hxx>
31 #include <BRepOffset_Analyse.hxx>
32 #include <BRepAlgo_Image.hxx>
33 #include <TopTools_ListOfShape.hxx>
34 #include <BRepOffset_Error.hxx>
35 #include <BRepOffset_MakeLoops.hxx>
36 #include <TopTools_MapOfShape.hxx>
37 #include <BRepOffset_DataMapOfShapeOffset.hxx>
38 class BRepAlgo_AsDes;
39 class TopoDS_Shape;
40 class TopoDS_Face;
41 class BRepOffset_Analyse;
42 class BRepAlgo_Image;
43 class BRepOffset_Inter3d;
44
45
46
47 class BRepOffset_MakeOffset 
48 {
49 public:
50
51   DEFINE_STANDARD_ALLOC
52
53   
54   Standard_EXPORT BRepOffset_MakeOffset();
55   
56   Standard_EXPORT BRepOffset_MakeOffset(const TopoDS_Shape& S, const Standard_Real Offset, const Standard_Real Tol, const BRepOffset_Mode Mode = BRepOffset_Skin, const Standard_Boolean Intersection = Standard_False, const Standard_Boolean SelfInter = Standard_False, const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean Thickening = Standard_False);
57   
58   Standard_EXPORT void Initialize (const TopoDS_Shape& S, const Standard_Real Offset, const Standard_Real Tol, const BRepOffset_Mode Mode = BRepOffset_Skin, const Standard_Boolean Intersection = Standard_False, const Standard_Boolean SelfInter = Standard_False, const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean Thickening = Standard_False);
59   
60   Standard_EXPORT void Clear();
61   
62   //! Add Closing Faces,  <F>  has to be  in  the initial
63   //! shape S.
64   Standard_EXPORT void AddFace (const TopoDS_Face& F);
65   
66   //! set the offset <Off> on the Face <F>
67   Standard_EXPORT void SetOffsetOnFace (const TopoDS_Face& F, const Standard_Real Off);
68   
69   Standard_EXPORT void MakeOffsetShape();
70   
71   Standard_EXPORT void MakeThickSolid();
72   
73   Standard_EXPORT const BRepOffset_Analyse& GetAnalyse() const;
74   
75   Standard_EXPORT Standard_Boolean IsDone() const;
76   
77   Standard_EXPORT const TopoDS_Shape& Shape() const;
78   
79   //! returns information about offset state.
80   Standard_EXPORT BRepOffset_Error Error() const;
81   
82   //! Returns <Image> containing links between initials
83   //! shapes and offset faces.
84   Standard_EXPORT const BRepAlgo_Image& OffsetFacesFromShapes() const;
85   
86   //! Returns myJoin.
87   Standard_EXPORT GeomAbs_JoinType GetJoinType() const;
88   
89   //! Returns <Image> containing links between initials
90   //! shapes and offset edges.
91   Standard_EXPORT const BRepAlgo_Image& OffsetEdgesFromShapes() const;
92   
93   //! Returns the list of closing faces stores by AddFace
94   Standard_EXPORT const TopTools_IndexedMapOfShape& ClosingFaces() const;
95
96   //! Makes pre analysis of possibility offset perform. Use method Error() to get more information.
97   //! Finds first error. List of checks:
98   //! 1) Check for existence object with non-null offset.
99   //! 2) Check for connectivity in offset shell.
100   //! 3) Check continuity of input surfaces.
101   //! 4) Check for normals existence on grid.
102   //! @return True if possible make computations and false otherwise.
103   Standard_EXPORT Standard_Boolean CheckInputData();
104
105   //! Return bad shape, which obtained in CheckInputData.
106   Standard_EXPORT const TopoDS_Shape& GetBadShape() const;
107
108
109
110
111 protected:
112
113
114
115
116
117 private:
118
119   
120   Standard_EXPORT void BuildOffsetByArc();
121   
122   Standard_EXPORT void BuildOffsetByInter();
123   
124   Standard_EXPORT void SelfInter (TopTools_MapOfShape& Modif);
125   
126   Standard_EXPORT void Intersection3D (BRepOffset_Inter3d& Inter);
127   
128   Standard_EXPORT void Intersection2D (const TopTools_IndexedMapOfShape& Modif, const TopTools_IndexedMapOfShape& NewEdges);
129   
130   Standard_EXPORT void MakeLoops (TopTools_IndexedMapOfShape& Modif);
131   
132   Standard_EXPORT void MakeLoopsOnContext (TopTools_MapOfShape& Modif);
133   
134   Standard_EXPORT void MakeFaces (TopTools_IndexedMapOfShape& Modif);
135   
136   Standard_EXPORT void MakeShells();
137   
138   Standard_EXPORT void SelectShells();
139   
140   Standard_EXPORT void EncodeRegularity();
141   
142   Standard_EXPORT void MakeSolid();
143   
144   Standard_EXPORT void ToContext (BRepOffset_DataMapOfShapeOffset& MapSF);
145   
146   //! Private method use to update the map face<->offset
147   Standard_EXPORT void UpdateFaceOffset();
148   
149   //! Private method used to correct degenerated edges on conical faces
150   Standard_EXPORT void CorrectConicalFaces();
151   
152   //! Private method used to build walls for thickening the shell
153   Standard_EXPORT void MakeMissingWalls();
154
155
156   Standard_Real myOffset;
157   Standard_Real myTol;
158   TopoDS_Shape myShape;
159   BRepOffset_Mode myMode;
160   Standard_Boolean myInter;
161   Standard_Boolean mySelfInter;
162   GeomAbs_JoinType myJoin;
163   Standard_Boolean myThickening;
164   TopTools_DataMapOfShapeReal myFaceOffset;
165   TopTools_IndexedMapOfShape myFaces;
166   BRepOffset_Analyse myAnalyse;
167   TopoDS_Shape myOffsetShape;
168   BRepAlgo_Image myInitOffsetFace;
169   BRepAlgo_Image myInitOffsetEdge;
170   BRepAlgo_Image myImageOffset;
171   TopTools_ListOfShape myWalls;
172   Handle(BRepAlgo_AsDes) myAsDes;
173   Standard_Boolean myDone;
174   BRepOffset_Error myError;
175   BRepOffset_MakeLoops myMakeLoops;
176   Standard_Boolean myIsPerformSewing; // Handle bad walls in thicksolid mode.
177   TopoDS_Shape myBadShape;
178
179
180 };
181
182
183
184
185
186
187
188 #endif // _BRepOffset_MakeOffset_HeaderFile