TextSymbolizer.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 terralib/se/TextSymbolizer.cpp
22 
23  \brief A TextSymbolizer is used to render text labels according to various graphical parameters.
24 */
25 
26 // TerraLib
27 #include "../fe/PropertyName.h"
28 #include "Fill.h"
29 #include "Font.h"
30 #include "Halo.h"
31 #include "LabelPlacement.h"
32 #include "ParameterValue.h"
33 #include "TextSymbolizer.h"
34 
35 const std::string te::se::TextSymbolizer::sm_type("TextSymbolizer");
36 
38  : m_geometry(nullptr),
39  m_label(nullptr),
40  m_font(nullptr),
41  m_labelPlacement(nullptr),
42  m_halo(nullptr),
43  m_fill(nullptr)
44 {
45 }
46 
48  : te::se::Symbolizer(rhs),
49  m_geometry(nullptr),
50  m_label(nullptr),
51  m_font(nullptr),
52  m_labelPlacement(nullptr),
53  m_halo(nullptr),
54  m_fill(nullptr)
55 {
56  if(rhs.m_geometry)
58 
59  if(rhs.m_label)
60  m_label = rhs.m_label->clone();
61 
62  if(rhs.m_font)
63  m_font = rhs.m_font->clone();
64 
65  if(rhs.m_labelPlacement)
67 
68  if(rhs.m_halo)
69  m_halo = rhs.m_halo->clone();
70 
71  if(rhs.m_fill)
72  m_fill = rhs.m_fill->clone();
73 }
74 
76 {
77  delete m_geometry;
78  delete m_label;
79  delete m_font;
80  delete m_labelPlacement;
81  delete m_halo;
82  delete m_fill;
83 }
84 
86 {
87  delete m_geometry;
88  m_geometry = g;
89 }
90 
92 {
93  delete m_label;
94  m_label = l;
95 }
96 
98 {
99  return m_label;
100 }
101 
103 {
104  delete m_font;
105  m_font = f;
106 }
107 
109 {
110  return m_font;
111 }
112 
114 {
115  delete m_labelPlacement;
116  m_labelPlacement = l;
117 }
118 
120 {
121  return m_labelPlacement;
122 }
123 
125 {
126  delete m_halo;
127  m_halo = h;
128 }
129 
131 {
132  return m_halo;
133 }
134 
136 {
137  delete m_fill;
138  m_fill = f;
139 }
140 
142 {
143  return m_fill;
144 }
145 
146 const std::string& te::se::TextSymbolizer::getType() const
147 {
148  return sm_type;
149 }
150 
152 {
153  return new TextSymbolizer(*this);
154 }
A TextSymbolizer is used to render text labels according to various graphical parameters.
const std::string & getName() const
It returns the property name.
A Font specifies the text font to use in a text symbolizer.
Font * m_font
The font element specifies the text font to use. (Optional)
A Halo is a type of Fill that is applied to the backgrounds of font glyphs.
LabelPlacement * clone() const
It creates a new copy of this object.
const LabelPlacement * getLabelPlacement() const
The LabelPlacement specifies where and how a text label should be rendered relative to a geometry...
A Fill specifies the pattern for filling an area geometry.
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:80
The ParameterValueType uses WFS-Filter expressions to give values for SE graphic parameters.
const std::string & getType() const
It returns the symbolizer type.
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
static const std::string sm_type
A static data member used in the implementation of getType method.
TextSymbolizer()
It initializes a new TextSymbolizer.
Symbolizer * clone() const
It creates a new copy of this object.
This class is used to encode the name of any property of an object.
LabelPlacement * m_labelPlacement
The label placement specifies where and how a text label should be rendered relative to a geometry...
URI C++ Library.
Definition: Attributes.h:37
A Font specifies the text font to use in a text symbolizer.
Definition: Font.h:63
ParameterValue * m_label
The label specifies the textual content to be rendered. (Optional)
Halo * clone() const
It creates a new copy of this object.
Definition: Halo.cpp:65
A Fill specifies the pattern for filling an area geometry.
Definition: Fill.h:59
const Font * getFont() const
te::fe::PropertyName * m_geometry
The Geometry will be interpreted as a point or a line as needed by the LabelPlacement. (Optional)
ParameterValue * clone() const
It creates a new copy of this object.
A TextSymbolizer is used to render text labels according to various graphical parameters.
Halo * m_halo
A Halo is a type of Fill that is applied to the backgrounds of font glyphs. (Optional) ...
Fill * clone() const
It creates a new copy of this object.
Definition: Fill.cpp:86
void setGeometry(te::fe::PropertyName *g)
void setLabel(ParameterValue *l)
~TextSymbolizer()
Destructor.
const ParameterValue * getLabel() const
const Fill * getFill() const
A Halo is a type of Fill that is applied to the backgrounds of font glyphs.
Definition: Halo.h:64
const Halo * getHalo() const
The LabelPlacement specifies where and how a text label should be rendered relative to a geometry...
Font * clone() const
It creates a new copy of this object.
Definition: Font.cpp:108
void setLabelPlacement(LabelPlacement *l)
Fill * m_fill
It specifies how the text area will be filled. (Optional)