0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / BRepOffsetAPI / BRepOffsetAPI_ThruSections.hxx
CommitLineData
42cf5bc1 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 <TopTools_SequenceOfShape.hxx>
25#include <Standard_Boolean.hxx>
26#include <Standard_Real.hxx>
27#include <TopoDS_Face.hxx>
28#include <TopTools_DataMapOfShapeShape.hxx>
50258e77 29#include <TopTools_DataMapOfShapeListOfInteger.hxx>
30#include <TopTools_DataMapOfShapeInteger.hxx>
42cf5bc1 31#include <GeomAbs_Shape.hxx>
32#include <Approx_ParametrizationType.hxx>
33#include <Standard_Integer.hxx>
34#include <BRepBuilderAPI_MakeShape.hxx>
35#include <TopTools_Array1OfShape.hxx>
36class Standard_DomainError;
37class TopoDS_Wire;
38class TopoDS_Vertex;
39class TopoDS_Shape;
40class Geom_BSplineSurface;
41
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).
47class BRepOffsetAPI_ThruSections : public BRepBuilderAPI_MakeShape
48{
49public:
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() 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
50258e77 148 //! Returns a list of new shapes generated from the shape
149 //! S by the shell-generating algorithm.
150 //! This function is redefined from BRepBuilderAPI_MakeShape::Generated.
151 //! S can be an edge or a vertex of a given Profile (see methods AddWire and AddVertex).
152 Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
42cf5bc1 153
4f7d41ea 154 //! Returns the list of original wires
155 const TopTools_ListOfShape& Wires() const
156 {
157 return myInputWires;
158 }
42cf5bc1 159
160
161protected:
162
163
164
165
166
167private:
168
169
170 Standard_EXPORT void CreateRuled();
171
172 Standard_EXPORT void CreateSmoothed();
173
50258e77 174 Standard_EXPORT Handle(Geom_BSplineSurface) TotalSurf (const TopTools_Array1OfShape& shapes,
175 const Standard_Integer NbSect,
176 const Standard_Integer NbEdges,
177 const Standard_Boolean w1Point,
178 const Standard_Boolean w2Point,
179 const Standard_Boolean vClosed) const;
42cf5bc1 180
181
4f7d41ea 182 TopTools_ListOfShape myInputWires; //!< List of input wires
183 TopTools_SequenceOfShape myWires; //!< Working wires
50258e77 184 TopTools_DataMapOfShapeListOfInteger myEdgeNewIndices;
185 TopTools_DataMapOfShapeInteger myVertexIndex;
186 Standard_Integer myNbEdgesInSection;
42cf5bc1 187 Standard_Boolean myIsSolid;
188 Standard_Boolean myIsRuled;
189 Standard_Boolean myWCheck;
190 Standard_Real myPres3d;
191 TopoDS_Face myFirst;
192 TopoDS_Face myLast;
50258e77 193 Standard_Boolean myDegen1;
194 Standard_Boolean myDegen2;
195 TopTools_DataMapOfShapeShape myEdgeFace;
42cf5bc1 196 GeomAbs_Shape myContinuity;
197 Approx_ParametrizationType myParamType;
198 Standard_Integer myDegMax;
199 Standard_Real myCritWeights[3];
200 Standard_Boolean myUseSmoothing;
201
202
203};
204
205
206
207
208
209
210
211#endif // _BRepOffsetAPI_ThruSections_HeaderFile