0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / BRepFilletAPI / BRepFilletAPI_MakeChamfer.hxx
CommitLineData
42cf5bc1 1// Created on: 1995-06-22
2// Created by: Flore Lantheaume
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 _BRepFilletAPI_MakeChamfer_HeaderFile
18#define _BRepFilletAPI_MakeChamfer_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <ChFi3d_ChBuilder.hxx>
25#include <TopTools_MapOfShape.hxx>
26#include <BRepFilletAPI_LocalOperation.hxx>
27#include <Standard_Real.hxx>
28#include <Standard_Integer.hxx>
29#include <Standard_Boolean.hxx>
30#include <TopTools_ListOfShape.hxx>
31#include <ChFiDS_SecHArray1.hxx>
32class StdFail_NotDone;
33class TopoDS_Shape;
34class TopoDS_Edge;
35class TopoDS_Face;
36class TopoDS_Vertex;
37class TopOpeBRepBuild_HBuilder;
38
39
40//! Describes functions to build chamfers on edges of a shell or solid.
41//! Chamfered Edge of a Shell or Solid
42//! A MakeChamfer object provides a framework for:
43//! - initializing the construction algorithm with a given shape,
44//! - acquiring the data characterizing the chamfers,
45//! - building the chamfers and constructing the resulting shape, and
46//! - consulting the result.
47class BRepFilletAPI_MakeChamfer : public BRepFilletAPI_LocalOperation
48{
49public:
50
51 DEFINE_STANDARD_ALLOC
52
53
54 //! Initializes an algorithm for computing chamfers on the shape S.
55 //! The edges on which chamfers are built are defined using the Add function.
56 Standard_EXPORT BRepFilletAPI_MakeChamfer(const TopoDS_Shape& S);
57
58 //! Adds edge E to the table of edges used by this
59 //! algorithm to build chamfers, where the parameters
60 //! of the chamfer must be set after the
79104795 61 Standard_EXPORT void Add (const TopoDS_Edge& E) Standard_OVERRIDE;
42cf5bc1 62
63 //! Adds edge E to the table of edges used by this
64 //! algorithm to build chamfers, where
1d54b807 65 //! the parameters of the chamfer are given by
66 //! the distance Dis (symmetric chamfer).
42cf5bc1 67 //! The Add function results in a contour being built by
68 //! propagation from the edge E (i.e. the contour contains at
69 //! least this edge). This contour is composed of edges of
70 //! the shape which are tangential to one another and
71 //! which delimit two series of tangential faces, with one
72 //! series of faces being located on either side of the contour.
73 //! Warning
74 //! Nothing is done if edge E or the face F does not belong to the initial shape.
1d54b807 75 Standard_EXPORT void Add (const Standard_Real Dis, const TopoDS_Edge& E);
42cf5bc1 76
77 //! Sets the distances Dis1 and Dis2 which give the
78 //! parameters of the chamfer along the contour of index
79 //! IC generated using the Add function in the internal
80 //! data structure of this algorithm. The face F identifies
81 //! the side where Dis1 is measured.
82 //! Warning
83 //! Nothing is done if either the edge E or the face F
84 //! does not belong to the initial shape.
85 Standard_EXPORT void SetDist (const Standard_Real Dis, const Standard_Integer IC, const TopoDS_Face& F);
86
87 Standard_EXPORT void GetDist (const Standard_Integer IC, Standard_Real& Dis) const;
88
1d54b807 89 //! Adds edge E to the table of edges used by this
90 //! algorithm to build chamfers, where
91 //! the parameters of the chamfer are given by the two
92 //! distances Dis1 and Dis2; the face F identifies the side
93 //! where Dis1 is measured.
94 //! The Add function results in a contour being built by
95 //! propagation from the edge E (i.e. the contour contains at
96 //! least this edge). This contour is composed of edges of
97 //! the shape which are tangential to one another and
98 //! which delimit two series of tangential faces, with one
99 //! series of faces being located on either side of the contour.
100 //! Warning
101 //! Nothing is done if edge E or the face F does not belong to the initial shape.
42cf5bc1 102 Standard_EXPORT void Add (const Standard_Real Dis1, const Standard_Real Dis2, const TopoDS_Edge& E, const TopoDS_Face& F);
103
104 //! Sets the distances Dis1 and Dis2 which give the
105 //! parameters of the chamfer along the contour of index
106 //! IC generated using the Add function in the internal
107 //! data structure of this algorithm. The face F identifies
108 //! the side where Dis1 is measured.
109 //! Warning
110 //! Nothing is done if either the edge E or the face F
111 //! does not belong to the initial shape.
112 Standard_EXPORT void SetDists (const Standard_Real Dis1, const Standard_Real Dis2, const Standard_Integer IC, const TopoDS_Face& F);
113
114 //! Returns the distances Dis1 and Dis2 which give the
115 //! parameters of the chamfer along the contour of index IC
116 //! in the internal data structure of this algorithm.
117 //! Warning
118 //! -1. is returned if IC is outside the bounds of the table of contours.
119 Standard_EXPORT void Dists (const Standard_Integer IC, Standard_Real& Dis1, Standard_Real& Dis2) const;
120
121 //! Adds a fillet contour in the builder (builds a
122 //! contour of tangent edges to <E> and sets the
123 //! distance <Dis1> and angle <Angle> ( parameters of the chamfer ) ).
124 Standard_EXPORT void AddDA (const Standard_Real Dis, const Standard_Real Angle, const TopoDS_Edge& E, const TopoDS_Face& F);
125
126 //! set the distance <Dis> and <Angle> of the fillet
127 //! contour of index <IC> in the DS with <Dis> on <F>.
128 //! if the face <F> is not one of common faces
129 //! of an edge of the contour <IC>
130 Standard_EXPORT void SetDistAngle (const Standard_Real Dis, const Standard_Real Angle, const Standard_Integer IC, const TopoDS_Face& F);
131
132 //! gives the distances <Dis> and <Angle> of the fillet
133 //! contour of index <IC> in the DS
1d54b807 134 Standard_EXPORT void GetDistAngle (const Standard_Integer IC, Standard_Real& Dis, Standard_Real& Angle) const;
135
136 //! Sets the mode of chamfer
137 Standard_EXPORT void SetMode (const ChFiDS_ChamfMode theMode);
42cf5bc1 138
139 //! return True if chamfer symetric false else.
140 Standard_EXPORT Standard_Boolean IsSymetric (const Standard_Integer IC) const;
141
142 //! return True if chamfer is made with two distances false else.
143 Standard_EXPORT Standard_Boolean IsTwoDistances (const Standard_Integer IC) const;
144
145 //! return True if chamfer is made with distance and angle false else.
146 Standard_EXPORT Standard_Boolean IsDistanceAngle (const Standard_Integer IC) const;
147
148 //! Erases the chamfer parameters on the contour of
149 //! index IC in the internal data structure of this algorithm.
150 //! Use the SetDists function to reset this data.
151 //! Warning
152 //! Nothing is done if IC is outside the bounds of the table of contours.
79104795 153 Standard_EXPORT void ResetContour (const Standard_Integer IC) Standard_OVERRIDE;
42cf5bc1 154
155 //! Returns the number of contours generated using the
156 //! Add function in the internal data structure of this algorithm.
79104795 157 Standard_EXPORT Standard_Integer NbContours() const Standard_OVERRIDE;
42cf5bc1 158
159 //! Returns the index of the contour in the internal data
160 //! structure of this algorithm, which contains the edge E of the shape.
161 //! This function returns 0 if the edge E does not belong to any contour.
162 //! Warning
163 //! This index can change if a contour is removed from the
164 //! internal data structure of this algorithm using the function Remove.
79104795 165 Standard_EXPORT Standard_Integer Contour (const TopoDS_Edge& E) const Standard_OVERRIDE;
42cf5bc1 166
167 //! Returns the number of edges in the contour of index I in
168 //! the internal data structure of this algorithm.
169 //! Warning
170 //! Returns 0 if I is outside the bounds of the table of contours.
79104795 171 Standard_EXPORT Standard_Integer NbEdges (const Standard_Integer I) const Standard_OVERRIDE;
42cf5bc1 172
173 //! Returns the edge of index J in the contour of index I in
174 //! the internal data structure of this algorithm.
175 //! Warning
176 //! Returns a null shape if:
177 //! - I is outside the bounds of the table of contours, or
178 //! - J is outside the bounds of the table of edges of the contour of index I.
79104795 179 Standard_EXPORT const TopoDS_Edge& Edge (const Standard_Integer I, const Standard_Integer J) const Standard_OVERRIDE;
42cf5bc1 180
181 //! Removes the contour in the internal data structure of
182 //! this algorithm which contains the edge E of the shape.
183 //! Warning
184 //! Nothing is done if the edge E does not belong to the
185 //! contour in the internal data structure of this algorithm.
79104795 186 Standard_EXPORT void Remove (const TopoDS_Edge& E) Standard_OVERRIDE;
42cf5bc1 187
188 //! Returns the length of the contour of index IC in the
189 //! internal data structure of this algorithm.
190 //! Warning
191 //! Returns -1. if IC is outside the bounds of the table of contours.
79104795 192 Standard_EXPORT Standard_Real Length (const Standard_Integer IC) const Standard_OVERRIDE;
42cf5bc1 193
194 //! Returns the first vertex of the contour of index IC
195 //! in the internal data structure of this algorithm.
196 //! Warning
197 //! Returns a null shape if IC is outside the bounds of the table of contours.
79104795 198 Standard_EXPORT TopoDS_Vertex FirstVertex (const Standard_Integer IC) const Standard_OVERRIDE;
42cf5bc1 199
200 //! Returns the last vertex of the contour of index IC
201 //! in the internal data structure of this algorithm.
202 //! Warning
203 //! Returns a null shape if IC is outside the bounds of the table of contours.
79104795 204 Standard_EXPORT TopoDS_Vertex LastVertex (const Standard_Integer IC) const Standard_OVERRIDE;
42cf5bc1 205
206 //! Returns the curvilinear abscissa of the vertex V on the
207 //! contour of index IC in the internal data structure of this algorithm.
208 //! Warning
209 //! Returns -1. if:
210 //! - IC is outside the bounds of the table of contours, or
211 //! - V is not on the contour of index IC.
79104795 212 Standard_EXPORT Standard_Real Abscissa (const Standard_Integer IC, const TopoDS_Vertex& V) const Standard_OVERRIDE;
42cf5bc1 213
214 //! Returns the relative curvilinear abscissa (i.e. between 0
215 //! and 1) of the vertex V on the contour of index IC in the
216 //! internal data structure of this algorithm.
217 //! Warning
218 //! Returns -1. if:
219 //! - IC is outside the bounds of the table of contours, or
220 //! - V is not on the contour of index IC.
79104795 221 Standard_EXPORT Standard_Real RelativeAbscissa (const Standard_Integer IC, const TopoDS_Vertex& V) const Standard_OVERRIDE;
42cf5bc1 222
223 //! eturns true if the contour of index IC in the internal
224 //! data structure of this algorithm is closed and tangential at the point of closure.
225 //! Warning
226 //! Returns false if IC is outside the bounds of the table of contours.
79104795 227 Standard_EXPORT Standard_Boolean ClosedAndTangent (const Standard_Integer IC) const Standard_OVERRIDE;
42cf5bc1 228
229 //! Returns true if the contour of index IC in the internal
230 //! data structure of this algorithm is closed.
231 //! Warning
232 //! Returns false if IC is outside the bounds of the table of contours.
79104795 233 Standard_EXPORT Standard_Boolean Closed (const Standard_Integer IC) const Standard_OVERRIDE;
42cf5bc1 234
235 //! Builds the chamfers on all the contours in the internal
236 //! data structure of this algorithm and constructs the resulting shape.
237 //! Use the function IsDone to verify that the chamfered
238 //! shape is built. Use the function Shape to retrieve the chamfered shape.
239 //! Warning
240 //! The construction of chamfers implements highly complex
241 //! construction algorithms. Consequently, there may be
242 //! instances where the algorithm fails, for example if the
243 //! data defining the parameters of the chamfer is not
244 //! compatible with the geometry of the initial shape. There
245 //! is no initial analysis of errors and these only become
246 //! evident at the construction stage.
247 //! Additionally, in the current software release, the following
248 //! cases are not handled:
249 //! - the end point of the contour is the point of
250 //! intersection of 4 or more edges of the shape, or
251 //! - the intersection of the chamfer with a face which
252 //! limits the contour is not fully contained in this face.
253 Standard_EXPORT virtual void Build() Standard_OVERRIDE;
254
255 //! Reinitializes this algorithm, thus canceling the effects of the Build function.
256 //! This function allows modifications to be made to the
257 //! contours and chamfer parameters in order to rebuild the shape.
79104795 258 Standard_EXPORT void Reset() Standard_OVERRIDE;
42cf5bc1 259
260 //! Returns the internal filleting algorithm.
261 Standard_EXPORT Handle(TopOpeBRepBuild_HBuilder) Builder() const;
262
263 //! Returns the list of shapes generated from the
264 //! shape <EorV>.
265 Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& EorV) Standard_OVERRIDE;
266
267 //! Returns the list of shapes modified from the shape
268 //! <F>.
269 Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& F) Standard_OVERRIDE;
270
271 Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& F) Standard_OVERRIDE;
272
79104795 273 Standard_EXPORT void Simulate (const Standard_Integer IC) Standard_OVERRIDE;
42cf5bc1 274
79104795 275 Standard_EXPORT Standard_Integer NbSurf (const Standard_Integer IC) const Standard_OVERRIDE;
42cf5bc1 276
79104795 277 Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect (const Standard_Integer IC, const Standard_Integer IS) const Standard_OVERRIDE;
42cf5bc1 278
279
280
281
282protected:
283
284
285
286
287
288private:
289
290
291
292 ChFi3d_ChBuilder myBuilder;
293 TopTools_MapOfShape myMap;
294
295
296};
297
298
299
300
301
302
303
304#endif // _BRepFilletAPI_MakeChamfer_HeaderFile