te::gm::LineString Class Referenceabstract

LineString is a curve with linear interpolation between points. More...

#include <LineString.h>

Inheritance diagram for te::gm::LineString:
te::gm::Curve te::gm::Geometry te::dt::AbstractData te::common::BaseVisitable< Visitor > te::gm::Line te::gm::LinearRing

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.

 LineString (GeomType t, int srid=0, Envelope *mbr=0)
 It initializes the linestring with the specified spatial reference system id and envelope. More...
 
 LineString (std::size_t size, GeomType t, int srid=0, Envelope *mbr=0)
 It initializes the linestring with the specified spatial reference system id and envelope. More...
 
 LineString (const LineString &rhs)
 Copy constructor. More...
 
virtual ~LineString ()
 Virtual destructor. More...
 
virtual LineStringoperator= (const LineString &rhs)
 Assignment operator. More...
 
Re-Implementation from AbstractData

Methods re-Implementated from AbstractData.

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

Re-Implmentation of basic methods from Geometry class.

const std::string & getGeometryType () const throw ()
 The name of instantiable subtype is: LineString. More...
 
void setSRID (int srid) throw ()
 It sets the Spatial Reference System ID of the linestring. More...
 
void transform (int srid) throw (te::common::Exception)
 It converts the coordinate values of the linestring to the new spatial reference system. More...
 
void computeMBR (bool cascade) const throw ()
 It computes the minimum bounding rectangle for the linestring. More...
 
std::size_t getNPoints () const throw ()
 It returns the number of points (vertexes) in the linestring. More...
 
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...
 
Re-Implementation from Curve

Methods re-impleented from Curve.

PointgetStartPoint () const
 The length of this Curve in its associated spatial reference. More...
 
PointgetEndPoint () const
 It returns the curve end point. More...
 
bool isClosed () const
 It returns true if the curve is closed (startPoint = endPoint). More...
 
LineString Specific Methods

Specific methods for a LineString.

std::size_t size () const
 It returns the number of points (vertexes) in the geometry. More...
 
void setNumCoordinates (std::size_t size)
 It reserves room for the number of coordinates in this LineString. More...
 
void makeEmpty ()
 It clears all the coordinates. More...
 
PointgetPointN (std::size_t i) const
 It returns the specified point in this LineString. More...
 
void setPointN (std::size_t i, const Point &p)
 It sets the value of the specified point to this new one. More...
 
void setPoint (std::size_t i, const double &x, const double &y)
 It sets the value of the specified point. More...
 
void setPointZ (std::size_t i, const double &x, const double &y, const double &z)
 It sets the value of the specified point. More...
 
void setPointM (std::size_t i, const double &x, const double &y, const double &m)
 It sets the value of the specified point. More...
 
void setPointZM (std::size_t i, const double &x, const double &y, const double &z, const double &m)
 It sets the value of the specified point. More...
 
const double & getX (std::size_t i) const
 It returns the n-th x coordinate value. More...
 
const double & getY (std::size_t i) const
 It returns the n-th y coordinate value. More...
 
const double & getZ (std::size_t i) const
 It returns the n-th z coordinate value. More...
 
const double & getM (std::size_t i) const
 It returns the n-th m measure value. More...
 
void setX (std::size_t i, const double &x)
 It sets the n-th x coordinate value. More...
 
void setY (std::size_t i, const double &y)
 It sets the n-th y coordinate value. More...
 
void setZ (std::size_t i, const double &z)
 It sets the n-th z coordinate value. More...
 
void setM (std::size_t i, const double &m)
 It sets the n-th m measure value. More...
 
Coord2DgetCoordinates () const
 It returns a pointer to the internal array of coordinates. More...
 
double * getZ () const
 It returns a pointer to the internal array of z-values. More...
 
double * getM () const
 It returns a pointer to the internal array of m-values. More...
 
Curve Specific Methods

Specific methods for a Curve.

virtual double getLength () const
 The length of this curve in the unit associated to its spatial reference system. More...
 
