27 #include "../common/Exception.h"
28 #include "../common/STLUtils.h"
29 #include "../common/Translator.h"
30 #include "../dataaccess/dataset/ObjectId.h"
31 #include "../datatype/SimpleData.h"
32 #include "../geometry/Coord2D.h"
33 #include "../geometry/Envelope.h"
34 #include "../geometry/Geometry.h"
35 #include "../geometry/Point.h"
36 #include "../geometry/Utils.h"
61 assert(!hasIdentifier(
id));
81 std::size_t pos = getPosition(f->
getId());
83 if(pos == std::string::npos)
85 m_features.push_back(f);
87 buildIndex(m_features.size() - 1, f->
getGeometry());
111 std::size_t pos = getPosition(f->
getId());
113 if(pos == std::string::npos)
124 std::size_t pos = getPosition(
id);
126 if(pos == std::string::npos)
130 delete m_features[pos];
133 m_features.erase(m_features.begin() + pos);
143 for(std::size_t i = 0; i < m_features.size(); ++i)
144 if(m_features[i]->isEquals(
id))
147 return std::string::npos;
152 return getPosition(
id) != std::string::npos;
167 std::vector<te::edit::Feature*> result;
169 for(std::size_t i = 0; i < m_features.size(); ++i)
186 std::vector<te::edit::Feature*> result;
189 std::vector<std::size_t> report;
190 m_rtree.search(e, report);
192 for(std::size_t i = 0; i < report.size(); ++i)
194 std::size_t pos = report[i];
196 assert(pos < m_features.size());
198 result.push_back(m_features[pos]);
206 std::vector<te::edit::Feature*> candidates = getFeatures(e, srid);
208 if(candidates.empty())
218 for(std::size_t i = 0; i < candidates.size(); ++i)
222 if(g->
contains(&point) || g->
crosses(geometryFromEnvelope.get()) || geometryFromEnvelope->contains(g))
223 return candidates[i];
239 assert(pos != std::string::npos);
241 assert(pos < m_features.size());
244 delete m_features[pos];
262 for(std::size_t i = 0; i < m_features.size(); ++i)
263 buildIndex(i, m_features[i]->getGeometry());
268 assert(pos != std::string::npos);
274 m_rtree.insert(mbr, pos);
void set(te::da::ObjectId *id, te::gm::Geometry *geom)
Feature * getFeature(const te::gm::Envelope &e, int srid) const
TEEDITEXPORT te::da::ObjectId * GenerateId()
const std::vector< Feature * > & getAllFeatures() const
std::vector< Feature * > getNewFeatures() const
te::da::ObjectId * getId() const
#define NEW_FEATURE_ID_SUFFIX
te::gm::Geometry * getGeometry() const
An utility struct for representing 2D coordinates.
virtual bool contains(const Geometry *const rhs) const
It returns true if this geometry object spatially contains rhs geometry.
Repository(const std::string &source)
#define TE_TR(message)
It marks a string in order to get translated.
This class represents a geographic feature.
bool hasIdentifier(te::da::ObjectId *id)
virtual bool crosses(const Geometry *const rhs) const
It returns true if the geometry object spatially crosses rhs geometry.
Coord2D getCenter() const
It returns the rectangle's center coordinate.
A point with x and y coordinate values.
An Envelope defines a 2D rectangular region.
void add(te::gm::Geometry *geom)
void remove(te::da::ObjectId *id)
This class represents an unique id for a data set element.
This class represents a repository of geometries and features.
std::string getValueAsString() const
It gets the properties values used to uniquely identify a data set element as string.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
std::vector< Feature * > getFeatures(const te::gm::Envelope &e, int srid) const
std::size_t getPosition(te::da::ObjectId *id)
Utility functions for TerraLib Edit module.
const std::string & getSource() const
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
const Envelope * getMBR() const
It returns the minimum bounding rectangle for the geometry in an internal representation.
bool isValid() const
It tells if the rectangle is valid or not.
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.