te::gm::GeometryCollection Class Referenceabstract

It is a collection of other geometric objects. More...

#include <GeometryCollection.h>

Inheritance diagram for te::gm::GeometryCollection:
te::gm::Geometry te::dt::AbstractData te::common::BaseVisitable< Visitor > te::gm::MultiCurve te::gm::MultiPoint te::gm::MultiSurface te::gm::MultiLineString te::gm::MultiPolygon

Public Types

typedef void ReturnType
 
typedef Visitor VisitorType
 

Public Member Functions

virtual ReturnType accept (VisitorType &guest) const =0
 It call the visit method from the guest object. More...
 
Initializer methods on geometric objects

Methods for initializing a geometric object.

 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. More...
 
 GeometryCollection (const GeometryCollection &rhs)
 Copy constructor. More...
 
GeometryCollectionoperator= (const GeometryCollection &rhs)
 Assignment operator. More...
 
virtual ~GeometryCollection ()
 Virtual destructor. More...
 
Re-Implementation from AbstractData

Methods re-Implementated from AbstractData.

virtual te::dt::AbstractDataclone () const
 It clones the geometry collection. More...
 
Re-Implmentation of methods from Geometry class

Re-Implmentation of basic methods from Geometry class.

virtual Dimensionality getDimension () const throw ()
 For non-homogeneous collections this method will return the largest dimension of the contained objects. More...
 
virtual const std::string & getGeometryType () const throw ()
 The name of the Geometry subtype is: GeometryCollection. More...
 
void setSRID (int srid) throw ()
 It sets the Spatial Reference System ID of the geometry collection and all its parts. More...
 
void transform (int srid) throw (te::common::Exception)
 It will transform the coordinates of the geometry collection to the new one. More...
 
void computeMBR (bool cascade) const throw ()
 It computes the minimum bounding rectangle for the geometry collection. More...
 
std::size_t getNPoints () const throw ()
 it returns the number of points (vertexes) in the geometry. More...
 
GeometryCollection Specific Methods

Specific methods for a GeometryCollection.

const std::vector< Geometry * > & getGeometries () const
 It returns a reference to the internal list of geometries. More...
 
std::vector< Geometry * > & getGeometries ()
 It returns a reference to the internal list of geometries. More...
 
std::size_t getNumGeometries () const
 It returns the number of geometries in this GeometryCollection. More...
 
void setNumGeometries (std::size_t size)
 It sets the number of geometries in this GeometryCollection. More...
 
GeometrygetGeometryN (std::size_t i) const
 It returns the n-th geometry in this GeometryCollection. More...
 
GeometrygetGeometryN (std::size_t i)
 It returns the n-th geometry in this GeometryCollection. More...
 
void setGeometryN (std::size_t i, Geometry *g)
 It sets the n-th geometry in this geometry collection. More...
 
void removeGeometryN (std::size_t i)
 It removes the n-th geometry in this geometry collection. More...
 
void add (Geometry *g)
 It adds the geometry into the collection. More...
 
void clear ()
 It deletes all the elements of the collection. More...
 
Basic Geometry Methods

Basic methods on geometric objects.

int getCoordinateDimension () const throw ()
 It returns the number of measurements or axes needed to describe a position in a coordinate system. More...
 
GeomType getGeomTypeId () const throw ()
 It returns the geometry subclass type identifier. More...
 
int getSRID () const throw ()
 It returns the Spatial Reference System ID associated to this geometric object. More...
 
GeometrygetEnvelope () const throw ()
 It returns the minimum bounding rectangle (MBR) for the geometry. More...
 
const EnvelopegetMBR () const throw ()
 It returns the minimum bounding rectangle for the geometry in an internal representation. More...
 
std::string asText () const throw ()
 It returns an string with the Well-Known Text Representation for the geometry. More...
 
char * asBinary (std::size_t &size) const throw (Exception)
 It serializes the geometric object to a Well-known Binary Representation (WKB). More...
 
std::size_t getWkbSize () const throw ()
 It returns the size required by a WKB representation for this geometric object. More...
 
void getWkb (char *wkb, te::common::MachineByteOrder byteOrder) const throw (Exception)
 It serializes the geometry to a WKB representation into the specified buffer. More...
 
virtual bool isEmpty () const throw (std::exception)
 It returns true if this geometric object is the empty Geometry. More...
 
virtual bool isSimple () const throw (std::exception)
 It returns true if this geometric object has no anomalous points, such as self intersection or self tangency. More...
 
virtual bool isValid () const throw (std::exception)
 It tells if the geometry is well formed. More...
 
bool is3D () const throw ()
 It returns true if this geometric object has z coordinate values. More...
 
bool isMeasured () const throw ()
 It returns true if this geometric object has m coordinate values. More...
 
virtual GeometrygetBoundary () const throw (std::exception)
 It returns the geometry boundary. More...
 
Spatial Relations

Methods for testing spatial relations between geometric objects.

Please, see OGC specification for a in depth definition of each spatial operation.

virtual bool equals (const Geometry *const rhs, const bool exact=false) const throw (std::exception)
 It returns true if the geometry object is spatially equal to rhs geometry. More...
 
virtual bool disjoint (const Geometry *const rhs) const throw (std::exception)
 It returns true if the geometry object is spatially disjoint from rhs geometry. More...
 
virtual bool intersects (const Geometry *const rhs) const throw (std::exception)
 It returns true if the geometry object spatially intersects rhs geometry. More...
 
virtual bool touches (const Geometry *const rhs) const throw (std::exception)
 It returns true if the geometry object spatially touches rhs geometry. More...
 
