te::rst::PolygonIterator< T > Class Template Reference

This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a polygon. More...

#include <PositionIterator.h>

Inheritance diagram for te::rst::PolygonIterator< T >:
te::rst::AbstractPositionIterator< T >

Public Member Functions

unsigned int getColumn () const
 Returns the current column in iterator. More...
 
unsigned int getRow () const
 Returns the current row in iterator. More...
 
virtual bool operator!= (const AbstractPositionIterator &rhs) const
 Difference operator. More...
 
bool operator!= (const PolygonIterator< T > &rhs) const
 
std::complex< T > operator() (const unsigned int i) const
 Returns the complex value in current position (column, row, band) from iterator. More...
 
const std::vector< T > operator* () const
 Returns a vector of the values in current position (column, row) from iterator. More...
 
void operator++ ()
 Advances to the next position. More...
 
void operator-- ()
 Returns to the previous position. More...
 
PolygonIteratoroperator= (const PolygonIterator &rhs)
 
operator[] (const unsigned int i) const
 Returns the real value in current position (column, row, band) from iterator. More...
 
 PolygonIterator ()
 
 PolygonIterator (const te::rst::Raster *r, const te::gm::Polygon *p)
 Constructor. More...
 
 PolygonIterator (const PolygonIterator &rhs)
 Copy constructor. More...
 
void setEnd ()
 Sets the iterator position to the end of the current band. More...
 
void setNextLine (bool updatecurrline=true)
 
 ~PolygonIterator ()
 

Static Public Member Functions

static PolygonIterator begin (const te::rst::Raster *r, const te::gm::Polygon *p)
 Returns an iterator referring to the first value of the band. More...
 
static PolygonIterator end (const te::rst::Raster *r, const te::gm::Polygon *p)
 Returns an iterator referring to after the end of the iterator. More...
 

Protected Member Functions

void clear ()
 Clear all internal allocated objects and reset back to the initial state. More...
 
void decompose (te::gm::Geometry const *const g, std::vector< te::gm::LineString * > &decomposedGeoms) const
 Decomponse one geometry collection in a vector of basic components (line, point). More...
 

Protected Attributes

int m_actualintersection
 The actual line of the iterator. More...
 
int m_column
 The current column of the iterator. More...
 
te::gm::Linem_currline
 The current line in the iterator. More...
 
int m_endingcolumn
 The column (in current line) to finalize the iteration. More...
 
int m_endingrow
 The ending row of the iteration. More...
 
std::vector< te::gm::LineString * > m_intersections
 The points or lines of the intersection between the geometry and the current line. More...
 
int m_maxcolumns
 The number of columns in band. More...
 
int m_maxrows
 The number of rows in band. More...
 
int m_nintersections
 The number number of intersected lines in current line of the iterator. More...
 
double m_operatorBrackets_value
 Used by the operator[] method. More...
 
std::complex< double > m_operatorParenthesis_value
 Used by the operator() method. More...
 
const te::gm::Polygonm_polygon
 The spatial restriction to be applied in the iterator. More...
 
const te::rst::Rasterm_raster
 The band from where to get the values. More...
 
int m_row
 The current row of the iterator. More...
 
int m_startingcolumn
 The starting column (in current line) to initialize the iteration. More...
 
int m_startingrow
 The starting row of the iteration. More...
 

Detailed Description

template<class T>
class te::rst::PolygonIterator< T >

This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a polygon.

Definition at line 157 of file PositionIterator.h.

Constructor & Destructor Documentation

template<class T >
te::rst::PolygonIterator< T >::PolygonIterator ( )

Definition at line 412 of file PositionIterator.h.

template<class T >
te::rst::PolygonIterator< T >::PolygonIterator ( const PolygonIterator< T > &  rhs)

Copy constructor.

Parameters
rhsThe right-hand-side copy used to copy from.

Definition at line 487 of file PositionIterator.h.

References te::rst::PolygonIterator< T >::operator=().

template<class T >
te::rst::PolygonIterator< T >::~PolygonIterator ( )

Definition at line 505 of file PositionIterator.h.

References te::rst::PolygonIterator< T >::clear().

