96f3bacc |
1 | #ifndef Draw_View_Header |
2 | #define Draw_View_Header |
3 | |
4 | #include <gp_Trsf.hxx> |
5 | #include <Draw_Window.hxx> |
6 | |
7 | class Draw_Viewer; |
8 | |
9 | class Draw_View : public Draw_Window |
10 | { |
11 | public: |
12 | |
13 | //! Constructor |
14 | Draw_View(Standard_Integer theId, |
15 | Draw_Viewer* theViewer, |
16 | Standard_Integer theX, |
17 | Standard_Integer theY, |
18 | Standard_Integer theWidth, |
19 | Standard_Integer theHeight); |
20 | |
21 | #if defined(_WIN32) || defined(__WIN32__) |
22 | Draw_View(Standard_Integer theId, |
23 | Draw_Viewer* theViewer, |
24 | Standard_Integer theX, |
25 | Standard_Integer theY, |
26 | Standard_Integer theWidth, |
27 | Standard_Integer theHeight, |
28 | HWND theWindow); |
29 | #elif defined(__APPLE__) && !defined(MACOSX_USE_GLX) |
30 | Draw_View(Standard_Integer theId, |
31 | Draw_Viewer* theViewer, |
32 | Standard_Integer theX, |
33 | Standard_Integer theY, |
34 | Standard_Integer theWidth, |
35 | Standard_Integer theHeight, |
36 | NSWindow* theWindow); |
37 | #endif |
38 | |
39 | //! Constructor. |
40 | Draw_View(Standard_Integer theId, |
41 | Draw_Viewer* theViewer, |
42 | const char* theTitle); |
43 | |
44 | //! Destructor. |
45 | ~Draw_View(); |
46 | |
47 | public: // @name getters and setters |
48 | |
49 | //! Sets horizontal offset. |
50 | void SetDx(const Standard_Integer theDx) |
51 | { |
52 | myDx = theDx; |
53 | } |
54 | |
55 | //! Sets vertical offset. |
56 | void SetDy(const Standard_Integer theDy) |
57 | { |
58 | myDy = theDy; |
59 | } |
60 | |
61 | //! Sets parameter of zoom. |
62 | void SetZoom(const Standard_Real theZoom) |
63 | { |
64 | myZoom = theZoom; |
65 | } |
66 | |
67 | //! Sets view matrix. |
68 | void SetMatrix(const gp_Trsf& theMatrix) |
69 | { |
70 | myMatrix = theMatrix; |
71 | } |
72 | |
73 | //! Sets focal distance. |
74 | void SetFocalDistance(const Standard_Real theDistance) |
75 | { |
76 | myFocalDistance = theDistance; |
77 | } |
78 | |
79 | //! Gets horizontal offset. |
487bf1ce |
80 | Standard_Integer GetDx() const |
96f3bacc |
81 | { |
82 | return myDx; |
83 | } |
84 | |
85 | //! Gets vertical offset. |
487bf1ce |
86 | Standard_Integer GetDy() const |
96f3bacc |
87 | { |
88 | return myDy; |
89 | } |
90 | |
91 | //! Gets parameter of zoom. |
487bf1ce |
92 | Standard_Real GetZoom() const |
96f3bacc |
93 | { |
94 | return myZoom; |
95 | } |
96 | |
97 | //! Gets matrix of view. |
98 | const gp_Trsf& GetMatrix() const |
99 | { |
100 | return myMatrix; |
101 | } |
102 | |
103 | //! Gets focal distance. |
487bf1ce |
104 | Standard_Real GetFocalDistance() const |
96f3bacc |
105 | { |
106 | return myFocalDistance; |
107 | } |
108 | |
109 | public: //! @name public inline methods |
110 | |
111 | //! Returns type of view. |
112 | const char* Type() |
113 | { |
114 | return myType; |
115 | } |
116 | |
117 | //! Returns true value if current view in 2D mode. |
487bf1ce |
118 | Standard_Boolean Is2D() const |
96f3bacc |
119 | { |
120 | return myIs2D; |
121 | } |
122 | |
123 | //! Returns true value if current view in perspective mode. |
487bf1ce |
124 | Standard_Real IsPerspective() const |
96f3bacc |
125 | { |
126 | return myIsPers; |
127 | } |
128 | |
129 | public: //! @name view API |
130 | |
131 | //! Initialize view by the type. |
132 | Standard_Boolean Init(const char* theType); |
133 | |
134 | //! Transformates view matrix. |
135 | void Transform(const gp_Trsf& theTransformation); |
136 | |
137 | //! Resets frame of current view. |
138 | void ResetFrame(); |
139 | |
140 | //! Returns parameters of frame corners. |
141 | void GetFrame(Standard_Integer& theX0,Standard_Integer& theY0, |
142 | Standard_Integer& theX1,Standard_Integer& theY1); |
143 | |
144 | //! Perform window exposing. |
145 | void WExpose(); |
146 | |
147 | protected: |
148 | |
149 | Standard_Integer myId; |
150 | Draw_Viewer* myViewer; |
151 | char myType[5]; |
152 | Standard_Boolean myIsPers; |
153 | Standard_Boolean myIs2D; |
154 | Standard_Real myFocalDistance; |
155 | Standard_Real myZoom; |
156 | gp_Trsf myMatrix; |
157 | Standard_Integer myDx; |
158 | Standard_Integer myDy; |
159 | Standard_Integer myFrameX0; |
160 | Standard_Integer myFrameY0; |
161 | Standard_Integer myFrameX1; |
162 | Standard_Integer myFrameY1; |
163 | }; |
164 | |
165 | #endif |