virtual bool crosses (const Geometry *const rhs) const throw (std::exception)
 It returns true if the geometry object spatially crosses rhs geometry. More...
 
virtual bool within (const Geometry *const rhs) const throw (std::exception)
 It returns true if the geometry object is spatially within rhs geometry. More...
 
virtual bool contains (const Geometry *const rhs) const throw (std::exception)
 It returns true if this geometry object spatially contains rhs geometry. More...
 
virtual bool overlaps (const Geometry *const rhs) const throw (std::exception)
 It returns true if this geometry object spatially overlaps rhs geometry. More...
 
virtual bool relate (const Geometry *const rhs, const std::string &matrix) const throw (std::exception)
 It returns true if this geometry object is spatially related to rhs geometry according to the pattern expressed by the intersection matrix. More...
 
virtual std::string relate (const Geometry *const rhs) const throw (std::exception)
 It returns the spatial relation between this geometry object and the rhs geometry. More...
 
virtual bool covers (const Geometry *const rhs) const throw (std::exception)
 It returns true if this geometry object spatially covers the rhs geometry. More...
 
virtual bool coveredBy (const Geometry *const rhs) const throw (std::exception)
 It returns true if this geometry object is spatially covered by rhs geometry. More...
 
virtual GeometrylocateAlong (const double &mValue) const throw (Exception)
 It returns a derived GeometryCollection value according to the specified coordinate value. More...
 
virtual GeometrylocateBetween (const double &mStart, const double &mEnd) const throw (Exception)
 It returns a derived geometry collection value according to the range of coordinate values inclusively. More...
 
Spatial Analysis

Methods that support spatial analysis.

virtual double distance (const Geometry *const rhs) const throw (std::exception)
 It returns the shortest distance between any two points in the two geometry objects. More...
 
virtual Geometrybuffer (const double &distance) const throw (std::exception)
 This method calculates the buffer of a geometry. More...
 
virtual Geometrybuffer (const double &distance, int quadrantSegments) const throw (std::exception)
 This method calculates the buffer of a geometry. More...
 
virtual Geometrybuffer (const double &distance, int quadrantSegments, BufferCapStyle endCapStyle) const throw (std::exception)
 This method calculates the buffer of a geometry. More...
 
virtual GeometryconvexHull () const throw (std::exception)
 This method calculates the Convex Hull of a geometry. More...
 
virtual Geometryintersection (const Geometry *const rhs) const throw (std::exception)
 It returns a geometric object that represents the point set intersection with another geometry. More...
 
virtual GeometryUnion (const Geometry *const rhs) const throw (std::exception)
 It returns a geometric object that represents the point set union with another geometry. More...
 
virtual Geometrydifference (const Geometry *const rhs) const throw (std::exception)
 It returns a geometric object that represents the point set difference with another geometry. More...
 
virtual GeometrysymDifference (const Geometry *const rhs) const throw (std::exception)
 It returns a geometric object that represents the point set symetric difference with another geometry. More...
 
virtual bool dWithin (const Geometry *const rhs, const double &distance) const throw (std::exception)
 It returns true if the geometries are within the specified distance. More...
 
AbstractData Re-implementation

Methods re-implemneted from AbstractData.

int getTypeCode () const
 It returns the data type code associated to the data value. More...
 
std::string toString () const
 It returns the data value in a WKT representation. More...
 

Static Public Member Functions

Auxiliary Methods

Auxiliary Methods.

static GeomType getGeomTypeId (const std::string &gtype)
 It returns the TerraLib geometry type id given a type string (the type string must be in capital letters). More...
 
static bool isGeomType (const std::string &stype)
 It tells if the given string is a geometry data type. More...
 
static void loadGeomTypeId ()
 It loads the internal MAP of geometry type names to geometry type ids. More...
 

Protected Attributes

std::vector< Geometry * > m_geometries
 The array of geometries that forms the collection. More...
 
GeomType m_gType
 Internal geometry type. More...
 
Envelopem_mbr
 The geometry minimum bounding rectangle. More...
 
int m_srid
 The Spatial Reference System code associated to the Geometry. More...
 

Static Protected Attributes

static std::map< std::string, GeomTypesm_geomTypeMap
 A set of geometry type names (in UPPER CASE). More...
 

Static Private Attributes

static const std::string sm_typeName
 Geometry type name for GeometryCollection. More...
 

Detailed Description

It is a collection of other geometric objects.

See also
Geometry, Point, Curve, LineString, LinearRing, Surface, Polygon, Triangle, PolyhedralSurface, TIN, MultiSurface, MultiCurve, MultiPoint, MultiLineString, MultiPolygon
Note
All the elements shall be in the same Spatial Reference System as the geometry collection. Although the class will not perform this check it is very important to use it to build valid geometries.

Definition at line 57 of file GeometryCollection.h.

Member Typedef Documentation

typedef void te::common::BaseVisitable< Visitor , void >::ReturnType
inherited

Definition at line 58 of file BaseVisitable.h.

typedef Visitor te::common::BaseVisitable< Visitor , void >::VisitorType
inherited

Definition at line 57 of file BaseVisitable.h.

Constructor & Destructor Documentation

te::gm::GeometryCollection::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.

Parameters
nGeomThe number of geometries in the collection. This will reserve same space in the list of geometries.
tThe internal type of the Geometry.
sridThe Spatial Reference System ID associated to the Geometry.
mbrThe minimum bounding rectangle of this geometry (i.e., its envelope). May be a NULL value.
Note
The geometry collection will take the ownership of the given mbr.
When using this constructor you must set all geometries before calling any other method (like getMBR).

Definition at line 39 of file GeometryCollection.cpp.

