fw4spl
scene2D/include/scene2D/adaptor/SAxis.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_SAXIS_HPP__
8 #define __SCENE2D_ADAPTOR_SAXIS_HPP__
9 
10 #include "scene2D/config.hpp"
11 
12 #include <fwRenderQt/IAdaptor.hpp>
13 
14 namespace scene2D
15 {
16 
17 namespace adaptor
18 {
19 
48 class SCENE2D_CLASS_API SAxis : public ::fwRenderQt::IAdaptor
49 {
50 
51 public:
53 
54  SCENE2D_API SAxis() noexcept;
55  SCENE2D_API virtual ~SAxis() noexcept;
56 
57 protected:
58 
59  void starting() override;
60  void stopping() override;
61  void updating() override;
62  void configuring() override;
63 
65  SCENE2D_API void processInteraction( ::fwRenderQt::data::Event& _event ) override;
66 
67  SCENE2D_API KeyConnectionsMap getAutoConnections() const override;
68 private:
69 
71  void buildAxis();
72 
74  double getStartVal();
75 
77  double getEndVal();
78 
79  // Specify where the axis must be aligned: left, right, top or bottom.
80  // Left and right side axis are aligned/floating relatively to the view.
81  std::string m_align;
82 
84  float m_interval;
85 
87  float m_min;
88 
90  float m_max;
91 
93  float m_tickSize;
94 
96  QPen m_color;
97 
99  bool m_showLine;
100 
101  // A layer that gathers all the graphic items.
102  QGraphicsItemGroup* m_layer;
103 
105  QGraphicsLineItem* m_line;
106 
108  std::vector< QGraphicsLineItem* > m_ticks;
109 };
110 
111 } // namespace adaptor
112 } // namespace scene2D
113 
114 #endif //__SCENE2D_ADAPTOR_SAXIS_HPP__
115 
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.
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
The namespace fwRenderQt contains classes for rendering with Qt.
Definition: Axis.hpp:12