27 #include "../common/STLUtils.h"
78 std::size_t size = m_geometries.size();
80 for(std::size_t i = 0; i < size; ++i)
82 if(maxDim < m_geometries[i]->getDimension())
83 maxDim = m_geometries[i]->getDimension();
96 std::size_t n = m_geometries.size();
98 for(std::size_t i = 0; i < n; ++i)
99 m_geometries[i]->setSRID(srid);
109 std::size_t nGeoms = m_geometries.size();
111 for(std::size_t i = 0; i < nGeoms; ++i)
112 m_geometries[i]->transform(srid);
127 std::size_t nGeoms = m_geometries.size();
133 m_geometries[0]->computeMBR(
true);
135 *m_mbr = *(m_geometries[0]->getMBR());
137 for(std::size_t i = 1; i < nGeoms; ++i)
140 m_geometries[i]->computeMBR(
true);
142 m_mbr->Union(*(m_geometries[i]->getMBR()));
148 std::size_t n = m_geometries.size();
152 for(std::size_t i = 0; i < n; ++i)
154 assert(m_geometries[i] != 0);
155 sum += m_geometries[i]->getNPoints();
163 if(size < m_geometries.size())
165 std::size_t oldSize = m_geometries.size();
166 for(std::size_t i = size; i < oldSize; ++i)
167 delete m_geometries[i];
170 m_geometries.resize(size);
175 assert(i < m_geometries.size());
176 return m_geometries[i];
181 assert(i < m_geometries.size());
182 return m_geometries[i];
187 assert((i < m_geometries.size()) && (m_geometries[i] == 0));
188 delete m_geometries[i];
194 assert(i < m_geometries.size());
195 delete m_geometries[i];
196 m_geometries.erase(m_geometries.begin() + i);
201 m_geometries.push_back(g);
207 m_geometries.clear();
void setNumGeometries(std::size_t size)
It sets the number of geometries in this GeometryCollection.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
virtual Dimensionality getDimension() const
For non-homogeneous collections this method will return the largest dimension of the contained object...
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...
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...
Geometry * getGeometryN(std::size_t i) const
It returns the n-th geometry in this GeometryCollection.
void Clone(const std::vector< T * > &src, std::vector< T * > &dst)
This function can be applied to a vector of pointers.
It is a collection of other geometric objects.
void computeMBR(bool cascade) const
It computes the minimum bounding rectangle for the geometry collection.
GeometryCollection & operator=(const GeometryCollection &rhs)
Assignment operator.
void add(Geometry *g)
It adds the geometry into 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".
std::size_t getNPoints() const
it returns the number of points (vertexes) in the geometry.
void clear()
It deletes all the elements of the collection.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
std::vector< Geometry * > m_geometries
The array of geometries that forms the collection.
static const std::string sm_typeName
Geometry type name for GeometryCollection.
A base class for values that can be retrieved from the data access module.
It is a collection of other geometric objects.
void transform(int srid)
It will transform the coordinates of the geometry collection to the new one.
virtual Geometry & operator=(const Geometry &rhs)
Assignment operator.
void setSRID(int srid)
It sets the Spatial Reference System ID of the geometry collection and all its parts.
An Envelope defines a 2D rectangular region.
virtual te::dt::AbstractData * clone() const
It clones the geometry collection.
virtual const std::string & getGeometryType() const
The name of the Geometry subtype is: GeometryCollection.
void setGeometryN(std::size_t i, Geometry *g)
It sets the n-th geometry in this geometry collection.
An Envelope defines a 2D rectangular region.
void removeGeometryN(std::size_t i)
It removes the n-th geometry in this geometry collection.
void makeInvalid()
It will invalidated the envelope.
virtual ~GeometryCollection()
Virtual destructor.