te::gm::GeometryCollection::GeometryCollection ( const GeometryCollection rhs)

Copy constructor.

Parameters
rhsThe other geometry.

Definition at line 45 of file GeometryCollection.cpp.

References te::common::Clone(), and m_geometries.

te::gm::GeometryCollection::~GeometryCollection ( )
virtual

Virtual destructor.

Definition at line 51 of file GeometryCollection.cpp.

References te::common::FreeContents().

Member Function Documentation

virtual ReturnType te::common::BaseVisitable< Visitor , void >::accept ( VisitorType guest) const
pure virtualinherited

It call the visit method from the guest object.

Parameters
guestThe guest or visitor.
Returns
Any valid value define by the template type R.
char * te::gm::Geometry::asBinary ( std::size_t &  size) const
throw (Exception
)
inherited

It serializes the geometric object to a Well-known Binary Representation (WKB).

Parameters
sizeThe size in bytes of the returned WKB.
Returns
The WKB representation for this object.
Exceptions
ExceptionIt will throw an exception if the operation could not be performed.
Note
The WKB will be on machine byte order.
The caller of this method will take the ownership of the returned wkb. You must use "delete [] pointer" in order to free the memory pointed by returned pointer.

Definition at line 123 of file Geometry.cpp.

References te::gm::WKBSize::size(), and te::common::Globals::sm_machineByteOrder.

std::string te::gm::Geometry::asText ( ) const
throw (
)
inherited

It returns an string with the Well-Known Text Representation for the geometry.

Returns
The WKT for the Geometry.

Definition at line 112 of file Geometry.cpp.

References te::gm::WKTWriter::write().

te::gm::Geometry * te::gm::Geometry::buffer ( const double &  distance) const
throw (std::exception
)
virtualinherited

This method calculates the buffer of a geometry.

Parameters
distanceDistance value.
Returns
A geometry representing all points less than or equal to the specified distance.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Note
The caller of this method will take the ownership of the returned geometry.
Performed by GEOS.

Definition at line 472 of file Geometry.cpp.

References te::gm::CapRoundType, and TE_GEOS_DEFAULT_QUADRANT_SEGMENTS.

Referenced by te::vp::BufferMemory::setBuffer().

te::gm::Geometry * te::gm::Geometry::buffer ( const double &  distance,
int  quadrantSegments 
) const
throw (std::exception
)
virtualinherited

This method calculates the buffer of a geometry.

Parameters
distanceDistance value.
quadrantSegmentsA specified number of segments used to approximate the curves.
Returns
A geometry representing all points less than or equal to the specified distance.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Note
The caller of this method will take the ownership of the returned geometry.
TerraLib extended method.
Performed by GEOS.

Definition at line 481 of file Geometry.cpp.

References te::gm::CapRoundType.

te::gm::Geometry * te::gm::Geometry::buffer ( const double &  distance,
int  quadrantSegments,
BufferCapStyle  endCapStyle 
) const
throw (std::exception
)
virtualinherited

This method calculates the buffer of a geometry.

As in GEOS, the quadrantSegments argument allows controlling the accuracy of the approximation by specifying the number of line segments used to represent a quadrant of a circle.

Parameters
distanceDistance value.
quadrantSegmentsA specified number of segments used to approximate the curves.
endCapStyleIt specifies the shape used at the ends of linestrings.
Returns
A geometry representing all points less than or equal to the specified distance.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Note
The caller of this method will take the ownership of the returned Geometry.
TerraLib extended method.
Performed by GEOS.

Definition at line 486 of file Geometry.cpp.

References TE_TR.

void te::gm::GeometryCollection::clear ( )

It deletes all the elements of the collection.

After calling this method you can NOT use the setGeometryN method. You will need to call setNumGeometries() again or use add().

Note
TerraLib extended method.

Definition at line 211 of file GeometryCollection.cpp.

References te::common::FreeContents().

Referenced by te::rp::SequenceMosaic::execute().

te::dt::AbstractData * te::gm::GeometryCollection::clone ( ) const
virtual

It clones the geometry collection.

Returns
A copy of the given geometry collection.
Note
The caller of this method will take the ownership of the returned geometry collection.
The cloned geometry collection will not have the MBR computed. This will save time when you are just cloning a geometry and don't intend to waste time computing the bounding box. If you have another suggestion, please, let me know.

Implements te::dt::AbstractData.

Reimplemented in te::gm::MultiPolygon, te::gm::MultiLineString, te::gm::MultiPoint, te::gm::MultiSurface, and te::gm::MultiCurve.

Definition at line 72 of file GeometryCollection.cpp.

void te::gm::GeometryCollection::computeMBR ( bool  cascade) const
throw (
)
virtual

It computes the minimum bounding rectangle for the geometry collection.

Parameters
cascadeIf true, it will update the MBR of its parts.
Note
You can use this method in order to update the MBR of the geometry collection.
TerraLib extended method.

Implements te::gm::Geometry.

Definition at line 127 of file GeometryCollection.cpp.

References te::gm::Envelope::makeInvalid().

bool te::gm::Geometry::contains ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns true if this geometry object spatially contains rhs geometry.

Parameters
rhsThe other geometry to be compared.
Returns
True if the geometry spatially contains the other geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
Performed by GEOS.

Definition at line 330 of file Geometry.cpp.

References TE_TR.

Referenced by te::edit::Repository::getFeature(), and te::gm::SatisfySpatialRelation().

te::gm::Geometry * te::gm::Geometry::convexHull ( ) const
throw (std::exception
)
virtualinherited

This method calculates the Convex Hull of a geometry.

