27 #ifndef __TERRALIB_RASTER_INTERNAL_POSITIONITERATOR_H    28 #define __TERRALIB_RASTER_INTERNAL_POSITIONITERATOR_H    31 #include "../common/STLUtils.h"    32 #include "../common/MathUtils.h"    33 #include "../core/logger/Logger.h"    34 #include "../geometry.h"    73         virtual const std::vector<T> 
operator*() 
const = 0;
    84         virtual T 
operator[](
const unsigned int i) 
const = 0;
    95         virtual std::complex< T > 
operator()(
const unsigned int i) 
const = 0;
    98         virtual unsigned int getRow() 
const = 0;
   101         virtual unsigned int getColumn() 
const = 0;
   132         virtual void setEnd() = 0;
   204         std::complex< T > 
operator()(
const unsigned int i) 
const;
   206         unsigned int getRow() 
const;
   274           std::vector<std::pair<int, int> >& intersectionRanges ) 
const;
   282           std::vector<std::pair<int, int> >& intersectionRanges ) 
const;
   291           std::vector<std::pair<int, int> >& intersectionRanges ) 
const;
   342         std::complex< T > 
operator()(
const unsigned int i) 
const;
   344         unsigned int getRow() 
const;
   415         std::complex< T > 
operator()(
const unsigned int i) 
const;
   417         unsigned int getRow() 
const;
   489       if( ! initialize( r, p, iterationType ) )
   491         throw te::rst::Exception( 
TE_TR(
"Iterator initialization error") );
   499       if( ! initialize( r, p, ScanLineIterationT ) )
   501         throw te::rst::Exception( 
TE_TR(
"Iterator initialization error") );
   518       std::vector<T> values( m_raster->getNumberOfBands());
   521       for (
unsigned int b = 0; b < this->m_raster->getNumberOfBands(); b++)
   523         m_raster->getValue( m_column, m_row, value, b);
   524         values[b] = ((T) value);
   532       this->m_raster->getValue(m_column, m_row, m_operatorBrackets_value, i);
   534       return (T) m_operatorBrackets_value;
   539       this->m_raster->getValue(m_column, m_row, m_operatorParenthesis_value, i);
   541       return (std::complex< T >) m_operatorParenthesis_value;
   556       if( m_column < m_currentRangeEndingColumn )
   562         if ( ( m_currentLineIntersectionRangesIndex + 1 ) < (
int)( m_currentLineIntersectionRanges.size() ) )
   564           ++m_currentLineIntersectionRangesIndex;
   565           m_column = m_currentRangeStartingColumn = m_currentLineIntersectionRanges[ m_currentLineIntersectionRangesIndex ].first;
   566           m_currentRangeEndingColumn = m_currentLineIntersectionRanges[ m_currentLineIntersectionRangesIndex ].second;
   570           if( m_row < m_polygonEndingRow )
   572             m_currentLineIntersectionRanges.clear();
   574             while( m_row <= m_polygonEndingRow )
   578               getIntersectionRanges( m_row, m_currentLineIntersectionRanges );
   580               if( ! m_currentLineIntersectionRanges.empty() )
   586             if( m_currentLineIntersectionRanges.empty() )
   592               m_column = m_currentRangeStartingColumn = m_currentLineIntersectionRanges[ 0 ].first;
   593               m_currentRangeEndingColumn = m_currentLineIntersectionRanges[ 0 ].second;
   594               m_currentLineIntersectionRangesIndex = 0;
   607       if(m_column > m_currentRangeStartingColumn )
   613         if( m_currentLineIntersectionRangesIndex > 0 )
   615           --m_currentLineIntersectionRangesIndex;
   616           m_currentRangeStartingColumn = m_currentLineIntersectionRanges[ m_currentLineIntersectionRangesIndex ].first;
   617           m_column = m_currentRangeEndingColumn = m_currentLineIntersectionRanges[ m_currentLineIntersectionRangesIndex ].second;
   621           if( m_row > m_polygonStartingRow )
   623             m_currentLineIntersectionRanges.clear();
   625             while( m_row >= m_polygonStartingRow )
   629               getIntersectionRanges( m_row, m_currentLineIntersectionRanges );
   631               if( ! m_currentLineIntersectionRanges.empty() )
   637             if( m_currentLineIntersectionRanges.empty() )
   643               m_currentLineIntersectionRangesIndex = 