bool isRing () const
 It returns true if the curve is closed and simple. More...
 
Re-Implmentation of methods from Geometry class

Re-Implmentation of basic methods from Geometry class.

Dimensionality getDimension () const throw ()
 Curves are 1-dimensional objects. 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...
 
virtual const std::string get2DGeometryType () const throw ()
 It returns the name of 2D geometry subclass. More...
 
virtual GeomType get2DGeomTypeId () const throw ()
 It returns the 2D 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...
 
bool isCollection () const throw ()
 It returns true if this geometric object is a collection. More...
 
virtual GeometrygetBoundary () const throw (std::exception)
 It returns the geometry boundary. More...
 
te::gm::Coord2D getCentroid () const throw (std::exception)
 It will get the centroid of the input geometries. 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...
 
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 std::string getGeomTypeString (const int &gId)
 It returns the TerraLib geometry type string given a type id. 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

Coord2Dm_coords
 A pointer to x, y values. More...
 
GeomType m_gType
 Internal geometry type. More...
 
double * m_mA
 A pointer to m values. More...
 
Envelopem_mbr
 The geometry minimum bounding rectangle. More...
 
std::size_t m_nPts
 The number of coordinates of the LineString. More...
 
int m_srid
 The Spatial Reference System code associated to the Geometry. More...
 
double * m_zA
 A pointer to z values. 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
 

Detailed Description

LineString is a curve with linear interpolation between points.

In a linestring each consecutive pair of points defines a line segment. Internally, we store an array of coordinates and separate arrays for points with z and m. All OGC interface is supported based on points through the method getPointN. But the extended methods, for coordinates, will be faster than the same versions of OGC methods because they work with less complex structures (coordinates) than points.

Note
A LineString must have at least two coordinates, otherwise, its methods must not be called.
See also
Geometry, AbstractPoint, Point, PointM, PointZ, PointZM, PointKd, Curve, Line, LinearRing, CircularString, CompoundCurve, Surface, Polygon, Triangle, CurvePolygon, PolyhedralSurface, TIN, GeometryCollection, MultiSurface, MultiCurve, MultiPoint, MultiLineString, MultiPolygon

Definition at line 62 of file LineString.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::LineString::LineString ( GeomType  t,
int  srid = 0,
Envelope mbr = 0 
)

It initializes the linestring with the specified spatial reference system id and envelope.

Parameters
tThe internal type of the linestring.
sridThe Spatial Reference System ID associated to the linestring.
mbrThe minimum bounding rectangle of this geometry (i.e., its envelope).
Note
The linestring will take the ownership of the given mbr.
te::gm::LineString::LineString ( std::size_t  size,
GeomType  t,
int  srid = 0,
Envelope mbr = 0 
)

It initializes the linestring with the specified spatial reference system id and envelope.

Parameters
sizeThe number of points in the LineString. It must be a value greater than 0.
tThe internal type of the linestring.
sridThe Spatial Reference System ID associated to the linestring.
mbrThe minimum bounding rectangle of this geometry (i.e., its envelope).
Note
The linestring will take the ownership of the given mbr.
te::gm::LineString::LineString ( const LineString rhs)

Copy constructor.

Parameters
rhsThe other geometry.
virtual te::gm::LineString::~LineString ( )
virtual

Virtual destructor.

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.
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.
virtual 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.
virtual 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.
virtual 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.
virtual te::dt::AbstractData* te::gm::LineString::clone ( ) const
virtual

It clones the linestring.

Returns
A copy of the given linestring.
Note
The caller of this method will take the ownership of the returned linestring.
The cloned linestring 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::LinearRing, and te::gm::Line.

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

It computes the minimum bounding rectangle for the linestring.

Parameters
cascadeFor linestring this flag doesn't have effect.
Note
You can use this method in order to update the MBR of the linestring.
TerraLib extended method.

Implements te::gm::Geometry.

virtual 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.
virtual 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.

