fw4spl
SGrid2D.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
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 #pragma once
8 
9 #include "scene2D/config.hpp"
10 
11 #include <fwRenderQt/IAdaptor.hpp>
12 
13 namespace scene2D
14 {
15 namespace adaptor
16 {
47 class SCENE2D_CLASS_API SGrid2D : public ::fwRenderQt::IAdaptor
48 {
49 
50 public:
52 
57  SCENE2D_API static const ::fwCom::Slots::SlotKeyType s_SET_GRID_SPACING_SLOT;
60  SCENE2D_API SGrid2D() noexcept;
62 
64  SCENE2D_API virtual ~SGrid2D() noexcept;
65 
66 protected:
67 
68  SCENE2D_API void configuring() override;
69 
71  SCENE2D_API void starting() override;
72 
73  SCENE2D_API void updating() override;
74 
76  SCENE2D_API void stopping() override;
77 
79  SCENE2D_API void processInteraction( ::fwRenderQt::data::Event& _event ) override;
80 
81 private:
82 
86  void draw();
87 
89  float getXStartVal();
90 
92  float getXEndVal();
93 
95  float getYStartVal();
96 
98  float getYEndVal();
99 
101  void setGridSpacing(double _x, double _y, std::string _key);
102 
104  float m_xMin, m_xMax, m_yMin, m_yMax, m_xSpacing, m_ySpacing;
105 
107  QPen m_pen;
108 
110  std::vector<QGraphicsItem*> m_lines;
111 
113  QGraphicsItemGroup* m_layer;
114 
115 };
116 
117 } // namespace adaptor
118 } // namespace scene2D
119 
Root class for all scene2d adaptors.
STL namespace.
This bundles contains data and services used to display a 2D Qt scene.
Render grid on the scene2d.
Definition: SGrid2D.hpp:47
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
The namespace fwRenderQt contains classes for rendering with Qt.
Definition: Axis.hpp:12