Returns
A geometry representing the convex hull.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Note
The caller of this method will take the ownership of the returned geometry.
Performed by GEOS.

Definition at line 505 of file Geometry.cpp.

References TE_TR.

Referenced by te::gm::GTFilter::getPt1ConvexHullArea(), and te::rp::GetTPConvexHullArea().

bool te::gm::Geometry::coveredBy ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns true if this geometry object is spatially covered by rhs geometry.

Parameters
rhsThe other geometry to be compared.
Returns
True if the geometry is spatially covered by the other geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
TerraLib extended method.
This is not the same as within. See Max Egenhofer paper on 9-intersection matrix.
Performed by GEOS.

Definition at line 429 of file Geometry.cpp.

References TE_TR.

Referenced by te::gm::SatisfySpatialRelation().

bool te::gm::Geometry::covers ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns true if this geometry object spatially covers the rhs geometry.

Parameters
rhsThe other geometry to be compared.
Returns
True if the geometry spatially covers the other geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
TerraLib extended method.
This is not the same as contains. See Max Egenhofer paper on 9-intersection matrix.
Performed by GEOS.

Definition at line 410 of file Geometry.cpp.

References TE_TR.

Referenced by te::gm::SatisfySpatialRelation().

bool te::gm::Geometry::crosses ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns true if the geometry object spatially crosses rhs geometry.

Parameters
rhsThe other geometry to be compared.
Returns
True if the geometry spatially crosses the other geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
Performed by GEOS.

Definition at line 292 of file Geometry.cpp.

References TE_TR.

Referenced by te::edit::Repository::getFeature(), and te::gm::SatisfySpatialRelation().

te::gm::Geometry * te::gm::Geometry::difference ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns a geometric object that represents the point set difference with another geometry.

Parameters
rhsAnother geometry whose difference with this geometry will be calculated.
Returns
A geometry representing the difference between the geometries.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
The caller of this method will take the ownership of the returned Geometry.
Performed by GEOS.

Definition at line 567 of file Geometry.cpp.

References TE_TR.

Referenced by te::vp::BufferMemory::dissolveMemory(), te::vp::BufferQuery::dissolveQuery(), and te::vp::BufferMemory::setBuffer().

bool te::gm::Geometry::disjoint ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns true if the geometry object is spatially disjoint from rhs geometry.

Parameters
rhsThe other geometry to be compared.
Returns
True if the geometry is spatially disjoint from the other geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
Performed by GEOS.

Definition at line 235 of file Geometry.cpp.

References TE_TR.

Referenced by te::gm::SatisfySpatialRelation().

double te::gm::Geometry::distance ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns the shortest distance between any two points in the two geometry objects.

Parameters
rhsThe other geometry.
Returns
The shortest distance between any two points in the two geometries.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Note
Performed by GEOS.

Definition at line 453 of file Geometry.cpp.

References TE_TR.

Referenced by te::sa::CalculateDistance(), te::qt::widgets::Measure::calculateLength(), te::sa::GPMConstructorDistanceStrategy::constructStrategy(), te::sa::GPMConstructorAdjacencyStrategy::constructStrategy(), te::st::IDWInterpolator::estimate(), and te::gm::locateAlong().

bool te::gm::Geometry::dWithin ( const Geometry *const  rhs,
const double &  distance 
) const
throw (std::exception
)
virtualinherited

It returns true if the geometries are within the specified distance.

Parameters
rhsThe other geometry whose symetric difference with this geometry will be calculated.
distanceThe distance.
Returns
True if the geometries are within the specified distance.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Note
TerraLib extended method.
Performed by GEOS.

Definition at line 612 of file Geometry.cpp.

References TE_TR.

bool te::gm::Geometry::equals ( const Geometry *const  rhs,
const bool  exact = false 
) const
throw (std::exception
)
virtualinherited

It returns true if the geometry object is spatially equal to rhs geometry.

Parameters
rhsThe another geometry to be compared.
exactIf true checks if this geometric object has the same vertexes in the same order of rhs geometry.
Returns
True if the geometry is spatially equal to the other geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise an exception will be thrown.
Note
Performed by GEOS.

Definition at line 214 of file Geometry.cpp.

References TE_TR.

Referenced by te::gm::SatisfySpatialRelation().

te::gm::Geometry * te::gm::Geometry::getBoundary ( ) const
throw (std::exception
)
virtualinherited

It returns the geometry boundary.

Returns
The geometry that makes the boundary of this geometry. The caller of this method will take the ownership of the returned geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Note
The caller of this method will take the ownership of the returned Geometry.
Performed by GEOS.

Definition at line 202 of file Geometry.cpp.

References TE_TR.

Referenced by te::ag::Canvas::draw().

int te::gm::Geometry::getCoordinateDimension ( ) const
throw (
)
inherited

It returns the number of measurements or axes needed to describe a position in a coordinate system.

It returns:

  • 2 for a coordinate with x, y;
  • 3 for a coordinate with x, y and z or x, y and m;
  • 4 for a coordinate with x, y, z and m.
Returns
The number of measurements or axes needed to describe a position in a coordinate system.
Note
This is NOT the same as getDimension() method!

Definition at line 94 of file Geometry.cpp.

References te::gm::GetCoordDimension().

Referenced by te::gm::WKBSize::visit().

te::gm::Dimensionality te::gm::GeometryCollection::getDimension ( ) const
throw (
)
virtual

For non-homogeneous collections this method will return the largest dimension of the contained objects.

Returns
The largest dimension of the contained objects.

Implements te::gm::Geometry.

Reimplemented in te::gm::MultiSurface, te::gm::MultiCurve, and te::gm::MultiPoint.

