fw4spl
SScaleValues.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 __SCENE2D_ADAPTOR_SSCALEVALUES_HPP__
8 #define __SCENE2D_ADAPTOR_SSCALEVALUES_HPP__
9 
10 #include "scene2D/config.hpp"
11 
12 #include <fwRenderQt/IAdaptor.hpp>
13 
14 namespace scene2D
15 {
16 namespace adaptor
17 {
18 
51 class SCENE2D_CLASS_API SScaleValues : public ::fwRenderQt::IAdaptor
52 {
53 
54 public:
56 
58  SCENE2D_API SScaleValues() noexcept;
59 
61  SCENE2D_API virtual ~SScaleValues() noexcept;
62 
63 protected:
64 
65  SCENE2D_API void configuring() override;
66 
68  SCENE2D_API void starting() override;
69 
71  SCENE2D_API void updating() override;
72 
74  SCENE2D_API void stopping() override;
75 
77  SCENE2D_API void processInteraction( ::fwRenderQt::data::Event& _event ) override;
78 
79  SCENE2D_API KeyConnectionsMap getAutoConnections() const override;
80 
81 private:
82 
83  void buildValues();
84 
85  void rescaleValues();
86 
87  double getStartVal();
88 
89  double getEndVal();
90 
92  void showHideScaleValues();
93 
95  float m_min, m_max;
96 
98  double m_interval;
99 
101  bool m_showUnit;
102 
104  QGraphicsSimpleTextItem* m_unit;
105 
107  std::string m_displayedUnit;
108 
110  QGraphicsItemGroup* m_layer;
111 
114  std::string m_align;
115 
117  QFont m_font;
118 
120  QBrush m_brush;
121 
123  std::vector<QGraphicsItem*> m_values;
124 
126  QPen m_pen;
127 
130  int m_step;
131 
133  float m_fontSize;
134 };
135 
136 } // namespace adaptor
137 } // namespace scene2D
138 
139 #endif // __SCENE2D_ADAPTOR_SSCALEVALUES_HPP__
Root class for all scene2d adaptors.
This class is a helper to define the connections of a service and its data.
Definition: IService.hpp:454
STL namespace.
This bundles contains data and services used to display a 2D Qt scene.
SScaleValues adaptor. Display values and units on the axis.
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
The namespace fwRenderQt contains classes for rendering with Qt.
Definition: Axis.hpp:12