static_cast<int>(m_currentLineIntersectionRanges.size()) - 1;
   644               m_currentRangeStartingColumn = m_currentLineIntersectionRanges[ m_currentLineIntersectionRangesIndex ].first;
   645               m_column = m_currentRangeEndingColumn = m_currentLineIntersectionRanges[ m_currentLineIntersectionRangesIndex ].second;
   738       return ( (this->m_row != rhs.
m_row) && (this->m_column != rhs.
m_column));
   752       m_iterationType = ScanLineIterationT;
   753       m_totalRasterColumns = 0;
   754       m_totalRasterRows = 0;
   755       m_polygonStartingColumn = -1;
   756       m_polygonEndingColumn = -1;
   757       m_polygonStartingRow = -1;
   758       m_polygonEndingRow = -1;
   762       m_currentRangeStartingColumn = -1;
   763       m_currentRangeEndingColumn = -1;
   764       m_currentLineIntersectionRangesIndex = -1;
   769       m_tileIndexerPtr.reset();
   770       m_currentLineIntersectionRanges.clear();
   777        std::vector<std::pair<int, int> >& intersectionRanges )
 const   779       switch( m_iterationType )
   781         case ScanLineIterationT :
   783           getScanLineIntersectionRanges( lineIndex, intersectionRanges );
   786         case NDisjointBBOXIterationT :
   788           getBBOXIntersectionRanges( lineIndex, 
false, intersectionRanges );
   791         case DisjointBBOXIterationT :
   793           getBBOXIntersectionRanges( lineIndex, 
true, intersectionRanges );
   798           throw te::rst::Exception( 
TE_TR(
"Invalid iteration type") );
   806        std::vector<std::pair<int, int> >& intersectionRanges )
 const   808       intersectionRanges.clear();
   812       const double& rasterEnvelopeLLX =
   813         m_raster->getGrid()->getExtent()->m_llx;
   814       const double& rasterEnvelopeURX =
   815         m_raster->getGrid()->getExtent()->m_urx;
   819       const double lineY = this->m_raster->getGrid()->gridToGeo(0, (
double)lineIndex).y;
   823         m_polygon->getSRID() );
   825       currline.
setX(0, std::min(
   827         m_polygon->getMBR()->getLowerLeft().x) );
   828       currline.setY(0, lineY);
   830       currline.setX(1, std::max(
   832         m_polygon->getMBR()->getUpperRight().x ) );
   833       currline.setY(1, lineY);
   836       std::vector<te::gm::Point*> intersectionPoints;
   844           m_tileIndexerPtr->getTile(currline.getY(0), ¤tTilePtr)
   846           ( currentTilePtr != 0 )
   850         std::unique_ptr<te::gm::Line> tileSeg;
   851         std::unique_ptr< te::gm::Geometry > interResultPtr;
   852         std::vector< te::gm::Geometry * > singleGeomsPtrs;
   853         std::size_t singleGeomsPtrsIdx = 0;
   862           for (std::size_t i = 0; i < currentTilePtr->size(); i++)
   864             assert((*currentTilePtr)[i].first < m_polygon->getNumRings());
   867             assert(dynamic_cast<te::gm::LinearRing const*>((*m_polygon)[(*currentTilePtr)[i].first]));
   870             assert((*currentTilePtr)[i].second < m_polygon->getNPoints());
   874                                                           ringTile->
getY((*currentTilePtr)[i].second),
   877                                                           ringTile->