Definition at line 77 of file GeometryCollection.cpp.

References te::gm::P.

te::gm::Geometry * te::gm::Geometry::getEnvelope ( ) const
throw (
)
inherited

It returns the minimum bounding rectangle (MBR) for the geometry.

As one can notice, the mbr is returned as a geometry, actually a polygon defined by the corner points of the bounding box [(MINX, MINY), (MAXX, MINY), (MAXX, MAXY), (MINX, MAXY), (MINX, MINY)].

Returns
The geometry envelope (or mbr).
Note
The caller of this method will take the ownership of the returned geometry.
If the MBR was not computed previously, it will compute it. Successive calls to this method will not compute the mbr anymore.

Definition at line 99 of file Geometry.cpp.

References te::gm::GetGeomFromEnvelope().

const std::vector<Geometry*>& te::gm::GeometryCollection::getGeometries ( ) const
inline

It returns a reference to the internal list of geometries.

Returns
A reference to the internal list of geometries.
Note
This method can be used by database drivers to implement its own geometry wrappers!
TerraLib extended method.

Definition at line 207 of file GeometryCollection.h.

Referenced by te::vp::GeometricOpMemory::CalculateTabularOp(), te::cl::ROISet::createROISet(), te::pgis::EWKBReader::getGeometryCollection(), te::vp::GetGeometryUnion(), te::qt::widgets::ClassifierWizardPage::getInputParams(), and te::qt::widgets::ROIManagerWidget::onPointPicked().

std::vector<Geometry*>& te::gm::GeometryCollection::getGeometries ( )
inline

It returns a reference to the internal list of geometries.

Returns
A reference to the internal list of geometries.
Note
This method can be used by database drivers to implement its own geometry wrappers!
TerraLib extended method.

Definition at line 218 of file GeometryCollection.h.

te::gm::Geometry * te::gm::GeometryCollection::getGeometryN ( std::size_t  i)

It returns the n-th geometry in this GeometryCollection.

Parameters
iThe index of the given geometry element.
Note
It doesn't check the index range.

Definition at line 186 of file GeometryCollection.cpp.

const std::string & te::gm::GeometryCollection::getGeometryType ( ) const
throw (
)
virtual

The name of the Geometry subtype is: GeometryCollection.

Returns
The name of the Geometry subtype is: GeometryCollection.

Implements te::gm::Geometry.

Reimplemented in te::gm::MultiPolygon, te::gm::MultiPoint, and te::gm::MultiLineString.

Definition at line 92 of file GeometryCollection.cpp.

GeomType te::gm::Geometry::getGeomTypeId ( ) const
throw (
)
inlineinherited

It returns the geometry subclass type identifier.

Returns
The geometry subclass type identifier
Note
Please, see GeomType enumeration for possible return values.
TerraLib extended method.

Definition at line 178 of file Geometry.h.

Referenced by terralib4::Transactor::addProperty(), te::map::AbstractLayerRenderer::buildChart(), te::map::QueryLayerRenderer::buildChart(), te::sa::CalculateDistance(), te::vp::GeometricOpMemory::CalculateTabularOp(), te::graph::RAGGraphBuilder::createVertexObjects(), te::graph::FlowGraphBuilder::createVertexObjects(), te::rst::PolygonIterator< T >::decompose(), te::edit::Renderer::draw(), te::qt::widgets::Canvas::draw(), te::ag::Canvas::draw(), te::qt::widgets::Info::drawGeometry(), te::edit::FindSegment(), te::gm::FixGeometry(), te::attributefill::VectorToVectorMemory::getAllPointsOfGeometry(), te::sa::GetArea(), te::attributefill::VectorToVectorMemory::getArea(), te::sa::GetCentroidCoord(), te::edit::GetCoordinates(), te::pgis::Transactor::getGeometryInfo(), te::vp::GetGeometryUnion(), te::vp::PolygonToLineMemory::getLines(), te::edit::GetLines(), te::addressgeocoding::AddressGeocodingOp::getLines(), te::vp::LineToPolygonMemory::getPolygons(), te::attributefill::RasterToVector::getTexture(), te::serialize::xml::Read(), te::rst::PolygonIterator< T >::setNextLine(), te::vp::GeometricOpQuery::SetOutputDSet(), te::vp::MultipartToSinglepart::single2multi(), te::gm::WKBWriter::visit(), te::pgis::EWKBWriter::visit(), te::gm::WKTWriter::visit(), Write2EWKB(), and te::gm::Write2WKB().

te::gm::GeomType te::gm::Geometry::getGeomTypeId ( const std::string &  gtype)
staticinherited

It returns the TerraLib geometry type id given a type string (the type string must be in capital letters).

Parameters
stypeThe geometry type name.
Returns
The geometry type id equivalent to the string name.
Note
If the type is unknow it returns UnknownGeometryType.

Definition at line 633 of file Geometry.cpp.

References te::gm::UnknownGeometryType.

const te::gm::Envelope * te::gm::Geometry::getMBR ( ) const
throw (
)
inherited

It returns the minimum bounding rectangle for the geometry in an internal representation.

The mbr can be constructed when reading a geometry from a database or it can be computed internally. So, if the mbr is not already set it will compute it just when this method is called. Successive calls to this method will not compute the mbr anymore.

Returns
The envelope of this geometry (i.e., the minimum bounding rectangle).
Note
It is supposed to be faster and more useful than getting the box as a polygon geometry.
TerraLib extended method.

Definition at line 104 of file Geometry.cpp.

