b311480e |
1 | // Created on: 1992-04-06 |
2 | // Created by: Remi LEQUETTE |
3 | // Copyright (c) 1992-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | #ifndef Draw_Viewer_HeaderFile |
24 | #define Draw_Viewer_HeaderFile |
25 | |
26 | #include <gp_Pnt.hxx> |
27 | #include <gp_Vec.hxx> |
28 | #include <gp_Dir.hxx> |
29 | #include <gp_Pnt2d.hxx> |
30 | #include <gp_Vec2d.hxx> |
31 | #include <gp_Dir2d.hxx> |
32 | #include <gp_Trsf.hxx> |
33 | #include <gp_Ax1.hxx> |
34 | #include <Draw_Drawable3D.hxx> |
35 | #include <Draw_SequenceOfDrawable3D.hxx> |
36 | #include <Draw_Color.hxx> |
37 | |
38 | #ifdef WNT |
39 | #include <windows.h> |
40 | #if !defined(__Draw_API) && !defined(HAVE_NO_DLL) |
41 | # ifdef __Draw_DLL |
42 | # define __Draw_API __declspec( dllexport ) |
43 | # else |
44 | # define __Draw_API /*__declspec( dllimport )*/ |
45 | # endif |
46 | #endif |
47 | #else |
48 | # define __Draw_API |
49 | #endif |
50 | const Standard_Integer MAXVIEW = 30; |
51 | |
52 | class Draw_View; |
53 | |
54 | class Draw_Viewer { |
55 | |
56 | public : |
57 | __Draw_API Draw_Viewer (); |
58 | __Draw_API Standard_Boolean DefineColor (const Standard_Integer i, |
59 | const char* colname); |
60 | __Draw_API void MakeView (const Standard_Integer id, |
61 | const char* typ, |
62 | const Standard_Integer X, const Standard_Integer Y, |
63 | const Standard_Integer W, const Standard_Integer H); |
64 | // build a view on a given window |
65 | #ifdef WNT |
66 | __Draw_API void MakeView (const Standard_Integer id, |
67 | const char* typ, |
68 | const Standard_Integer X, const Standard_Integer Y, |
69 | const Standard_Integer W, const Standard_Integer H, |
70 | HWND win, |
71 | const Standard_Boolean useBuffer = Standard_False); |
72 | #endif |
73 | __Draw_API void MakeView (const Standard_Integer id, |
74 | const char* typ, |
75 | const char* window); |
76 | __Draw_API void SetTitle (const Standard_Integer id, |
77 | const char* name); |
78 | __Draw_API void ResetView (const Standard_Integer id); |
79 | __Draw_API void SetZoom (const Standard_Integer id, |
80 | const Standard_Real z); |
81 | __Draw_API void RotateView (const Standard_Integer id, |
82 | const gp_Dir2d&, |
83 | const Standard_Real); |
84 | __Draw_API void RotateView (const Standard_Integer id, |
85 | const gp_Pnt&, |
86 | const gp_Dir&, |
87 | const Standard_Real); |
88 | __Draw_API void SetFocal (const Standard_Integer id, |
89 | const Standard_Real FocalDist); |
90 | __Draw_API char* GetType (const Standard_Integer id) const; |
91 | __Draw_API Standard_Real Zoom (const Standard_Integer id) const; |
92 | __Draw_API Standard_Real Focal (const Standard_Integer id) const; |
93 | __Draw_API void SetTrsf (const Standard_Integer id, |
94 | gp_Trsf& T); |
95 | __Draw_API void GetTrsf (const Standard_Integer id, |
96 | gp_Trsf& T) const; |
97 | __Draw_API void GetPosSize (const Standard_Integer id, |
98 | Standard_Integer& X, Standard_Integer& Y, |
99 | Standard_Integer& W, Standard_Integer& H); |
100 | __Draw_API Standard_Boolean Is3D (const Standard_Integer id) const; |
101 | __Draw_API void GetFrame (const Standard_Integer id, |
102 | Standard_Integer& xmin, Standard_Integer& ymin, |
103 | Standard_Integer& xmax, Standard_Integer& ymax); |
104 | __Draw_API void FitView (const Standard_Integer id, const Standard_Integer frame); |
105 | __Draw_API void PanView (const Standard_Integer id, |
106 | const Standard_Integer DX, const Standard_Integer DY); |
107 | __Draw_API void SetPan (const Standard_Integer id, |
108 | const Standard_Integer DX, const Standard_Integer DY); |
109 | __Draw_API void GetPan (const Standard_Integer id, |
110 | Standard_Integer& DX, Standard_Integer& DY); |
111 | __Draw_API Standard_Boolean HasView (const Standard_Integer id) const; |
112 | __Draw_API void DisplayView (const Standard_Integer id) const; |
113 | __Draw_API void HideView (const Standard_Integer id) const; |
114 | __Draw_API void ClearView (const Standard_Integer id) const; |
115 | __Draw_API void RemoveView (const Standard_Integer id) ; |
116 | __Draw_API void RepaintView (const Standard_Integer id) const; |
117 | #ifdef WNT |
118 | __Draw_API void ResizeView (const Standard_Integer id) const; |
119 | __Draw_API void UpdateView (const Standard_Integer id, const Standard_Boolean forced = Standard_False) const; |
120 | #endif |
121 | __Draw_API void ConfigView (const Standard_Integer id) const; |
122 | __Draw_API void PostScriptView (const Standard_Integer id, |
123 | const Standard_Integer VXmin, |
124 | const Standard_Integer VYmin, |
125 | const Standard_Integer VXmax, |
126 | const Standard_Integer VYmax, |
127 | const Standard_Integer PXmin, |
128 | const Standard_Integer PYmin, |
129 | const Standard_Integer PXmax, |
130 | const Standard_Integer PYmax, |
131 | ostream& sortie) const; |
132 | __Draw_API void PostColor(const Standard_Integer icol, |
133 | const Standard_Integer width, |
134 | const Standard_Real gray); |
135 | __Draw_API Standard_Boolean SaveView(const Standard_Integer id, const char* filename); |
136 | __Draw_API void RepaintAll () const; |
137 | __Draw_API void Repaint2D () const; |
138 | __Draw_API void Repaint3D () const; |
139 | __Draw_API unsigned long GetWindow (const Standard_Integer id) const; |
140 | __Draw_API void DeleteView (const Standard_Integer id); |
141 | __Draw_API void Clear (); |
142 | __Draw_API void Clear2D (); |
143 | __Draw_API void Clear3D (); |
144 | __Draw_API void Flush (); |
145 | |
146 | __Draw_API void DrawOnView (const Standard_Integer id, |
147 | const Handle(Draw_Drawable3D)& D) const; |
148 | __Draw_API void HighlightOnView (const Standard_Integer id, |
149 | const Handle(Draw_Drawable3D)& D, |
150 | const Draw_ColorKind C = Draw_blanc) const; |
151 | __Draw_API void AddDrawable (const Handle(Draw_Drawable3D)& D); |
152 | __Draw_API void RemoveDrawable (const Handle(Draw_Drawable3D)& D); |
153 | __Draw_API Draw_Display MakeDisplay (const Standard_Integer id) const; |
154 | |
155 | __Draw_API void Select (Standard_Integer& id, // View, -1 if none |
156 | Standard_Integer& X, // Pick coordinates |
157 | Standard_Integer& Y, |
158 | Standard_Integer& Button, // Button pressed, 0 if none |
159 | Standard_Boolean waitclick = Standard_True |
160 | ); |
161 | |
162 | __Draw_API Standard_Integer Pick(const Standard_Integer id, // returns the index (or 0) |
163 | const Standard_Integer X, |
164 | const Standard_Integer Y, |
165 | const Standard_Integer Prec, |
166 | Handle(Draw_Drawable3D)& D, |
167 | const Standard_Integer First = 0) const; // search after this drawable |
168 | |
169 | __Draw_API void LastPick(gp_Pnt& P1, gp_Pnt& P2, Standard_Real& Param); |
170 | // returns the extremities and parameter of the last picked segment |
171 | |
172 | __Draw_API ~Draw_Viewer(); |
173 | __Draw_API Draw_Viewer& operator<<(const Handle(Draw_Drawable3D)&); |
174 | __Draw_API const Draw_SequenceOfDrawable3D& GetDrawables(); |
175 | |
176 | private : |
177 | |
178 | Draw_View* myViews[MAXVIEW]; |
179 | Draw_SequenceOfDrawable3D myDrawables; |
180 | }; |
181 | |
182 | |
183 | #endif |