Member Function Documentation

template<class T >
te::rst::PolygonIterator< T > te::rst::PolygonIterator< T >::begin ( const te::rst::Raster r,
const te::gm::Polygon p 
)
static

Returns an iterator referring to the first value of the band.

Definition at line 813 of file PositionIterator.h.

template<class T >
void te::rst::PolygonIterator< T >::decompose ( te::gm::Geometry const *const  g,
std::vector< te::gm::LineString * > &  decomposedGeoms 
) const
protected

Decomponse one geometry collection in a vector of basic components (line, point).

Parameters
gThe input geometry collection.
decomposedGeomsThe output geometries will be appended to this vector.
Note
The caller of this method must take the ownership of the returned objects.

Definition at line 511 of file PositionIterator.h.

References te::dt::AbstractData::clone(), te::gm::GeometryCollectionType, te::gm::GeometryCollection::getGeometryN(), te::gm::Geometry::getGeomTypeId(), te::gm::GeometryCollection::getNumGeometries(), te::gm::Geometry::getSRID(), te::gm::Point::getX(), te::gm::Point::getY(), te::gm::LineStringType, te::gm::MultiLineStringType, te::gm::MultiPointType, te::gm::PointType, te::gm::LineString::setX(), te::gm::LineString::setY(), TE_TR, and te::gm::Geometry::toString().

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

template<class T >
te::rst::PolygonIterator< T > te::rst::PolygonIterator< T >::end ( const te::rst::Raster r,
const te::gm::Polygon p 
)
static

Returns an iterator referring to after the end of the iterator.

Definition at line 818 of file PositionIterator.h.

References te::rst::PolygonIterator< T >::setEnd().

template<class T >
unsigned int te::rst::PolygonIterator< T >::getColumn ( ) const
virtual

Returns the current column in iterator.

Implements te::rst::AbstractPositionIterator< T >.

Definition at line 714 of file PositionIterator.h.

References te::rst::PolygonIterator< T >::m_column.

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

template<class T >
unsigned int te::rst::PolygonIterator< T >::getRow ( ) const
virtual

Returns the current row in iterator.

Implements te::rst::AbstractPositionIterator< T >.

Definition at line 709 of file PositionIterator.h.

References te::rst::PolygonIterator< T >::m_row.

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

template<class T >
bool te::rst::AbstractPositionIterator< T >::operator!= ( const AbstractPositionIterator< T > &  rhs) const
virtualinherited

Difference operator.

Parameters
rhsThe right-hand side to compare.
Returns
Returns true if the iterators are at different positions, or false otherwise.

Definition at line 406 of file PositionIterator.h.

References te::rst::AbstractPositionIterator< T >::m_raster.

template<class T >
bool te::rst::PolygonIterator< T >::operator!= ( const PolygonIterator< T > &  rhs) const
template<class T >
std::complex< T > te::rst::PolygonIterator< T >::operator() ( const unsigned int  i) const
virtual

Returns the complex value in current position (column, row, band) from iterator.

Parameters
iThe band index.
Returns
The pixel comples value in current position.
Note
For real values use operator[]

Implements te::rst::AbstractPositionIterator< T >.

Definition at line 702 of file PositionIterator.h.

References te::rst::Raster::getValue(), te::rst::PolygonIterator< T >::m_column, te::rst::PolygonIterator< T >::m_operatorParenthesis_value, te::rst::AbstractPositionIterator< T >::m_raster, and te::rst::PolygonIterator< T >::m_row.

template<class T >
const std::vector< T > te::rst::PolygonIterator< T >::operator* ( ) const
virtual
template<class T >
T te::rst::PolygonIterator< T >::operator[] ( const unsigned int  i) const
virtual

Returns the real value in current position (column, row, band) from iterator.

Parameters
iThe band index.
Returns
The pixel real value in current position.
Note
For complex values use operator()

Implements te::rst::AbstractPositionIterator< T >.

Definition at line 695 of file PositionIterator.h.

References te::rst::Raster::getValue(), te::rst::PolygonIterator< T >::m_column, te::rst::PolygonIterator< T >::m_operatorBrackets_value, te::rst::AbstractPositionIterator< T >::m_raster, and te::rst::PolygonIterator< T >::m_row.

