This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a polygon. More...
#include <PositionIterator.h>
Public Types | |
enum | IterationType { ScanLineIterationT , NDisjointBBOXIterationT , DisjointBBOXIterationT } |
Public Member Functions | |
unsigned int | getColumn () const |
Returns the current column in iterator. | |
unsigned int | getRow () const |
Returns the current row in iterator. | |
bool | operator!= (const AbstractPositionIterator< T > &rhs) const |
Difference operator. | |
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. | |
const std::vector< T > | operator* () const |
Returns a vector of the values in current position (column, row) from iterator. | |
void | operator++ () |
Advances to the next position. | |
void | operator-- () |
Returns to the previous position. | |
AbstractPositionIterator< T > & | operator= (const AbstractPositionIterator< T > &rhs) |
Assignment operator. | |
PolygonIterator & | operator= (const PolygonIterator &rhs) |
T | operator[] (const unsigned int i) const |
Returns the real value in current position (column, row, band) from iterator. | |
PolygonIterator () | |
PolygonIterator (const PolygonIterator &rhs) | |
Copy constructor. | |
PolygonIterator (const te::rst::Raster *r, const te::gm::Polygon *p) | |
Constructor. | |
PolygonIterator (const te::rst::Raster *r, const te::gm::Polygon *p, const IterationType iterationType) | |
Constructor. | |
void | setEnd () |
Sets the iterator position to the end of the current band. | |
~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. | |
static PolygonIterator | begin (const te::rst::Raster *r, const te::gm::Polygon *p, const IterationType iterationType) |
Returns an iterator referring to the first value of the band. | |
static PolygonIterator | end (const te::rst::Raster *r, const te::gm::Polygon *p) |
Returns an iterator referring to after the end of the iterator. | |
static PolygonIterator | end (const te::rst::Raster *r, const te::gm::Polygon *p, const IterationType iterationType) |
Returns an iterator referring to after the end of the iterator. | |
Protected Member Functions | |
void | breakIntoSingleGeoms (te::gm::Geometry const *const g, std::vector< te::gm::Geometry const * > &geoms) const |
It will get a GeometryCollection and distribute in a vector. | |
void | clear () |
Clear all internal allocated objects and reset back to the initial state. | |
void | getBBOXIntersectionRanges (int lineIndex, const bool areDisjoint, std::vector< std::pair< int, int > > &intersectionRanges) const |
Returns the given line intersection ranges using the pixel bounding box as reference. | |
void | getIntersectionRanges (int lineIndex, std::vector< std::pair< int, int > > &intersectionRanges) const |
Returns the given line intersection ranges (Coordinates of the columns to be transversed) using the current iteration type. | |
void | getScanLineIntersectionRanges (int lineIndex, std::vector< std::pair< int, int > > &intersectionRanges) const |
Returns the given line intersection ranges (Coordinates of the columns to be transversed) using the ScanLineIterationT mode. | |
bool | initialize (const te::rst::Raster *r, const te::gm::Polygon *p, const IterationType iterationType) |
Initialize this instance. | |
void | initiateVariables () |
Initialize all internal variables to initial states. | |
Protected Attributes | |
int | m_column |
The current column of the iterator (default -1). | |
std::vector< std::pair< int, int > > | m_currentLineIntersectionRanges |
Coordinates of the columns to be transversed. | |
int | m_currentLineIntersectionRangesIndex |
The actual line of the iterator (default -1). | |
int | m_currentRangeEndingColumn |
The current line iteration range column to finalize the iteration (default: -1). | |
int | m_currentRangeStartingColumn |
The current line iteration range starting column (default: -1). | |
IterationType | m_iterationType |
Current iteration type (default ScanLineIterationT). | |
double | m_operatorBrackets_value |
std::complex< double > | m_operatorParenthesis_value |
const te::gm::Polygon * | m_polygon |
The spatial restriction to be applied in the iterator (default 0). | |
int | m_polygonEndingColumn |
Polygon last raster column (default: -1). | |
int | m_polygonEndingRow |
Polygon last raster row (default: -1). | |
int | m_polygonStartingColumn |
Polygon first raster column (default: -1). | |
int | m_polygonStartingRow |
Polygon first raster row (default: -1). | |
const te::rst::Raster * | m_raster |
The band from where to get the values (default 0). | |
int | m_row |
The current row of the iterator (default -1). | |
std::unique_ptr< te::rst::TileIndexer > | m_tileIndexerPtr |
Tile indexer used to optimize the geometric operations. | |
int | m_totalRasterColumns |
The number of columns in band (default: 0). | |
int | m_totalRasterRows |
The number of rows in band (default: 0). | |
This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a polygon.
Definition at line 156 of file PositionIterator.h.
enum te::rst::PolygonIterator::IterationType |
Definition at line 161 of file PositionIterator.h.
te::rst::PolygonIterator< T >::PolygonIterator |
Definition at line 488 of file PositionIterator.h.
te::rst::PolygonIterator< T >::PolygonIterator | ( | const te::rst::Raster * | r, |
const te::gm::Polygon * | p, | ||
const IterationType | iterationType | ||
) |
Constructor.
b | The band to iterate. |
p | The polygon from where the iteration will navigate. |
iterationType | Iteration type. |
Definition at line 493 of file PositionIterator.h.
References TE_TR.
te::rst::PolygonIterator< T >::PolygonIterator | ( | const te::rst::Raster * | r, |
const te::gm::Polygon * | p | ||
) |
Constructor.
b | The band to iterate. |
p | The polygon from where the iteration will navigate. |
Definition at line 505 of file PositionIterator.h.
References TE_TR.
te::rst::PolygonIterator< T >::PolygonIterator | ( | const PolygonIterator< T > & | rhs | ) |
Copy constructor.
rhs | The right-hand-side copy used to copy from. |
Definition at line 515 of file PositionIterator.h.
te::rst::PolygonIterator< T >::~PolygonIterator |
Definition at line 521 of file PositionIterator.h.
|
static |
Returns an iterator referring to the first value of the band.
Definition at line 722 of file PositionIterator.h.
|
static |
Returns an iterator referring to the first value of the band.
Definition at line 716 of file PositionIterator.h.
|
protected |
It will get a GeometryCollection and distribute in a vector.
g | Input GeometryCollection. |
geoms | Output Geometry Vector. |
Definition at line 1251 of file PositionIterator.h.
References te::gm::GeometryCollection::getGeometryN(), and te::gm::GeometryCollection::getNumGeometries().
|
protected |
Clear all internal allocated objects and reset back to the initial state.
Definition at line 777 of file PositionIterator.h.
|
static |
Returns an iterator referring to after the end of the iterator.
Definition at line 737 of file PositionIterator.h.
References te::rst::PolygonIterator< T >::setEnd().
|
static |
Returns an iterator referring to after the end of the iterator.
Definition at line 727 of file PositionIterator.h.
References te::rst::PolygonIterator< T >::setEnd().
|
protected |
Returns the given line intersection ranges using the pixel bounding box as reference.
lineIndex | Line index. |
areDisjoint | If true, returns only thos pixels disjoint with the polygon, otherwise returns those pixels not disjoint with the polygon. |
intersectionRanges | Line intersection ranges (first:initial column, second:ending column) or an empty vector if no intersections exist. |
Definition at line 1070 of file PositionIterator.h.
References te::gm::Geometry::disjoint(), te::gm::LineString::getCoordinates(), te::gm::LineStringType, te::gm::LineString::setNumCoordinates(), te::gm::Coord2D::x, and te::gm::Coord2D::y.
|
virtual |
Returns the current column in iterator.
Implements te::rst::AbstractPositionIterator< T >.
Definition at line 559 of file PositionIterator.h.
|
protected |
Returns the given line intersection ranges (Coordinates of the columns to be transversed) using the current iteration type.
lineIndex | Line index. |
intersectionRanges | Line intersection ranges (first:initial column, second:ending column) or an empty vector if no intersections exist. |
Definition at line 786 of file PositionIterator.h.
References TE_TR.
|
virtual |
Returns the current row in iterator.
Implements te::rst::AbstractPositionIterator< T >.
Definition at line 554 of file PositionIterator.h.
|
protected |
Returns the given line intersection ranges (Coordinates of the columns to be transversed) using the ScanLineIterationT mode.
lineIndex | Line index. |
intersectionRanges | Line intersection ranges (first:initial column, second:ending column) or an empty vector if no intersections exist. |
Definition at line 815 of file PositionIterator.h.
References te::gm::LineString::getEndPoint(), te::gm::Geometry::getSRID(), te::gm::LineString::getStartPoint(), te::gm::LineString::getX(), te::gm::LineString::getY(), te::gm::LineStringType, te::gm::PointType, te::gm::LineString::setX(), te::gm::LineString::setY(), te::gm::LineString::size(), te::rst::StdSortPointPointerComparison(), and TE_LOG_WARN.
|
protected |
Initialize this instance.
r | The raster to iterate. |
p | The polygon from where the iteration will navigate. |
iterationType | The iteration type |
Definition at line 1140 of file PositionIterator.h.
References te::rst::Grid::geoToGrid(), te::rst::Grid::getExtent(), te::rst::Raster::getGrid(), te::rst::Grid::getNumberOfColumns(), te::rst::Raster::getNumberOfColumns(), te::rst::Grid::getNumberOfRows(), te::rst::Raster::getNumberOfRows(), te::rst::Grid::getResolutionY(), te::rst::Raster::getSRID(), te::gm::Geometry::getSRID(), te::gm::Envelope::m_llx, te::gm::Envelope::m_lly, te::gm::Envelope::m_urx, te::gm::Envelope::m_ury, te::gm::Coord2D::x, and te::gm::Coord2D::y.
|
protected |
Initialize all internal variables to initial states.
Definition at line 758 of file PositionIterator.h.
|
virtual |
Difference operator.
rhs | The right-hand side to compare. |
Implements te::rst::AbstractPositionIterator< T >.
Definition at line 752 of file PositionIterator.h.
References operator!=().
bool te::rst::PolygonIterator< T >::operator!= | ( | const PolygonIterator< T > & | rhs | ) | const |
Definition at line 746 of file PositionIterator.h.
References te::rst::PolygonIterator< T >::m_column, and te::rst::PolygonIterator< T >::m_row.
|
virtual |
Returns the complex value in current position (column, row, band) from iterator.
i | The band index. |
Implements te::rst::AbstractPositionIterator< T >.
Definition at line 547 of file PositionIterator.h.
|
virtual |
Returns a vector of the values in current position (column, row) from iterator.
Implements te::rst::AbstractPositionIterator< T >.
Definition at line 526 of file PositionIterator.h.
|
virtual |
Advances to the next position.
Implements te::rst::AbstractPositionIterator< T >.
Definition at line 564 of file PositionIterator.h.
|
virtual |
Returns to the previous position.
Implements te::rst::AbstractPositionIterator< T >.
Definition at line 615 of file PositionIterator.h.
|
virtual |
Assignment operator.
rhs | The right-hand-side copy used to copy from. |
Reimplemented from te::rst::AbstractPositionIterator< T >.
Definition at line 704 of file PositionIterator.h.
te::rst::PolygonIterator< T > & te::rst::PolygonIterator< T >::operator= | ( | const PolygonIterator< T > & | rhs | ) |
Definition at line 667 of file PositionIterator.h.
References te::rst::PolygonIterator< T >::m_column, te::rst::PolygonIterator< T >::m_currentLineIntersectionRanges, te::rst::PolygonIterator< T >::m_currentLineIntersectionRangesIndex, te::rst::PolygonIterator< T >::m_currentRangeEndingColumn, te::rst::PolygonIterator< T >::m_currentRangeStartingColumn, te::rst::PolygonIterator< T >::m_iterationType, te::rst::PolygonIterator< T >::m_polygon, te::rst::PolygonIterator< T >::m_polygonEndingColumn, te::rst::PolygonIterator< T >::m_polygonEndingRow, te::rst::PolygonIterator< T >::m_polygonStartingColumn, te::rst::PolygonIterator< T >::m_polygonStartingRow, te::rst::PolygonIterator< T >::m_raster, te::rst::PolygonIterator< T >::m_row, te::rst::PolygonIterator< T >::m_tileIndexerPtr, te::rst::PolygonIterator< T >::m_totalRasterColumns, te::rst::PolygonIterator< T >::m_totalRasterRows, and te::rst::AbstractPositionIterator< T >::operator=().
|
virtual |
Returns the real value in current position (column, row, band) from iterator.
i | The band index. |
Implements te::rst::AbstractPositionIterator< T >.
Definition at line 540 of file PositionIterator.h.
|
virtual |
Sets the iterator position to the end of the current band.
b | The band to retrieve the end information. |
Implements te::rst::AbstractPositionIterator< T >.
Definition at line 710 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::end(), and te::rst::PolygonIterator< T >::end().
|
protected |
The current column of the iterator (default -1).
Definition at line 250 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator!=(), and te::rst::PolygonIterator< T >::operator=().
|
protected |
Coordinates of the columns to be transversed.
Definition at line 256 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator=().
|
protected |
The actual line of the iterator (default -1).
Definition at line 254 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator=().
|
protected |
The current line iteration range column to finalize the iteration (default: -1).
Definition at line 253 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator=().
|
protected |
The current line iteration range starting column (default: -1).
Definition at line 252 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator=().
|
protected |
Current iteration type (default ScanLineIterationT).
Definition at line 242 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator=().
|
mutableprotected |
Definition at line 259 of file PositionIterator.h.
|
mutableprotected |
Definition at line 260 of file PositionIterator.h.
|
protected |
The spatial restriction to be applied in the iterator (default 0).
Definition at line 241 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator=().
|
protected |
Polygon last raster column (default: -1).
Definition at line 246 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator=().
|
protected |
Polygon last raster row (default: -1).
Definition at line 248 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator=().
|
protected |
Polygon first raster column (default: -1).
Definition at line 245 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator=().
|
protected |
Polygon first raster row (default: -1).
Definition at line 247 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator=().
|
protected |
The band from where to get the values (default 0).
Definition at line 240 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator=().
|
protected |
The current row of the iterator (default -1).
Definition at line 251 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator!=(), and te::rst::PolygonIterator< T >::operator=().
|
protected |
Tile indexer used to optimize the geometric operations.
Definition at line 255 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator=().
|
protected |
The number of columns in band (default: 0).
Definition at line 243 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator=().
|
protected |
The number of rows in band (default: 0).
Definition at line 244 of file PositionIterator.h.
Referenced by te::rst::PolygonIterator< T >::operator=().