getY((*currentTilePtr)[i].second + 1),
   883             interResultPtr.reset( tileSeg->intersection( &currline ) );
   885             if( interResultPtr.get() != 0 )
   887               for(
auto p : singleGeomsPtrs)
   889               singleGeomsPtrs.clear();
   892               for( singleGeomsPtrsIdx = 0 ; singleGeomsPtrsIdx < singleGeomsPtrs.size() ;
   893                 ++singleGeomsPtrsIdx )
   895                 if( singleGeomsPtrs[ singleGeomsPtrsIdx ]->getGeomTypeId() ==
   899                     singleGeomsPtrs[ singleGeomsPtrsIdx ]->clone() ) );
   901                 else if( singleGeomsPtrs[ singleGeomsPtrsIdx ]->getGeomTypeId() ==
   905                     singleGeomsPtrsIdx ]);
   906                   intersectionPoints.push_back( lineStrPtr->
getStartPoint().release() );
   907                   intersectionPoints.push_back( lineStrPtr->
getEndPoint().release() );
   913         catch(
const std::exception& e)
   915           TE_LOG_WARN( 
"Geometry intersection error:" + e.what() );
   919           for( std::size_t intersectionPointsIdx = 0; intersectionPointsIdx <
   920             intersectionPoints.size() ; ++intersectionPointsIdx )
   922             delete intersectionPoints[intersectionPointsIdx];
   925           intersectionPoints.clear();
   933           for( std::size_t intersectionPointsIdx = 0; intersectionPointsIdx <
   934             intersectionPoints.size() ; ++intersectionPointsIdx )
   936             delete intersectionPoints[intersectionPointsIdx];
   939           intersectionPoints.clear();
   942         for(
auto p : singleGeomsPtrs)
   944         singleGeomsPtrs.clear();
   950         std::size_t positionBegin = 0;
   951         std::size_t positionEnd = 0;
   952         std::vector<te::gm::Point*> intersectionPointsAux = intersectionPoints;
   954         intersectionPoints.clear();
   956         while( positionBegin < intersectionPointsAux.size() )
   958           if( intersectionPointsAux[positionBegin] )
   960             positionEnd = positionBegin + 1;
   962             while( positionEnd < intersectionPointsAux.size() )
   965                   ( intersectionPointsAux[positionEnd] != 0 )
   967                   intersectionPointsAux[positionBegin]->equals(
   968                     intersectionPointsAux[positionEnd], 
true)
   971                 delete intersectionPointsAux[positionEnd];
   972                 intersectionPointsAux[positionEnd] = 0;
   978             intersectionPoints.push_back( intersectionPointsAux[positionBegin] );
   986       std::sort(intersectionPoints.begin(), intersectionPoints.end(),
   992       std::size_t positionBegin = 0;
   993       std::size_t positionEnd = 0;
   996       double startingX = 0;
   997       double startingY = 0;
  1001       while( ( positionBegin + 1 ) < intersectionPoints.size() )
  1003         positionEnd = positionBegin + 1;
  1005         startingX = intersectionPoints[positionBegin]->getX();
  1006         startingX = std::max( startingX, rasterEnvelopeLLX );
  1008         startingY = intersectionPoints[positionBegin]->getY();
  1010         endingX = intersectionPoints[positionEnd]->getX();
  1011         endingX = std::min( endingX, rasterEnvelopeURX );
  1013         endingY = intersectionPoints[positionEnd]->getY();
  1020             ( startingX != endingX )
  1024                 (startingX + (endingX - startingX) / 2.0 ),
  1025                 (startingY +(endingY - startingY) / 2.0 ),
  1026                 m_polygon->getSRID()))
  1033           startingCol = (int)std::ceil( m_raster->getGrid()->geoToGrid(startingX, startingY).x );
  1034           startingCol = std::max( 0, startingCol );
  1035           startingCol = std::min( m_totalRasterColumns - 1, startingCol );
  1037           endingCol = (int)std::floor( m_raster->getGrid()->geoToGrid(endingX, endingY).x );
  1038           endingCol = std::max( 0, endingCol );
  1039           endingCol = std::min( m_totalRasterColumns - 1, endingCol );
  1041           if( endingCol >= startingCol )
  1043             intersectionRanges.push_back(std::pair<int, int>(startingCol, endingCol));
  1047         positionBegin = positionEnd;
  1054       while ( positionBegin < intersectionPoints.size() )
  1056         delete intersectionPoints[positionBegin];
  1061     template<
