27 #include "../common/STLUtils.h"
28 #include "../common/Translator.h"
80 std::size_t size = m_geometries.size();
82 for(std::size_t i = 0; i < size; ++i)
84 if(maxDim < m_geometries[i]->getDimension())
85 maxDim = m_geometries[i]->getDimension();
98 std::size_t n = m_geometries.size();
100 for(std::size_t i = 0; i < n; ++i)
101 m_geometries[i]->setSRID(srid);
108 #ifdef TERRALIB_MOD_SRS_ENABLED
112 std::size_t nGeoms = m_geometries.size();
114 for(std::size_t i = 0; i < nGeoms; ++i)
115 m_geometries[i]->transform(srid);
122 throw Exception(
TE_TR(
"transform method is not supported!"));
123 #endif // TERRALIB_MOD_SRS_ENABLED
133 std::size_t nGeoms = m_geometries.size();
139 m_geometries[0]->computeMBR(
true);
141 *m_mbr = *(m_geometries[0]->getMBR());
143 for(std::size_t i = 1; i < nGeoms; ++i)
146 m_geometries[i]->computeMBR(
true);
148 m_mbr->Union(*(m_geometries[i]->getMBR()));
154 std::size_t n = m_geometries.size();
158 for(std::size_t i = 0; i < n; ++i)
160 assert(m_geometries[i] != 0);
161 sum += m_geometries[i]->getNPoints();
169 if(size < m_geometries.size())
171 std::size_t oldSize = m_geometries.size();
172 for(std::size_t i = size; i < oldSize; ++i)
173 delete m_geometries[i];
176 m_geometries.resize(size);
181 assert(i < m_geometries.size());
182 return m_geometries[i];
187 assert(i < m_geometries.size());
188 return m_geometries[i];
193 assert((i < m_geometries.size()) && (m_geometries[i] == 0));
194 delete m_geometries[i];
200 assert(i < m_geometries.size());
201 delete m_geometries[i];
202 m_geometries.erase(m_geometries.begin() + i);
207 m_geometries.push_back(g);
213 m_geometries.clear();
virtual Dimensionality getDimension() const
For non-homogeneous collections this method will return the largest dimension of the contained object...
void computeMBR(bool cascade) const
It computes the minimum bounding rectangle for the geometry collection.
void makeInvalid()
It will invalidated the envelope.
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
virtual Geometry & operator=(const Geometry &rhs)
Assignment operator.
void setNumGeometries(std::size_t size)
It sets the number of geometries in this GeometryCollection.
virtual const std::string & getGeometryType() const
The name of the Geometry subtype is: GeometryCollection.
GeometryCollection & operator=(const GeometryCollection &rhs)
Assignment operator.
#define TE_TR(message)
It marks a string in order to get translated.
void removeGeometryN(std::size_t i)
It removes the n-th geometry in this geometry collection.
virtual te::dt::AbstractData * clone() const
It clones the geometry collection.
An Envelope defines a 2D rectangular region.
An Envelope defines a 2D rectangular region.
void clear()
It deletes all the elements of the collection.
std::vector< Geometry * > m_geometries
The array of geometries that forms the collection.
Dimensionality
From Wikipedia: "in mathematics, the dimension of an object is an intrinsic property, independent of the space in which the object may happen to be embedded".
void transform(int srid)
It will transform the coordinates of the geometry collection to the new one.
A base class for values that can be retrieved from the data access module.
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.
An exception class for the Geometry module.
Geometry * getGeometryN(std::size_t i) const
It returns the n-th geometry in this GeometryCollection.
void setSRID(int srid)
It sets the Spatial Reference System ID of the geometry collection and all its parts.
virtual ~GeometryCollection()
Virtual destructor.
void add(Geometry *g)
It adds the geometry into the collection.
void setGeometryN(std::size_t i, Geometry *g)
It sets the n-th geometry in this geometry collection.
static const std::string sm_typeName
Geometry type name for GeometryCollection.
It is a collection of other geometric objects.
void Clone(const std::vector< T * > &src, std::vector< T * > &dst)
This function can be applied to a vector of pointers.
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...
std::size_t getNPoints() const
it returns the number of points (vertexes) in the geometry.
It is a collection of other geometric objects.
GeometryCollection(std::size_t nGeom, GeomType t, int srid=0, Envelope *mbr=0)
It initializes the geometry collection with the specified spatial reference system id and envelope...