All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Attributes.cpp
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 Attributes.cpp
22 
23  \brief An Text Element consists of a string, location, leader line and may have attribute.
24  */
25 
26 // TerraLib
27 #include "Attributes.h"
28 
30 {
31  m_family = "Verdana";
32  m_pointSize = 12.;
36  m_letterSpacing = 0.;
37  m_wordSpacing = 0.;
38  m_fillColor = "black";
39  m_fillOpacity = 1.;
40  m_strokeColor.clear();
41  m_strokeWidth = 0.;
42  m_strokeOpacity = 1.;
43  m_hAlign = Start;
46  m_multiLineSpacing = 0.;
47 }
48 
49 te::at::Attributes::Attributes(const std::string& family,
50  const double pointSize,
51  FontStyle style,
52  FontWeight weight,
55  : m_family(family),
56  m_pointSize(pointSize),
57  m_style(style),
58  m_weight(weight)
59 {
61  m_letterSpacing = 0.;
62  m_wordSpacing = 0.;
63  m_fillColor = "black";
64  m_fillOpacity = 1.;
65  m_strokeColor.clear();
66  m_strokeWidth = 0.;
67  m_strokeOpacity = 1.;
69  m_multiLineSpacing = 0.;
70  m_hAlign = ha;
71  m_vAlign = va;
72 }
73 
75 {
76  m_family = rhs.m_family;
77  m_pointSize = rhs.m_pointSize;
78  m_style = rhs.m_style;
79  m_weight = rhs.m_weight;
80  m_decoration = rhs.m_decoration;
81  m_letterSpacing = rhs.m_letterSpacing;
82  m_wordSpacing = rhs.m_wordSpacing;
83  m_fillColor = rhs.m_fillColor;
84  m_fillOpacity = rhs.m_fillOpacity;
85  m_strokeColor = rhs.m_strokeColor;
86  m_strokeWidth = rhs.m_strokeWidth;
87  m_strokeOpacity = rhs.m_strokeOpacity;
88  m_hAlign = rhs.m_hAlign;
89  m_vAlign = rhs.m_vAlign;
90  m_multiLineJustification = rhs.m_multiLineJustification;
91  m_multiLineSpacing = rhs.m_multiLineSpacing;
92 }
93 
95 {
96  m_family = rhs.m_family;
97  m_pointSize = rhs.m_pointSize;
98  m_style = rhs.m_style;
99  m_weight = rhs.m_weight;
100  m_decoration = rhs.m_decoration;
101  m_letterSpacing = rhs.m_letterSpacing;
102  m_wordSpacing = rhs.m_wordSpacing;
103  m_fillColor = rhs.m_fillColor;
104  m_fillOpacity = rhs.m_fillOpacity;
105  m_strokeColor = rhs.m_strokeColor;
106  m_strokeWidth = rhs.m_strokeWidth;
107  m_strokeOpacity = rhs.m_strokeOpacity;
108  m_hAlign = rhs.m_hAlign;
109  m_vAlign = rhs.m_vAlign;
110  m_multiLineJustification = rhs.m_multiLineJustification;
111  m_multiLineSpacing = rhs.m_multiLineSpacing;
112  return *this;
113 }
114 
116 {
117 }
118 
119 void te::at::Attributes::setFamily(const std::string& family)
120 {
121  m_family = family;
122 }
123 
124 const std::string& te::at::Attributes::getFamily() const
125 {
126  return m_family;
127 }
128 
129 void te::at::Attributes::setPointSize(const double& ps)
130 {
131  m_pointSize = ps;
132 }
133 
134 const double& te::at::Attributes::getPointSize() const
135 {
136  return m_pointSize;
137 }
138 
140 {
141  m_style = style;
142 }
143 
145 {
146  return m_style;
147 }
148 
150 {
151  m_weight = weight;
152 }
153 
155 {
156  return m_weight;
157 }
158 
160 {
161  m_decoration = decoration;
162 }
163 
165 {
166  return m_decoration;
167 }
168 
169 void te::at::Attributes::setLetterSpacing(const double& spacing)
170 {
171  m_letterSpacing = spacing;
172 }
173 
175 {
176  return m_letterSpacing;
177 }
178 
179 void te::at::Attributes::setWordSpacing(const double& spacing)
180 {
181  m_wordSpacing = spacing;
182 }
183 
185 {
186  return m_wordSpacing;
187 }
188 
189 void te::at::Attributes::setTextColor(const std::string& color)
190 {
191  m_fillColor = color;
192 }
193 
194 const std::string& te::at::Attributes::getTextColor() const
195 {
196  return m_fillColor;
197 }
198 
200 {
201  m_fillOpacity = opacity;
202 }
203 
205 {
206  return m_fillOpacity;
207 }
208 
209 void te::at::Attributes::setTextStrokecolor(const std::string& color)
210 {
211  m_strokeColor = color;
212 }
213 
214 const std::string& te::at::Attributes::getTextStrokeColor() const
215 {
216  return m_strokeColor;
217 }
218 
219 void te::at::Attributes::setTextStrokeWidth(const double& width)
220 {
221  m_strokeWidth = width;
222 }
223 
225 {
226  return m_strokeWidth;
227 }
228 
229 void te::at::Attributes::setTextStrokeOpacity(const double& opacity)
230 {
231  m_strokeOpacity = opacity;
232 }
233 
235 {
236  return m_strokeOpacity;
237 }
238 
240 {
241  m_hAlign = ha;
242 }
243 
245 {
246  return m_hAlign;
247 }
248 
250 {
251  m_vAlign = va;
252 }
253 
255 {
256  return m_vAlign;
257 }
258 
260 {
261  m_multiLineJustification = just;
262 }
263 
265 {
266  return m_multiLineJustification;
267 }
268 
269 void te::at::Attributes::setLineSpacing(const double& spacing)
270 {
271  m_multiLineSpacing = spacing;
272 }
273 
275 {
276  return m_multiLineSpacing;
277 }
278 
void setTextOpacity(double &opacity)
It sets the text opacity.
Definition: Attributes.cpp:199
void setHorizontalAlignment(HorizontalAlignment ha)
It sets the horizontal text alignment.
Definition: Attributes.cpp:239
TextDecoration getDecoration() const
It returns the font decoration.
Definition: Attributes.cpp:164
std::string m_strokeColor
text stroke color
Definition: Attributes.h:295
const double & getLetterSpacing() const
It returns the letter spacing.
Definition: Attributes.cpp:174
const double & getWordSpacing() const
It returns the word spacing.
Definition: Attributes.cpp:184
std::string m_fillColor
text fill color
Definition: Attributes.h:293
FontWeight
Font weight for drawing text.
Definition: Enums.h:50
const double & getTextOpacity() const
It returns the text opacity.
Definition: Attributes.cpp:204
VerticalAlignment m_vAlign
vertical text alignment
Definition: Attributes.h:299
double m_letterSpacing
letter spacing (0..1)
Definition: Attributes.h:291
void setTextColor(const std::string &color)
It sets the text color.
Definition: Attributes.cpp:189
HorizontalAlignment m_hAlign
horizontal text alignment
Definition: Attributes.h:298
const std::string & getFamily() const
It returns the font family.
Definition: Attributes.cpp:124
LineJustification
Line justification for drawing multi line text.
Definition: Enums.h:106
FontStyle
Font style for drawing text.
Definition: Enums.h:38
const std::string & getTextColor() const
It returns the text color.
Definition: Attributes.cpp:194
void setTextStrokecolor(const std::string &color)
It sets the text stroke color.
Definition: Attributes.cpp:209
const double & getPointSize() const
It returns the font point size.
Definition: Attributes.cpp:134
const std::string & getTextStrokeColor() const
It returns the text stroke color.
Definition: Attributes.cpp:214
TextDecoration m_decoration
text decoration
Definition: Attributes.h:290
void setFamily(const std::string &family)
It sets the font family.
Definition: Attributes.cpp:119
Attributes & operator=(const Attributes &rhs)
Assignment operator.
Definition: Attributes.cpp:94
~Attributes()
Text Element destructor.
Definition: Attributes.cpp:115
HorizontalAlignment getHorizontalAlignment() const
It returns the horizontal text alignment.
Definition: Attributes.cpp:244
void setWeight(FontWeight weight)
It sets the font weight.
Definition: Attributes.cpp:149
double m_fillOpacity
text fill color opacity (0..1)
Definition: Attributes.h:294
void setPointSize(const double &ps)
It sets the font point size.
Definition: Attributes.cpp:129
FontStyle getStyle() const
It returns the font style.
Definition: Attributes.cpp:144
TextDecoration
Text decoration for drawing text.
Definition: Enums.h:68
void setLetterSpacing(const double &spacing)
It sets the letter spacing.
Definition: Attributes.cpp:169
Attributes()
Text Attributes constructor.
Definition: Attributes.cpp:29
HorizontalAlignment
Horizontal alignment for drawing text.
Definition: Enums.h:81
VerticalAlignment getVerticalAlignment() const
It returns the vertical text alignment.
Definition: Attributes.cpp:254
void setLineSpacing(const double &spacing)
It sets the multi line spacing.
Definition: Attributes.cpp:269
const double & getLineSpacing() const
It returns the multi line spacing.
Definition: Attributes.cpp:274
std::string m_family
font family
Definition: Attributes.h:286
const double & getTextStrokeOpacity() const
It returns the text stroke opacity.
Definition: Attributes.cpp:234
FontWeight getWeight() const
It returns the font weight.
Definition: Attributes.cpp:154
void setWordSpacing(const double &spacing)
It sets the word spacing.
Definition: Attributes.cpp:179
LineJustification m_multiLineJustification
multi line justufucation
Definition: Attributes.h:300
void setVerticalAlignment(VerticalAlignment va)
It sets the vertical text alignment.
Definition: Attributes.cpp:249
VerticalAlignment
Vertical alignment for drawing text.
Definition: Enums.h:93
double m_strokeWidth
text stroke width (0..1)
Definition: Attributes.h:296
LineJustification getLineJustification() const
It returns the multi line justification.
Definition: Attributes.cpp:264
void setTextStrokeWidth(const double &width)
It sets the text stroke width.
Definition: Attributes.cpp:219
void setDecoration(TextDecoration decoration)
It sets the font decoration.
Definition: Attributes.cpp:159
void setStyle(FontStyle style)
It sets the font style.
Definition: Attributes.cpp:139
FontStyle m_style
font style
Definition: Attributes.h:288
double m_pointSize
font point size
Definition: Attributes.h:287
void setTextStrokeOpacity(const double &opacity)
It sets the text stroke opacity.
Definition: Attributes.cpp:229
double m_multiLineSpacing
multi line spacing
Definition: Attributes.h:301
double m_wordSpacing
word spacing (0..1)
Definition: Attributes.h:292
void setLineJustification(LineJustification just)
It sets the multi line justification.
Definition: Attributes.cpp:259
const double & getTextStrokeWidth() const
It returns the text stroke width.
Definition: Attributes.cpp:224
FontWeight m_weight
font weight
Definition: Attributes.h:289
double m_strokeOpacity
text stroke color opacity (0..1)
Definition: Attributes.h:297