0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / ShapeCustom / ShapeCustom_BSplineRestriction.hxx
CommitLineData
42cf5bc1 1// Created on: 1999-06-18
2// Created by: Galina Koulikova
3// Copyright (c) 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 _ShapeCustom_BSplineRestriction_HeaderFile
18#define _ShapeCustom_BSplineRestriction_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
23#include <GeomAbs_Shape.hxx>
24#include <Standard_Integer.hxx>
25#include <Standard_Real.hxx>
26#include <Standard_Boolean.hxx>
27#include <ShapeCustom_Modification.hxx>
28class ShapeCustom_RestrictionParameters;
29class TopoDS_Face;
30class Geom_Surface;
31class TopLoc_Location;
32class TopoDS_Edge;
33class Geom_Curve;
34class Geom2d_Curve;
35class TopoDS_Vertex;
36class gp_Pnt;
37
38
39class ShapeCustom_BSplineRestriction;
40DEFINE_STANDARD_HANDLE(ShapeCustom_BSplineRestriction, ShapeCustom_Modification)
41
42//! this tool intended for aproximation surfaces, curves and pcurves with
43//! specified degree , max number of segments, tolerance 2d, tolerance 3d. Specified
44//! continuity can be reduced if approximation with specified continuity was not done.
45class ShapeCustom_BSplineRestriction : public ShapeCustom_Modification
46{
47
48public:
49
50
51 //! Empty constructor.
52 Standard_EXPORT ShapeCustom_BSplineRestriction();
53
54 //! Initializes with specified parameters of aproximation.
55 Standard_EXPORT ShapeCustom_BSplineRestriction(const Standard_Boolean anApproxSurfaceFlag, const Standard_Boolean anApproxCurve3dFlag, const Standard_Boolean anApproxCurve2dFlag, const Standard_Real aTol3d, const Standard_Real aTol2d, const GeomAbs_Shape aContinuity3d, const GeomAbs_Shape aContinuity2d, const Standard_Integer aMaxDegree, const Standard_Integer aNbMaxSeg, const Standard_Boolean Degree, const Standard_Boolean Rational);
56
57 //! Initializes with specified parameters of aproximation.
58 Standard_EXPORT ShapeCustom_BSplineRestriction(const Standard_Boolean anApproxSurfaceFlag, const Standard_Boolean anApproxCurve3dFlag, const Standard_Boolean anApproxCurve2dFlag, const Standard_Real aTol3d, const Standard_Real aTol2d, const GeomAbs_Shape aContinuity3d, const GeomAbs_Shape aContinuity2d, const Standard_Integer aMaxDegree, const Standard_Integer aNbMaxSeg, const Standard_Boolean Degree, const Standard_Boolean Rational, const Handle(ShapeCustom_RestrictionParameters)& aModes);
59
60 //! Returns Standard_True if the face <F> has been
61 //! modified. In this case, <S> is the new geometric
62 //! support of the face, <L> the new location,<Tol>
63 //! the new tolerance.<RevWires> has to be set to
64 //! Standard_True when the modification reverses the
65 //! normal of the surface.(the wires have to be
66 //! reversed). <RevFace> has to be set to
67 //! Standard_True if the orientation of the modified
68 //! face changes in the shells which contain it.
69 //!
70 //! Otherwise, returns Standard_False, and <S>, <L>,
71 //! <Tol> , <RevWires> ,<RevFace> are not significant.
72 Standard_EXPORT Standard_Boolean NewSurface (const TopoDS_Face& F, Handle(Geom_Surface)& S, TopLoc_Location& L, Standard_Real& Tol, Standard_Boolean& RevWires, Standard_Boolean& RevFace);
73
74 //! Returns Standard_True if curve from the edge <E> has been
75 //! modified. In this case, <C> is the new geometric
76 //! support of the edge, <L> the new location, <Tol>
77 //! the new tolerance.
78 //! Otherwise, returns Standard_True if Surface is modified or
79 //! one of pcurves of edge is modified. In this case C is copy of
80 //! geometric support of the edge.
81 //! In other cases returns Standard_False, and <C>, <L>, <Tol> are not
82 //! significant.
83 Standard_EXPORT Standard_Boolean NewCurve (const TopoDS_Edge& E, Handle(Geom_Curve)& C, TopLoc_Location& L, Standard_Real& Tol);
84
85 //! Returns Standard_True if the edge <E> has been modified.
86 //! In this case,if curve on the surface is modified, <C>
87 //! is the new geometric support of the edge, <L> the
88 //! new location, <Tol> the new tolerance. If curve on the surface
89 //! is not modified C is copy curve on surface from the edge <E>.
90 //!
91 //! Otherwise, returns Standard_False, and <C>, <L>,
92 //! <Tol> are not significant.
93 //!
94 //! <NewE> is the new edge created from <E>. <NewF>
95 //! is the new face created from <F>. They may be usefull.
96 Standard_EXPORT Standard_Boolean NewCurve2d (const TopoDS_Edge& E, const TopoDS_Face& F, const TopoDS_Edge& NewE, const TopoDS_Face& NewF, Handle(Geom2d_Curve)& C, Standard_Real& Tol);
97
98 //! Returns Standard_True if the surface has been modified.
99 //! if flag IsOf equals Standard_True Offset surfaces are aproximated to Offset
100 //! if Standard_False to BSpline
101 Standard_EXPORT Standard_Boolean ConvertSurface (const Handle(Geom_Surface)& aSurface, Handle(Geom_Surface)& S, const Standard_Real UF, const Standard_Real UL, const Standard_Real VF, const Standard_Real VL, const Standard_Boolean IsOf = Standard_True);
102
103 //! Returns Standard_True if the curve has been modified.
104 //! if flag IsOf equals Standard_True Offset curves are aproximated to Offset
105 //! if Standard_False to BSpline
106 Standard_EXPORT Standard_Boolean ConvertCurve (Handle(Geom_Curve)& aCurve, Handle(Geom_Curve)& C, const Standard_Boolean IsConvert, const Standard_Real First, const Standard_Real Last, Standard_Real& TolCur, const Standard_Boolean IsOf = Standard_True);
107
108 //! Returns Standard_True if the pcurve has been modified.
109 //! if flag IsOf equals Standard_True Offset pcurves are aproximated to Offset
110 //! if Standard_False to BSpline
111 Standard_EXPORT Standard_Boolean ConvertCurve2d (Handle(Geom2d_Curve)& aCurve, Handle(Geom2d_Curve)& C, const Standard_Boolean IsConvert, const Standard_Real First, const Standard_Real Last, Standard_Real& TolCur, const Standard_Boolean IsOf = Standard_True);
112
113 //! Sets tolerance of aproximation for curve3d and surface
114 void SetTol3d (const Standard_Real Tol3d);
115
116 //! Sets tolerance of aproximation for curve2d
117 void SetTol2d (const Standard_Real Tol2d);
118
119 //! Returns (modifiable) the flag which defines whether the
120 //! surface is aproximated.
121 Standard_Boolean& ModifyApproxSurfaceFlag();
122
123 //! Returns (modifiable) the flag which defines whether the
124 //! curve3d is aproximated.
125 Standard_Boolean& ModifyApproxCurve3dFlag();
126
127 //! Returns (modifiable) the flag which defines whether the curve2d is aproximated.
128 Standard_Boolean& ModifyApproxCurve2dFlag();
129
130 //! Sets continuity3d for aproximation curve3d and surface.
131 void SetContinuity3d (const GeomAbs_Shape Continuity3d);
132
133 //! Sets continuity3d for aproximation curve2d.
134 void SetContinuity2d (const GeomAbs_Shape Continuity2d);
135
136 //! Sets max degree for aproximation.
137 void SetMaxDegree (const Standard_Integer MaxDegree);
138
139 //! Sets max number of segments for aproximation.
140 void SetMaxNbSegments (const Standard_Integer MaxNbSegments);
141
142 //! Sets priority for aproximation curves and surface.
143 //! If Degree is True approximation is made with degree less
144 //! then specified MaxDegree at the expense of number of spanes.
145 //! If Degree is False approximation is made with number of
146 //! spans less then specified MaxNbSegment at the expense of
147 //! specified MaxDegree.
148 void SetPriority (const Standard_Boolean Degree);
149
150 //! Sets flag for define if rational BSpline or Bezier is
151 //! converted to polynomial. If Rational is True approximation
152 //! for rational BSpline and Bezier is made to polynomial even
153 //! if degree is less then MaxDegree and number of spans is less
154 //! then specified MaxNbSegment.
155 void SetConvRational (const Standard_Boolean Rational);
156
157 //! Returns the container of modes which defines
158 //! what geometry should be converted to BSplines.
159 Handle(ShapeCustom_RestrictionParameters) GetRestrictionParameters() const;
160
161 //! Sets the container of modes which defines
162 //! what geometry should be converted to BSplines.
163 void SetRestrictionParameters (const Handle(ShapeCustom_RestrictionParameters)& aModes);
164
165 //! Returns error for aproximation curve3d.
166 Standard_Real Curve3dError() const;
167
168 //! Returns error for aproximation curve2d.
169 Standard_Real Curve2dError() const;
170
171 //! Returns error for aproximation surface.
172 Standard_Real SurfaceError() const;
173
174 Standard_EXPORT Standard_Boolean NewPoint (const TopoDS_Vertex& V, gp_Pnt& P, Standard_Real& Tol);
175
176 Standard_EXPORT Standard_Boolean NewParameter (const TopoDS_Vertex& V, const TopoDS_Edge& E, Standard_Real& P, Standard_Real& Tol);
177
178 Standard_EXPORT GeomAbs_Shape Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, const TopoDS_Edge& NewE, const TopoDS_Face& NewF1, const TopoDS_Face& NewF2);
179
180 //! Returns error for aproximation surface, curve3d and curve2d.
181 Standard_EXPORT Standard_Real MaxErrors (Standard_Real& aCurve3dErr, Standard_Real& aCurve2dErr) const;
182
183 //! Returns number for aproximation surface, curve3d and curve2d.
184 Standard_EXPORT Standard_Integer NbOfSpan() const;
185
186
187
188
189 DEFINE_STANDARD_RTTI(ShapeCustom_BSplineRestriction,ShapeCustom_Modification)
190
191protected:
192
193
194
195
196private:
197
198
199 GeomAbs_Shape myContinuity3d;
200 GeomAbs_Shape myContinuity2d;
201 Standard_Integer myMaxDegree;
202 Standard_Integer myNbMaxSeg;
203 Standard_Real myTol3d;
204 Standard_Real myTol2d;
205 Standard_Real mySurfaceError;
206 Standard_Real myCurve3dError;
207 Standard_Real myCurve2dError;
208 Standard_Integer myNbOfSpan;
209 Standard_Boolean myApproxSurfaceFlag;
210 Standard_Boolean myApproxCurve3dFlag;
211 Standard_Boolean myApproxCurve2dFlag;
212 Standard_Boolean myDeg;
213 Standard_Boolean myConvert;
214 Standard_Boolean myRational;
215 Handle(ShapeCustom_RestrictionParameters) myParameters;
216
217
218};
219
220
221#include <ShapeCustom_BSplineRestriction.lxx>
222
223
224
225
226
227#endif // _ShapeCustom_BSplineRestriction_HeaderFile