26 #ifndef __TERRALIB_RASTER_INTERNAL_BANDITERATOR_H
27 #define __TERRALIB_RASTER_INTERNAL_BANDITERATOR_H
35 #include <boost/dynamic_bitset.hpp>
84 unsigned int getRow()
const;
341 : m_blkw(b->getProperty()->m_blkw),
342 m_blkh(b->getProperty()->m_blkh),
343 m_npxlsblk(m_blkw * m_blkh),
344 m_nblocksx(b->getProperty()->m_nblocksx),
345 m_nblocksy(b->getProperty()->m_nblocksy),
349 m_blksize(b->getBlockSize()),
364 : m_blkw(rhs.m_blkw),
366 m_npxlsblk(rhs.m_npxlsblk),
367 m_nblocksx(rhs.m_nblocksx),
368 m_nblocksy(rhs.m_nblocksy),
372 m_lastblksize(rhs.m_lastblksize),
373 m_blksize(rhs.m_blksize),
374 m_getBuff(rhs.m_getBuff),
375 m_getBuffI(rhs.m_getBuffI),
376 m_setBuff(rhs.m_setBuff),
377 m_setBuffI(rhs.m_setBuffI)
391 return m_blky * m_blkh + (m_i - (m_i % m_blkw)) / m_blkw;
396 return m_blkx * m_blkw + m_i % m_blkw;
410 if(m_blkx < m_nblocksx)
421 if(m_blky < m_nblocksy)
424 if((m_blkx == m_nblocksx - 1) && (m_blky == m_nblocksy - 1))
425 m_npxlsblk = m_lastblksize;
435 m_i = m_npxlsblk - 1;
446 m_blkx = m_nblocksx - 1;
479 return (m_blky != rhs.
m_blky);
509 this->m_getBuff(this->m_i, this->m_blk, &value);
518 this->m_getBuff(this->m_i, this->m_blk, &value);
548 m_band->read(this->m_blkx, this->m_blky, this->m_blk);
578 this->m_getBuff(this->m_i, this->m_blk, &value);
608 m_band->read(this->m_blkx, this->m_blky, this->m_blk);
614 m_currentpixelindex(0),
622 m_currentpixelindex(0),
630 m_mask.resize(m_masksize);
657 m_currentpixelindex++;
659 if (m_currentpixelindex >= m_masksize)
662 while (m_mask[m_currentpixelindex] == 0);
671 m_currentpixelindex--;
673 if (m_currentpixelindex < 0)
676 while (m_mask[m_currentpixelindex] == 0);
707 #endif // __TERRALIB_RASTER_INTERNAL_BANDITERATOR_H
It gives access to values in one band (dimension) of a raster.
unsigned int getColumn() const
Returns the current column in iterator.
static BandIteratorWithMask begin(Band *b, Raster *m)
Returns an iterator with the mask referring to the first value of the band.
ConstBandIterator()
Constructor.
Utility functions for dealing with raster data blocks.
This class implements an iterator to "navigate" over a single band.
int m_nblocksy
The number of blocks in Y direction.
AbstractBandIterator & operator=(const AbstractBandIterator &rhs)
Assignment operator.
virtual void replaceBlock()=0
Replaces the current bufferized block values.
int getType() const
It returns the data type of the elements in the band.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
int m_i
The actual position inside the block.
te::rst::SetBufferValueFPtr m_setBuffI
A pointer to a function that helps to insert the imaginary part value into a specific buffer data typ...
void(* GetBufferValueFPtr)(int index, void *buffer, double *value)
The type of function used to extract data from a buffer.
It describes one band (or dimension) of a raster.
bool operator!=(const AbstractBandIterator &rhs) const
Difference operator.
int m_blky
The position in Y of the current block.
int m_blkw
The internal block width.
const Band * m_band
The band from where to get the values.
int m_nblocksy
The number of blocks in y.
void(* SetBufferValueFPtr)(int index, void *buffer, const double *value)
The type of function used to extract data from a buffer.
void operator++()
Advances to the next position.
A raster band description.
te::rst::SetBufferValueFPtr m_setBuff
A pointer to a function that helps to insert a double or complex value into a specific buffer data ty...
AbstractBandIterator()
Constructor.
virtual Raster * getRaster() const =0
Returns the associated raster.
This class implements an iterator to "navigate" over a single band, with a spatial restriction given ...
int m_blkx
The position in X of the current block.
TERASTEREXPORT void SetBlockFunctions(GetBufferValueFPtr *gb, GetBufferValueFPtr *gbi, SetBufferValueFPtr *sb, SetBufferValueFPtr *sbi, int type)
Sets the pointers to functions that helps to extract a double or complex value from a specific buffer...
int m_blkh
The internal block height.
void replaceBlock()
Replaces the current bufferized block values.
ConstBandIterator & operator=(const ConstBandIterator &rhs)
Assignment operator.
int m_lastblksize
The number of pixels inside the last block.
Band * m_band
The band from where to get the values.
te::rst::GetBufferValueFPtr m_getBuffI
A pointer to a function that helps to extract the imaginary part value from a specific buffer data ty...
BandIterator()
Constructor.
unsigned int m_currentpixelindex
The index of the current pixel location.
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
void replaceBlock()
Replaces the current bufferized block values.
const T operator*() const
Returns the value in current position (column, row) from iterator.
This class implements an iterator to "navigate" over a single band (const).
boost::dynamic_bitset m_mask
The internal mask of bits, one bit per pixel.
unsigned int getRow() const
Returns the current row in iterator.
int m_nblocksx
The number of blocks in X direction.
static ConstBandIterator begin(const Band *b)
Returns an iterator referring to the first value of the band.
An abstract class for raster data strucutures.
BandProperty * getProperty()
Returns the band property.
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band.
virtual void operator++()
Advances to the next position.
int m_blksize
The block size of the band.
static BandIterator begin(Band *b)
Returns an iterator referring to the first value of the band.
T operator*()
Returns the value in current position (column, row) from iterator.
te::rst::GetBufferValueFPtr m_getBuff
A pointer to a function that helps to extract a double or complex value from a specific buffer data t...
virtual const T operator*() const =0
Returns the value in current position (column, row) from iterator.
void operator--()
Returns to the previous position.
~AbstractBandIterator()
Destructor.
static BandIteratorWithMask end(Band *b, Raster *m)
Returns an iterator with the mask referring to after the end of the iterator.
unsigned int m_masksize
The size of the mask (rows * columns of the mask raster).
BandIteratorWithMask()
Constructor.
static ConstBandIterator end(const Band *b)
Returns an iterator referring to after the end of the iterator.
BandIterator & operator=(const BandIterator &rhs)
Assignment operator.
BandIteratorWithMask & operator=(const BandIteratorWithMask &rhs)
Assignment operator.
int m_npxlsblk
The maximum number of pixels inside the block.
This class implements an abstract iterator to "navigate" over a single band.
static BandIterator end(Band *b)
Returns an iterator referring to after the end of the iterator.