0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / BRepOffsetAPI / BRepOffsetAPI_ThruSections.hxx
1 // Created on: 1995-07-17
2 // Created by: Jing-Cheng MEI
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 _BRepOffsetAPI_ThruSections_HeaderFile
18 #define _BRepOffsetAPI_ThruSections_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <BRepFill_ThruSectionErrorStatus.hxx>
25 #include <TopTools_SequenceOfShape.hxx>
26 #include <TopoDS_Face.hxx>
27 #include <TopTools_DataMapOfShapeShape.hxx>
28 #include <TopTools_DataMapOfShapeListOfInteger.hxx>
29 #include <TopTools_DataMapOfShapeInteger.hxx>
30 #include <GeomAbs_Shape.hxx>
31 #include <Approx_ParametrizationType.hxx>
32 #include <Standard_Integer.hxx>
33 #include <BRepBuilderAPI_MakeShape.hxx>
34 #include <TopTools_Array1OfShape.hxx>
35 #include <NCollection_Handle.hxx>
36
37 class TopoDS_Wire;
38 class TopoDS_Vertex;
39 class TopoDS_Shape;
40 class Geom_BSplineSurface;
41 class BRepFill_Generator;
42
43 //! Describes functions to build a loft. This is a shell or a
44 //! solid passing through a set of sections in a given
45 //! sequence. Usually sections are wires, but the first and
46 //! the last sections may be vertices (punctual sections).
47 class BRepOffsetAPI_ThruSections  : public BRepBuilderAPI_MakeShape
48 {
49 public:
50
51   DEFINE_STANDARD_ALLOC
52
53   
54   //! Initializes an algorithm for building a shell or a solid
55   //! passing through a set of sections, where:
56   //! -          isSolid is set to true if the construction algorithm is
57   //! required to build a solid or to false if it is required to build
58   //! a shell (the default value),
59   //! -          ruled is set to true if the faces generated between
60   //! the edges of two consecutive wires are ruled surfaces or to
61   //! false (the default value) if they are smoothed out by approximation,
62   //! -          pres3d defines the precision criterion used by the
63   //! approximation algorithm; the default value is 1.0e-6.
64   //! Use AddWire and AddVertex to define the
65   //! successive sections of the shell or solid to be built.
66   Standard_EXPORT BRepOffsetAPI_ThruSections(const Standard_Boolean isSolid = Standard_False, const Standard_Boolean ruled = Standard_False, const Standard_Real pres3d = 1.0e-06);
67   
68   //! Initializes this algorithm for building a shell or a solid
69   //! passing through a set of sections, where:
70   //! - isSolid is set to true if this construction algorithm is
71   //! required to build a solid or to false if it is required to
72   //! build a shell. false is the default value;
73   //! - ruled is set to true if the faces generated between the
74   //! edges of two consecutive wires are ruled surfaces or
75   //! to false (the default value) if they are smoothed out by approximation,
76   //! - pres3d defines the precision criterion used by the
77   //! approximation algorithm; the default value is 1.0e-6.
78   //! Use AddWire and AddVertex to define the successive
79   //! sections of the shell or solid to be built.
80   Standard_EXPORT void Init (const Standard_Boolean isSolid = Standard_False, const Standard_Boolean ruled = Standard_False, const Standard_Real pres3d = 1.0e-06);
81   
82   //! Adds the wire wire to the set of
83   //! sections through which the shell or solid is built.
84   //! Use the Build function to construct the shape.
85   Standard_EXPORT void AddWire (const TopoDS_Wire& wire);
86   
87   //! Adds the vertex Vertex (punctual section) to the set of sections
88   //! through which the shell or solid is built. A vertex may be added to the
89   //! set of sections only as first or last section. At least one wire
90   //! must be added to the set of sections by the method AddWire.
91   //! Use the Build function to construct the shape.
92   Standard_EXPORT void AddVertex (const TopoDS_Vertex& aVertex);
93   
94   //! Sets/unsets the option to
95   //! compute origin and orientation on wires to avoid twisted results
96   //! and update wires to have same number of edges.
97   Standard_EXPORT void CheckCompatibility (const Standard_Boolean check = Standard_True);
98   
99   //! Define the approximation algorithm
100   Standard_EXPORT void SetSmoothing (const Standard_Boolean UseSmoothing);
101   
102   //! Define the type of parametrization   used in the approximation
103   Standard_EXPORT void SetParType (const Approx_ParametrizationType ParType);
104   
105   //! Define the Continuity used in the approximation
106   Standard_EXPORT void SetContinuity (const GeomAbs_Shape C);
107   
108   //! define the Weights  associed to the criterium used in
109   //! the  optimization.
110   //!
111   //! if Wi <= 0
112   Standard_EXPORT void SetCriteriumWeight (const Standard_Real W1, const Standard_Real W2, const Standard_Real W3);
113   
114   //! Define the maximal U degree of result surface
115   Standard_EXPORT void SetMaxDegree (const Standard_Integer MaxDeg);
116   
117   //! returns the type of parametrization used in the approximation
118   Standard_EXPORT Approx_ParametrizationType ParType() const;
119   
120   //! returns the Continuity used in the approximation
121   Standard_EXPORT GeomAbs_Shape Continuity() const;
122   
123   //! returns the maximal U degree of result surface
124   Standard_EXPORT Standard_Integer MaxDegree() const;
125   
126   //! Define the approximation algorithm
127   Standard_EXPORT Standard_Boolean UseSmoothing() const;
128   
129   //! returns the Weights associed  to the criterium used in
130   //! the  optimization.
131   Standard_EXPORT void CriteriumWeight (Standard_Real& W1, Standard_Real& W2, Standard_Real& W3) const;
132   
133   Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
134   
135   //! Returns the TopoDS Shape of the bottom of the loft if solid
136   Standard_EXPORT const TopoDS_Shape& FirstShape() const;
137   
138   //! Returns the TopoDS Shape of the top of the loft if solid
139   Standard_EXPORT const TopoDS_Shape& LastShape() const;
140   
141   //! if Ruled
142   //! Returns the Face generated by each edge
143   //! except the last wire
144   //! if smoothed
145   //! Returns the Face generated by each edge of the first wire
146   Standard_EXPORT TopoDS_Shape GeneratedFace (const TopoDS_Shape& Edge) const;
147
148   //! Sets the mutable input state.
149   //! If true then the input profile can be modified inside
150   //! the thrusection operation. Default value is true.
151   Standard_EXPORT void SetMutableInput(const Standard_Boolean theIsMutableInput);
152   
153   //! Returns a list of new shapes generated from the shape
154   //! S by the shell-generating algorithm.
155   //! This function is redefined from BRepBuilderAPI_MakeShape::Generated.
156   //! S can be an edge or a vertex of a given Profile (see methods AddWire and AddVertex).
157   Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
158
159   //! Returns the list of original wires
160   const TopTools_ListOfShape& Wires() const
161   {
162     return myInputWires;
163   }
164   //! Returns the current mutable input state
165   Standard_EXPORT Standard_Boolean IsMutableInput() const;
166   
167   //! Returns the status of thrusection operation
168   BRepFill_ThruSectionErrorStatus GetStatus() const
169   {
170     return myStatus;
171   }
172
173 protected:
174
175
176
177
178
179 private:
180
181   
182   Standard_EXPORT void CreateRuled();
183   
184   Standard_EXPORT void CreateSmoothed();
185   
186   Standard_EXPORT Handle(Geom_BSplineSurface) TotalSurf (const TopTools_Array1OfShape& shapes,
187                                                          const Standard_Integer NbSect,
188                                                          const Standard_Integer NbEdges,
189                                                          const Standard_Boolean w1Point,
190                                                          const Standard_Boolean w2Point,
191                                                          const Standard_Boolean vClosed) const;
192
193
194   TopTools_ListOfShape myInputWires; //!< List of input wires
195   TopTools_SequenceOfShape myWires;  //!< Working wires
196   TopTools_DataMapOfShapeListOfInteger myEdgeNewIndices;
197   TopTools_DataMapOfShapeInteger myVertexIndex;
198   Standard_Integer myNbEdgesInSection;
199   Standard_Boolean myIsSolid;
200   Standard_Boolean myIsRuled;
201   Standard_Boolean myWCheck;
202   Standard_Real myPres3d;
203   TopoDS_Face myFirst;
204   TopoDS_Face myLast;
205   Standard_Boolean myDegen1;
206   Standard_Boolean myDegen2;
207   TopTools_DataMapOfShapeShape myEdgeFace;
208   GeomAbs_Shape myContinuity;
209   Approx_ParametrizationType myParamType;
210   Standard_Integer myDegMax;
211   Standard_Real myCritWeights[3];
212   Standard_Boolean myUseSmoothing;
213   Standard_Boolean myMutableInput;
214   NCollection_Handle<BRepFill_Generator> myBFGenerator;
215   BRepFill_ThruSectionErrorStatus myStatus;
216
217 };
218
219
220
221
222
223
224
225 #endif // _BRepOffsetAPI_ThruSections_HeaderFile