Warnings on vc14 were eliminated
[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
65 //! the parameters of the chamfer are given by the two
66 //! distances Dis1 and Dis2; the face F identifies the side
67 //! where Dis1 is measured.
68 //! The Add function results in a contour being built by
69 //! propagation from the edge E (i.e. the contour contains at
70 //! least this edge). This contour is composed of edges of
71 //! the shape which are tangential to one another and
72 //! which delimit two series of tangential faces, with one
73 //! series of faces being located on either side of the contour.
74 //! Warning
75 //! Nothing is done if edge E or the face F does not belong to the initial shape.
76 Standard_EXPORT void Add (const Standard_Real Dis, const TopoDS_Edge& E, const TopoDS_Face& F);
77
78 //! Sets the distances Dis1 and Dis2 which give the
79 //! parameters of the chamfer along the contour of index
80 //! IC generated using the Add function in the internal
81 //! data structure of this algorithm. The face F identifies
82 //! the side where Dis1 is measured.
83 //! Warning
84 //! Nothing is done if either the edge E or the face F
85 //! does not belong to the initial shape.
86 Standard_EXPORT void SetDist (const Standard_Real Dis, const Standard_Integer IC, const TopoDS_Face& F);
87
88 Standard_EXPORT void GetDist (const Standard_Integer IC, Standard_Real& Dis) const;
89
90 //! Adds a fillet contour in the builder (builds a
91 //! contour of tangent edges to <E> and sets the two
92 //! distances <Dis1> and <Dis2> ( parameters of the chamfer ) ).
93 Standard_EXPORT void Add (const Standard_Real Dis1, const Standard_Real Dis2, const TopoDS_Edge& E, const TopoDS_Face& F);
94
95 //! Sets the distances Dis1 and Dis2 which give the
96 //! parameters of the chamfer along the contour of index
97 //! IC generated using the Add function in the internal
98 //! data structure of this algorithm. The face F identifies
99 //! the side where Dis1 is measured.
100 //! Warning
101 //! Nothing is done if either the edge E or the face F
102 //! does not belong to the initial shape.
103 Standard_EXPORT void SetDists (const Standard_Real Dis1, const Standard_Real Dis2, const Standard_Integer IC, const TopoDS_Face& F);
104
105 //! Returns the distances Dis1 and Dis2 which give the
106 //! parameters of the chamfer along the contour of index IC
107 //! in the internal data structure of this algorithm.
108 //! Warning
109 //! -1. is returned if IC is outside the bounds of the table of contours.
110 Standard_EXPORT void Dists (const Standard_Integer IC, Standard_Real& Dis1, Standard_Real& Dis2) const;
111
112 //! Adds a fillet contour in the builder (builds a
113 //! contour of tangent edges to <E> and sets the
114 //! distance <Dis1> and angle <Angle> ( parameters of the chamfer ) ).
115 Standard_EXPORT void AddDA (const Standard_Real Dis, const Standard_Real Angle, const TopoDS_Edge& E, const TopoDS_Face& F);
116
117 //! set the distance <Dis> and <Angle> of the fillet
118 //! contour of index <IC> in the DS with <Dis> on <F>.
119 //! if the face <F> is not one of common faces
120 //! of an edge of the contour <IC>
121 Standard_EXPORT void SetDistAngle (const Standard_Real Dis, const Standard_Real Angle, const Standard_Integer IC, const TopoDS_Face& F);
122
123 //! gives the distances <Dis> and <Angle> of the fillet
124 //! contour of index <IC> in the DS
125 Standard_EXPORT void GetDistAngle (const Standard_Integer IC, Standard_Real& Dis, Standard_Real& Angle, Standard_Boolean& DisOnFace1) const;
126
127 //! return True if chamfer symetric false else.
128 Standard_EXPORT Standard_Boolean IsSymetric (const Standard_Integer IC) const;
129
130 //! return True if chamfer is made with two distances false else.
131 Standard_EXPORT Standard_Boolean IsTwoDistances (const Standard_Integer IC) const;
132
133 //! return True if chamfer is made with distance and angle false else.
134 Standard_EXPORT Standard_Boolean IsDistanceAngle (const Standard_Integer IC) const;
135
136 //! Erases the chamfer parameters on the contour of
137 //! index IC in the internal data structure of this algorithm.
138 //! Use the SetDists function to reset this data.
139 //! Warning
140 //! Nothing is done if IC is outside the bounds of the table of contours.
79104795 141 Standard_EXPORT void ResetContour (const Standard_Integer IC) Standard_OVERRIDE;
42cf5bc1 142
143 //! Returns the number of contours generated using the
144 //! Add function in the internal data structure of this algorithm.
79104795 145 Standard_EXPORT Standard_Integer NbContours() const Standard_OVERRIDE;
42cf5bc1 146
147 //! Returns the index of the contour in the internal data
148 //! structure of this algorithm, which contains the edge E of the shape.
149 //! This function returns 0 if the edge E does not belong to any contour.
150 //! Warning
151 //! This index can change if a contour is removed from the
152 //! internal data structure of this algorithm using the function Remove.
79104795 153 Standard_EXPORT Standard_Integer Contour (const TopoDS_Edge& E) const Standard_OVERRIDE;
42cf5bc1 154
155 //! Returns the number of edges in the contour of index I in
156 //! the internal data structure of this algorithm.
157 //! Warning
158 //! Returns 0 if I is outside the bounds of the table of contours.
79104795 159 Standard_EXPORT Standard_Integer NbEdges (const Standard_Integer I) const Standard_OVERRIDE;
42cf5bc1 160
161 //! Returns the edge of index J in the contour of index I in
162 //! the internal data structure of this algorithm.
163 //! Warning
164 //! Returns a null shape if:
165 //! - I is outside the bounds of the table of contours, or
166 //! - J is outside the bounds of the table of edges of the contour of index I.
79104795 167 Standard_EXPORT const TopoDS_Edge& Edge (const Standard_Integer I, const Standard_Integer J) const Standard_OVERRIDE;
42cf5bc1 168
169 //! Removes the contour in the internal data structure of
170 //! this algorithm which contains the edge E of the shape.
171 //! Warning
172 //! Nothing is done if the edge E does not belong to the
173 //! contour in the internal data structure of this algorithm.
79104795 174 Standard_EXPORT void Remove (const TopoDS_Edge& E) Standard_OVERRIDE;
42cf5bc1 175
176 //! Returns the length of the contour of index IC in the
177 //! internal data structure of this algorithm.
178 //! Warning
179 //! Returns -1. if IC is outside the bounds of the table of contours.
79104795 180 Standard_EXPORT Standard_Real Length (const Standard_Integer IC) const Standard_OVERRIDE;
42cf5bc1 181
182 //! Returns the first vertex of the contour of index IC
183 //! in the internal data structure of this algorithm.
184 //! Warning
185 //! Returns a null shape if IC is outside the bounds of the table of contours.
79104795 186 Standard_EXPORT TopoDS_Vertex FirstVertex (const Standard_Integer IC) const Standard_OVERRIDE;
42cf5bc1 187
188 //! Returns the last vertex of the contour of index IC
189 //! in the internal data structure of this algorithm.
190 //! Warning
191 //! Returns a null shape if IC is outside the bounds of the table of contours.
79104795 192 Standard_EXPORT TopoDS_Vertex LastVertex (const Standard_Integer IC) const Standard_OVERRIDE;
42cf5bc1 193
194 //! Returns the curvilinear abscissa of the vertex V on the
195 //! contour of index IC in the internal data structure of this algorithm.
196 //! Warning
197 //! Returns -1. if:
198 //! - IC is outside the bounds of the table of contours, or
199 //! - V is not on the contour of index IC.
79104795 200 Standard_EXPORT Standard_Real Abscissa (const Standard_Integer IC, const TopoDS_Vertex& V) const Standard_OVERRIDE;
42cf5bc1 201
202 //! Returns the relative curvilinear abscissa (i.e. between 0
203 //! and 1) of the vertex V on the contour of index IC in the
204 //! internal data structure of this algorithm.
205 //! Warning
206 //! Returns -1. if:
207 //! - IC is outside the bounds of the table of contours, or
208 //! - V is not on the contour of index IC.
79104795 209 Standard_EXPORT Standard_Real RelativeAbscissa (const Standard_Integer IC, const TopoDS_Vertex& V) const Standard_OVERRIDE;
42cf5bc1 210
211 //! eturns true if the contour of index IC in the internal
212 //! data structure of this algorithm is closed and tangential at the point of closure.
213 //! Warning
214 //! Returns false if IC is outside the bounds of the table of contours.
79104795 215 Standard_EXPORT Standard_Boolean ClosedAndTangent (const Standard_Integer IC) const Standard_OVERRIDE;
42cf5bc1 216
217 //! Returns true if the contour of index IC in the internal
218 //! data structure of this algorithm is closed.
219 //! Warning
220 //! Returns false if IC is outside the bounds of the table of contours.
79104795 221 Standard_EXPORT Standard_Boolean Closed (const Standard_Integer IC) const Standard_OVERRIDE;
42cf5bc1 222
223 //! Builds the chamfers on all the contours in the internal
224 //! data structure of this algorithm and constructs the resulting shape.
225 //! Use the function IsDone to verify that the chamfered
226 //! shape is built. Use the function Shape to retrieve the chamfered shape.
227 //! Warning
228 //! The construction of chamfers implements highly complex
229 //! construction algorithms. Consequently, there may be
230 //! instances where the algorithm fails, for example if the
231 //! data defining the parameters of the chamfer is not
232 //! compatible with the geometry of the initial shape. There
233 //! is no initial analysis of errors and these only become
234 //! evident at the construction stage.
235 //! Additionally, in the current software release, the following
236 //! cases are not handled:
237 //! - the end point of the contour is the point of
238 //! intersection of 4 or more edges of the shape, or
239 //! - the intersection of the chamfer with a face which
240 //! limits the contour is not fully contained in this face.
241 Standard_EXPORT virtual void Build() Standard_OVERRIDE;
242
243 //! Reinitializes this algorithm, thus canceling the effects of the Build function.
244 //! This function allows modifications to be made to the
245 //! contours and chamfer parameters in order to rebuild the shape.
79104795 246 Standard_EXPORT void Reset() Standard_OVERRIDE;
42cf5bc1 247
248 //! Returns the internal filleting algorithm.
249 Standard_EXPORT Handle(TopOpeBRepBuild_HBuilder) Builder() const;
250
251 //! Returns the list of shapes generated from the
252 //! shape <EorV>.
253 Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& EorV) Standard_OVERRIDE;
254
255 //! Returns the list of shapes modified from the shape
256 //! <F>.
257 Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& F) Standard_OVERRIDE;
258
259 Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& F) Standard_OVERRIDE;
260
79104795 261 Standard_EXPORT void Simulate (const Standard_Integer IC) Standard_OVERRIDE;
42cf5bc1 262
79104795 263 Standard_EXPORT Standard_Integer NbSurf (const Standard_Integer IC) const Standard_OVERRIDE;
42cf5bc1 264
79104795 265 Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect (const Standard_Integer IC, const Standard_Integer IS) const Standard_OVERRIDE;
42cf5bc1 266
267
268
269
270protected:
271
272
273
274
275
276private:
277
278
279
280 ChFi3d_ChBuilder myBuilder;
281 TopTools_MapOfShape myMap;
282
283
284};
285
286
287
288
289
290
291
292#endif // _BRepFilletAPI_MakeChamfer_HeaderFile