typename T>
  1063        const bool areDisjoint, std::vector<std::pair<int, int> >& intersectionRanges )
 const  1065       intersectionRanges.clear();
  1067       double ulXCoord = 0;
  1068       double ulYCoord = 0;
  1069       m_raster->getGrid()->gridToGeo( ((
double)m_polygonStartingColumn) - 0.5,
  1070         ((
double)lineIndex) - 0.5, ulXCoord, ulYCoord);
  1072       const double yRes = this->m_raster->getGrid()->getResolutionY();
  1073       const double xRes = this->m_raster->getGrid()->getResolutionX();
  1076         m_polygon->getSRID(), 0 );
  1080       bool rangeStarted = 
false;
  1081       std::pair<int, int> range;
  1083       for(  
int col = m_polygonStartingColumn ; col <= m_polygonEndingColumn ; ++col )
  1086         currBBOXCoordsPtr[ 0 ].
x = currBBOXCoordsPtr[ 4 ].
x =
  1087           ulXCoord + ( xRes * (double)( col - m_polygonStartingColumn ) );
  1088         currBBOXCoordsPtr[ 0 ].
y = currBBOXCoordsPtr[ 4 ].
y = ulYCoord;
  1091         currBBOXCoordsPtr[ 1 ].
x = currBBOXCoordsPtr[ 0 ].
x + xRes;
  1092         currBBOXCoordsPtr[ 1 ].
y = ulYCoord;
  1095         currBBOXCoordsPtr[ 2 ].
x = currBBOXCoordsPtr[ 1 ].
x;
  1096         currBBOXCoordsPtr[ 2 ].
y = ulYCoord - yRes;
  1099         currBBOXCoordsPtr[ 3 ].
x = currBBOXCoordsPtr[ 0 ].
x;
  1100         currBBOXCoordsPtr[ 3 ].
y = ulYCoord - yRes;
  1102         if( areDisjoint == currBBOX.disjoint( m_polygon ) )
  1110             rangeStarted = 
true;
  1111             range.first = range.second = col;
  1118             rangeStarted = 
false;
  1119             intersectionRanges.push_back( range );
  1127         intersectionRanges.push_back( range );
  1131     template<
typename T>
  1141       m_iterationType = iterationType;
  1157           ( ll.
x > rasterEnvelope.
m_urx )
  1159           ( ur.
x < rasterEnvelope.
m_llx )
  1161           ( ur.
y < rasterEnvelope.
m_lly )
  1163           ( ll.
y > rasterEnvelope.
m_ury )
  1177         m_polygonStartingRow = (int)std::floor( urIndexed.
y );
  1178         m_polygonStartingRow = std::max( 0, m_polygonStartingRow );
  1179         m_polygonStartingRow = std::min( m_polygonStartingRow, ((
int)rasterGrid.
getNumberOfRows()) - 1 );
  1181         m_polygonEndingRow = (int)std::ceil( llIndexed.
y );
  1182         m_polygonEndingRow = std::max( 0, m_polygonEndingRow );
  1183         m_polygonEndingRow = std::min( m_polygonEndingRow, ((
int)rasterGrid.
getNumberOfRows()) - 1 );
  1185         m_polygonStartingColumn = (int)std::floor( llIndexed.
x );
  1186         m_polygonStartingColumn = std::max( 0, m_polygonStartingColumn );
  1187         m_polygonStartingColumn = std::min( m_polygonStartingColumn, ((
int)rasterGrid.
getNumberOfColumns()) - 1 );
  1189         m_polygonEndingColumn = (int)std::ceil( urIndexed.
x );
  1190         m_polygonEndingColumn = std::max( 0, m_polygonEndingColumn );
  1191         m_polygonEndingColumn = std::min( m_polygonEndingColumn, ((
int)rasterGrid.
getNumberOfColumns()) - 1 );
  1194             ( m_polygonEndingRow < m_polygonStartingRow )
  1196             ( m_polygonEndingColumn < m_polygonStartingColumn )
  1205           if( m_iterationType == ScanLineIterationT )
  1212           m_row = m_polygonStartingRow;
  1214           while( m_row <= m_polygonEndingRow )
  1216             getIntersectionRanges( m_row, m_currentLineIntersectionRanges );
  1218             if( ! m_currentLineIntersectionRanges.empty() )
  1226           if( m_currentLineIntersectionRanges.empty() )
  1232             m_column = m_currentRangeStartingColumn = m_currentLineIntersectionRanges[ 0 ].first;
  1233             m_currentRangeEndingColumn = m_currentLineIntersectionRanges[ 0 ].second;
  1234             m_currentLineIntersectionRangesIndex = 0;
  1249         m_currentpixelindex(0),
  1257         m_currentpixelindex(0),
  1262         throw te::rst::Exception( 
TE_TR(
"Invalid line SRID") );
  1271       if (inter->isEmpty())
  1282       double startingcolumn;
  1284       std::unique_ptr<te::gm::Point> startpoint = inrasterline->
