SymbolLibrary.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/SymbolLibrary.h
22 
23  \brief This class represents a library of symbols.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_SE_INTERNAL_SYMBOLLIBRARY_H
27 #define __TERRALIB_QT_WIDGETS_SE_INTERNAL_SYMBOLLIBRARY_H
28 
29 // TerraLib
30 #include "../Config.h"
31 
32 // STL
33 #include <map>
34 #include <string>
35 #include <memory>
36 
37 namespace te
38 {
39  namespace qt
40  {
41  namespace widgets
42  {
43 // Forward declarations
44  class Symbol;
45  class SymbolNode;
46 
47  /*!
48  \class SymbolLibrary
49 
50  \brief This class represents a library of symbols.
51 
52  \sa Symbol, SymbolLibaryManager
53  */
55  {
56  public:
57 
58  /*! \brief Constructor. */
59  SymbolLibrary(const std::string& name);
60 
61  /*! \brief Destructor. */
62  virtual ~SymbolLibrary();
63 
64  /*!
65  \brief It inserts a new symbol to this library.
66 
67  \param symbol The new symbol that will be added to this library.
68  */
69  void addGroup(SymbolNode* group, const std::string& groupParentId = "");
70 
71  /*!
72  \brief It removes the symbol from this library.
73 
74  \param symbol The symbol to be removed.
75 
76  \exception Exception If the symbol doesn't exist it will raise an exception.
77  */
79 
80  /*!
81  \brief It removes the symbol from this library.
82 
83  \param symbol The symbol to be removed.
84 
85  \exception Exception If the symbol doesn't exist it will raise an exception.
86  */
87  void eraseGroup(SymbolNode* group);
88 
89  /*!
90  \brief It returns the symbol identified by a given id or NULL if none is found.
91 
92  \param name The id of the symbol we are looking for.
93 
94  \return A pointer to a symbol or NULL if none is found.
95  */
96  SymbolNode* findGroupById(const std::string& id) const;
97 
98  /*!
99  \brief It returns the symbol identified by a given id or NULL if none is found.
100 
101  \param name The id of the symbol we are looking for.
102 
103  \return A pointer to a symbol or NULL if none is found.
104  */
105  Symbol* findSymbolById(const std::string& id) const;
106 
107  /*!
108  \brief It returns the symbol identified by a given id or NULL if none is found.
109 
110  \param name The id of the symbol we are looking for.
111 
112  \return A pointer to a symbol or NULL if none is found.
113  */
114  SymbolNode* findParentBySymbolId(const std::string& id);
115 
116  /*!
117  \brief It inserts a new symbol to this library.
118 
119  \param symbol The new symbol that will be added to this library.
120  */
121  void addSymbol(Symbol* symbol, const std::string& groupParentId = "");
122 
123  /*!
124  \brief It removes the symbol from this library.
125 
126  \param symbol The symbol to be removed.
127 
128  \exception Exception If the symbol doesn't exist it will raise an exception.
129  */
131 
132  /*!
133  \brief It removes the symbol from this library.
134 
135  \param symbol The symbol to be removed.
136 
137  \exception Exception If the symbol doesn't exist it will raise an exception.
138  */
139  void eraseSymbol(Symbol* symbol);
140 
141  const std::string& getName() const;
142 
143  bool isEmpty();
144 
145  SymbolNode* getRoot() const;
146 
147  bool swapGroup(const std::string& id, const std::string& toParentId);
148 
149  bool swapSymbol(const std::string& id, const std::string& toParentId);
150 
151  std::string version();
152 
153  private:
154 
155  std::string m_name; //!< The name of the symbol library.
156  std::unique_ptr<SymbolNode> m_root;
157  std::string m_version;
158  };
159 
160  } // end namespace widgets
161  } // end namespace qt
162 } // end namespace te
163 
164 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_SYMBOLLIBRARY_H
This class represents a library of symbols.
Definition: SymbolLibrary.h:55
std::string m_name
The name of the symbol library.
void eraseGroup(SymbolNode *group)
It removes the symbol from this library.
SymbolNode * getRoot() const
void addGroup(SymbolNode *group, const std::string &groupParentId="")
It inserts a new symbol to this library.
std::unique_ptr< SymbolNode > m_root
void eraseSymbol(Symbol *symbol)
It removes the symbol from this library.
const std::string & getName() const
bool swapGroup(const std::string &id, const std::string &toParentId)
Symbol * findSymbolById(const std::string &id) const
It returns the symbol identified by a given id or NULL if none is found.
void addSymbol(Symbol *symbol, const std::string &groupParentId="")
It inserts a new symbol to this library.
SymbolLibrary(const std::string &name)
Constructor.
bool swapSymbol(const std::string &id, const std::string &toParentId)
virtual ~SymbolLibrary()
Destructor.
SymbolNode * findGroupById(const std::string &id) const
It returns the symbol identified by a given id or NULL if none is found.
SymbolNode * findParentBySymbolId(const std::string &id)
It returns the symbol identified by a given id or NULL if none is found.
Symbol * removeSymbol(Symbol *symbol)
It removes the symbol from this library.
SymbolNode * removeGroup(SymbolNode *group)
It removes the symbol from this library.
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