1 // Copyright (c) 2015 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef Draw_View_Header
15 #define Draw_View_Header
17 #include <gp_Trsf.hxx>
18 #include <Draw_Window.hxx>
22 class Draw_View : public Draw_Window
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);
34 #if defined(_WIN32) || defined(__WIN32__)
35 Draw_View(Standard_Integer theId,
36 Draw_Viewer* theViewer,
37 Standard_Integer theX,
38 Standard_Integer theY,
39 Standard_Integer theWidth,
40 Standard_Integer theHeight,
42 #elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
43 Draw_View(Standard_Integer theId,
44 Draw_Viewer* theViewer,
45 Standard_Integer theX,
46 Standard_Integer theY,
47 Standard_Integer theWidth,
48 Standard_Integer theHeight,
53 Draw_View(Standard_Integer theId,
54 Draw_Viewer* theViewer,
55 const char* theTitle);
60 public: // @name getters and setters
62 //! Sets horizontal offset.
63 void SetDx(const Standard_Integer theDx)
68 //! Sets vertical offset.
69 void SetDy(const Standard_Integer theDy)
74 //! Sets parameter of zoom.
75 void SetZoom(const Standard_Real theZoom)
81 void SetMatrix(const gp_Trsf& theMatrix)
86 //! Sets focal distance.
87 void SetFocalDistance(const Standard_Real theDistance)
89 myFocalDistance = theDistance;
92 //! Gets horizontal offset.
93 Standard_Integer GetDx() const
98 //! Gets vertical offset.
99 Standard_Integer GetDy() const
104 //! Gets parameter of zoom.
105 Standard_Real GetZoom() const
110 //! Gets matrix of view.
111 const gp_Trsf& GetMatrix() const
116 //! Gets focal distance.
117 Standard_Real GetFocalDistance() const
119 return myFocalDistance;
122 public: //! @name public inline methods
124 //! Returns type of view.
130 //! Returns true value if current view in 2D mode.
131 Standard_Boolean Is2D() const
136 //! Returns true value if current view in perspective mode.
137 Standard_Real IsPerspective() const
142 public: //! @name view API
144 //! Initialize view by the type.
145 Standard_Boolean Init(const char* theType);
147 //! Transform view matrix.
148 void Transform(const gp_Trsf& theTransformation);
150 //! Resets frame of current view.
153 //! Returns parameters of frame corners.
154 void GetFrame(Standard_Integer& theX0,Standard_Integer& theY0,
155 Standard_Integer& theX1,Standard_Integer& theY1);
157 //! Perform window exposing.
162 Standard_Integer myId;
163 Draw_Viewer* myViewer;
165 Standard_Boolean myIsPers;
166 Standard_Boolean myIs2D;
167 Standard_Real myFocalDistance;
168 Standard_Real myZoom;
170 Standard_Integer myDx;
171 Standard_Integer myDy;
172 Standard_Integer myFrameX0;
173 Standard_Integer myFrameY0;
174 Standard_Integer myFrameX1;
175 Standard_Integer myFrameY1;