0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / Convert / Convert_ElementarySurfaceToBSplineSurface.hxx
1 // Created on: 1991-10-10
2 // Created by: Jean Claude VAUTHIER
3 // Copyright (c) 1991-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 _Convert_ElementarySurfaceToBSplineSurface_HeaderFile
18 #define _Convert_ElementarySurfaceToBSplineSurface_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <TColgp_Array2OfPnt.hxx>
25 #include <TColStd_Array2OfReal.hxx>
26 #include <TColStd_Array1OfReal.hxx>
27 #include <TColStd_Array1OfInteger.hxx>
28 #include <Standard_Integer.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <Standard_Real.hxx>
31 class Standard_OutOfRange;
32 class gp_Pnt;
33
34
35 //! Root class for algorithms which convert an elementary
36 //! surface (cylinder, cone, sphere or torus) into a BSpline
37 //! surface (CylinderToBSplineSurface, ConeToBSplineSurface,
38 //! SphereToBSplineSurface, TorusToBSplineSurface).
39 //! These algorithms all work on elementary surfaces from
40 //! the gp package and compute all the data needed to
41 //! construct a BSpline surface equivalent to the cylinder,
42 //! cone, sphere or torus. This data consists of the following:
43 //! -   degrees in the u and v parametric directions,
44 //! -   periodic characteristics in the u and v parametric directions,
45 //! -   a poles table with associated weights,
46 //! -   a knots table (for the u and v parametric directions)
47 //! with associated multiplicities.
48 //! The abstract class
49 //! ElementarySurfaceToBSplineSurface provides a
50 //! framework for storing and consulting this computed data.
51 //! This data may then be used to construct a
52 //! Geom_BSplineSurface surface, for example.
53 //! All those classes define algorithmes to convert an
54 //! ElementarySurface into a B-spline surface.
55 //! This abstract class implements the methods to get
56 //! the geometric representation of the B-spline surface.
57 //! The B-spline representation is computed at the creation
58 //! time in the sub classes.
59 //! The B-spline surface is defined with its degree in the
60 //! parametric U and V directions, its control points (Poles),
61 //! its weights, its knots and their multiplicity.
62 //! KeyWords :
63 //! Convert, ElementarySurface, BSplineSurface.
64 class Convert_ElementarySurfaceToBSplineSurface 
65 {
66 public:
67
68   DEFINE_STANDARD_ALLOC
69
70   
71   Standard_EXPORT Standard_Integer UDegree() const;
72   
73   //! Returns the degree for the u or v parametric direction of
74   //! the BSpline surface whose data is computed in this framework.
75   Standard_EXPORT Standard_Integer VDegree() const;
76   
77   Standard_EXPORT Standard_Integer NbUPoles() const;
78   
79   //! Returns the number of poles for the u or v parametric
80   //! direction of the BSpline surface whose data is computed in this framework.
81   Standard_EXPORT Standard_Integer NbVPoles() const;
82   
83   Standard_EXPORT Standard_Integer NbUKnots() const;
84   
85   //! Returns the number of knots for the u or v parametric
86   //! direction of the BSpline surface whose data is computed in this framework .
87   Standard_EXPORT Standard_Integer NbVKnots() const;
88   
89   Standard_EXPORT Standard_Boolean IsUPeriodic() const;
90   
91   //! Returns true if the BSpline surface whose data is computed
92   //! in this framework is periodic in the u or v parametric direction.
93   Standard_EXPORT Standard_Boolean IsVPeriodic() const;
94   
95   //! Returns the pole of index (UIndex,VIndex) to the poles
96   //! table of the BSpline surface whose data is computed in this framework.
97   //! Exceptions
98   //! Standard_OutOfRange if, for the BSpline surface whose
99   //! data is computed in this framework:
100   //! -   UIndex is outside the bounds of the poles table in the u
101   //! parametric direction, or
102   //! -   VIndex is outside the bounds of the poles table in the v
103   //! parametric direction.
104   Standard_EXPORT gp_Pnt Pole (const Standard_Integer UIndex, const Standard_Integer VIndex) const;
105   
106   //! Returns the weight of the pole of index (UIndex,VIndex) to
107   //! the poles table of the BSpline surface whose data is computed in this framework.
108   //! Exceptions
109   //! Standard_OutOfRange if, for the BSpline surface whose
110   //! data is computed in this framework:
111   //! -   UIndex is outside the bounds of the poles table in the u
112   //! parametric direction, or
113   //! -   VIndex is outside the bounds of the poles table in the v
114   //! parametric direction.
115   Standard_EXPORT Standard_Real Weight (const Standard_Integer UIndex, const Standard_Integer VIndex) const;
116   
117   //! Returns the U-knot of range UIndex.
118   //! Raised if UIndex < 1 or UIndex > NbUKnots.
119   Standard_EXPORT Standard_Real UKnot (const Standard_Integer UIndex) const;
120   
121   //! Returns the V-knot of range VIndex.
122   //! Raised if VIndex < 1 or VIndex > NbVKnots.
123   Standard_EXPORT Standard_Real VKnot (const Standard_Integer UIndex) const;
124   
125   //! Returns the multiplicity of the U-knot of range UIndex.
126   //! Raised if UIndex < 1 or UIndex > NbUKnots.
127   Standard_EXPORT Standard_Integer UMultiplicity (const Standard_Integer UIndex) const;
128   
129   //! Returns the multiplicity of the V-knot of range VIndex.
130   //! Raised if VIndex < 1 or VIndex > NbVKnots.
131   Standard_EXPORT Standard_Integer VMultiplicity (const Standard_Integer VIndex) const;
132
133
134
135
136 protected:
137
138   
139   Standard_EXPORT Convert_ElementarySurfaceToBSplineSurface(const Standard_Integer NumberOfUPoles, const Standard_Integer NumberOfVPoles, const Standard_Integer NumberOfUKnots, const Standard_Integer NumberOfVKnots, const Standard_Integer UDegree, const Standard_Integer VDegree);
140
141
142   TColgp_Array2OfPnt poles;
143   TColStd_Array2OfReal weights;
144   TColStd_Array1OfReal uknots;
145   TColStd_Array1OfInteger umults;
146   TColStd_Array1OfReal vknots;
147   TColStd_Array1OfInteger vmults;
148   Standard_Integer udegree;
149   Standard_Integer vdegree;
150   Standard_Integer nbUPoles;
151   Standard_Integer nbVPoles;
152   Standard_Integer nbUKnots;
153   Standard_Integer nbVKnots;
154   Standard_Boolean isuperiodic;
155   Standard_Boolean isvperiodic;
156
157
158 private:
159
160
161
162
163
164 };
165
166
167
168
169
170
171
172 #endif // _Convert_ElementarySurfaceToBSplineSurface_HeaderFile