All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Project.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/af/Project.h
22 
23  \brief This class models the concept of a project for the TerraLib Application Framework.
24 */
25 
26 #ifndef __TERRALIB_QT_AF_INTERNAL_PROJECT_H
27 #define __TERRALIB_QT_AF_INTERNAL_PROJECT_H
28 
29 // Terralib
30 #include "../../maptools/AbstractLayer.h"
31 #include "Config.h"
32 
33 // STL
34 #include <list>
35 #include <string>
36 
37 namespace te
38 {
39  namespace qt
40  {
41  namespace af
42  {
43  /*!
44  \class Project
45 
46  \brief This class models the concept of a project for the TerraLib Application Framework.
47 
48  \ingroup af
49  */
51  {
52  public:
53 
54  /*! \brief Constructor. */
55  Project();
56 
57  /*! \brief Destructor. */
58  ~Project();
59 
60  /*!
61  \brief It sets the title of the project.
62 
63  \param title The title of the project to be set.
64  */
65  void setTitle(const std::string& title);
66 
67  /*!
68  \brief It gets the title of the project.
69 
70  \return The title of the project.
71  */
72  const std::string& getTitle() const;
73 
74  /*!
75  \brief It sets the author of the project.
76 
77  \param title The author of the project to be set.
78  */
79  void setAuthor(const std::string& author);
80 
81  /*!
82  \brief It gets the author of the project.
83 
84  \return The author of the project.
85  */
86  const std::string& getAuthor() const;
87 
88  /*!
89  \brief It gets all the top layers of the project (folder and single layers).
90 
91  \return The list of all the top layers of the project (folder and single layers).
92  */
93  const std::list<te::map::AbstractLayerPtr>& getTopLayers() const;
94 
95  /*!
96  \brief It gets all the top layers of the project (folder and single layers).
97 
98  \return The list of all the top layers of the project (folder and single layers).
99  */
100  std::list<te::map::AbstractLayerPtr>& getTopLayers();
101 
102  /*!
103  \brief It gets all the layers (single and folder layers) of the project.
104 
105  \param invalid If including invalid layers.
106 
107  \return The list of all the layers (single and folder layers) of the project.
108  */
109  std::list<te::map::AbstractLayerPtr> getAllLayers(bool invalid = true);
110 
111  /*!
112  \brief It gets all the single layers of the project.
113 
114  \param invalid If including invalid layers.
115 
116  \return The list of all the single layers of the project.
117  */
118  std::list<te::map::AbstractLayerPtr> getSingleLayers(bool invalid = true);
119 
120  /*!
121  \brief It gets all the single layers that are visible.
122 
123  \param invalid If including invalid layers.
124 
125  \return The list of all the single layers that are visible.
126  */
127  std::list<te::map::AbstractLayerPtr> getVisibleSingleLayers(bool invalid = true);
128 
129  /*!
130  \brief It sets the top layers of the project.
131 
132  \param layers The layers that will be set as the top layers of the project.
133  */
134  void setTopLayers(const std::list<te::map::AbstractLayerPtr>& layers);
135 
136  /*!
137  \brief It gets all the layers that are selected.
138 
139  \param invalid If including invalid layers.
140 
141  \return The list of all the layers that are selected.
142  */
143  const std::list<te::map::AbstractLayerPtr> getSelectedLayers(bool invalid = true) const;
144 
145  /*!
146  \brief It sets all the layers that are selected.
147 
148  \param selectedLayers The list of all the layers that are selected.
149  */
150  void setSelectedLayers(const std::list<te::map::AbstractLayerPtr>& selectedLayers);
151 
152  /*!
153  \brief It adds the specified layer to the list of layers of the parent layer.
154  If the parent layer is not specified, the layer is added as a top layer of the project.
155 
156  \param layer The layer that will be added to the list of layers of the project.
157  \param parentLayer The parent layer where the layer will be added.
158  */
159  void add(const te::map::AbstractLayerPtr& layer,
161 
162  /*!
163  \brief It removes the specified layer from the project.
164 
165  \param layer The layer to be removed from the project.
166  */
167  void remove(const te::map::AbstractLayerPtr& layer);
168 
169  /*!
170  \brief It informs if the project has changed.
171 
172  \return True, if the project has changed; otherwise, it returns false.
173  */
174  bool hasChanged();
175 
176  /*!
177  \brief It sets the filename where the project will be saved.
178 
179  \param fName The file name where the project will be saved.
180  */
181  void setFileName(const std::string& fName);
182 
183  /*!
184  \brief It gets the filename where the project is saved.
185 
186  \return The file name where the project is saved.
187  */
188  const std::string& getFileName() const;
189 
190  /*!
191  \brief It sets the project status as changed or not.
192 
193  \param changed The flag that specifies if the project is to be set as changed or not.
194  */
195  void setProjectAsChanged(const bool& changed);
196 
197  /*!
198  \brief It clears the project, setting it as having no layers.
199  */
200  void clear();
201 
202  private:
203 
204  std::string m_title; //!< The title of the project.
205  std::string m_author; //!< The author of the project.
206  std::list<te::map::AbstractLayerPtr> m_topLayers; //!< The list of top layers of the project.
207  std::list<te::map::AbstractLayerPtr> m_selectedLayers; //!< The list of selected layers of the project.
208  bool m_changed; //!< Flag indicating that the project needs to be saved.
209  std::string m_fileName; //!< The project file.
210  };
211 
212  } // end namespace af
213  } // end namespace qt
214 } // end namespace te
215 
216 #endif // __TERRALIB_QT_AF_INTERNAL_PROJECT_H
std::string m_author
The author of the project.
Definition: Project.h:205
std::list< te::map::AbstractLayerPtr > m_selectedLayers
The list of selected layers of the project.
Definition: Project.h:207
Configuration flags for the TerraLib Application Framework.
std::string m_fileName
The project file.
Definition: Project.h:209
#define TEQTAFEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:81
std::list< te::map::AbstractLayerPtr > m_topLayers
The list of top layers of the project.
Definition: Project.h:206
This class models the concept of a project for the TerraLib Application Framework.
Definition: Project.h:50
std::string m_title
The title of the project.
Definition: Project.h:204
bool m_changed
Flag indicating that the project needs to be saved.
Definition: Project.h:208
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr