27 #include "terralib_config.h"
28 #include "../common/STLUtils.h"
29 #include "../common/Translator.h"
81 std::size_t size = m_geometries.size();
83 for(std::size_t i = 0; i < size; ++i)
85 if(maxDim < m_geometries[i]->getDimension())
86 maxDim = m_geometries[i]->getDimension();
99 std::size_t n = m_geometries.size();
101 for(std::size_t i = 0; i < n; ++i)
102 m_geometries[i]->setSRID(srid);
109 #ifdef TERRALIB_MOD_SRS_ENABLED
113 std::size_t nGeoms = m_geometries.size();
115 for(std::size_t i = 0; i < nGeoms; ++i)
116 m_geometries[i]->transform(srid);
123 throw Exception(
TE_TR(
"transform method is not supported!"));
124 #endif // TERRALIB_MOD_SRS_ENABLED
134 std::size_t nGeoms = m_geometries.size();
140 m_geometries[0]->computeMBR(
true);
142 *m_mbr = *(m_geometries[0]->getMBR());
144 for(std::size_t i = 1; i < nGeoms; ++i)
147 m_geometries[i]->computeMBR(
true);
149 m_mbr->Union(*(m_geometries[i]->getMBR()));
155 std::size_t n = m_geometries.size();
159 for(std::size_t i = 0; i < n; ++i)
161 assert(m_geometries[i] != 0);
162 sum += m_geometries[i]->getNPoints();
170 if(size < m_geometries.size())
172 std::size_t oldSize = m_geometries.size();
173 for(std::size_t i = size; i < oldSize; ++i)
174 delete m_geometries[i];
177 m_geometries.resize(size);
182 assert(i < m_geometries.size());
183 return m_geometries[i];
188 assert(i < m_geometries.size());
189 return m_geometries[i];
194 assert((i < m_geometries.size()) && (m_geometries[i] == 0));
195 delete m_geometries[i];
201 assert(i < m_geometries.size());
202 delete m_geometries[i];
203 m_geometries.erase(m_geometries.begin() + i);
208 m_geometries.push_back(g);
214 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...