getStartPoint();
  1286                                            startingcolumn, startingrow);
  1288       double endingcolumn;
  1290       std::unique_ptr<te::gm::Point> endpoint = inrasterline->
getEndPoint();
  1292                                            endingcolumn, endingrow);
  1297       double x1, x2, y1, y2, geoX, geoY;
  1298       for(
int r = (
int)startingrow; r <= (int)endingrow; r++)
  1299         for(
int c = (
int)startingcolumn; c <= (int)endingcolumn; c++)
  1303           x1 = geoX - resXdiv2; y1 = geoY - resYdiv2;
  1304           x2 = geoX + resXdiv2; y2 = geoY + resYdiv2;
  1318       : m_raster(rhs.m_raster),
  1319         m_currentpixelindex(rhs.m_currentpixelindex),
  1320         m_pixelsinline(rhs.m_pixelsinline)
  1326       m_pixelsinline.clear();
  1331       std::vector<T> values(this->m_raster->getNumberOfBands());
  1334       for (
unsigned int b = 0; b < this->m_raster->getNumberOfBands(); b++)
  1336         this->m_raster->getValue(getColumn(), getRow(), value, b);
  1337         values[b] = ((T) value);
  1345       this->m_raster->getValue(getColumn(), getRow(), m_operatorBrackets_value, i);
  1347       return (T) m_operatorBrackets_value;
  1352       this->m_raster->getValue(getColumn(), getRow(), m_operatorParenthesis_value, i);
  1354       return (std::complex< T >) m_operatorParenthesis_value;
  1359       return (
unsigned int)(m_pixelsinline[m_currentpixelindex]->getY());
  1364       return (
unsigned int)(m_pixelsinline[m_currentpixelindex]->getX());
  1369       m_currentpixelindex++;
  1371       if (m_currentpixelindex >= (
int)(m_pixelsinline.size()))
  1377       m_currentpixelindex--;
  1379       if (m_currentpixelindex < 0)
  1397     template<
typename T>
  1406       this->m_currentpixelindex = -1;
  1428     template<