Referenced by te::map::AbstractLayerRenderer::buildChart(), te::map::QueryLayerRenderer::buildChart(), te::edit::Repository::buildIndex(), computeDataSetEnvelope(), te::da::SpatialQueryProcessor::computeEnvelope(), te::graph::RAGGraphBuilder::createEdgeObjects(), te::rst::CropRaster(), DataSetAdapterLayerReader(), te::vp::BufferMemory::dissolveMemory(), te::vp::BufferQuery::dissolveQuery(), te::qt::widgets::Canvas::draw(), te::qt::widgets::Measure::drawPolygon(), te::rp::ClassifierDummyStrategy::execute(), te::rp::GeoMosaic::execute(), te::rp::TiePointsMosaic::execute(), te::stmem::DataSet::filter(), te::layout::MapModel::generateSystematic(), te::sqlite::DataSourceTransactor::getDataSet(), te::wcs::Transactor::getDataSet(), te::wms::Transactor::getDataSet(), te::da::SpatialQueryProcessor::getOIDSet(), te::st::Trajectory::getPatches(), te::sa::SamplePointsGeneratorStratified::getPointInGeometry(), te::rst::TileIndexer::getTileIndex(), te::rst::PolygonIterator< T >::PolygonIterator(), te::layout::Utils::remapToPlanar(), te::attributefill::RasterToVector::run(), te::layout::LineModel::setCoords(), te::layout::Utils::textBoundingBox(), and te::rst::TileIndexer::TileIndexer().

std::size_t te::gm::GeometryCollection::getNPoints ( ) const
throw (
)
virtual

it returns the number of points (vertexes) in the geometry.

Returns
The number of points (vertexes) in the geometry.
Note
TerraLib extended method.

Implements te::gm::Geometry.

Definition at line 153 of file GeometryCollection.cpp.

int te::gm::Geometry::getTypeCode ( ) const
virtualinherited

It returns the data type code associated to the data value.

Returns
The data type code associated to the data value.

Implements te::dt::AbstractData.

Definition at line 694 of file Geometry.cpp.

References te::dt::GEOMETRY_TYPE.

void te::gm::Geometry::getWkb ( char *  wkb,
te::common::MachineByteOrder  byteOrder 
) const
throw (Exception
)
inherited

It serializes the geometry to a WKB representation into the specified buffer.

The wkb parameter must have at least getWkbSize() in order to be used. Don't pass a NULL pointer or a buffer smaller than the size needed. Note that the WKB will be on the specified byte order.

Parameters
wkbThe buffer where the Geometry will be serialized.
byteOrderThe byte order used to store/serialize the geometry.
Exceptions
ExceptionIt will throw an exception if the operation could not be performed.
Note
TerraLib extended method.

Definition at line 139 of file Geometry.cpp.

References te::gm::WKBWriter::write().

Referenced by te::ado::Convert2Ado(), and te::ogr::Convert2OGR().

std::size_t te::gm::Geometry::getWkbSize ( ) const
throw (
)
inherited

It returns the size required by a WKB representation for this geometric object.

This is the preferred method for creating a WKB. First of all, it gives you the possibility to use a pre-allocated buffer. So, this method can be used in conjunction with the getWkb method.

Returns
The size required by a WKB representation for the geometry object.
Note
TerraLib extended method.

Definition at line 134 of file Geometry.cpp.

References te::gm::WKBSize::size().

Referenced by te::pgis::PreparedQuery::bind(), te::ado::Convert2Ado(), te::ogr::Convert2OGR(), and te::pgis::Convert2PostGIS().

te::gm::Geometry * te::gm::Geometry::intersection ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns a geometric object that represents the point set intersection with another geometry.

Parameters
rhsThe other Geometry whose intersection with this Geometry will be calculated.
Returns
A Geometry representing the intersection with this Geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
The caller of this method will take the ownership of the returned Geometry.
Performed by GEOS.

Definition at line 521 of file Geometry.cpp.

References TE_TR.

Referenced by te::rst::LineIterator< T >::LineIterator(), and te::rst::PolygonIterator< T >::setNextLine().

bool te::gm::Geometry::intersects ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns true if the geometry object spatially intersects rhs geometry.

Parameters
rhsThe other geometry to be compared.
Returns
True if the geometry intersects the other geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
Performed by GEOS.

Definition at line 254 of file Geometry.cpp.

References TE_TR.

Referenced by te::vp::BufferMemory::dissolveMemory(), te::vp::BufferQuery::dissolveQuery(), te::rp::ClassifierDummyStrategy::execute(), te::st::Trajectory::getPatches(), and te::gm::SatisfySpatialRelation().

bool te::gm::Geometry::is3D ( ) const
throw (
)
inherited

It returns true if this geometric object has z coordinate values.

Returns
True if this geometric object has z coordinate values.

Definition at line 180 of file Geometry.cpp.

bool te::gm::Geometry::isEmpty ( ) const
throw (std::exception
)
virtualinherited

It returns true if this geometric object is the empty Geometry.

If true, then this geometric object represents the empty point set for the coordinate space.

Returns
True if this geometric object is the empty Geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Note
Performed by GEOS.

Definition at line 144 of file Geometry.cpp.

References TE_TR.

Referenced by te::rst::PolygonIterator< T >::setNextLine().

bool te::gm::Geometry::isGeomType ( const std::string &  stype)
staticinherited

It tells if the given string is a geometry data type.

Parameters
stypeThe geometry type to be checked.
Returns
True if the given string corresponds to a geometry type.

Definition at line 643 of file Geometry.cpp.

References te::gm::UnknownGeometryType.

Referenced by te::sqlite::Convert2TerraLib().

bool te::gm::Geometry::isMeasured ( ) const
throw (
)
inherited

