b311480e |
1 | // Created on: 1992-04-06 |
2 | // Created by: Remi LEQUETTE |
3 | // Copyright (c) 1992-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | #ifndef Draw_Viewer_HeaderFile |
18 | #define Draw_Viewer_HeaderFile |
19 | |
20 | #include <gp_Pnt.hxx> |
21 | #include <gp_Vec.hxx> |
22 | #include <gp_Dir.hxx> |
23 | #include <gp_Pnt2d.hxx> |
24 | #include <gp_Vec2d.hxx> |
25 | #include <gp_Dir2d.hxx> |
26 | #include <gp_Trsf.hxx> |
27 | #include <gp_Ax1.hxx> |
28 | #include <Draw_Drawable3D.hxx> |
29 | #include <Draw_SequenceOfDrawable3D.hxx> |
30 | #include <Draw_Color.hxx> |
31 | |
57c28b61 |
32 | #ifdef _WIN32 |
7fd59977 |
33 | #include <windows.h> |
7fd59977 |
34 | #endif |
68df8478 |
35 | |
7fd59977 |
36 | const Standard_Integer MAXVIEW = 30; |
37 | |
38 | class Draw_View; |
39 | |
40 | class Draw_Viewer { |
41 | |
42 | public : |
68df8478 |
43 | Standard_EXPORT Draw_Viewer (); |
44 | Standard_EXPORT Standard_Boolean DefineColor (const Standard_Integer i, |
7fd59977 |
45 | const char* colname); |
68df8478 |
46 | Standard_EXPORT void MakeView (const Standard_Integer id, |
7fd59977 |
47 | const char* typ, |
48 | const Standard_Integer X, const Standard_Integer Y, |
49 | const Standard_Integer W, const Standard_Integer H); |
50 | // build a view on a given window |
57c28b61 |
51 | #ifdef _WIN32 |
68df8478 |
52 | Standard_EXPORT void MakeView (const Standard_Integer id, |
7fd59977 |
53 | const char* typ, |
54 | const Standard_Integer X, const Standard_Integer Y, |
55 | const Standard_Integer W, const Standard_Integer H, |
56 | HWND win, |
57 | const Standard_Boolean useBuffer = Standard_False); |
58 | #endif |
68df8478 |
59 | Standard_EXPORT void MakeView (const Standard_Integer id, |
7fd59977 |
60 | const char* typ, |
61 | const char* window); |
68df8478 |
62 | Standard_EXPORT void SetTitle (const Standard_Integer id, |
7fd59977 |
63 | const char* name); |
68df8478 |
64 | Standard_EXPORT void ResetView (const Standard_Integer id); |
65 | Standard_EXPORT void SetZoom (const Standard_Integer id, |
7fd59977 |
66 | const Standard_Real z); |
68df8478 |
67 | Standard_EXPORT void RotateView (const Standard_Integer id, |
7fd59977 |
68 | const gp_Dir2d&, |
69 | const Standard_Real); |
68df8478 |
70 | Standard_EXPORT void RotateView (const Standard_Integer id, |
7fd59977 |
71 | const gp_Pnt&, |
72 | const gp_Dir&, |
73 | const Standard_Real); |
68df8478 |
74 | Standard_EXPORT void SetFocal (const Standard_Integer id, |
7fd59977 |
75 | const Standard_Real FocalDist); |
68df8478 |
76 | Standard_EXPORT char* GetType (const Standard_Integer id) const; |
77 | Standard_EXPORT Standard_Real Zoom (const Standard_Integer id) const; |
78 | Standard_EXPORT Standard_Real Focal (const Standard_Integer id) const; |
79 | Standard_EXPORT void SetTrsf (const Standard_Integer id, |
7fd59977 |
80 | gp_Trsf& T); |
68df8478 |
81 | Standard_EXPORT void GetTrsf (const Standard_Integer id, |
7fd59977 |
82 | gp_Trsf& T) const; |
68df8478 |
83 | Standard_EXPORT void GetPosSize (const Standard_Integer id, |
7fd59977 |
84 | Standard_Integer& X, Standard_Integer& Y, |
85 | Standard_Integer& W, Standard_Integer& H); |
68df8478 |
86 | Standard_EXPORT Standard_Boolean Is3D (const Standard_Integer id) const; |
87 | Standard_EXPORT void GetFrame (const Standard_Integer id, |
7fd59977 |
88 | Standard_Integer& xmin, Standard_Integer& ymin, |
89 | Standard_Integer& xmax, Standard_Integer& ymax); |
68df8478 |
90 | Standard_EXPORT void FitView (const Standard_Integer id, const Standard_Integer frame); |
91 | Standard_EXPORT void PanView (const Standard_Integer id, |
7fd59977 |
92 | const Standard_Integer DX, const Standard_Integer DY); |
68df8478 |
93 | Standard_EXPORT void SetPan (const Standard_Integer id, |
7fd59977 |
94 | const Standard_Integer DX, const Standard_Integer DY); |
68df8478 |
95 | Standard_EXPORT void GetPan (const Standard_Integer id, |
7fd59977 |
96 | Standard_Integer& DX, Standard_Integer& DY); |
68df8478 |
97 | Standard_EXPORT Standard_Boolean HasView (const Standard_Integer id) const; |
98 | Standard_EXPORT void DisplayView (const Standard_Integer id) const; |
99 | Standard_EXPORT void HideView (const Standard_Integer id) const; |
100 | Standard_EXPORT void ClearView (const Standard_Integer id) const; |
101 | Standard_EXPORT void RemoveView (const Standard_Integer id) ; |
102 | Standard_EXPORT void RepaintView (const Standard_Integer id) const; |
57c28b61 |
103 | #ifdef _WIN32 |
68df8478 |
104 | Standard_EXPORT void ResizeView (const Standard_Integer id) const; |
105 | Standard_EXPORT void UpdateView (const Standard_Integer id, const Standard_Boolean forced = Standard_False) const; |
7fd59977 |
106 | #endif |
68df8478 |
107 | Standard_EXPORT void ConfigView (const Standard_Integer id) const; |
108 | Standard_EXPORT void PostScriptView (const Standard_Integer id, |
7fd59977 |
109 | const Standard_Integer VXmin, |
110 | const Standard_Integer VYmin, |
111 | const Standard_Integer VXmax, |
112 | const Standard_Integer VYmax, |
113 | const Standard_Integer PXmin, |
114 | const Standard_Integer PYmin, |
115 | const Standard_Integer PXmax, |
116 | const Standard_Integer PYmax, |
04232180 |
117 | std::ostream& sortie) const; |
68df8478 |
118 | Standard_EXPORT void PostColor(const Standard_Integer icol, |
7fd59977 |
119 | const Standard_Integer width, |
120 | const Standard_Real gray); |
68df8478 |
121 | Standard_EXPORT Standard_Boolean SaveView(const Standard_Integer id, const char* filename); |
122 | Standard_EXPORT void RepaintAll () const; |
123 | Standard_EXPORT void Repaint2D () const; |
124 | Standard_EXPORT void Repaint3D () const; |
125 | Standard_EXPORT void DeleteView (const Standard_Integer id); |
126 | Standard_EXPORT void Clear (); |
127 | Standard_EXPORT void Clear2D (); |
128 | Standard_EXPORT void Clear3D (); |
129 | Standard_EXPORT void Flush (); |
7fd59977 |
130 | |
68df8478 |
131 | Standard_EXPORT void DrawOnView (const Standard_Integer id, |
7fd59977 |
132 | const Handle(Draw_Drawable3D)& D) const; |
68df8478 |
133 | Standard_EXPORT void HighlightOnView (const Standard_Integer id, |
7fd59977 |
134 | const Handle(Draw_Drawable3D)& D, |
135 | const Draw_ColorKind C = Draw_blanc) const; |
68df8478 |
136 | Standard_EXPORT void AddDrawable (const Handle(Draw_Drawable3D)& D); |
137 | Standard_EXPORT void RemoveDrawable (const Handle(Draw_Drawable3D)& D); |
138 | Standard_EXPORT Draw_Display MakeDisplay (const Standard_Integer id) const; |
7fd59977 |
139 | |
68df8478 |
140 | Standard_EXPORT void Select (Standard_Integer& id, // View, -1 if none |
7fd59977 |
141 | Standard_Integer& X, // Pick coordinates |
142 | Standard_Integer& Y, |
143 | Standard_Integer& Button, // Button pressed, 0 if none |
144 | Standard_Boolean waitclick = Standard_True |
145 | ); |
146 | |
68df8478 |
147 | Standard_EXPORT Standard_Integer Pick(const Standard_Integer id, // returns the index (or 0) |
7fd59977 |
148 | const Standard_Integer X, |
149 | const Standard_Integer Y, |
150 | const Standard_Integer Prec, |
151 | Handle(Draw_Drawable3D)& D, |
152 | const Standard_Integer First = 0) const; // search after this drawable |
153 | |
68df8478 |
154 | Standard_EXPORT void LastPick(gp_Pnt& P1, gp_Pnt& P2, Standard_Real& Param); |
7fd59977 |
155 | // returns the extremities and parameter of the last picked segment |
156 | |
68df8478 |
157 | Standard_EXPORT ~Draw_Viewer(); |
158 | Standard_EXPORT Draw_Viewer& operator<<(const Handle(Draw_Drawable3D)&); |
159 | Standard_EXPORT const Draw_SequenceOfDrawable3D& GetDrawables(); |
7fd59977 |
160 | |
161 | private : |
162 | |
163 | Draw_View* myViews[MAXVIEW]; |
164 | Draw_SequenceOfDrawable3D myDrawables; |
165 | }; |
166 | |
167 | |
168 | #endif |