17470159 |
1 | // Copyright (c) 2015 OPEN CASCADE SAS |
2 | // |
3 | // This file is part of Open CASCADE Technology software library. |
4 | // |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
10 | // |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
13 | |
96f3bacc |
14 | #ifndef Draw_View_Header |
15 | #define Draw_View_Header |
16 | |
17 | #include <gp_Trsf.hxx> |
18 | #include <Draw_Window.hxx> |
19 | |
20 | class Draw_Viewer; |
21 | |
22 | class Draw_View : public Draw_Window |
23 | { |
24 | public: |
25 | |
26 | //! Constructor |
96f3bacc |
27 | Draw_View(Standard_Integer theId, |
28 | Draw_Viewer* theViewer, |
29 | Standard_Integer theX, |
30 | Standard_Integer theY, |
31 | Standard_Integer theWidth, |
32 | Standard_Integer theHeight, |
b69e576a |
33 | Aspect_Drawable theWindow = 0); |
96f3bacc |
34 | |
35 | //! Constructor. |
36 | Draw_View(Standard_Integer theId, |
37 | Draw_Viewer* theViewer, |
38 | const char* theTitle); |
39 | |
40 | //! Destructor. |
41 | ~Draw_View(); |
42 | |
43 | public: // @name getters and setters |
44 | |
96f3bacc |
45 | //! Gets horizontal offset. |
b69e576a |
46 | Standard_Integer GetDx() const { return myDx; } |
47 | |
48 | //! Sets horizontal offset. |
49 | void SetDx (const Standard_Integer theDx) { myDx = theDx; } |
96f3bacc |
50 | |
51 | //! Gets vertical offset. |
b69e576a |
52 | Standard_Integer GetDy() const { return myDy; } |
53 | |
54 | //! Sets vertical offset. |
55 | void SetDy (const Standard_Integer theDy) { myDy = theDy; } |
96f3bacc |
56 | |
57 | //! Gets parameter of zoom. |
b69e576a |
58 | Standard_Real GetZoom() const { return myZoom; } |
59 | |
60 | //! Sets parameter of zoom. |
61 | void SetZoom (const Standard_Real theZoom) { myZoom = theZoom; } |
96f3bacc |
62 | |
63 | //! Gets matrix of view. |
b69e576a |
64 | const gp_Trsf& GetMatrix() const { return myMatrix; } |
65 | |
66 | //! Sets view matrix. |
67 | void SetMatrix (const gp_Trsf& theMatrix) { myMatrix = theMatrix; } |
96f3bacc |
68 | |
69 | //! Gets focal distance. |
b69e576a |
70 | Standard_Real GetFocalDistance() const { return myFocalDistance; } |
96f3bacc |
71 | |
b69e576a |
72 | //! Sets focal distance. |
73 | void SetFocalDistance (const Standard_Real theDistance) { myFocalDistance = theDistance; } |
96f3bacc |
74 | |
75 | //! Returns type of view. |
b69e576a |
76 | const char* Type() { return myType; } |
96f3bacc |
77 | |
78 | //! Returns true value if current view in 2D mode. |
b69e576a |
79 | Standard_Boolean Is2D() const { return myIs2D; } |
96f3bacc |
80 | |
81 | //! Returns true value if current view in perspective mode. |
b69e576a |
82 | Standard_Real IsPerspective() const { return myIsPers; } |
96f3bacc |
83 | |
84 | public: //! @name view API |
85 | |
86 | //! Initialize view by the type. |
87 | Standard_Boolean Init(const char* theType); |
88 | |
4551e1be |
89 | //! Transform view matrix. |
96f3bacc |
90 | void Transform(const gp_Trsf& theTransformation); |
91 | |
92 | //! Resets frame of current view. |
93 | void ResetFrame(); |
94 | |
95 | //! Returns parameters of frame corners. |
96 | void GetFrame(Standard_Integer& theX0,Standard_Integer& theY0, |
97 | Standard_Integer& theX1,Standard_Integer& theY1); |
98 | |
99 | //! Perform window exposing. |
b69e576a |
100 | virtual void WExpose() Standard_OVERRIDE; |
96f3bacc |
101 | |
102 | protected: |
103 | |
104 | Standard_Integer myId; |
105 | Draw_Viewer* myViewer; |
106 | char myType[5]; |
107 | Standard_Boolean myIsPers; |
108 | Standard_Boolean myIs2D; |
109 | Standard_Real myFocalDistance; |
110 | Standard_Real myZoom; |
111 | gp_Trsf myMatrix; |
112 | Standard_Integer myDx; |
113 | Standard_Integer myDy; |
114 | Standard_Integer myFrameX0; |
115 | Standard_Integer myFrameY0; |
116 | Standard_Integer myFrameX1; |
117 | Standard_Integer myFrameY1; |
118 | }; |
119 | |
120 | #endif |