It returns true if this geometric object has m coordinate values.

Returns
True if this geometric object has m coordinate values.

Definition at line 191 of file Geometry.cpp.

bool te::gm::Geometry::isSimple ( ) const
throw (std::exception
)
virtualinherited

It returns true if this geometric object has no anomalous points, such as self intersection or self tangency.

See the ISO and OGC documentation for an explanation about specific conditions of each type of geometry to be considered not simple.

Returns
True if this geometric object has no anomalous geometric points.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Note
Performed by GEOS.

Definition at line 156 of file Geometry.cpp.

References TE_TR.

bool te::gm::Geometry::isValid ( ) const
throw (std::exception
)
virtualinherited

It tells if the geometry is well formed.

Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Note
TerraLib extended method.
Performed by GEOS.

Definition at line 168 of file Geometry.cpp.

References TE_TR.

Referenced by te::attributefill::VectorToVectorMemory::checkGeometries(), te::vp::BufferMemory::dissolveMemory(), te::vp::BufferQuery::dissolveQuery(), te::attributefill::VectorToVectorMemory::getIntersections(), te::vp::GeometricOpMemory::SetAggregByAttribute(), te::vp::BufferMemory::setBuffer(), and te::vp::GeometricOpQuery::SetOutputDSet().

virtual Geometry* te::gm::Geometry::locateAlong ( const double &  mValue) const
throw (Exception
)
inlinevirtualinherited

It returns a derived GeometryCollection value according to the specified coordinate value.

Parameters
mValueThe coordinate value.
Returns
A GeometryCollection value.
Exceptions
ExceptionIt will throw an exception if the operation could not be performed.
Note
The caller of this method will take the ownership of the returned geometry.
This method only applies to Point and Line geometries, including homogeneu collections of points or lines. For polygons this will return a NULL value.

Definition at line 611 of file Geometry.h.

te::gm::Geometry * te::gm::Geometry::locateBetween ( const double &  mStart,
const double &  mEnd 
) const
throw (Exception
)
virtualinherited

It returns a derived geometry collection value according to the range of coordinate values inclusively.

Parameters
mStartThe initial coordinate value.
mEndThe final coordinate value.
Returns
A GeometryCollection value.
Exceptions
ExceptionIt will throw an exception if the operation could not be performed.
Note
This method only applies to Point and Line geometries, including homogeneous collections of points or lines. For polygons this will return a NULL value.
The caller of this method will take the ownership of the returned Geometry.

Reimplemented in te::gm::LineString, te::gm::CircularString, te::gm::CompoundCurve, te::gm::MultiPoint, te::gm::PointM, te::gm::PointZM, and te::gm::MultiLineString.

Definition at line 448 of file Geometry.cpp.

te::gm::GeometryCollection & te::gm::GeometryCollection::operator= ( const GeometryCollection rhs)

Assignment operator.

Parameters
rhsThe other geometry.
Returns
A reference for this.

Definition at line 56 of file GeometryCollection.cpp.

References te::common::Clone(), te::common::FreeContents(), m_geometries, and te::gm::Geometry::operator=().

Referenced by te::gm::MultiCurve::operator=(), te::gm::MultiSurface::operator=(), and te::gm::MultiPoint::operator=().

bool te::gm::Geometry::overlaps ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns true if this geometry object spatially overlaps rhs geometry.

Parameters
rhsThe other geometry to be compared.
Returns
True if the geometry spatially overlaps the other geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
Performed by GEOS.

Definition at line 349 of file Geometry.cpp.

References TE_TR.

Referenced by te::gm::SatisfySpatialRelation().

bool te::gm::Geometry::relate ( const Geometry *const  rhs,
const std::string &  matrix 
) const
throw (std::exception
)
virtualinherited

It returns true if this geometry object is spatially related to rhs geometry according to the pattern expressed by the intersection matrix.

It does this by testing for intersections between the interior, boundary and exterior of the two geometric objects as specified by the values in the matrix.

Parameters
rhsThe other geometry to be compared.
matrixThe intersection matrix.
Returns
True if the geometry is spatially related to the other geometry according to the pattern expressed by the intersection matrix.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
Performed by GEOS.

Definition at line 368 of file Geometry.cpp.

References TE_TR.

std::string te::gm::Geometry::relate ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns the spatial relation between this geometry object and the rhs geometry.

Parameters
rhsThe another geometry to be compared.
Returns
A string where each byte is a intersection in the pattern intersection matrix of the relationship of the two objects.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
TerraLib extended method.
This method will be handy when you don't know the spatial relation in advance.
Performed by GEOS.

Definition at line 389 of file Geometry.cpp.

References TE_TR.

void te::gm::GeometryCollection::removeGeometryN ( std::size_t  i)

It removes the n-th geometry in this geometry collection.

Parameters
iThe index of the geometry element we want to remove.
Note
It doesn't check the index range.
TerraLib extended method.

Definition at line 199 of file GeometryCollection.cpp.

void te::gm::GeometryCollection::setGeometryN ( std::size_t  i,
Geometry g 
)

It sets the n-th geometry in this geometry collection.

GeometryCollection will take the ownership of the informed geometry. If there is a geometry in the given position it will be released before stting the new one.

Parameters
iThe index of the given geometry element.
gThe geometry that will be placed on the position indicated by index.
Note
It doesn't check the index range.
Geometry collection will take the ownership of the informed geometry.
TerraLib extended method.

Definition at line 192 of file GeometryCollection.cpp.