template<class T >
void te::rst::PolygonIterator< T >::setEnd ( )
virtual

Sets the iterator position to the end of the current band.

Parameters
bThe band to retrieve the end information.

Implements te::rst::AbstractPositionIterator< T >.

Definition at line 806 of file PositionIterator.h.

References te::rst::PolygonIterator< T >::m_column, and te::rst::PolygonIterator< T >::m_row.

Referenced by te::rst::PolygonIterator< T >::end(), te::rst::PolygonIterator< T >::operator++(), te::rst::PolygonIterator< T >::operator--(), and te::rst::PolygonIterator< T >::setNextLine().

template<class T >
void te::rst::PolygonIterator< T >::setNextLine ( bool  updatecurrline = true)

Definition at line 592 of file PositionIterator.h.

References te::gm::GeometryCollection::add(), te::rst::PolygonIterator< T >::decompose(), te::rst::Grid::geoToGrid(), te::gm::LineString::getEndPoint(), te::gm::Geometry::getGeomTypeId(), te::rst::Raster::getGrid(), te::gm::Envelope::getLowerLeft(), te::gm::Geometry::getMBR(), te::gm::Geometry::getSRID(), te::gm::LineString::getStartPoint(), te::gm::Envelope::getUpperRight(), te::gm::Point::getX(), te::gm::Point::getY(), te::rst::Grid::gridToGeo(), te::gm::Geometry::intersection(), te::gm::Geometry::isEmpty(), te::rst::PolygonIterator< T >::m_actualintersection, te::rst::PolygonIterator< T >::m_column, te::rst::PolygonIterator< T >::m_currline, te::rst::PolygonIterator< T >::m_endingcolumn, te::rst::PolygonIterator< T >::m_endingrow, te::rst::PolygonIterator< T >::m_intersections, te::rst::PolygonIterator< T >::m_maxcolumns, te::rst::PolygonIterator< T >::m_nintersections, te::rst::PolygonIterator< T >::m_polygon, te::rst::AbstractPositionIterator< T >::m_raster, te::rst::PolygonIterator< T >::m_row, te::rst::PolygonIterator< T >::m_startingcolumn, te::rst::PolygonIterator< T >::m_startingrow, te::rst::PolygonIterator< T >::operator++(), te::rst::PolygonIterator< T >::setEnd(), te::gm::LineString::setX(), te::gm::LineString::setY(), te::gm::Geometry::toString(), and te::gm::Coord2D::x.

Referenced by te::rst::PolygonIterator< T >::operator++(), te::rst::PolygonIterator< T >::operator--(), and te::rst::PolygonIterator< T >::PolygonIterator().

Member Data Documentation

template<class T>
std::vector<te::gm::LineString*> te::rst::PolygonIterator< T >::m_intersections
protected

The points or lines of the intersection between the geometry and the current line.

Definition at line 212 of file PositionIterator.h.

Referenced by te::rst::PolygonIterator< T >::clear(), te::rst::PolygonIterator< T >::operator=(), and te::rst::PolygonIterator< T >::setNextLine().

template<class T>
int te::rst::PolygonIterator< T >::m_maxrows
protected
template<class T>
int te::rst::PolygonIterator< T >::m_nintersections
protected

The number number of intersected lines in current line of the iterator.

Definition at line 223 of file PositionIterator.h.

Referenced by te::rst::PolygonIterator< T >::clear(), te::rst::PolygonIterator< T >::operator++(), te::rst::PolygonIterator< T >::operator=(), and te::rst::PolygonIterator< T >::setNextLine().

template<class T>
double te::rst::PolygonIterator< T >::m_operatorBrackets_value
mutableprotected

Used by the operator[] method.

Definition at line 224 of file PositionIterator.h.

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

template<class T>
std::complex< double > te::rst::PolygonIterator< T >::m_operatorParenthesis_value
mutableprotected

Used by the operator() method.

Definition at line 225 of file PositionIterator.h.

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

template<class T>
const te::gm::Polygon* te::rst::PolygonIterator< T >::m_polygon
protected

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