typename T>
  1438         m_pixelsinpointset(0),
  1439         m_currentpixelindex(0)
  1445         m_pixelsinpointset(p),
  1446         m_currentpixelindex(0)
  1454       std::vector<te::gm::Point*> inside_points;
  1461           throw te::rst::Exception( 
TE_TR(
"Invalid point SRID") );
  1480       : m_raster(rhs.m_raster),
  1481         m_pixelsinpointset(rhs.m_pixelsinpointset),
  1482         m_currentpixelindex(rhs.m_currentpixelindex)
  1488       m_pixelsinpointset.clear();
  1493       std::vector<T> values(this->m_raster->getNumberOfBands());
  1496       for (
unsigned int b = 0; b < this->m_raster->getNumberOfBands(); b++)
  1498         this->m_raster->getValue(getColumn(), getRow(), value, b);
  1499         values[b] = ((T) value);
  1507       this->m_raster->getValue(getColumn(), getRow(), m_operatorBrackets_value, i);
  1509       return (T) m_operatorBrackets_value;
  1514       this->m_raster->getValue(getColumn(), getRow(), m_operatorParenthesis_value, i);
  1516       return (std::complex< T >) m_operatorParenthesis_value;
  1521       return (
unsigned int)(m_pixelsinpointset[m_currentpixelindex]->getY());
  1526       return (
unsigned int)(m_pixelsinpointset[m_currentpixelindex]->getX());
  1531       m_currentpixelindex++;
  1533       if (m_currentpixelindex >= (
int) m_pixelsinpointset.size())
  1539       m_currentpixelindex--;
  1541       if (m_currentpixelindex < 0)
  1558     template<
typename T>
  1567       this->m_currentpixelindex = -1;
  1589     template<
typename T>
  1599 #endif  // __TERRALIB_RASTER_INTERNAL_POSITIONITERATOR_H int m_row
The current row of the iterator (default -1). 
 
void setEnd()
Sets the iterator position to the end of the current band. 
 
double getResolutionX() const
Returns the raster horizontal (x-axis) resolution. 
 
static PointSetIterator begin(const te::rst::Raster *r, const std::vector< te::gm::Point *> p)
Returns an iterator referring to the first value of the band. 
 
Polygon tile indexing class for optmized geometrical relational tests. 
 
A Line is LineString with 2 points. 
 
unsigned int getNumberOfRows() const
Returns the raster number of rows. 
 
int m_polygonEndingColumn
Polygon last raster column (default: -1). 
 
It describes one band (or dimension) of a raster. 
 
int m_currentRangeEndingColumn
The current line iteration range column to finalize the iteration (default: -1). 
 
void setX(std::size_t i, const double &x)
It sets the n-th x coordinate value. 
 
const te::gm::Line * m_line
The spatial restriction to be applied in the iterator. 
 
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 setEnd()
Sets the iterator position to the end of the current band. 
 
int m_currentLineIntersectionRangesIndex
The actual line of the iterator (default -1). 
 
std::complex< double > m_operatorParenthesis_value
Used by the operator() method. 
 
double m_operatorBrackets_value
Used by the operator[] method. 
 
unsigned int getNumberOfRows() const
Returns the grid number of rows. 
 
virtual void operator--()=0
Returns to the previous position. 
 
bool operator!=(const PointSetIterator< T > &rhs) const
 
Itaration over pixels whose bounding boxes are disjoint in relation with the polygon. 
 
int m_currentpixelindex
The index of the current pixel location. 
 
This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a...
 
virtual unsigned int getRow() const =0
Returns the current row in iterator. 
 
This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a...
 
double m_urx
Upper right corner x-coordinate. 
 
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope. 
 
const double & getX(std::size_t i) const
It returns the n-th x coordinate value. 
 
Scan line iteration type. 
 
double m_operatorBrackets_value
Used by the operator[] method. 
 
std::complex< T > operator()(const unsigned int i) const
Returns the complex value in current position (column, row, band) from iterator. 
 
unsigned int getColumn() const
Returns the current column in iterator. 
 
te::gm::Envelope * getExtent()
Returns the geographic extension of the grid. 
 
bool StdSortPointPointerComparison(te::gm::Point *p1, te::gm::Point *p2)
 
unsigned int getNumberOfColumns() const
Returns the raster number of columns. 
 
This class is the base for implementing ways to navigate over the band with spatial restriction...
 
An utility struct for representing 2D coordinates. 
 
void operator++()
Advances to the next position. 
 
virtual std::complex< T > operator()(const unsigned int i) const =0
Returns the complex value in current position (column, row, band) from iterator. 
 
