All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Text.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 Text.cpp
22 
23  \brief An Text consists of a Envelope and a Text Element array.
24  */
25 
26 // TerraLib
27 #include "Text.h"
28 #include "Element.h"
29 #include "../common/STLUtils.h"
30 
32 {
33 }
34 
36 {
37  m_envelope = rhs.m_envelope;
38  m_elements = rhs.m_elements;
39 }
40 
42 {
43  m_envelope = rhs.m_envelope;
44  m_elements = rhs.m_elements;
45  return *this;
46 }
47 
49 {
50  te::common::FreeContents(m_elements);
51  m_elements.clear();
52 }
53 
55 {
56  Text* t = new Text;
57  t->setEnvelope(m_envelope);
58  t->setElements(m_elements);
59  return t;
60 }
61 
63 {
64  m_envelope = envelope;
65 }
66 
68 {
69  return m_envelope;
70 }
71 
72 void te::at::Text::setElements(const std::vector<Element*> elements)
73 {
74  te::common::FreeContents(m_elements);
75  m_elements.clear();
76 
77  m_elements = elements;
78 }
79 
80 void te::at::Text::add(Element* element)
81 {
82  m_elements.push_back(element);
83 }
84 
85 const std::vector<te::at::Element*>& te::at::Text::getElements() const
86 {
87  return m_elements;
88 }
Text * clone()
It clones the Text.
Definition: Text.cpp:54
te::gm::Envelope m_envelope
Definition: Text.h:134
Text & operator=(const Text &rhs)
No assignment operator allowed.
Definition: Text.cpp:41
void setEnvelope(const te::gm::Envelope &envelope)
It sets the envelope.
Definition: Text.cpp:62
An Text Element consists of a string, location, leader line and may have attribute.
A Text may contain 1 or more Text Elements.
Definition: Text.h:51
void setElements(const std::vector< Element * > elements)
It sets the elements.
Definition: Text.cpp:72
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
const std::vector< Element * > & getElements() const
It returns the elements.
Definition: Text.cpp:85
Text()
Text constructor.
Definition: Text.cpp:31
const te::gm::Envelope & getEnvelope()
It returns the envelope.
Definition: Text.cpp:67
~Text()
Text destructor.
Definition: Text.cpp:48
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
Definition: BoostUtils.h:55
std::vector< Element * > m_elements
Definition: Text.h:135
void add(Element *element)
It adds the element.
Definition: Text.cpp:80
An Text Element consists of a string, location, leader line and may have attribute.