Referenced by te::rp::GetTPConvexHullArea().

virtual 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.
virtual 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.
virtual 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.
virtual 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.
virtual 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.
virtual 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.
virtual 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.
virtual 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.
virtual const std::string te::gm::Geometry::get2DGeometryType ( ) const
throw (
)
virtualinherited

It returns the name of 2D geometry subclass.

The name of the 2D geometry subclass may be one of the following:

Returns
The name of the geometry subclass type ide.
virtual GeomType te::gm::Geometry::get2DGeomTypeId ( ) const
throw (
)
virtualinherited

It returns the 2D geometry subclass type identifier.

  • GeometryType = 0
  • PointType = 1
  • LineStringType = 2
  • PolygonType = 3
  • MultiPointType = 4
  • MultiLineStringType = 5
  • MultiPolygonType = 6
  • GeometryCollectionType = 7
  • CircularStringType = 8
  • CompoundCurveType = 9
  • CurvePolygonType = 10
  • MultiSurfaceType = 12
Returns
The 2D geometry subclass type identifier
Note
Please, see GeomType enumeration for possible return values.
TerraLib extended method.
virtual 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.
te::gm::Coord2D te::gm::Geometry::getCentroid ( ) const
throw (std::exception
)
inherited

It will get the centroid of the input geometries.

Exceptions
std::exceptionIt will throw an exception if the operation could not be performed.
Returns
a Point containing the centroid coord.
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!
Coord2D* te::gm::LineString::getCoordinates ( ) const
inline

It returns a pointer to the internal array of coordinates.

Returns
A pointer to the internal array of coordinates.
Warning
Don't use this method unless you know exactly what you're doing!
Note
TerraLib extended method.

Definition at line 456 of file LineString.h.

Dimensionality te::gm::Curve::getDimension ( ) const
throw (
)
virtualinherited

Curves are 1-dimensional objects.

Returns
1-dimensional.

Implements te::gm::Geometry.

Point* te::gm::LineString::getEndPoint ( ) const
virtual

It returns the curve end point.

Returns
The curve end point.
Note
The caller of this method will take the ownership of the point geometry.

Implements te::gm::Curve.

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

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.
const std::string& te::gm::LineString::getGeometryType ( ) const
throw (
)
virtual

The name of instantiable subtype is: LineString.

Returns
The name of instantiable subtype is: LineString.

Implements te::gm::Geometry.

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 179 of file Geometry.h.

static 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
gtypeThe geometry type name.
Returns
The geometry type id equivalent to the string name.
Note
If the type is unknow it returns UnknownGeometryType.
static std::string te::gm::Geometry::getGeomTypeString ( const int &  gId)
staticinherited

It returns the TerraLib geometry type string given a type id.

Parameters
gIdThe geometry type id.
Returns
The geometry type string equivalent to the id.
Note
If the type is unknow it returns UNKNOWGEOMETRYTYPE.
virtual double te::gm::Curve::getLength ( ) const
virtualinherited

The length of this curve in the unit associated to its spatial reference system.

Returns
The length of this Curve in the unit associated to its spatial reference system.

Reimplemented in te::gm::CircularString, and te::gm::CompoundCurve.

const double& te::gm::LineString::getM ( std::size_t  i) const

It returns the n-th m measure value.

Parameters
iThe n-th coordinate.
Returns
The n-th m measure value.
Note
Don't call this method if the LineString doesn't have M coordinate values.
TerraLib extended method.
double* te::gm::LineString::getM ( ) const
inline

It returns a pointer to the internal array of m-values.

Returns
A pointer to the internal array of m-values.
Warning
Don't use this method unless you know exactly what you're doing!
Note
TerraLib extended method.

Definition at line 484 of file LineString.h.

const 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.

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

std::size_t te::gm::LineString::getNPoints ( ) const
throw (
)
inlinevirtual

It returns the number of points (vertexes) in the linestring.

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

Implements te::gm::Geometry.

Definition at line 193 of file LineString.h.

