Attributes.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file Text.h
22 
23  \brief An Text Element consists of a string, location, leader line and may have attribute.
24  */
25 
26 #ifndef __TERRALIB_ANNOTATIONTEXT_INTERNAL_ATTRIBUTES_H
27 #define __TERRALIB_ANNOTATIONTEXT_INTERNAL_ATTRIBUTES_H
28 
29 // TerraLib
30 #include "../common/STLUtils.h"
31 #include "Config.h"
32 #include "Enums.h"
33 
34 // STL
35 #include <string>
36 
37 namespace te
38 {
39 // Forward declarations
40  namespace gm
41  {
42  class Envelope;
43  }
44 
45  namespace at
46  {
47  /*!
48  \class Text
49 
50  \brief A Text may contain 1 or more Text Elements.
51  */
53  {
54  public:
55 
56  /*! \brief Text Attributes constructor. */
57  Attributes();
58 
59  /*! \brief Text Attributes constructor.
60 
61  \param family The font family.
62  \param pointSize The font point size
63  \param style The font style.
64  \param weight The font weight.
65  \param ha The text horizontal alignment.
66  \param va The text vertical alignment.
67  */
68  Attributes(const std::string& family,
69  const double pointSize = 10.0,
70  FontStyle style = NormalStyle,
71  FontWeight weight = NormalWeight,
74 
75  /*!
76  \brief Copy constructor.
77 
78  \param rhs The right-hand-side copy that would be used to copy from.
79  */
80  Attributes(const Attributes& rhs);
81 
82  /*!
83  \brief Assignment operator.
84 
85  \param rhs The right-hand-side copy that would be used to copy from.
86  */
87  Attributes& operator=(const Attributes& rhs);
88 
89  /*! \brief Text Element destructor. */
90  ~Attributes();
91 
92  /*! \brief It sets the font family.
93 
94  \param family The font family.
95  */
96  void setFamily(const std::string& family);
97 
98  /*! \brief It returns the font family.
99 
100  \return The font family.
101  */
102  const std::string& getFamily() const;
103 
104  /*! \brief It sets the font point size.
105 
106  \param ps The font point size.
107  */
108  void setPointSize(const double& ps);
109 
110  /*! \brief It returns the font point size.
111 
112  \return The font point size.
113  */
114  const double& getPointSize() const;
115 
116  /*! \brief It sets the font style.
117 
118  \param style The font style.
119  */
120  void setStyle(FontStyle style);
121 
122  /*! \brief It returns the font style.
123 
124  \return The font style.
125  */
126  FontStyle getStyle() const;
127 
128  /*! \brief It sets the font weight.
129 
130  \param weight The font weight.
131  */
132  void setWeight(FontWeight weight);
133 
134  /*! \brief It returns the font weight.
135 
136  \return The font weight.
137  */
138  FontWeight getWeight() const;
139 
140  /*! \brief It sets the font decoration.
141 
142  \param decoration The font decoration.
143  */
144  void setDecoration(TextDecoration decoration);
145 
146  /*! \brief It returns the font decoration.
147 
148  \return The font decoration.
149  */
150  TextDecoration getDecoration() const;
151 
152  /*! \brief It sets the letter spacing.
153 
154  \param spacing The letter spacing.
155  */
156  void setLetterSpacing(const double& spacing);
157 
158  /*! \brief It returns the letter spacing.
159 
160  \return The letter spacing.
161  */
162  const double& getLetterSpacing() const;
163 
164  /*! \brief It sets the word spacing.
165 
166  \param spacing The word spacing.
167  */
168  void setWordSpacing(const double& spacing);
169 
170  /*! \brief It returns the word spacing.
171 
172  \return The word spacing.
173  */
174  const double& getWordSpacing() const;
175 
176  /*! \brief It sets the text color.
177 
178  \param color The text color.
179  */
180  void setTextColor(const std::string& color);
181 
182  /*! \brief It returns the text color.
183 
184  \return The text color.
185  */
186  const std::string& getTextColor() const;
187 
188  /*! \brief It sets the text opacity.
189 
190  \param opacity The text opacity.
191  */
192  void setTextOpacity(double& opacity);
193 
194  /*! \brief It returns the text opacity.
195 
196  \return The text opacity.
197  */
198  const double& getTextOpacity() const;
199 
200  /*! \brief It sets the text stroke color.
201 
202  \param color The text stroke color.
203  */
204  void setTextStrokecolor(const std::string& color);
205 
206  /*! \brief It returns the text stroke color.
207 
208  \return The text stroke color.
209  */
210  const std::string& getTextStrokeColor() const;
211 
212  /*! \brief It sets the text stroke width.
213 
214  \param width The text stroke width.
215  */
216  void setTextStrokeWidth(const double& width);
217 
218  /*! \brief It returns the text stroke width.
219 
220  \return The text stroke width.
221  */
222  const double& getTextStrokeWidth() const;
223 
224  /*! \brief It sets the text stroke opacity.
225 
226  \param opacity The text stroke opacity.
227  */
228  void setTextStrokeOpacity(const double& opacity);
229 
230  /*! \brief It returns the text stroke opacity.
231 
232  \return The text stroke opacity.
233  */
234  const double& getTextStrokeOpacity() const;
235 
236  /*! \brief It sets the horizontal text alignment.
237 
238  \param ha The horizontal text alignment.
239  */
240  void setHorizontalAlignment(HorizontalAlignment ha);
241 
242  /*! \brief It returns the horizontal text alignment.
243 
244  \return The horizontal text alignment.
245  */
246  HorizontalAlignment getHorizontalAlignment() const;
247 
248  /*! \brief It sets the vertical text alignment.
249 
250  \param ha The vertical text alignment.
251  */
252  void setVerticalAlignment(VerticalAlignment va);
253 
254  /*! \brief It returns the vertical text alignment.
255 
256  \return The vertical text alignment.
257  */
258  VerticalAlignment getVerticalAlignment() const;
259 
260  /*! \brief It sets the multi line justification.
261 
262  \param just The multi line justification.
263  */
264  void setLineJustification(LineJustification just);
265 
266  /*! \brief It returns the multi line justification.
267 
268  \return The multi line justification.
269  */
270  LineJustification getLineJustification() const;
271 
272  /*! \brief It sets the multi line spacing.
273 
274  \param spacing The multi line spacing.
275  */
276  void setLineSpacing(const double& spacing);
277 
278  /*! \brief It returns the multi line spacing.
279 
280  \return The multi line spacing.
281  */
282  const double& getLineSpacing() const;
283 
284  private:
285 
286  std::string m_family; //!< font family
287  double m_pointSize; //!< font point size
288  FontStyle m_style; //!< font style
289  FontWeight m_weight; //!< font weight
290  TextDecoration m_decoration; //!< text decoration
291  double m_letterSpacing; //!< letter spacing (0..1)
292  double m_wordSpacing; //!< word spacing (0..1)
293  std::string m_fillColor; //!< text fill color
294  double m_fillOpacity; //!< text fill color opacity (0..1)
295  std::string m_strokeColor; //!< text stroke color
296  double m_strokeWidth; //!< text stroke width (0..1)
297  double m_strokeOpacity; //!< text stroke color opacity (0..1)
298  HorizontalAlignment m_hAlign; //!< horizontal text alignment
299  VerticalAlignment m_vAlign; //!< vertical text alignment
300  LineJustification m_multiLineJustification; //!< multi line justufucation
301  double m_multiLineSpacing; //!< multi line spacing
302  };
303 
304  } // end namespace at
305 } // end namespace te
306 
307 #endif // __TERRALIB_ANNOTATIONTEXT_INTERNAL_ATTRIBUTES_H
308 
std::string m_strokeColor
text stroke color
Definition: Attributes.h:295
std::string m_fillColor
text fill color
Definition: Attributes.h:293
FontWeight
Font weight for drawing text.
Definition: Enums.h:50
VerticalAlignment m_vAlign
vertical text alignment
Definition: Attributes.h:299
double m_letterSpacing
letter spacing (0..1)
Definition: Attributes.h:291
HorizontalAlignment m_hAlign
horizontal text alignment
Definition: Attributes.h:298
LineJustification
Line justification for drawing multi line text.
Definition: Enums.h:106
FontStyle
Font style for drawing text.
Definition: Enums.h:38
TextDecoration m_decoration
text decoration
Definition: Attributes.h:290
Several enumerations related to Annotation Text.
double m_fillOpacity
text fill color opacity (0..1)
Definition: Attributes.h:294
Configuration flags for the TerraLib Annotation Text module.
TextDecoration
Text decoration for drawing text.
Definition: Enums.h:68
HorizontalAlignment
Horizontal alignment for drawing text.
Definition: Enums.h:81
URI C++ Library.
std::string m_family
font family
Definition: Attributes.h:286
#define TEANNOTATIONTEXTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:59
LineJustification m_multiLineJustification
multi line justufucation
Definition: Attributes.h:300
VerticalAlignment
Vertical alignment for drawing text.
Definition: Enums.h:93
double m_strokeWidth
text stroke width (0..1)
Definition: Attributes.h:296
FontStyle m_style
font style
Definition: Attributes.h:288
double m_pointSize
font point size
Definition: Attributes.h:287
double m_multiLineSpacing
multi line spacing
Definition: Attributes.h:301
double m_wordSpacing
word spacing (0..1)
Definition: Attributes.h:292
FontWeight m_weight
font weight
Definition: Attributes.h:289
double m_strokeOpacity
text stroke color opacity (0..1)
Definition: Attributes.h:297