All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RepositoryManager.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/edit/RepositoryManager.h
22 
23  \brief This is a singleton for managing edit repositories.
24 */
25 
26 #ifndef __TERRALIB_EDIT_INTERNAL_REPOSITORYMANAGER_H
27 #define __TERRALIB_EDIT_INTERNAL_REPOSITORYMANAGER_H
28 
29 // TerraLib
30 #include "../common/Singleton.h"
31 #include "Config.h"
32 
33 // STL
34 #include <map>
35 #include <vector>
36 
37 namespace te
38 {
39 // Forward declarations
40  namespace da
41  {
42  class ObjectId;
43  }
44 
45  namespace gm
46  {
47  class Envelope;
48  class Geometry;
49  }
50 
51  namespace edit
52  {
53 // Forward declaration
54  class Feature;
55  class Repository;
56 
57  /*!
58  \class RepositoryManager
59 
60  \brief This is a singleton for managing edit repositories.
61  */
62  class TEEDITEXPORT RepositoryManager : public te::common::Singleton<RepositoryManager>
63  {
65 
66  public:
67 
68  void addGeometry(const std::string& source, te::gm::Geometry* geom);
69 
70  void addGeometry(const std::string& source, te::da::ObjectId* id, te::gm::Geometry* geom);
71 
72  void addFeature(const std::string& source, Feature* f);
73 
74  bool hasIdentify(const std::string& source, te::da::ObjectId* id);
75 
76  const std::map<std::string, Repository*>& getRepositories() const;
77 
78  Repository* getRepository(const std::string& source) const;
79 
80  std::vector<Feature*> getFeatures(const std::string& source, const te::gm::Envelope& e, int srid) const;
81 
82  Feature* getFeature(const std::string& source, const te::gm::Envelope& e, int srid) const;
83 
84  void clearAll();
85 
86  void clear(const std::string& source);
87 
88  void removeAll();
89 
90  void remove(const std::string& source);
91 
92  protected:
93 
94  /*! \brief It initializes the singleton instance of the repository manager. */
96 
97  /*! \brief Singleton destructor. */
99 
100  private:
101 
102  std::map<std::string, Repository*> m_repositories;
103  };
104 
105  } // end namespace edit
106 } // end namespace te
107 
108 #endif // __TERRALIB_EDIT_INTERNAL_REPOSITORYMANAGER_H
#define TEEDITEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:67
std::map< std::string, Repository * > m_repositories
This is a singleton for managing edit repositories.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
This class represents an unique id for a data set element.
Definition: ObjectId.h:47
Configuration flags for the TerraLib Edit module.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
This class represents a repository of geometries and features.
Definition: Repository.h:62
Template support for singleton pattern.
Definition: Singleton.h:100