TEDATAACCESSEXPORT te::da::Expression * operator!=(const te::da::Expression &e1, const te::da::Expression &e2)
 
const te::gm::Polygon * m_polygon
The spatial restriction to be applied in the iterator (default 0). 
 
int m_polygonStartingColumn
Polygon first raster column (default: -1). 
 
#define TE_TR(message)
It marks a string in order to get translated. 
 
PolygonIterator & operator=(const PolygonIterator &rhs)
 
PointSetIterator & operator=(const PointSetIterator &rhs)
 
virtual bool operator!=(const AbstractPositionIterator< T > &rhs) const =0
Difference operator. 
 
te::gm::Envelope * getExtent()
Returns the geographic extension of the raster data. 
 
Grid * getGrid()
It returns the raster grid. 
 
This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a...
 
unsigned int getRow() const
Returns the current row in iterator. 
 
AbstractPositionIterator()
Constructor. 
 
Utility functions for dealing with raster data blocks. 
 
virtual void operator++()=0
Advances to the next position. 
 
void operator++()
Advances to the next position. 
 
A LinearRing is a LineString that is both closed and simple. 
 
std::unique_ptr< Point > getStartPoint() const
The length of this Curve in its associated spatial reference. 
 
void gridToGeo(const double &col, const double &row, double &x, double &y) const
Get the spatial location of a grid point. 
 
An exception class for the Raster module. 
 
int getSRID() const _NOEXCEPT_OP(true)
It returns the Spatial Reference System ID associated to this geometric object. 
 
std::vector< te::gm::Point * > m_pixelsinline
A vector of pixel locations that intersects the line. 
 
double m_llx
Lower left corner x-coordinate. 
 
LineString is a curve with linear interpolation between points. 
 
const te::rst::Raster * m_raster
The band from where to get the values. 
 
int m_totalRasterRows
The number of rows in band (default: 0). 
 
static PolygonIterator end(const te::rst::Raster *r, const te::gm::Polygon *p)
Returns an iterator referring to after the end of the iterator. 
 
const te::rst::Raster * m_raster
The band from where to get the values. 
 
double getResolutionY() const
Returns the grid vertical (y-axis) resolution. 
 
int m_currentRangeStartingColumn
The current line iteration range starting column (default: -1). 
 
A point with x and y coordinate values. 
 
void geoToGrid(const double &x, const double &y, double &col, double &row) const
Get the grid point associated to a spatial location. 
 
An Envelope defines a 2D rectangular region. 
 
T operator[](const unsigned int i) const
Returns the real value in current position (column, row, band) from iterator. 
 
An abstract class for raster data strucutures. 
 
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 c...
 
virtual unsigned int getColumn() const =0
Returns the current column in iterator. 
 
const te::rst::Raster * m_raster
The band from where to get the values (default 0). 
 
unsigned int getColumn() const
Returns the current column in iterator. 
 
const std::vector< T > operator*() const
Returns a vector of the values in current position (column, row) from iterator. 
 
std::unique_ptr< Point > getEndPoint() const
It returns the curve end point. 
 
double getResolutionY() const
Returns the raster vertical (y-axis) resolution. 
 
int m_currentpixelindex
The index of the current pixel location. 
 
void setNumCoordinates(std::size_t size)
It reserves room for the number of coordinates in this LineString. 
 
TEGEOMEXPORT bool SatisfySpatialRelation(const Geometry *g1, const Geometry *g2, SpatialRelation relation)
It returns if two geometries satisfy a given spatial relation. 
 
Itaration over pixels whose bounding boxes are not disjoint in relation with the polygon. 
 
std::complex< double > m_operatorParenthesis_value
Used by the operator() method. 
 
const double & getY(std::size_t i) const
It returns the n-th y coordinate value. 
 
void setEnd()
Sets the iterator position to the end of the current band. 
 
T operator[](const unsigned int i) const
Returns the real value in current position (column, row, band) from iterator. 
 
