fw4spl
Viewport.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWRENDERQT_DATA_VIEWPORT_HPP__
8 #define __FWRENDERQT_DATA_VIEWPORT_HPP__
9 
10 #include "fwRenderQt/config.hpp"
11 
12 #include <fwData/Exception.hpp>
13 #include <fwData/Object.hpp>
14 
15 namespace fwRenderQt
16 {
17 namespace data
18 {
19 
23 class FWRENDERQT_CLASS_API Viewport : public ::fwData::Object
24 {
25 
26 public:
27 
28  fwCoreClassDefinitionsWithFactoryMacro( (Viewport)(::fwData::Object), (()), ::fwData::factory::New< Viewport >);
29 
34  m_x(200.f),
35  m_y(200.f),
36  m_width(400.f),
37  m_height(400.f)
38  {
39  }
40 
42  FWRENDERQT_API void shallowCopy( const ::fwData::Object::csptr& _source ) override;
43 
45  FWRENDERQT_API void cachedDeepCopy( const ::fwData::Object::csptr& _source, DeepCopyCacheType& cache ) override;
46 
47  float getX() const;
48  void setX (float _x);
49  float getY() const;
50  void setY (float _y);
51 
52  float getWidth() const;
53  void setWidth (float _width);
54  float getHeight() const;
55  void setHeight (float _height);
56 
57 private:
58  float m_x, m_y, m_width, m_height;
59 
60 };
61 
62 //------------------------------------------------------------------------------
63 
64 inline float Viewport::getX() const
65 {
66  return m_x;
67 }
68 
69 //-----------------------------------------------------------------------------
70 
71 inline void Viewport::setX (float _x)
72 {
73  m_x = _x;
74 }
75 
76 //-----------------------------------------------------------------------------
77 
78 inline float Viewport::getY() const
79 {
80  return m_y;
81 }
82 
83 //-----------------------------------------------------------------------------
84 
85 inline void Viewport::setY (float _y)
86 {
87  m_y = _y;
88 }
89 
90 //-----------------------------------------------------------------------------
91 
92 inline float Viewport::getWidth() const
93 {
94  return m_width;
95 }
96 
97 //-----------------------------------------------------------------------------
98 
99 inline void Viewport::setWidth (float _width)
100 {
101  m_width = _width;
102 }
103 
104 //-----------------------------------------------------------------------------
105 
106 inline float Viewport::getHeight() const
107 {
108  return m_height;
109 }
110 
111 //-----------------------------------------------------------------------------
112 
113 inline void Viewport::setHeight (float _height)
114 {
115  m_height = _height;
116 }
117 
118 //-----------------------------------------------------------------------------
119 
120 } // namespace data
121 } // namespace fwRenderQt
122 
123 #endif // __FWRENDERQT_DATA_VIEWPORT_HPP__
124 
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
Base class for each data object.
Viewport(::fwData::Object::Key key)
Constructor.
Definition: Viewport.hpp:33
Manage the current viewport of the fwRenderQt.
Definition: Viewport.hpp:23
The namespace fwRenderQt contains classes for rendering with Qt.
Definition: Axis.hpp:12