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 #include "Utils.h"
33 
34 
35 // STL
36 #include <map>
37 #include <vector>
38 
39 namespace te
40 {
41  // Forward declarations
42  namespace da
43  {
44  class ObjectId;
45  }
46 
47  namespace gm
48  {
49  class Envelope;
50  class Geometry;
51  }
52 
53  namespace edit
54  {
55  // Forward declaration
56  class Feature;
57  class Repository;
58 
59  /*!
60  \class RepositoryManager
61 
62  \brief This is a singleton for managing edit repositories.
63  */
64  class TEEDITEXPORT RepositoryManager : public te::common::Singleton<RepositoryManager>
65  {
67 
68  public:
69 
70  void addGeometry(const std::string& source, te::gm::Geometry* geom);
71 
72  void addGeometry(const std::string& source, te::da::ObjectId* id, te::gm::Geometry* geom);
73 
74  void addFeature(const std::string& source, Feature* f);
75 
76  bool hasIdentify(const std::string& source, te::da::ObjectId* id);
77 
78  const std::map<std::string, Repository*>& getRepositories() const;
79 
80  Repository* getRepository(const std::string& source) const;
81 
82  Repository* createRepository(const std::string& source) ;
83 
84  std::vector<Feature*> getFeatures(const std::string& source, const te::gm::Envelope& e, int srid) const;
85 
86  Feature* getFeature(const std::string& source, const te::gm::Envelope& e, int srid) const;
87 
88  Feature* getFeature(const std::string& source, te::da::ObjectId* id) const;
89 
90  void clearAll();
91 
92  void clear(const std::string& source);
93 
94  void removeAll();
95 
96  void remove(const std::string& source);
97 
98  void removeFeature(const std::string& source, te::da::ObjectId* id);
99 
100  protected:
101 
102  /*! \brief It initializes the singleton instance of the repository manager. */
104 
105  /*! \brief Singleton destructor. */
107 
108  private:
109 
110  std::map<std::string, Repository*> m_repositories;
111 
112  };
113 
114  } // end namespace edit
115 } // end namespace te
116 
117 #endif // __TERRALIB_EDIT_INTERNAL_REPOSITORYMANAGER_H
te::gm::Envelope
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
te::edit::RepositoryManager::~RepositoryManager
~RepositoryManager()
Singleton destructor.
te::edit::RepositoryManager::removeAll
void removeAll()
te::da::ObjectId
This class represents an unique id for a data set element.
Definition: ObjectId.h:48
te::edit::Repository
This class represents a repository of geometries and features.
Definition: Repository.h:64
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::edit::RepositoryManager::getRepositories
const std::map< std::string, Repository * > & getRepositories() const
te::edit::RepositoryManager::addGeometry
void addGeometry(const std::string &source, te::gm::Geometry *geom)
te::edit::RepositoryManager::createRepository
Repository * createRepository(const std::string &source)
te::edit::RepositoryManager::clearAll
void clearAll()
TEEDITEXPORT
#define TEEDITEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:68
te::edit::RepositoryManager::m_repositories
std::map< std::string, Repository * > m_repositories
Definition: RepositoryManager.h:110
te::edit::RepositoryManager
This is a singleton for managing edit repositories.
Definition: RepositoryManager.h:65
te::edit::RepositoryManager::clear
void clear(const std::string &source)
te::edit::RepositoryManager::removeFeature
void removeFeature(const std::string &source, te::da::ObjectId *id)
te::common::Singleton
Template support for singleton pattern.
Definition: Singleton.h:101
te::edit::RepositoryManager::hasIdentify
bool hasIdentify(const std::string &source, te::da::ObjectId *id)
te::edit::RepositoryManager::addGeometry
void addGeometry(const std::string &source, te::da::ObjectId *id, te::gm::Geometry *geom)
te::edit::RepositoryManager::getFeature
Feature * getFeature(const std::string &source, const te::gm::Envelope &e, int srid) const
te::edit::RepositoryManager::getFeatures
std::vector< Feature * > getFeatures(const std::string &source, const te::gm::Envelope &e, int srid) const
te::edit::Feature
Definition: Feature.h:58
te::edit::RepositoryManager::addFeature
void addFeature(const std::string &source, Feature *f)
te::edit::RepositoryManager::getRepository
Repository * getRepository(const std::string &source) const
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::edit::RepositoryManager::RepositoryManager
RepositoryManager()
It initializes the singleton instance of the repository manager.
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::edit::RepositoryManager::getFeature
Feature * getFeature(const std::string &source, te::da::ObjectId *id) const
te::edit::RepositoryManager::remove
void remove(const std::string &source)
Utils.h