0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BRepFill / BRepFill_PipeShell.hxx
1 // Created on: 1998-07-22
2 // Created by: Philippe MANGIN
3 // Copyright (c) 1998-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 _BRepFill_PipeShell_HeaderFile
18 #define _BRepFill_PipeShell_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <TopoDS_Wire.hxx>
24 #include <TopoDS_Shape.hxx>
25 #include <BRepFill_SequenceOfSection.hxx>
26 #include <TopTools_DataMapOfShapeListOfShape.hxx>
27 #include <Standard_Real.hxx>
28 #include <Standard_Integer.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <TopTools_HArray2OfShape.hxx>
31 #include <GeomFill_Trihedron.hxx>
32 #include <BRepFill_TransitionStyle.hxx>
33 #include <GeomFill_PipeError.hxx>
34 #include <MMgt_TShared.hxx>
35 #include <BRepFill_TypeOfContact.hxx>
36 #include <TopTools_ListOfShape.hxx>
37 class Law_Function;
38 class BRepFill_LocationLaw;
39 class BRepFill_SectionLaw;
40 class Standard_DomainError;
41 class StdFail_NotDone;
42 class TopoDS_Wire;
43 class gp_Ax2;
44 class gp_Dir;
45 class TopoDS_Shape;
46 class TopoDS_Vertex;
47 class BRepFill_Section;
48 class gp_Trsf;
49 class BRepFill_Sweep;
50
51
52 class BRepFill_PipeShell;
53 DEFINE_STANDARD_HANDLE(BRepFill_PipeShell, MMgt_TShared)
54
55 //! Computes a topological shell using some wires
56 //! (spines and profiles) and diplacement option
57 //! Perform general sweeping construction
58 class BRepFill_PipeShell : public MMgt_TShared
59 {
60
61 public:
62
63   
64   //! Set an sweep's mode
65   //! If no mode are setted, the mode use in MakePipe is used
66   Standard_EXPORT BRepFill_PipeShell(const TopoDS_Wire& Spine);
67   
68   //! Set an Frenet or an CorrectedFrenet trihedron
69   //! to  perform  the  sweeping
70   Standard_EXPORT void Set (const Standard_Boolean Frenet = Standard_False);
71   
72   //! Set a Discrete trihedron
73   //! to  perform  the  sweeping
74   Standard_EXPORT void SetDiscrete();
75   
76   //! Set  an  fixed  trihedron  to  perform  the  sweeping
77   //! all sections will be parallel.
78   Standard_EXPORT void Set (const gp_Ax2& Axe);
79   
80   //! Set an fixed  BiNormal  direction to  perform
81   //! the sweeping
82   Standard_EXPORT void Set (const gp_Dir& BiNormal);
83   
84   //! Set support to the spine to define the BiNormal
85   //! at   the spine, like    the  normal the surfaces.
86   //! Warning: To  be  effective,  Each  edge  of  the  <spine>  must
87   //! have an  representaion  on   one   face  of<SpineSupport>
88   Standard_EXPORT Standard_Boolean Set (const TopoDS_Shape& SpineSupport);
89   
90   //! Set  an  auxiliary  spine  to  define  the Normal
91   //! For  each  Point  of  the  Spine  P,  an  Point  Q  is  evalued
92   //! on  <AuxiliarySpine>
93   //! If <CurvilinearEquivalence>
94   //! Q split <AuxiliarySpine> with  the  same  length ratio
95   //! than P split  <Spline>.
96   //! Else  the  plan  define  by  P  and  the  tangent  to  the  <Spine>
97   //! intersect <AuxiliarySpine> in Q.
98   //! If <KeepContact> equals BRepFill_NoContact: The Normal is defined
99   //! by the vector PQ.
100   //! If <KeepContact> equals BRepFill_Contact: The Normal is defined to
101   //! achieve that the sweeped section is in contact to the
102   //! auxiliarySpine. The width of section is constant all along the path.
103   //! In other words, the auxiliary spine lies on the swept surface,
104   //! but not necessarily is a boundary of this surface. However,
105   //! the auxiliary spine has to be close enough to the main spine
106   //! to provide intersection with any section all along the path.
107   //! If <KeepContact> equals BRepFill_ContactOnBorder: The auxiliary spine
108   //! becomes a boundary of the swept surface and the width of section varies
109   //! along the path.
110   Standard_EXPORT void Set (const TopoDS_Wire& AuxiliarySpine, const Standard_Boolean CurvilinearEquivalence = Standard_True, const BRepFill_TypeOfContact KeepContact = BRepFill_NoContact);
111   
112   //! Define the maximum V degree of resulting surface
113   Standard_EXPORT void SetMaxDegree (const Standard_Integer NewMaxDegree);
114   
115   //! Define the maximum number of spans in V-direction
116   //! on resulting surface
117   Standard_EXPORT void SetMaxSegments (const Standard_Integer NewMaxSegments);
118   
119   //! Set the flag that indicates attempt to approximate
120   //! a C1-continuous surface if a swept surface proved
121   //! to be C0.
122   //! Give section to sweep.
123   //! Possibilities are :
124   //! - Give one or sevral profile
125   //! - Give one profile and an homotetic law.
126   //! - Automatic compute of correspondance beetween profile, and section
127   //! on the sweeped shape
128   //! - correspondance beetween profile, and section on the sweeped shape
129   //! defined by a vertex of the spine
130   Standard_EXPORT void SetForceApproxC1 (const Standard_Boolean ForceApproxC1);
131   
132   //! Set an section. The corespondance with the spine, will
133   //! be automaticaly performed.
134   Standard_EXPORT void Add (const TopoDS_Shape& Profile, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
135   
136   //! Set an section.   The corespondance with the spine, is
137   //! given by  <Location>
138   Standard_EXPORT void Add (const TopoDS_Shape& Profile, const TopoDS_Vertex& Location, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
139   
140   //! Set  an    section  and  an   homotetic    law.
141   //! The  homotetie's  centers  is  given  by  point  on  the  <Spine>.
142   Standard_EXPORT void SetLaw (const TopoDS_Shape& Profile, const Handle(Law_Function)& L, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
143   
144   //! Set  an    section  and  an   homotetic    law.
145   //! The  homotetie  center  is  given  by  point  on  the  <Spine>
146   Standard_EXPORT void SetLaw (const TopoDS_Shape& Profile, const Handle(Law_Function)& L, const TopoDS_Vertex& Location, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
147   
148   //! Delete an section.
149   Standard_EXPORT void Delete (const TopoDS_Shape& Profile);
150   
151   //! Say if <me> is ready to build the shape
152   //! return False if <me> do not have section definition
153   Standard_EXPORT Standard_Boolean IsReady() const;
154   
155   //! Get a status, when Simulate or Build failed.
156   Standard_EXPORT GeomFill_PipeError GetStatus() const;
157   
158   Standard_EXPORT void SetTolerance (const Standard_Real Tol3d = 1.0e-4, const Standard_Real BoundTol = 1.0e-4, const Standard_Real TolAngular = 1.0e-2);
159   
160   //! Set the  Transition Mode to manage discontinuities
161   //! on the sweep.
162   Standard_EXPORT void SetTransition (const BRepFill_TransitionStyle Mode = BRepFill_Modified, const Standard_Real Angmin = 1.0e-2, const Standard_Real Angmax = 6.0);
163   
164   //! Perform simulation of the sweep :
165   //! Somes Section are returned.
166   Standard_EXPORT void Simulate (const Standard_Integer NumberOfSection, TopTools_ListOfShape& Sections);
167   
168   //! Builds the resulting shape (redefined from MakeShape).
169   Standard_EXPORT Standard_Boolean Build();
170   
171   //! Transform the sweeping Shell in Solid.
172   //! If the section are not closed returns False
173   Standard_EXPORT Standard_Boolean MakeSolid();
174   
175   //! Returns the result Shape.
176   Standard_EXPORT const TopoDS_Shape& Shape() const;
177   
178   Standard_EXPORT Standard_Real ErrorOnSurface() const;
179   
180   //! Returns the  TopoDS  Shape of the bottom of the sweep.
181   Standard_EXPORT const TopoDS_Shape& FirstShape() const;
182   
183   //! Returns the TopoDS Shape of the top of the sweep.
184   Standard_EXPORT const TopoDS_Shape& LastShape() const;
185   
186   //! Returns the  list   of shapes generated   from the
187   //! shape <S>.
188   Standard_EXPORT void Generated (const TopoDS_Shape& S, TopTools_ListOfShape& L);
189
190
191
192
193   DEFINE_STANDARD_RTTI(BRepFill_PipeShell,MMgt_TShared)
194
195 protected:
196
197
198
199
200 private:
201
202   
203   Standard_EXPORT void Prepare();
204   
205   Standard_EXPORT void Place (const BRepFill_Section& Sec, TopoDS_Wire& W, gp_Trsf& Trsf, Standard_Real& param);
206   
207   Standard_EXPORT void ResetLoc();
208   
209   Standard_EXPORT void BuildHistory (const BRepFill_Sweep& theSweep);
210
211   TopoDS_Wire mySpine;
212   TopoDS_Shape myFirst;
213   TopoDS_Shape myLast;
214   TopoDS_Shape myShape;
215   BRepFill_SequenceOfSection mySeq;
216   TopTools_DataMapOfShapeListOfShape myGenMap;
217   Standard_Real myTol3d;
218   Standard_Real myBoundTol;
219   Standard_Real myTolAngular;
220   Standard_Real angmin;
221   Standard_Real angmax;
222   Standard_Integer myMaxDegree;
223   Standard_Integer myMaxSegments;
224   Standard_Boolean myForceApproxC1;
225   Handle(Law_Function) myLaw;
226   Standard_Boolean myIsAutomaticLaw;
227   Handle(BRepFill_LocationLaw) myLocation;
228   Handle(BRepFill_SectionLaw) mySection;
229   Handle(TopTools_HArray2OfShape) myFaces;
230   GeomFill_Trihedron myTrihedron;
231   BRepFill_TransitionStyle myTransition;
232   GeomFill_PipeError myStatus;
233   Standard_Real myErrorOnSurf;
234
235
236 };
237
238
239
240
241
242
243
244 #endif // _BRepFill_PipeShell_HeaderFile