27 #include "terralib_config.h" 
   28 #include "../common/STLUtils.h" 
   29 #include "../common/Translator.h" 
   38 #ifdef TERRALIB_GEOS_ENABLED 
   40 #include <geos/algorithm/CentroidArea.h> 
   41 #include <geos/geom/Geometry.h> 
   42 #include <geos/geom/IntersectionMatrix.h> 
   43 #include <geos/operation/buffer/OffsetCurveBuilder.h> 
   44 #include <geos/util/GEOSException.h> 
   89   assert(m_rings.size() > 0);
 
   95   return (m_rings.size() > 0) ?  (m_rings.size() - 1) : 0;
 
  100   if(size < m_rings.size())
 
  102     std::size_t oldSize = m_rings.size();
 
  103     for(std::size_t i = size; i < oldSize; ++i)
 
  107   m_rings.resize(size);
 
  112   assert(i < getNumInteriorRings());
 
  113   return m_rings[i + 1];
 
  118   assert(i < m_rings.size());
 
  125   assert(i < m_rings.size());
 
  127   m_rings.erase(m_rings.begin() + i);
 
  138 #ifdef TERRALIB_GEOS_ENABLED 
  139   std::auto_ptr<geos::geom::Geometry> g(GEOSWriter::write(
this));
 
  144   throw Exception(
TE_TR(
"getArea routine is supported by GEOS! Please, enable the GEOS support."));
 
  150 #ifdef TERRALIB_GEOS_ENABLED 
  151   std::auto_ptr<geos::geom::Geometry> thisGeom(GEOSWriter::write(
this));
 
  153   geos::algorithm::CentroidArea c;
 
  155   c.add(thisGeom.get());
 
  157   geos::geom::Coordinate coord;
 
  159   if(c.getCentroid(coord))
 
  161     Point* pt = 
new Point(coord.x, coord.y, m_srid, 0);
 
  201 #ifdef TERRALIB_GEOS_ENABLED 
  202   std::auto_ptr<geos::geom::Geometry> g(GEOSWriter::write(
this));
 
  204   return g->getLength();
 
  207   throw Exception(
TE_TR(
"getLength routine is supported by GEOS! Please, enable the GEOS support."));
 
  218   std::size_t n = m_rings.size();
 
  220   for(std::size_t i = 0; i < n; ++i)
 
  221     m_rings[i]->setSRID(srid);
 
  228 #ifdef TERRALIB_MOD_SRS_ENABLED 
  232   std::size_t n = m_rings.size();
 
  234   for(std::size_t i = 0; i < n; ++i)
 
  235     m_rings[i]->transform(srid);
 
  242   throw Exception(
TE_TR(
"transform method is not supported!"));
 
  243 #endif // TERRALIB_MOD_SRS_ENABLED 
  253   std::size_t n = m_rings.size();
 
  259     m_rings[0]->computeMBR(
true);
 
  261   *m_mbr = *(m_rings[0]->getMBR());
 
  264     for(std::size_t i = 1; i < n; ++i)
 
  265       m_rings[i]->computeMBR(
true);
 
  270   std::size_t n = m_rings.size();
 
  274   for(std::size_t i = 0; i < n; ++i)
 
  275     sum += m_rings[i]->getNPoints();
 
virtual CurvePolygon & operator=(const CurvePolygon &rhs)
Assignment operator. 
 
Curve * getInteriorRingN(std::size_t i) const 
It returns the n-th interior ring for this curve polygon as a curve. 
 
void makeInvalid()
It will invalidated the envelope. 
 
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code. 
 
virtual const std::string & getGeometryType() const 
The name of the geometry subtype for curve polygons is: CurvePolygon. 
 
void transform(int srid)
It converts the coordinate values of the geometry to the new spatial reference system. 
 
void setSRID(int srid)
It sets the Spatial Reference System ID of the geometry and all its parts if it is a GeometryCollecti...
 
Curve is an abstract class that represents 1-dimensional geometric objects stored as a sequence of co...
 
std::size_t getNumInteriorRings() const 
It returns the number of interior rings in this CurvePolygon. 
 
double getPerimeter() const 
It returns the length of the boundary for the surface. 
 
A point with x and y coordinate values. 
 
Curve * getExteriorRing() const 
It returns the exterior ring of this CurvePolygon. 
 
void removeRingN(std::size_t i)
It removes the n-th ring in this CurvePolygon. 
 
An utility struct for representing 2D coordinates. 
 
#define TE_TR(message)
It marks a string in order to get translated. 
 
void setNumRings(std::size_t size)
It sets the number of rings in this curve polygon. 
 
An Envelope defines a 2D rectangular region. 
 
static const std::string sm_typeName
 
std::size_t getNPoints() const 
it returns the number of points (vertexes) in the geometry. 
 
const double & getY() const 
It returns the Point y-coordinate value. 
 
A point with x and y coordinate values. 
 
An Envelope defines a 2D rectangular region. 
 
CurvePolygon is a planar surface defined by 1 exterior boundary and 0 or more interior boundaries...
 
Point * getPointOnSurface() const 
It returns a point guaranteed to be on this surface. 
 
CurvePolygon(std::size_t nRings, GeomType t, int srid=0, Envelope *mbr=0)
It initializes the curve polygon with the specified spatial reference system id and envelope...
 
CurvePolygon is a planar surface defined by 1 exterior boundary and 0 or more interior boundaries...
 
virtual ~CurvePolygon()
Virtual destructor. 
 
virtual Surface & operator=(const Surface &rhs)
Assignment operator. 
 
A base class for values that can be retrieved from the data access module. 
 
Coord2D * getCoordOnSurface() const 
It returns a coordinate guaranteed to be on this surface. 
 
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
 
Curve is an abstract class that represents 1-dimensional geometric objects stored as a sequence of co...
 
A class that converts a TerraLib geometry to a GEOS geometry. 
 
double getArea() const 
It returns the area of this surface, as measured in the spatial reference system of this surface...
 
void computeMBR(bool cascade) const 
It computes the minimum bounding rectangle for the curve polygon. 
 
Coord2D * getCentroidCoord() const 
It returns the mathematical centroid for this surface as a coordinate. 
 
Point * getCentroid() const 
It returns the mathematical centroid for this surface as a point. 
 
void clear()
It deletes all the rings of the CurvePolygon and clear it. 
 
virtual te::dt::AbstractData * clone() const 
It clones the linestring. 
 
Configuration flags for the Vector Geometry Model of TerraLib. 
 
void Clone(const std::vector< T * > &src, std::vector< T * > &dst)
This function can be applied to a vector of pointers. 
 
An utility struct for representing 2D coordinates. 
 
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 double & getX() const 
It returns the Point x-coordinate value. 
 
void setRingN(std::size_t i, Curve *r)
It sets the informed position ring to the new one. 
 
Surface is an abstract class that represents a 2-dimensional geometric objects. 
 
std::vector< Curve * > m_rings
An array with the ring list.