Loading...
Searching...
No Matches
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
37namespace 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
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
This class represents a symbol.
void addSymbol(Symbol *symbol)
It inserts a new symbol to this library.
te::qt::widgets::SymbolNode * m_parent
Definition: SymbolNode.h:205
std::string getID() const
std::map< std::string, te::qt::widgets::SymbolNode * > m_nodes
Definition: SymbolNode.h:204
void clear()
It removes all symbols from this library.
const std::map< std::string, te::qt::widgets::Symbol * > & getSymbols() const
SymbolNodeType getType()
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.
void setParent(SymbolNode *parent)
virtual ~SymbolNode()
Destructor.
std::map< std::string, Symbol * > m_symbolMap
The set of symbol.
Definition: SymbolNode.h:207
te::qt::widgets::SymbolNode * findParentBySymbolId(const std::string &id)
It returns the symbol identified by a given id or NULL if none is found.
SymbolNode * getParent() const
Symbol * removeSymbol(Symbol *symbol)
It removes the symbol from this library.
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 * findNodeById(const std::string &id) const
It returns the group identified by a given id or NULL if none is found.
const std::map< std::string, te::qt::widgets::SymbolNode * > & getNodes() const
virtual void erase(te::qt::widgets::SymbolNode *node)
void eraseSymbol(Symbol *symbol)
It removes the symbol from this library.
std::string getName() const
SymbolNode(const std::string &name, te::qt::widgets::SymbolNode *parent=nullptr)
Default constructor.
virtual void add(te::qt::widgets::SymbolNode *node)
std::size_t getNodesCount() const
void setName(const std::string &name)
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.
virtual te::qt::widgets::SymbolNode * remove(te::qt::widgets::SymbolNode *node)
This class represents a symbol. TODO: More description!
Definition: Symbol.h:55
TerraLib.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63