42cf5bc1 |
1 | // Created on: 1991-06-24 |
2 | // Created by: Christophe MARION |
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 _DrawTrSurf_HeaderFile |
18 | #define _DrawTrSurf_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
42cf5bc1 |
24 | #include <Draw_Interpretor.hxx> |
5b111128 |
25 | #include <Geom_Geometry.hxx> |
26 | #include <Geom_Surface.hxx> |
27 | #include <Geom2d_Curve.hxx> |
28 | |
42cf5bc1 |
29 | class gp_Pnt; |
30 | class gp_Pnt2d; |
42cf5bc1 |
31 | class Poly_Triangulation; |
32 | class Poly_Polygon3D; |
33 | class Poly_Polygon2D; |
34 | class Geom_Curve; |
35 | class Geom_BezierCurve; |
36 | class Geom_BSplineCurve; |
37 | class Geom2d_BezierCurve; |
38 | class Geom2d_BSplineCurve; |
42cf5bc1 |
39 | class Geom_BezierSurface; |
40 | class Geom_BSplineSurface; |
41 | class DrawTrSurf_Drawable; |
42 | class DrawTrSurf_Point; |
43 | class DrawTrSurf_Curve; |
44 | class DrawTrSurf_BSplineCurve; |
45 | class DrawTrSurf_BezierCurve; |
46 | class DrawTrSurf_Curve2d; |
47 | class DrawTrSurf_BSplineCurve2d; |
48 | class DrawTrSurf_BezierCurve2d; |
49 | class DrawTrSurf_Triangulation2D; |
50 | class DrawTrSurf_Surface; |
51 | class DrawTrSurf_BSplineSurface; |
52 | class DrawTrSurf_BezierSurface; |
53 | class DrawTrSurf_Triangulation; |
54 | class DrawTrSurf_Polygon3D; |
55 | class DrawTrSurf_Polygon2D; |
56 | |
57 | |
58 | //! This package supports the display of parametric |
59 | //! curves and surfaces. |
60 | //! |
61 | //! The Drawable deferred classes is inherited from |
62 | //! the Drawable3D class from the package Draw, it |
63 | //! adds methods to draw 3D Curves and Curves on 3D |
64 | //! Surfaces. |
65 | //! |
66 | //! The classes Curve Curve2d and Surface are drawable |
67 | //! and can be used to draw a single curve from |
68 | //! packages Geom or Geom2d or a surface from Geom. |
69 | //! |
70 | //! The Triangulation and Polygon from the package |
71 | //! Poly are also supported. |
72 | class DrawTrSurf |
73 | { |
74 | public: |
75 | |
76 | DEFINE_STANDARD_ALLOC |
77 | |
78 | |
79 | //! Sets <G> in the variable <Name>. Overwrite the |
80 | //! variable if already set. |
81 | Standard_EXPORT static void Set (const Standard_CString Name, const gp_Pnt& G); |
82 | |
83 | //! Sets <G> in the variable <Name>. Overwrite the |
84 | //! variable if already set. |
85 | Standard_EXPORT static void Set (const Standard_CString Name, const gp_Pnt2d& G); |
86 | |
87 | //! Sets <G> in the variable <Name>. Overwrite the |
88 | //! variable if already set. |
89 | //! isSenseMarker indicates whether to render the |
90 | //! sense glyph (arrow) for curves or not |
91 | Standard_EXPORT static void Set (const Standard_CString Name, const Handle(Geom_Geometry)& G, const Standard_Boolean isSenseMarker = Standard_True); |
71c810df |
92 | template <class T> static void Set (const Standard_CString Name, const Handle(T)& Arg, typename opencascade::std::enable_if<opencascade::std::is_base_of<Geom_Geometry, T>::value>::type * = 0) { Set (Name, (const Handle(Geom_Geometry)&)Arg); } |
42cf5bc1 |
93 | |
94 | //! Sets <C> in the variable <Name>. Overwrite the |
95 | //! variable if already set. |
96 | //! isSenseMarker indicates whether to render the |
97 | //! sense glyph (arrow) for curves or not |
98 | Standard_EXPORT static void Set (const Standard_CString Name, const Handle(Geom2d_Curve)& C, const Standard_Boolean isSenseMarker = Standard_True); |
71c810df |
99 | template <class T> static void Set (const Standard_CString Name, const Handle(T)& Arg, typename opencascade::std::enable_if<opencascade::std::is_base_of<Geom2d_Curve, T>::value>::type * = 0) { Set (Name, (const Handle(Geom2d_Curve)&)Arg); } |
42cf5bc1 |
100 | |
101 | //! Sets <T> in the variable <Name>. Overwrite the |
102 | //! variable if already set. |
103 | Standard_EXPORT static void Set (const Standard_CString Name, const Handle(Poly_Triangulation)& T); |
104 | |
105 | //! Sets <P> in the variable <Name>. Overwrite the |
106 | //! variable if already set. |
107 | Standard_EXPORT static void Set (const Standard_CString Name, const Handle(Poly_Polygon3D)& P); |
108 | |
109 | //! Sets <P> in the variable <Name>. Overwrite the |
110 | //! variable if already set. |
111 | Standard_EXPORT static void Set (const Standard_CString Name, const Handle(Poly_Polygon2D)& P); |
112 | |
113 | //! Get the variable <S>. Returns a null handle if |
114 | //! none, and print a warning message. |
115 | Standard_EXPORT static Handle(Geom_Geometry) Get (Standard_CString& Name); |
116 | |
117 | //! Gets the variable. Returns False if none and print |
118 | //! a warning message. |
119 | Standard_EXPORT static Standard_Boolean GetPoint (Standard_CString& Name, gp_Pnt& P); |
120 | |
121 | //! Gets the variable. Returns False if none and print |
122 | //! a warning message. |
123 | Standard_EXPORT static Standard_Boolean GetPoint2d (Standard_CString& Name, gp_Pnt2d& P); |
124 | |
125 | //! Get the variable <S>. Returns a null handle if |
126 | //! none, and print a warning message. |
127 | Standard_EXPORT static Handle(Geom_Curve) GetCurve (Standard_CString& Name); |
128 | |
129 | //! Get the variable <S>. Returns a null handle if |
130 | //! none, and print a warning message. |
131 | Standard_EXPORT static Handle(Geom_BezierCurve) GetBezierCurve (Standard_CString& Name); |
132 | |
133 | //! Get the variable <S>. Returns a null handle if |
134 | //! none, and print a warning message. |
135 | Standard_EXPORT static Handle(Geom_BSplineCurve) GetBSplineCurve (Standard_CString& Name); |
136 | |
137 | //! Get the variable <S>. Returns a null handle if |
138 | //! none, and print a warning message. |
139 | Standard_EXPORT static Handle(Geom2d_Curve) GetCurve2d (Standard_CString& Name); |
140 | |
141 | //! Get the variable <S>. Returns a null handle if |
142 | //! none, and print a warning message. |
143 | Standard_EXPORT static Handle(Geom2d_BezierCurve) GetBezierCurve2d (Standard_CString& Name); |
144 | |
145 | //! Get the variable <S>. Returns a null handle if |
146 | //! none, and print a warning message. |
147 | Standard_EXPORT static Handle(Geom2d_BSplineCurve) GetBSplineCurve2d (Standard_CString& Name); |
148 | |
149 | //! Get the variable <S>. Returns a null handle if |
150 | //! none, and print a warning message. |
151 | Standard_EXPORT static Handle(Geom_Surface) GetSurface (Standard_CString& Name); |
152 | |
153 | //! Get the variable <S>. Returns a null handle if |
154 | //! none, and print a warning message. |
155 | Standard_EXPORT static Handle(Geom_BezierSurface) GetBezierSurface (Standard_CString& Name); |
156 | |
157 | //! Get the variable <S>. Returns a null handle if |
158 | //! none, and print a warning message. |
159 | Standard_EXPORT static Handle(Geom_BSplineSurface) GetBSplineSurface (Standard_CString& Name); |
160 | |
161 | //! Get the variable <S>. Returns a null handle if |
162 | //! none, and print a warning message. |
163 | Standard_EXPORT static Handle(Poly_Triangulation) GetTriangulation (Standard_CString& Name); |
164 | |
165 | //! Get the variable <S>. Returns a null handle if |
166 | //! none, and print a warning message. |
167 | Standard_EXPORT static Handle(Poly_Polygon3D) GetPolygon3D (Standard_CString& Name); |
168 | |
169 | //! Get the variable <S>. Returns a null handle if |
170 | //! none, and print a warning message. |
171 | Standard_EXPORT static Handle(Poly_Polygon2D) GetPolygon2D (Standard_CString& Name); |
172 | |
173 | //! defines display commands. |
174 | Standard_EXPORT static void BasicCommands (Draw_Interpretor& I); |
175 | |
176 | |
177 | |
178 | |
179 | protected: |
180 | |
181 | |
182 | |
183 | |
184 | |
185 | private: |
186 | |
187 | |
188 | |
189 | |
190 | friend class DrawTrSurf_Drawable; |
191 | friend class DrawTrSurf_Point; |
192 | friend class DrawTrSurf_Curve; |
193 | friend class DrawTrSurf_BSplineCurve; |
194 | friend class DrawTrSurf_BezierCurve; |
195 | friend class DrawTrSurf_Curve2d; |
196 | friend class DrawTrSurf_BSplineCurve2d; |
197 | friend class DrawTrSurf_BezierCurve2d; |
198 | friend class DrawTrSurf_Triangulation2D; |
199 | friend class DrawTrSurf_Surface; |
200 | friend class DrawTrSurf_BSplineSurface; |
201 | friend class DrawTrSurf_BezierSurface; |
202 | friend class DrawTrSurf_Triangulation; |
203 | friend class DrawTrSurf_Polygon3D; |
204 | friend class DrawTrSurf_Polygon2D; |
205 | |
206 | }; |
207 | |
208 | |
209 | |
210 | |
211 | |
212 | |
213 | |
214 | #endif // _DrawTrSurf_HeaderFile |