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

This class implements and iterator to "navigate" over a raster, with a predefined number of bands. More...

#include <RasterIterator.h>

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...
 
void getValues (std::vector< T > &v) const
 Gets the values from all bands in current position (column, row) from iterator. More...
 
bool operator!= (const RasterIterator &rhs) const
 Difference operator. More...
 
std::vector< T > operator* () const
 Returns a vector with pixel values from all bands in current position (column, row) from iterator. More...
 
void operator++ ()
 Advances to the next position. More...
 
void operator-- ()
 Returns to the previous position. More...
 
RasterIteratoroperator= (const RasterIterator &rhs)
 Assignment operator. More...
 
operator[] (const unsigned int i) const
 Returns the value in current position (column, row, band) from iterator. More...
 
 RasterIterator ()
 Empty constructor. More...
 
 RasterIterator (Raster *r, const std::vector< unsigned int > &bands)
 Constructor. More...
 
 RasterIterator (const RasterIterator &rhs)
 Copy constructor. More...
 
 ~RasterIterator ()
 Destructor. More...
 

Static Public Member Functions

static RasterIterator begin (Raster *r, const std::vector< unsigned int > &bands)
 Returns an iterator referring to the first value. More...
 
static RasterIterator end (Raster *r, const std::vector< unsigned int > &bands)
 Returns an iterator referring to after the end of the iterator. More...
 

Private Attributes

std::vector< unsigned int > m_b
 The vector of bands to iterate. More...
 
std::vector< BandIterator< T > > m_it
 The vector of band iterators. More...
 
Rasterm_raster
 The raster from where to get the values. More...
 

Detailed Description

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

This class implements and iterator to "navigate" over a raster, with a predefined number of bands.

See also
te::rst::Raster

Definition at line 52 of file RasterIterator.h.

Constructor & Destructor Documentation

◆ RasterIterator() [1/3]

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

Empty constructor.

Definition at line 151 of file RasterIterator.h.

◆ RasterIterator() [2/3]

template<class T >
te::rst::RasterIterator< T >::RasterIterator ( Raster r,
const std::vector< unsigned int > &  bands 
)

Constructor.

Parameters
rThe raster to iterate.
bandsThe vector of band indices that the iterator will use.

Definition at line 158 of file RasterIterator.h.

References te::rst::Raster::getBand(), te::rst::RasterIterator< T >::m_b, and te::rst::RasterIterator< T >::m_it.

◆ RasterIterator() [3/3]

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

Copy constructor.

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

Definition at line 166 of file RasterIterator.h.

◆ ~RasterIterator()

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

Destructor.

Definition at line 171 of file RasterIterator.h.

Member Function Documentation

◆ begin()

template<class T >
te::rst::RasterIterator< T > te::rst::RasterIterator< T >::begin ( Raster r,
const std::vector< unsigned int > &  bands 
)
static

Returns an iterator referring to the first value.

Parameters
rThe raster to iterate.
bandsThe vector of band indices that the iterator will use.

Definition at line 236 of file RasterIterator.h.

◆ end()

template<class T >
te::rst::RasterIterator< T > te::rst::RasterIterator< T >::end ( Raster r,
const std::vector< unsigned int > &  bands 
)
static

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

Parameters
rThe raster to iterate.
bandsThe vector of band indices that the iterator will use.

Definition at line 241 of file RasterIterator.h.

References te::rst::Raster::getBand(), and te::rst::RasterIterator< T >::m_it.

◆ getColumn()

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

Returns the current column in iterator.

Definition at line 180 of file RasterIterator.h.

◆ getRow()

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

Returns the current row in iterator.

Definition at line 175 of file RasterIterator.h.

◆ getValues()

template<class T >
void te::rst::RasterIterator< T >::getValues ( std::vector< T > &  v) const

Gets the values from all bands in current position (column, row) from iterator.

Parameters
vA vector previously created to be filled with values.
Warning
The caller is responsible for creating the vector with enough space.

Definition at line 199 of file RasterIterator.h.

◆ operator!=()

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

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 231 of file RasterIterator.h.

References te::rst::RasterIterator< T >::m_it.

◆ operator*()

template<class T >
std::vector< T > te::rst::RasterIterator< T >::operator* ( ) const

Returns a vector with pixel values from all bands in current position (column, row) from iterator.

Definition at line 190 of file RasterIterator.h.

◆ operator++()

template<class T >
void te::rst::RasterIterator< T >::operator++ ( )

Advances to the next position.

Definition at line 205 of file RasterIterator.h.

◆ operator--()

template<class T >
void te::rst::RasterIterator< T >::operator-- ( )

Returns to the previous position.

Definition at line 211 of file RasterIterator.h.

◆ operator=()

template<class T >
te::rst::RasterIterator< T > & te::rst::RasterIterator< T >::operator= ( const RasterIterator< T > &  rhs)

Assignment operator.

Parameters
rhsThe right-hand-side copy used to copy from.
Returns
A reference to this object.

Definition at line 217 of file RasterIterator.h.

References te::rst::RasterIterator< T >::m_b, te::rst::RasterIterator< T >::m_it, and te::rst::RasterIterator< T >::m_raster.

◆ operator[]()

template<class T >
T te::rst::RasterIterator< T >::operator[] ( const unsigned int  i) const

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

Parameters
iThe band index.
Returns
The pixel value in current position.

Definition at line 185 of file RasterIterator.h.

Member Data Documentation

◆ m_b

template<class T>
std::vector<unsigned int> te::rst::RasterIterator< T >::m_b
private

The vector of bands to iterate.

Definition at line 146 of file RasterIterator.h.

Referenced by te::rst::RasterIterator< T >::operator=(), and te::rst::RasterIterator< T >::RasterIterator().

◆ m_it

◆ m_raster

template<class T>
Raster* te::rst::RasterIterator< T >::m_raster
private

The raster from where to get the values.

Definition at line 147 of file RasterIterator.h.

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


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