Point* te::gm::LineString::getPointN ( std::size_t  i) const

It returns the specified point in this LineString.

Parameters
iThe index of the point you want to retrieve.
Returns
The specified point in this LineString.
Note
The caller of this method will take the ownership of the point geometry.
This method doesn't check the index range.
int te::gm::Geometry::getSRID ( ) const
throw (
)
inlineinherited

It returns the Spatial Reference System ID associated to this geometric object.

This value can be used to identify the associated Spatial Reference System.

Returns
The Spatial Reference System ID associated to this geometric object.
Note
When not set this value will be -1.

Definition at line 239 of file Geometry.h.

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

Point* te::gm::LineString::getStartPoint ( ) const
virtual

The length of this Curve in its associated spatial reference.

Returns
The length of this Curve in its associated spatial reference.

It returns the curve start point.

Returns
The curve start point.
Note
The caller of this method will take the ownership of the point geometry.

Implements te::gm::Curve.

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

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.

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.
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.
const double& te::gm::LineString::getX ( std::size_t  i) const

It returns the n-th x coordinate value.

Parameters
iThe n-th coordinate.
Returns
The n-th x coordinate value.
Note
TerraLib extended method.

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

const double& te::gm::LineString::getY ( std::size_t  i) const

It returns the n-th y coordinate value.

Parameters
iThe n-th coordinate.
Returns
The n-th y coordinate value.
Note
TerraLib extended method.

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

const double& te::gm::LineString::getZ ( std::size_t  i) const

It returns the n-th z coordinate value.

Parameters
iThe n-th coordinate.
Returns
The n-th z coordinate value.
Note
Don't call this method if the LineString doesn't have Z coordinate values.
TerraLib extended method.
double* te::gm::LineString::getZ ( ) const
inline

It returns a pointer to the internal array of z-values.

Returns
A pointer to the internal array of z-values.
Warning
Don't use this method unless you know exactly what you're doing!
Note
TerraLib extended method.

Definition at line 470 of file LineString.h.

virtual 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.

Referenced by te::rst::LineIterator< T >::LineIterator().

virtual 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.
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.
bool te::gm::LineString::isClosed ( ) const
virtual

It returns true if the curve is closed (startPoint = endPoint).

Returns
True if the curve is closed (startPoint = endPoint).
Warning
The line must have at least 2 points.

Implements te::gm::Curve.

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

It returns true if this geometric object is a collection.

Returns
True if this geometric object is a collection.
virtual 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.
static 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.
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.
bool te::gm::Curve::isRing ( ) const
inherited

It returns true if the curve is closed and simple.

Returns
True if the curve is closed and simple.
Warning
If you just want to know if the first and last points are the same, call isClosed() it is computationally less intensive.
virtual 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.
virtual 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.
static void te::gm::Geometry::loadGeomTypeId ( )
staticinherited

It loads the internal MAP of geometry type names to geometry type ids.

Warning
Ths method will be automatically called when geometry module is initialized!
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 677 of file Geometry.h.

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

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.
Note
The caller of this method will take the ownership of geometry.

Reimplemented from te::gm::Geometry.

void te::gm::LineString::makeEmpty ( )

It clears all the coordinates.

After calling this method you can not use the set methods. You will need to use the setNumCoordinates method in order to use the set methods.

Note
TerraLib extended method.
virtual LineString& te::gm::LineString::operator= ( const LineString rhs)
virtual

Assignment operator.

Parameters
rhsThe other geometry.
Returns
A reference for this.
virtual 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.
virtual 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.
virtual 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.
void te::gm::LineString::setM ( std::size_t  i,
const double &  m 
)

It sets the n-th m measure value.

Parameters
iThe coordinate index.
mThe m value.
Note
Don't call this method if the LineString doesn't have M coordinate values.
TerraLib extended method.
void te::gm::LineString::setNumCoordinates ( std::size_t  size)

It reserves room for the number of coordinates in this LineString.

