All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  : te::se::Symbolizer(),
39  m_geometry(0),
40  m_label(0),
41  m_font(0),
42  m_labelPlacement(0),
43  m_halo(0),
44  m_fill(0)
45 {
46 }
47 
49  : te::se::Symbolizer(rhs),
50  m_geometry(0),
51  m_label(0),
52  m_font(0),
53  m_labelPlacement(0),
54  m_halo(0),
55  m_fill(0)
56 {
57  if(rhs.m_geometry)
59 
60  if(rhs.m_label)
61  m_label = rhs.m_label->clone();
62 
63  if(rhs.m_font)
64  m_font = rhs.m_font->clone();
65 
66  if(rhs.m_labelPlacement)
68 
69  if(rhs.m_halo)
70  m_halo = rhs.m_halo->clone();
71 
72  if(rhs.m_fill)
73  m_fill = rhs.m_fill->clone();
74 }
75 
77 {
78  delete m_geometry;
79  delete m_label;
80  delete m_font;
81  delete m_labelPlacement;
82  delete m_halo;
83  delete m_fill;
84 }
85 
87 {
88  delete m_geometry;
89  m_geometry = g;
90 }
91 
93 {
94  delete m_label;
95  m_label = l;
96 }
97 
99 {
100  return m_label;
101 }
102 
104 {
105  delete m_font;
106  m_font = f;
107 }
108 
110 {
111  return m_font;
112 }
113 
115 {
116  delete m_labelPlacement;
117  m_labelPlacement = l;
118 }
119 
121 {
122  return m_labelPlacement;
123 }
124 
126 {
127  delete m_halo;
128  m_halo = h;
129 }
130 
132 {
133  return m_halo;
134 }
135 
137 {
138  delete m_fill;
139  m_fill = f;
140 }
141 
143 {
144  return m_fill;
145 }
146 
147 const std::string& te::se::TextSymbolizer::getType() const
148 {
149  return sm_type;
150 }
151 
153 {
154  return new TextSymbolizer(*this);
155 }
A TextSymbolizer is used to render text labels according to various graphical parameters.
const std::string & getName() const
It returns the property name.
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.
Definition: PropertyName.h:54
LabelPlacement * m_labelPlacement
The label placement specifies where and how a text label should be rendered relative to a geometry...
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:105
A Font specifies the text font to use in a text symbolizer.
void setLabelPlacement(LabelPlacement *l)
Fill * m_fill
It specifies how the text area will be filled. (Optional)