SymbolNode.h
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/qt/widgets/se/SymbolNode.h
22 
23  \brief This class represents a SymbolNode.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_SE_INTERNAL_SYMBOL_NODE_H
27 #define __TERRALIB_QT_WIDGETS_SE_INTERNAL_SYMBOL_NODE_H
28 
29 // TerraLib
30 #include "../Config.h"
31 #include "Symbol.h"
32 
33 // STL
34 #include <string>
35 #include <map>
36 
37 namespace te
38 {
39  namespace qt
40  {
41  namespace widgets
42  {
43  /*!
44  \class Symbol
45 
46  \brief This class represents a SymbolNode. TODO: More description!
47  */
49  {
50  private:
51 
52  /*!
53  \enum NodeType
54 
55  \brief Auxiliary internal enumeration to control the tree nodes.
56  */
58  {
59  NODE = 0, /*!< node */
60  LEAF = 1, /*!< leaf */
61  };
62 
63  public:
64 
66 
67  /** @name Initializer Methods
68  * Methods related to instantiation and destruction.
69  */
70  //@{
71 
72  /*! \brief Default constructor. */
73  SymbolNode(const std::string& name, te::qt::widgets::SymbolNode* parent = nullptr);
74 
75  /*! \brief Destructor. */
76  virtual ~SymbolNode();
77 
78  virtual void add(te::qt::widgets::SymbolNode* node);
79 
81 
82  virtual void erase(te::qt::widgets::SymbolNode* node);
83 
84  virtual void eraseAll();
85 
86  /*!
87  \brief
88 
89  \return
90 
91  \note
92  */
93  const std::map<std::string, te::qt::widgets::SymbolNode*>& getNodes() const;
94 
95  /*!
96  \brief
97 
98  \return
99  */
100  std::size_t getNodesCount() const;
101 
102  /*!
103  \brief It inserts a new symbol to this library.
104 
105  \param symbol The new symbol that will be added to this library.
106  */
107  void addSymbol(Symbol* symbol);
108 
109  /*!
110  \brief It removes the symbol from this library.
111 
112  \param symbol The symbol to be removed.
113 
114  \exception Exception If the symbol doesn't exist it will raise an exception.
115  */
117 
118  /*!
119  \brief It removes the symbol from this library.
120 
121  \param symbol The symbol to be removed.
122 
123  \exception Exception If the symbol doesn't exist it will raise an exception.
124  */
125  void eraseSymbol(Symbol* symbol);
126 
127  /*!
128  \brief
129 
130  \return
131 
132  \note
133  */
134  const std::map<std::string, te::qt::widgets::Symbol*>& getSymbols() const;
135 
136  /*!
137  \brief It returns the symbol identified by a given id or NULL if none is found.
138 
139  \param name The id of the symbol we are looking for.
140 
141  \return A pointer to a symbol or NULL if none is found.
142  */
143  te::qt::widgets::Symbol* findSymbolById(const std::string& id) const;
144 
145  /*!
146  \brief It returns the symbol identified by a given id or NULL if none is found.
147 
148  \param name The id of the symbol we are looking for.
149 
150  \return A pointer to a symbol or NULL if none is found.
151  */
153 
154  /*!
155  \brief It returns the group identified by a given id or NULL if none is found.
156 
157  \param name The id of the symbol we are looking for.
158 
159  \return A pointer to a symbol or NULL if none is found.
160  */
161  te::qt::widgets::SymbolNode* findNodeById(const std::string& id) const;
162 
163  /*!
164  \brief It returns the group identified by a given id or NULL if none is found.
165 
166  \param name The name of the group we are looking for.
167 
168  \return A pointer to a group or NULL if none is found.
169  */
171 
172  /*!
173  \brief It returns the group identified by a given id or NULL if none is found.
174 
175  \param name The name of the group we are looking for.
176 
177  \return A pointer to a group or NULL if none is found.
178  */
180 
181  bool hasNodes() const;
182 
183  bool hasSymbols() const;
184 
185  std::string getID() const;
186 
187  void setName(const std::string& name);
188 
189  std::string getName() const;
190 
191  void setParent(SymbolNode* parent);
192 
194 
195  protected:
196 
198 
199  /*! \brief It removes all symbols from this library. */
200  void clear();
201 
202  protected:
203 
204  std::map<std::string, te::qt::widgets::SymbolNode*> m_nodes;
207  std::map<std::string, Symbol*> m_symbolMap; //!< The set of symbol.
208  std::string m_id;
209  std::string m_name;
210  };
211 
212  } // end namespace widgets
213  } // end namespace qt
214 } // end namespace te
215 
216 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_SYMBOL_NODE_H
te::qt::widgets::SymbolNode::eraseSymbol
void eraseSymbol(Symbol *symbol)
It removes the symbol from this library.
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::qt::widgets::SymbolNode::~SymbolNode
virtual ~SymbolNode()
Destructor.
te::qt::widgets::SymbolNode::findSymbolById
te::qt::widgets::Symbol * findSymbolById(const std::string &id) const
It returns the symbol identified by a given id or NULL if none is found.
te::qt::widgets::SymbolNode::hasNodes
bool hasNodes() const
te::qt::widgets::SymbolNode::clear
void clear()
It removes all symbols from this library.
te::qt::widgets::SymbolNode::m_name
std::string m_name
Definition: SymbolNode.h:209
te::qt::widgets::SymbolNode::erase
virtual void erase(te::qt::widgets::SymbolNode *node)
te::qt::widgets::SymbolNode::getNodesCount
std::size_t getNodesCount() const
TEQTWIDGETSEXPORT
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
te::qt::widgets::SymbolNode::getID
std::string getID() const
te::qt::widgets::SymbolNode::getNodes
const std::map< std::string, te::qt::widgets::SymbolNode * > & getNodes() const
te::qt::widgets::SymbolNode::m_parent
te::qt::widgets::SymbolNode * m_parent
Definition: SymbolNode.h:205
te::qt::widgets::SymbolNode::m_id
std::string m_id
Definition: SymbolNode.h:208
te::qt::widgets::SymbolNode::getName
std::string getName() const
te::qt::widgets::SymbolNode::addSymbol
void addSymbol(Symbol *symbol)
It inserts a new symbol to this library.
te::qt::widgets::SymbolNode
Definition: SymbolNode.h:49
te::qt::widgets::SymbolNode::eraseAll
virtual void eraseAll()
te::qt::widgets::SymbolNode::SymbolNodeType
SymbolNodeType
Definition: SymbolNode.h:58
te::qt::widgets::SymbolNode::SymbolNode
SymbolNode()
te::qt::widgets::SymbolNode::m_symbolMap
std::map< std::string, Symbol * > m_symbolMap
The set of symbol.
Definition: SymbolNode.h:207
te::qt::widgets::SymbolNode::hasSymbols
bool hasSymbols() const
Symbol.h
This class represents a symbol.
te::qt::widgets::SymbolNode::removeSymbol
Symbol * removeSymbol(Symbol *symbol)
It removes the symbol from this library.
te::qt::widgets::SymbolNode::findNodeFromTopLevelById
te::qt::widgets::SymbolNode * findNodeFromTopLevelById(const std::string &id) const
It returns the group identified by a given id or NULL if none is found.
te::qt::widgets::SymbolNode::setName
void setName(const std::string &name)
te::qt::widgets::SymbolNode::getParent
SymbolNode * getParent() const
te::qt::widgets::SymbolNode::findNodeById
te::qt::widgets::SymbolNode * findNodeById(const std::string &id) const
It returns the group identified by a given id or NULL if none is found.
te::qt::widgets::SymbolNode::add
virtual void add(te::qt::widgets::SymbolNode *node)
te::qt::widgets::SymbolNode::m_type
SymbolNodeType m_type
Definition: SymbolNode.h:206
te::qt::widgets::SymbolNode::findNodeFromTopLevelByName
te::qt::widgets::SymbolNode * findNodeFromTopLevelByName(const std::string &name) const
It returns the group identified by a given id or NULL if none is found.
te::qt::widgets::SymbolNode::getSymbols
const std::map< std::string, te::qt::widgets::Symbol * > & getSymbols() const
te::qt::widgets::SymbolNode::remove
virtual te::qt::widgets::SymbolNode * remove(te::qt::widgets::SymbolNode *node)
te::qt::widgets::Symbol
This class represents a symbol. TODO: More description!
Definition: Symbol.h:55
te::qt::widgets::SymbolNode::findParentBySymbolId
te::qt::widgets::SymbolNode * findParentBySymbolId(const std::string &id)
It returns the symbol identified by a given id or NULL if none is found.
te::qt::widgets::SymbolNode::setParent
void setParent(SymbolNode *parent)
te::qt::widgets::SymbolNode::SymbolNode
SymbolNode(const std::string &name, te::qt::widgets::SymbolNode *parent=nullptr)
Default constructor.
te::qt::widgets::SymbolNode::m_nodes
std::map< std::string, te::qt::widgets::SymbolNode * > m_nodes
Definition: SymbolNode.h:204
te::qt::widgets::SymbolNode::getType
SymbolNodeType getType()