Parameters
sizeThe number of coordinates reserved for the LineString.
Note
TerraLib extended method.
void te::gm::LineString::setPoint ( std::size_t  i,
const double &  x,
const double &  y 
)

It sets the value of the specified point.

Parameters
iThe index where the point will be set to the new value.
xThe x coordinate value.
yThe y coordinate value.
Note
TerraLib extended method.
void te::gm::LineString::setPointM ( std::size_t  i,
const double &  x,
const double &  y,
const double &  m 
)

It sets the value of the specified point.

Parameters
iThe index where the point will be set to the new value.
xThe x coordinate value.
yThe y coordinate value.
mThe m coordinate value.
Note
TerraLib extended method.
void te::gm::LineString::setPointN ( std::size_t  i,
const Point p 
)

It sets the value of the specified point to this new one.

Parameters
iThe index where the point will be set to the new value.
pThe new point value.
Note
TerraLib extended method.
void te::gm::LineString::setPointZ ( std::size_t  i,
const double &  x,
const double &  y,
const double &  z 
)

It sets the value of the specified point.

Parameters
iThe index where the point will be set to the new value.
xThe x coordinate value.
yThe y coordinate value.
zThe z coordinate value.
Note
TerraLib extended method.
void te::gm::LineString::setPointZM ( std::size_t  i,
const double &  x,
const double &  y,
const double &  z,
const double &  m 
)

It sets the value of the specified point.

Parameters
iThe index where the point will be set to the new value.
xThe x coordinate value.
yThe y coordinate value.
zThe z coordinate value.
mThe m coordinate value.
Note
TerraLib extended method.
void te::gm::LineString::setSRID ( int  srid)
throw (
)
virtual

It sets the Spatial Reference System ID of the linestring.

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

Implements te::gm::Geometry.

void te::gm::LineString::setX ( std::size_t  i,
const double &  x 
)

It sets the n-th x coordinate value.

Parameters
iThe coordinate index.
xThe x value.
Note
TerraLib extended method.
void te::gm::LineString::setY ( std::size_t  i,
const double &  y 
)

It sets the n-th y coordinate value.

Parameters
iThe coordinate index.
yThe y value.
Note
TerraLib extended method.
void te::gm::LineString::setZ ( std::size_t  i,
const double &  z 
)

It sets the n-th z coordinate value.

Parameters
iThe coordinate index.
zThe z value.
Note
Don't call this method if the LineString doesn't have Z coordinate values.
TerraLib extended method.
std::size_t te::gm::LineString::size ( ) const
inline

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

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

Definition at line 262 of file LineString.h.

virtual 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.
std::string te::gm::Geometry::toString ( void  ) const
inlinevirtualinherited

It returns the data value in a WKT representation.

Returns
The data value in a WKT representation.

Implements te::dt::AbstractData.

Definition at line 935 of file Geometry.h.

virtual 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.
void te::gm::LineString::transform ( int  srid)
throw (te::common::Exception
)
virtual

It converts the coordinate values of the linestring to the new spatial reference system.

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

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

Implements te::gm::Geometry.

virtual 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.
virtual 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.

Member Data Documentation

Coord2D* te::gm::LineString::m_coords
protected

A pointer to x, y values.

Definition at line 493 of file LineString.h.

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

Internal geometry type.

Definition at line 941 of file Geometry.h.

double* te::gm::LineString::m_mA
protected

A pointer to m values.

Definition at line 495 of file LineString.h.

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

The geometry minimum bounding rectangle.

Definition at line 943 of file Geometry.h.

std::size_t te::gm::LineString::m_nPts
protected

The number of coordinates of the LineString.

Definition at line 496 of file LineString.h.

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

The Spatial Reference System code associated to the Geometry.

Definition at line 942 of file Geometry.h.

double* te::gm::LineString::m_zA
protected

A pointer to z values.

Definition at line 494 of file LineString.h.

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

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

Definition at line 945 of file Geometry.h.

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

Definition at line 500 of file LineString.h.


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