All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Element.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/annotationtext/Element.cpp
22 
23  \brief An Text Element consists of a string, location, leader line and may have attribute.
24  */
25 
26 // TerraLib
27 #include "Element.h"
28 #include "Attributes.h"
29 #include "../geometry/Geometry.h"
30 
32 {
33  m_value.clear();
34  m_location = 0;
35  m_leaderLine = 0;
36  m_attribute = 0;
37 }
38 
39 te::at::Element::Element(const std::string& value, te::gm::Geometry* location, te::gm::Geometry* leaderLine)
40 {
41  m_value = value;
42  m_location = location;
43  m_leaderLine = leaderLine;
44  m_attribute = 0;
45 }
46 
48 {
49  delete m_location;
50  delete m_leaderLine;
51  delete m_attribute;
52 }
53 
55 {
56  Element* e = new Element;
57  e->setValue(m_value);
58  e->setLocation(m_location);
59  e->setLeaderLine(m_leaderLine);
60  e->setAttributes(m_attribute);
61  return e;
62 }
63 
64 void te::at::Element::setValue(const std::string& value)
65 {
66  m_value = value;
67 }
68 
69 const std::string& te::at::Element::getValue() const
70 {
71  return m_value;
72 }
73 
75 {
76  delete m_location;
77  m_location = location;
78 }
79 
81 {
82  return m_location;
83 }
84 
86 {
87  delete m_leaderLine;
88  m_leaderLine = leaderLine;
89 }
90 
92 {
93  return m_leaderLine;
94 }
95 
97 {
98  delete m_attribute;
99  m_attribute = attribute;
100 }
101 
103 {
104  return m_attribute;
105 }
106 
Element * clone() const
It clones the Element.
Definition: Element.cpp:54
std::string m_value
text value
Definition: Element.h:173
Attributes * m_attribute
attributes
Definition: Element.h:176
const Attributes * getAttributes() const
it returns the text attributes.
Definition: Element.cpp:102
const te::gm::Geometry * getLeaderLine() const
it returns the text leader line.
Definition: Element.cpp:91
te::gm::Geometry * m_location
location
Definition: Element.h:174
void setAttributes(Attributes *attribute)
it sets the text attributes.
Definition: Element.cpp:96
~Element()
Text Element destructor.
Definition: Element.cpp:47
const std::string & getValue() const
it returns the text string.
Definition: Element.cpp:69
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
void setLeaderLine(te::gm::Geometry *leaderLine)
it sets the text leader line.
Definition: Element.cpp:85
void setValue(const std::string &value)
it sets the text string.
Definition: Element.cpp:64
const te::gm::Geometry * getLocation() const
it returns the text location.
Definition: Element.cpp:80
Element()
Text Element constructor.
Definition: Element.cpp:31
te::gm::Geometry * m_leaderLine
leader line
Definition: Element.h:175
void setLocation(te::gm::Geometry *location)
it sets the text location.
Definition: Element.cpp:74
An Text Element consists of a string, location, leader line and may have attribute.