0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / HLRBRep / HLRBRep_Surface.hxx
1 // Created on: 1993-04-14
2 // Created by: Modelistation
3 // Copyright (c) 1993-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 _HLRBRep_Surface_HeaderFile
18 #define _HLRBRep_Surface_HeaderFile
19
20 #include <HLRBRep_Curve.hxx>
21
22 #include <Standard.hxx>
23 #include <Standard_DefineAlloc.hxx>
24 #include <Standard_Handle.hxx>
25
26 #include <BRepAdaptor_Surface.hxx>
27 #include <GeomAbs_SurfaceType.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <Standard_Real.hxx>
30 #include <Standard_Integer.hxx>
31 #include <TColgp_Array2OfPnt.hxx>
32 #include <GeomAbs_Shape.hxx>
33 #include <gp_Vec.hxx>
34 #include <gp_Cylinder.hxx>
35 #include <gp_Cone.hxx>
36 #include <gp_Sphere.hxx>
37 #include <gp_Torus.hxx>
38 #include <gp_Ax1.hxx>
39 class Standard_OutOfRange;
40 class Standard_NoSuchObject;
41 class Standard_DomainError;
42 class BRepAdaptor_Surface;
43 class TopoDS_Face;
44 class gp_Pnt;
45 class gp_Vec;
46 class gp_Pln;
47
48
49
50 class HLRBRep_Surface 
51 {
52 public:
53
54   DEFINE_STANDARD_ALLOC
55
56   
57   //! Creates an undefined surface with no face loaded.
58   Standard_EXPORT HLRBRep_Surface();
59   
60   void Projector (const HLRAlgo_Projector* Proj)
61   {
62     myProj = Proj;
63   }
64   
65   //! Returns the 3D Surface.
66     BRepAdaptor_Surface& Surface();
67   
68   //! Sets the 3D Surface to be projected.
69   Standard_EXPORT void Surface (const TopoDS_Face& F);
70   
71   //! returns true if it is a side face
72   Standard_EXPORT Standard_Boolean IsSide (const Standard_Real tolf, const Standard_Real toler) const;
73   
74   Standard_EXPORT Standard_Boolean IsAbove (const Standard_Boolean back, const HLRBRep_Curve* A, const Standard_Real tolC) const;
75   
76     Standard_Real FirstUParameter() const;
77   
78     Standard_Real LastUParameter() const;
79   
80     Standard_Real FirstVParameter() const;
81   
82     Standard_Real LastVParameter() const;
83   
84     GeomAbs_Shape UContinuity() const;
85   
86     GeomAbs_Shape VContinuity() const;
87   
88   //! If necessary, breaks the surface in U intervals of
89   //! continuity    <S>.  And   returns  the  number  of
90   //! intervals.
91     Standard_Integer NbUIntervals (const GeomAbs_Shape S);
92   
93   //! If necessary, breaks the surface in V intervals of
94   //! continuity    <S>.  And   returns  the  number  of
95   //! intervals.
96     Standard_Integer NbVIntervals (const GeomAbs_Shape S);
97   
98     GeomAbs_Shape UIntervalContinuity() const;
99   
100     GeomAbs_Shape VIntervalContinuity() const;
101   
102     Standard_Boolean IsUClosed() const;
103   
104     Standard_Boolean IsVClosed() const;
105   
106     Standard_Boolean IsUPeriodic() const;
107   
108     Standard_Real UPeriod() const;
109   
110     Standard_Boolean IsVPeriodic() const;
111   
112     Standard_Real VPeriod() const;
113   
114   //! Computes the point of parameters U,V on the surface.
115   Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
116   
117   //! Computes the point of parameters U,V on the surface.
118     void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const;
119   
120   //! Computes the point  and the first derivatives on
121   //! the surface.
122   //! Raised   if  the continuity  of   the  current
123   //! intervals is not C1.
124     void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
125   
126   //! Computes   the point,  the  first  and  second
127   //! derivatives on the surface.
128   //! Raised  if   the   continuity   of the current
129   //! intervals is not C2.
130     void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const;
131   
132   //! Computes the point,  the first, second and third
133   //! derivatives on the surface.
134   //! Raised  if   the   continuity   of the current
135   //! intervals is not C3.
136     void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const;
137   
138   //! Computes  the  derivative of order   Nu  in the
139   //! direction U and Nv in the  direction  V  at the point P(U,
140   //! V).
141   //! Raised if the current U  interval is not not CNu
142   //! and the current V interval is not CNv.
143   //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
144     gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const;
145   
146   //! Returns the type of the surface : Plane, Cylinder,
147   //! Cone,      Sphere,        Torus,    BezierSurface,
148   //! BSplineSurface,               SurfaceOfRevolution,
149   //! SurfaceOfExtrusion, OtherSurface
150     GeomAbs_SurfaceType GetType() const;
151   
152   Standard_EXPORT gp_Pln Plane() const;
153   
154     gp_Cylinder Cylinder() const;
155   
156     gp_Cone Cone() const;
157   
158     gp_Sphere Sphere() const;
159   
160     gp_Torus Torus() const;
161   
162     Standard_Integer UDegree() const;
163   
164     Standard_Integer NbUPoles() const;
165   
166     Standard_Integer VDegree() const;
167   
168     Standard_Integer NbVPoles() const;
169   
170     Standard_Integer NbUKnots() const;
171   
172     Standard_Integer NbVKnots() const;
173   
174     gp_Ax1 Axis() const;
175
176
177
178
179 protected:
180
181
182
183
184
185 private:
186
187   
188   //! returns true if it is a side face
189   Standard_EXPORT Standard_Boolean SideRowsOfPoles (const Standard_Real tol, const Standard_Integer nbuPoles, const Standard_Integer nbvPoles, TColgp_Array2OfPnt& Pnt) const;
190
191
192   BRepAdaptor_Surface mySurf;
193   GeomAbs_SurfaceType myType;
194   const HLRAlgo_Projector* myProj;
195
196
197 };
198
199
200 #include <HLRBRep_Surface.lxx>
201
202
203
204
205
206 #endif // _HLRBRep_Surface_HeaderFile