Repository.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/Repository.h
22 
23  \brief This class represents a repository of geometries and features.
24 */
25 
26 #ifndef __TERRALIB_EDIT_INTERNAL_REPOSITORY_H
27 #define __TERRALIB_EDIT_INTERNAL_REPOSITORY_H
28 
29 // TerraLib
30 #include "../sam/rtree/Index.h"
31 #include "../srs/Config.h"
32 #include "Config.h"
33 #include "Utils.h"
34 
35 // STL
36 #include <vector>
37 #include <string>
38 
39 namespace te
40 {
41 // Forward declaration
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 
58  /*!
59  \class Repository
60 
61  \brief This class represents a repository of geometries and features.
62  */
64  {
65  public:
66 
67  Repository(const std::string& source);
68 
70 
71  void add(te::gm::Geometry* geom);
72 
74 
75  void add(Feature* f);
76 
78 
79  void set(Feature* f);
80 
82 
83  std::size_t getPosition(te::da::ObjectId* id);
84 
86 
87  const std::string& getSource() const;
88 
89  const std::vector<Feature*>& getAllFeatures() const;
90 
91  std::vector<Feature*> getFeatures(const te::gm::Envelope& e, int srid) const;
92 
93  Feature* getFeature(const te::gm::Envelope& e, int srid) const;
94 
96 
97  void clear();
98 
99  private:
100 
101  void set(const std::size_t& pos, Feature* f);
102 
103  void clearIndex();
104 
105  void buildIndex();
106 
107  void buildIndex(const std::size_t& pos, te::gm::Geometry* geom);
108 
109  private:
110 
111  std::string m_source; //!< The source of the features.
112  std::vector<Feature*> m_features; //!< The repository features.
113  te::sam::rtree::Index<std::size_t, 8> m_rtree; //!< Internal index used to retrieve geometries spatially.
114 
115  };
116 
117  } // end namespace edit
118 } // end namespace te
119 
120 #endif // __TERRALIB_EDIT_INTERNAL_REPOSITORY_H
te::gm::Envelope
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
te::edit::Repository::buildIndex
void buildIndex(const std::size_t &pos, te::gm::Geometry *geom)
te::da::ObjectId
This class represents an unique id for a data set element.
Definition: ObjectId.h:48
te::edit::Repository::buildIndex
void buildIndex()
te::edit::Repository
This class represents a repository of geometries and features.
Definition: Repository.h:64
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::edit::Repository::~Repository
~Repository()
te::sam::rtree::Index< std::size_t, 8 >
te::edit::Repository::getAllFeatures
const std::vector< Feature * > & getAllFeatures() const
te::edit::Repository::add
void add(te::da::ObjectId *id, te::gm::Geometry *geom)
te::edit::Repository::getFeature
Feature * getFeature(te::da::ObjectId *id) const
te::edit::Repository::m_rtree
te::sam::rtree::Index< std::size_t, 8 > m_rtree
Internal index used to retrieve geometries spatially.
Definition: Repository.h:113
te::edit::Repository::getSource
const std::string & getSource() const
te::edit::Repository::set
void set(te::da::ObjectId *id, te::gm::Geometry *geom)
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::Repository::getFeature
Feature * getFeature(const te::gm::Envelope &e, int srid) const
te::edit::Repository::m_features
std::vector< Feature * > m_features
The repository features.
Definition: Repository.h:112
te::edit::Repository::Repository
Repository(const std::string &source)
te::edit::Repository::clearIndex
void clearIndex()
te::edit::Repository::hasIdentifier
bool hasIdentifier(te::da::ObjectId *id)
te::edit::Repository::getFeatures
std::vector< Feature * > getFeatures(const te::gm::Envelope &e, int srid) const
te::edit::Repository::add
void add(te::gm::Geometry *geom)
te::edit::Repository::remove
void remove(te::da::ObjectId *id)
te::edit::Feature
Definition: Feature.h:58
te::edit::Repository::set
void set(const std::size_t &pos, Feature *f)
te::edit::Repository::clear
void clear()
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::edit::Repository::set
void set(Feature *f)
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::edit::Repository::m_source
std::string m_source
The source of the features.
Definition: Repository.h:111
Utils.h
te::edit::Repository::add
void add(Feature *f)
te::edit::Repository::getPosition
std::size_t getPosition(te::da::ObjectId *id)