Referenced by te::gm::WKTActions::buildGeometryCollection(), te::gm::WKTActions::buildMultiLineString(), te::gm::WKTActions::buildMultiPoint(), te::gm::WKTActions::buildMultiPolygon(), te::gm::WKBReader::getGeometryCollection(), te::vp::GetGeometryUnion(), te::vp::AggregationQuery::run(), and te::vp::GeometricOpQuery::SetOutputDSet().

void te::gm::GeometryCollection::setNumGeometries ( std::size_t  size)

It sets the number of geometries in this GeometryCollection.

Parameters
sizeThe new number of geometries for the GeometryCollection.
Note
If size is smaller than the current GeometryCollection size, the content is reduced to its first size elements, the rest being just dropped (the deallocation of geometries is done automatically).
If size is greater than the current GeometryCollection size, the content is expanded by inserting at the end NULL pointers to geometries as needed.
You must assure that all nGeom geometries are set before calling any other method (like getMBR).
TerraLib extended method.

Definition at line 168 of file GeometryCollection.cpp.

void te::gm::GeometryCollection::setSRID ( int  srid)
throw (
)
virtual

It sets the Spatial Reference System ID of the geometry collection and all its parts.

Parameters
sridThe Spatial Reference System ID to be associated to the geometric object.
Note
TerraLib extended method.

Implements te::gm::Geometry.

Definition at line 97 of file GeometryCollection.cpp.

Referenced by te::rp::SequenceMosaic::execute(), and te::vp::MultipartToSinglepart::single2multi().

te::gm::Geometry * te::gm::Geometry::symDifference ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns a geometric object that represents the point set symetric difference with another geometry.

Parameters
rhsThe other geometry whose symetric difference with this geometry will be calculated.
Returns
A geometry representing the symetric difference with this geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
The caller of this method will take the ownership of the returned Geometry.
Performed by GEOS.

Definition at line 590 of file Geometry.cpp.

References TE_TR.

std::string te::gm::Geometry::toString ( void  ) const
inlinevirtualinherited
bool te::gm::Geometry::touches ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns true if the geometry object spatially touches rhs geometry.

Parameters
rhsThe other geometry to be compared.
Returns
True if the geometry spatially touches the other geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
Performed by GEOS.

Definition at line 273 of file Geometry.cpp.

References TE_TR.

Referenced by te::gm::SatisfySpatialRelation().

void te::gm::GeometryCollection::transform ( int  srid)
throw (te::common::Exception
)
virtual

It will transform the coordinates of the geometry collection to the new one.

After calling this method the geometry collection will be associated to the new SRID.

Parameters
sridThe new Spatial Reference System ID used to transform the coordinates of the geometry collection.
Exceptions
ExceptionIt will throw an exception if it can not do the transformation.
Note
The geometry collection must be associated to a valid SRID before calling this method.
If the geometry collection already has an associated MBR, it will automatically update it (i. e. automatically recompute it).
TerraLib extended method.

Implements te::gm::Geometry.

Definition at line 107 of file GeometryCollection.cpp.

References TE_TR.

te::gm::Geometry * te::gm::Geometry::Union ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns a geometric object that represents the point set union with another geometry.

Parameters
rhsAnother geometry whose union with this geometry will be calculated.
Returns
A geometry representing the union with this geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
The caller of this method will take the ownership of the returned Geometry.
Performed by GEOS.

Definition at line 544 of file Geometry.cpp.

References TE_TR.

Referenced by te::vp::BufferMemory::dissolveMemory(), te::vp::BufferQuery::dissolveQuery(), te::rp::SequenceMosaic::execute(), te::vp::GetGeometryUnion(), te::qt::widgets::ClippingWizardPage::getLayerClipping(), and te::addressgeocoding::AddressGeocodingOp::getLineString().

bool te::gm::Geometry::within ( const Geometry *const  rhs) const
throw (std::exception
)
virtualinherited

It returns true if the geometry object is spatially within rhs geometry.

Parameters
rhsThe other geometry to be compared.
Returns
True if the geometry is spatially within the other geometry.
Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Warning
Don't call this method for a Heterogeneous GeometryCollection, otherwise, an exception will be thrown.
Note
Performed by GEOS.

Definition at line 311 of file Geometry.cpp.

References TE_TR.

Referenced by te::graph::LayerRenderer::drawMemoryGraph(), te::sa::SamplePointsGeneratorStratified::getPointInGeometry(), and te::gm::SatisfySpatialRelation().

Member Data Documentation

std::vector<Geometry*> te::gm::GeometryCollection::m_geometries
protected

The array of geometries that forms the collection.

Definition at line 321 of file GeometryCollection.h.

Referenced by GeometryCollection(), and operator=().

GeomType te::gm::Geometry::m_gType
protectedinherited

Internal geometry type.

Definition at line 864 of file Geometry.h.

Referenced by te::gm::CircularString::CircularString(), te::gm::LineString::LineString(), and te::gm::Geometry::operator=().

Envelope* te::gm::Geometry::m_mbr
mutableprotectedinherited

The geometry minimum bounding rectangle.

Definition at line 866 of file Geometry.h.

Referenced by te::gm::Geometry::~Geometry().

int te::gm::Geometry::m_srid
protectedinherited

The Spatial Reference System code associated to the Geometry.

Definition at line 865 of file Geometry.h.

std::map< std::string, te::gm::GeomType > te::gm::Geometry::sm_geomTypeMap
staticprotectedinherited

A set of geometry type names (in UPPER CASE).

Definition at line 868 of file Geometry.h.

const std::string te::gm::GeometryCollection::sm_typeName
staticprivate

Geometry type name for GeometryCollection.

Definition at line 325 of file GeometryCollection.h.


The documentation for this class was generated from the following files: