fw4spl
SSquare.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_SSQUARE_HPP__
8 #define __SCENE2D_ADAPTOR_SSQUARE_HPP__
9 
10 #include "scene2D/config.hpp"
11 
12 #include <fwRenderQt/data/Coord.hpp>
13 #include <fwRenderQt/IAdaptor.hpp>
14 
15 #include <QGraphicsItem>
16 
17 namespace scene2D
18 {
19 namespace adaptor
20 {
21 
41 class SCENE2D_CLASS_API SSquare : public ::fwRenderQt::IAdaptor
42 {
43 
44 public:
45 
47 
48  SCENE2D_API SSquare() noexcept;
49  SCENE2D_API virtual ~SSquare() noexcept;
50 
51 protected:
52 
53  SCENE2D_API void configuring() override;
54  SCENE2D_API void starting() override;
55  SCENE2D_API void updating() override;
56  SCENE2D_API void stopping() override;
57 
58  SCENE2D_API void processInteraction( ::fwRenderQt::data::Event& _event ) override;
59 
60  SCENE2D_API void setColor(const std::string& _color );
61  SCENE2D_API bool coordViewIsInItem( const ::fwRenderQt::data::Coord& coord, QGraphicsItem* item );
62  SCENE2D_API ::fwRenderQt::data::Coord coordViewToCoordItem( const ::fwRenderQt::data::Coord& coord,
63  QGraphicsItem* item );
64 
65 private:
66 
67  ::fwRenderQt::data::Coord m_coord;
68  std::uint32_t m_size;
69  QColor m_color;
70  QGraphicsItemGroup* m_layer;
71  QGraphicsRectItem* m_rec;
72  ::fwRenderQt::data::Coord m_oldCoord;
73 
74  bool m_pointIsCaptured;
75 };
76 
77 } // namespace adaptor
78 } // namespace scene2D
79 
80 #endif // __SCENE2D_ADAPTOR_SSQUARE_HPP__
81 
Root class for all scene2d adaptors.
Create a square on the scene2D.
Definition: SSquare.hpp:41
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