It gives access to values in one band (dimension) of a raster. 
 
void initiateVariables()
Initialize all internal variables to initial states. 
 
void clear()
Clear all internal allocated objects and reset back to the initial state. 
 
int m_polygonStartingRow
Polygon first raster row (default: -1). 
 
virtual void setEnd()=0
Sets the iterator position to the end of the current band. 
 
unsigned int getNumberOfColumns() const
Returns the grid number of columns. 
 
virtual const std::vector< T > operator*() const =0
Returns a vector of the values in current position (column, row) from iterator. 
 
int getSRID() const
Returns the raster spatial reference system identifier. 
 
double m_operatorBrackets_value
 
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards. 
 
void operator--()
Returns to the previous position. 
 
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 S...
 
double m_lly
Lower left corner y-coordinate. 
 
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. 
 
IterationType m_iterationType
Current iteration type (default ScanLineIterationT). 
 
std::vector< std::pair< int, int > > m_currentLineIntersectionRanges
Coordinates of the columns to be transversed. 
 
bool operator!=(const LineIterator< T > &rhs) const
 
virtual Geometry * intersection(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns a geometric object that represents the point set intersection with another geometry...
 
std::vector< te::gm::Point * > m_pixelsinpointset
The spatial restriction to be applied in the iterator. 
 
unsigned int getColumn() const
Returns the current column in iterator. 
 
virtual ~AbstractPositionIterator()
Destructor. 
 
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings. 
 
static PointSetIterator end(const te::rst::Raster *r, const std::vector< te::gm::Point *> p)
Returns an iterator referring to after the end of the iterator. 
 
void operator--()
Returns to the previous position. 
 
A rectified grid is the spatial support for raster data. 
 
TEGEOMEXPORT void Multi2Single(const te::gm::Geometry *g, std::vector< te::gm::Geometry *> &geoms)
It will get a GeometryCollection and distribute in a vector. 
 
unsigned int getRow() const
Returns the current row in iterator. 
 
const std::vector< T > operator*() const
Returns a vector of the values in current position (column, row) from iterator. 
 
double m_ury
Upper right corner y-coordinate. 
 
int m_column
The current column of the iterator (default -1). 
 
std::complex< double > m_operatorParenthesis_value
 
static LineIterator end(const te::rst::Raster *r, const te::gm::Line *l)
Returns an iterator referring to after the end of the iterator. 
 
unsigned int getRow() const
Returns the current row in iterator. 
 
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. 
 
std::vector< std::pair< unsigned int, unsigned int > > TileSegIndex
 
#define TE_LOG_WARN(message)
Use this tag in order to log a message to the TerraLib default logger with the WARN level...
 
int m_totalRasterColumns
The number of columns in band (default: 0). 
 
void operator++()
Advances to the next position. 
 
virtual T operator[](const unsigned int i) const =0
Returns the real value in current position (column, row, band) from iterator. 
 
void operator--()
Returns to the previous position. 
 
A rectified grid is the spatial support for raster data. 
 
bool initialize(const te::rst::Raster *r, const te::gm::Polygon *p, const IterationType iterationType)
Initialize this instance. 
 
int m_polygonEndingRow
Polygon last raster row (default: -1). 
 
virtual AbstractPositionIterator< T > & operator=(const AbstractPositionIterator< T > &rhs)
Assignment operator. 
 
LineIterator & operator=(const LineIterator &rhs)
 
T operator[](const unsigned int i) const
Returns the real value in current position (column, row, band) from iterator. 
 
std::unique_ptr< te::rst::TileIndexer > m_tileIndexerPtr
Tile indexer used to optimize the geometric operations. 
 
std::complex< T > operator()(const unsigned int i) const
Returns the complex value in current position (column, row, band) from iterator. 
 
static LineIterator begin(const te::rst::Raster *r, const te::gm::Line *l)
Returns an iterator referring to the first value of the band. 
 
const std::vector< T > operator*() const
Returns a vector of the values in current position (column, row) from iterator.