913a4c4a |
1 | // Created on: 2011-10-14 |
2 | // Created by: Roman KOZLOV |
3 | // Copyright (c) 2011-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef __IVTKVTK_VIEW_H__ |
17 | #define __IVTKVTK_VIEW_H__ |
18 | |
19 | #include <IVtk_IView.hxx> |
20 | |
21 | class vtkRenderer; |
22 | |
23 | DEFINE_STANDARD_HANDLE( IVtkVTK_View, IVtk_IView ) |
24 | |
25 | //! @class IVtkVTK_View |
26 | //! @brief ICamera implementation for VTK. |
27 | //! |
28 | //! This class is used for obtaining view transformation parameters. |
29 | //! These parameters are used by selection algorithm to compute |
30 | //! projections of selectable (active) 3D shapes. |
31 | class IVtkVTK_View : public IVtk_IView |
32 | { |
33 | |
34 | public: |
35 | typedef Handle(IVtkVTK_View) Handle; |
36 | |
37 | Standard_EXPORT IVtkVTK_View (vtkRenderer* theRenderer); |
38 | |
39 | //! Destructor |
40 | Standard_EXPORT virtual ~IVtkVTK_View(); |
41 | |
42 | //! @return true if this is a perspective view, and false otherwise. |
43 | Standard_EXPORT virtual bool IsPerspective() const; |
44 | |
45 | //! @return The focal distance of the view |
46 | Standard_EXPORT virtual double GetDistance() const; |
47 | |
48 | //! @return The world coordinates of the view position |
49 | Standard_EXPORT virtual void GetPosition (double& theX, double& theY, double& theZ) const; |
50 | |
51 | //! @return The "view up" direction of the view |
52 | Standard_EXPORT virtual void GetViewUp (double& theDx, double& theDy, double& theDz) const; |
53 | |
54 | //! @return The projection direction vector of this view |
55 | Standard_EXPORT virtual void GetDirectionOfProjection (double& theDx, |
56 | double& theDy, |
57 | double& theDz) const; |
58 | |
59 | //! @return Three doubles containing scale components of the view transformation |
60 | Standard_EXPORT virtual void GetScale (double& theX, double& theY, double& theZ) const; |
61 | |
62 | //! @return The current view's zoom factor (for parallel projection) |
63 | Standard_EXPORT virtual double GetParallelScale() const; |
64 | |
65 | //! @return The current view angle (for perspective projection) |
66 | Standard_EXPORT virtual double GetViewAngle() const; |
67 | |
68 | //! @return Two doubles containing the display coordinates of the view window center |
69 | Standard_EXPORT virtual void GetViewCenter (double& theX, double& theY) const; |
70 | |
f751596e |
71 | //! Gets window size in screen coordinates in pixels |
72 | Standard_EXPORT virtual void GetWindowSize (int& theX, int& theY) const Standard_OVERRIDE; |
73 | |
74 | //! Gets camera projection and orientation matrices |
75 | Standard_EXPORT virtual void GetCamera (Graphic3d_Mat4d& theProj, |
76 | Graphic3d_Mat4d& theOrient, |
77 | Standard_Boolean& theIsOrtho) const Standard_OVERRIDE; |
78 | |
79 | //! Gets viewport coordinates |
80 | Standard_EXPORT virtual void GetViewport (Standard_Real& theX, |
81 | Standard_Real& theY, |
82 | Standard_Real& theWidth, |
83 | Standard_Real& theHeight) const Standard_OVERRIDE; |
84 | |
913a4c4a |
85 | //! Converts 3D display coordinates into 3D world coordinates. |
86 | //! @param [in] theDisplayPnt 2d point of display coordinates |
87 | //! @param [out] theWorldPnt 3d point of world coordinates |
88 | //! @return true if conversion was successful, false otherwise |
89 | Standard_EXPORT virtual bool DisplayToWorld (const gp_XY& theDisplayPnt, gp_XYZ& theWorldPnt) const; |
90 | |
91 | DEFINE_STANDARD_RTTI( IVtkVTK_View ) |
92 | |
93 | private: |
94 | vtkRenderer* myRenderer; |
95 | }; |
96 | |
97 | #endif // __IVTKVTK_VIEW_H__ |