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;
165 DisjointBBOXIterationT
204 std::complex< T >
operator()(
const unsigned int i)
const;
206 unsigned int getRow()
const;
263 void initiateVariables();
273 void getIntersectionRanges(
int lineIndex,
274 std::vector<std::pair<int, int> >& intersectionRanges )
const;
281 void getScanLineIntersectionRanges(
int lineIndex,
282 std::vector<std::pair<int, int> >& intersectionRanges )
const;
290 void getBBOXIntersectionRanges(
int lineIndex,
const bool areDisjoint,
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 = 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),
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;
1337 values[
b] = ((T) value);
1397 template<
typename T>
1428 template<
typename T>
1438 m_pixelsinpointset(0),
1454 std::vector<te::gm::Point*> inside_points;
1461 throw te::rst::Exception(
TE_TR(
"Invalid point SRID") );
1499 values[
b] = ((T) value);
1558 template<
typename T>
1589 template<
typename T>
1599 #endif // __TERRALIB_RASTER_INTERNAL_POSITIONITERATOR_H An exception class for the Raster module.
unsigned int getNumberOfRows() const
Returns the grid number of rows.
std::unique_ptr< Point > getEndPoint() const
It returns the curve end point.
int m_row
The current row of the iterator (default -1).
te::gm::Envelope * getExtent()
Returns the geographic extension of the raster data.
void setEnd()
Sets the iterator position to the end of the current band.
virtual T operator[](const unsigned int i) const =0
Returns the real value in current position (column, row, band) from iterator.
It gives access to values in one band (dimension) of a raster.
Polygon tile indexing class for optmized geometrical relational tests.
A Line is LineString with 2 points.
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).
const std::vector< T > operator*() const
Returns a vector of the values in current position (column, row) from iterator.
void setX(std::size_t i, const double &x)
It sets the n-th x coordinate value.
virtual bool operator!=(const AbstractPositionIterator< T > &rhs) const =0
Difference operator.
const te::gm::Line * m_line
The spatial restriction to be applied in the iterator.
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.
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
double m_operatorBrackets_value
Used by the operator[] method.
virtual void operator--()=0
Returns to the previous position.
bool operator!=(const PolygonIterator< T > &rhs) const
T operator[](const unsigned int i) const
Returns the real value in current position (column, row, band) from iterator.
unsigned int getColumn() const
Returns the current column in iterator.
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...
TEGEOMEXPORT bool SatisfySpatialRelation(const Geometry *g1, const Geometry *g2, SpatialRelation relation)
It returns if two geometries satisfy a given spatial relation.
This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a...
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...
double m_urx
Upper right corner x-coordinate.
Scan line iteration type.
double m_operatorBrackets_value
Used by the operator[] method.
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.
bool StdSortPointPointerComparison(te::gm::Point *p1, te::gm::Point *p2)
This class is the base for implementing ways to navigate over the band with spatial restriction...
unsigned int getRow() const
Returns the current row in iterator.
An utility struct for representing 2D coordinates.
bool operator!=(const PointSetIterator< T > &rhs) const
void operator++()
Advances to the next position.
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).
bool operator!=(const LineIterator< T > &rhs) const
#define TE_TR(message)
It marks a string in order to get translated.
T operator[](const unsigned int i) const
Returns the real value in current position (column, row, band) from iterator.
virtual std::complex< T > operator()(const unsigned int i) const =0
Returns the complex value in current position (column, row, band) from iterator.
PolygonIterator & operator=(const PolygonIterator &rhs)
TEGEOMEXPORT void Multi2Single(const te::gm::Geometry *g, std::vector< te::gm::Geometry * > &geoms)
It will get a GeometryCollection and distribute in a vector.
PointSetIterator & operator=(const PointSetIterator &rhs)
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...
void geoToGrid(const double &x, const double &y, double &col, double &row) const
Get the grid point associated to a spatial location.
This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a...
const double & getY(std::size_t i) const
It returns the n-th y coordinate value.
double getResolutionY() const
Returns the grid vertical (y-axis) resolution.
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.
std::complex< T > operator()(const unsigned int i) const
Returns the complex value in current position (column, row, band) from iterator.
A LinearRing is a LineString that is both closed and simple.
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.
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...
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.
int m_currentRangeStartingColumn
The current line iteration range starting column (default: -1).
A point with x and y coordinate values.
An Envelope defines a 2D rectangular region.
An abstract class for raster data strucutures.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
const te::rst::Raster * m_raster
The band from where to get the values (default 0).
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
const double & getX(std::size_t i) const
It returns the n-th x coordinate value.
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.
unsigned int getNumberOfColumns() const
Returns the grid number of columns.
double getResolutionX() const
Returns the raster horizontal (x-axis) resolution.
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.
std::complex< T > operator()(const unsigned int i) const
Returns the complex value in current position (column, row, band) from iterator.
void setEnd()
Sets the iterator position to the end of the current band.
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.
Grid * getGrid()
It returns the raster grid.
virtual const std::vector< T > operator*() const =0
Returns a vector of the values in current position (column, row) from iterator.
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.
virtual void getValue(unsigned int c, unsigned int r, double &value, std::size_t b=0) const
Returns the attribute value of a band of a cell.
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.
int getSRID() const
Returns the raster spatial reference system identifier.
std::vector< te::gm::Point * > m_pixelsinpointset
The spatial restriction to be applied in the iterator.
virtual ~AbstractPositionIterator()
Destructor.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
void operator--()
Returns to the previous position.
A rectified grid is the spatial support for raster data.
double m_ury
Upper right corner y-coordinate.
const std::vector< T > operator*() const
Returns a vector of the values in current position (column, row) from iterator.
int m_column
The current column of the iterator (default -1).
unsigned int getColumn() const
Returns the current column in iterator.
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.
te::gm::Envelope * getExtent()
Returns the geographic extension of the grid.
void clear()
It deletes all the rings of the CurvePolygon and clear it.
T operator[](const unsigned int i) const
Returns the real value in current position (column, row, band) from iterator.
void gridToGeo(const double &col, const double &row, double &x, double &y) const
Get the spatial location of a grid point.
unsigned int getRow() const
Returns the current row in iterator.
double getResolutionY() const
Returns the raster vertical (y-axis) resolution.
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.
virtual unsigned int getRow() const =0
Returns the current row in 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...
std::complex< T > operator()(const unsigned int i) const
Returns the complex value in current position (column, row, band) from iterator.
int m_totalRasterColumns
The number of columns in band (default: 0).
void operator++()
Advances to the next position.
virtual unsigned int getColumn() const =0
Returns the current column in iterator.
void operator--()
Returns to the previous position.
unsigned int getColumn() const
Returns the current column in iterator.
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).
const std::vector< T > operator*() const
Returns a vector of the values in current position (column, row) from iterator.
virtual AbstractPositionIterator< T > & operator=(const AbstractPositionIterator< T > &rhs)
Assignment operator.
std::unique_ptr< Point > getStartPoint() const
The length of this Curve in its associated spatial reference.
LineIterator & operator=(const LineIterator &rhs)
unsigned int getRow() const
Returns the current row in iterator.
std::unique_ptr< te::rst::TileIndexer > m_tileIndexerPtr
Tile indexer used to optimize the geometric operations.
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.
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.
static LineIterator begin(const te::rst::Raster *r, const te::gm::Line *l)
Returns an iterator referring to the first value of the band.