fw4spl
fwRenderQt/include/fwRenderQt/IAdaptor.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_IADAPTOR_HPP__
8 #define __FWRENDERQT_IADAPTOR_HPP__
9 
10 #include "fwRenderQt/config.hpp"
11 #include "fwRenderQt/data/Axis.hpp"
12 #include "fwRenderQt/data/Event.hpp"
13 #include "fwRenderQt/SRender.hpp"
14 
15 #include <fwServices/IService.hpp>
16 
17 namespace fwRenderQt
18 {
19 
23 class FWRENDERQT_CLASS_API IAdaptor : public ::fwServices::IService
24 {
25 
26 public:
27 
29  typedef std::pair< double, double > Point2DType;
30 
32  typedef std::pair<float, float> ViewSizeRatio;
33 
35  typedef std::pair<float, float> ViewportSizeRatio;
36 
38  typedef std::pair<float, float> Scene2DRatio;
39 
41 
43  FWRENDERQT_API void setZValue(float _zValue);
44 
46  FWRENDERQT_API float getZValue() const;
47 
49  FWRENDERQT_API SPTR(::fwRenderQt::SRender) getScene2DRender() const;
50 
53  FWRENDERQT_API virtual void processInteraction(::fwRenderQt::data::Event& _event );
54 
55 protected:
56 
58  FWRENDERQT_API IAdaptor() noexcept;
59 
61  FWRENDERQT_API virtual ~IAdaptor() noexcept;
62 
74  FWRENDERQT_API void configureParams();
75 
78  FWRENDERQT_API Point2DType mapAdaptorToScene(const Point2DType& _xy,
79  const ::fwRenderQt::data::Axis::sptr& _xAxis,
80  const ::fwRenderQt::data::Axis::sptr& _yAxis) const;
81 
84  FWRENDERQT_API Point2DType mapSceneToAdaptor(const Point2DType& _xy,
85  const ::fwRenderQt::data::Axis::sptr& _xAxis,
86  const ::fwRenderQt::data::Axis::sptr& _yAxis) const;
87 
89  FWRENDERQT_API ViewSizeRatio getViewSizeRatio() const;
90 
92  FWRENDERQT_API ViewportSizeRatio getViewportSizeRatio() const;
93 
95  FWRENDERQT_API void initializeViewSize();
96 
98  FWRENDERQT_API void initializeViewportSize();
99 
100  FWRENDERQT_API Scene2DRatio getRatio() const;
101 
103  ::fwRenderQt::data::Axis::sptr m_xAxis;
104 
106  ::fwRenderQt::data::Axis::sptr m_yAxis;
107 
110  float m_zValue;
111 
113  float m_opacity;
114 
118  ViewSizeRatio m_viewInitialSize;
119 
122  ViewportSizeRatio m_viewportInitialSize;
123 };
124 
125 //------------------------------------------------------------------------------
126 
127 } // namespace fwRenderQt
128 
129 #endif // __FWRENDERQT_IADAPTOR_HPP__
130 
Root class for all scene2d adaptors.
Base class for all services.
Definition: IService.hpp:61
#define SPTR(_cls_)
std::pair< float, float > Scene2DRatio
<width, height>
std::pair< float, float > ViewSizeRatio
<width, height>
std::pair< double, double > Point2DType
Point2D coordinate <X, Y>
std::pair< float, float > ViewportSizeRatio
<width, height>
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
The namespace fwRenderQt contains classes for rendering with Qt.
Definition: Axis.hpp:12