fw4spl
SText.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 __VISUVTKADAPTOR_STEXT_HPP__
8 #define __VISUVTKADAPTOR_STEXT_HPP__
9 
10 #include "visuVTKAdaptor/config.hpp"
11 
12 #include <fwRenderVTK/IAdaptor.hpp>
13 
14 #include <string>
15 
16 class vtkTextActor;
17 class vtkActor2D;
18 class vtkTextMapper;
19 
20 namespace visuVTKAdaptor
21 {
22 
68 class VISUVTKADAPTOR_CLASS_API SText : public ::fwRenderVTK::IAdaptor
69 {
70 
71 public:
73 
74  VISUVTKADAPTOR_API SText();
75  VISUVTKADAPTOR_API virtual ~SText() noexcept;
76 
77  VISUVTKADAPTOR_API virtual void setText(const std::string& str);
78  //------------------------------------------------------------------------------
79 
80  std::string getText() const
81  {
82  return m_text;
83  }
84 
91  VISUVTKADAPTOR_API virtual KeyConnectionsMap getAutoConnections() const override;
92 
93 protected:
94 
95  VISUVTKADAPTOR_API virtual void configuring() override;
96  VISUVTKADAPTOR_API virtual void starting() override;
97  VISUVTKADAPTOR_API virtual void updating() override;
98  VISUVTKADAPTOR_API virtual void stopping() override;
99 
101  std::string m_text;
102 
104  std::string m_path;
105 
106  vtkActor2D* m_actor;
107  vtkTextMapper* m_mapper;
108 
110  unsigned int m_fontSize;
111 
113  std::string m_fontFamily;
114 
116  bool m_italic;
117 
119  bool m_bold;
120 
122  bool m_shadow;
123 
125  std::string m_vAlign;
126 
128  std::string m_hAlign;
129 
131  std::string m_textColor;
132 
133 private:
134 
136  void setAlignment();
137 
139  void setStyle();
140 
142  void updateText();
143 };
144 
145 } //namespace visuVTKAdaptor
146 
147 #endif //__VISUVTKADAPTOR_STEXT_HPP__
148 
This class is a helper to define the connections of a service and its data.
Definition: IService.hpp:454
std::string m_fontFamily
Font family. Only &#39;arial&#39;, &#39;courier&#39; and &#39;times&#39; are supported for now.
Definition: SText.hpp:113
The namespace visuVTKAdaptor contains the list of adaptors available for the generic scene...
bool m_bold
Enables bold font.
Definition: SText.hpp:119
STL namespace.
std::string m_hAlign
Horizontal alignment.
Definition: SText.hpp:128
std::string m_vAlign
Vertical alignment.
Definition: SText.hpp:125
unsigned int m_fontSize
Font size (in points) applied to VTK text mapper.
Definition: SText.hpp:110
std::string m_path
Seshat path, empty if not used.
Definition: SText.hpp:104
bool m_italic
Enables italic font.
Definition: SText.hpp:116
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
bool m_shadow
Enables text shadow.
Definition: SText.hpp:122
std::string m_textColor
Text color (hex format #ffffff)
Definition: SText.hpp:131
std::string m_text
Displayed text.
Definition: SText.hpp:101
Displays a text.
Definition: SText.hpp:68