28 #ifndef __TERRALIB_RASTER_INTERNAL_BANDITERATORWINDOW_H 
   29 #define __TERRALIB_RASTER_INTERNAL_BANDITERATORWINDOW_H 
   32 #include "../common/STLUtils.h" 
   80         unsigned int getRow() 
const;
 
  193       : m_w(static_cast<int>(w)),
 
  194       m_h(static_cast<int>(h)),
 
  195         m_blkw(b->getProperty()->m_blkw),
 
  196         m_blkh(b->getProperty()->m_blkh),
 
  197         m_npxlsblk(m_blkw * m_blkh),
 
  198         m_nblocksx(b->getProperty()->m_nblocksx),
 
  199         m_nblocksy(b->getProperty()->m_nblocksy),
 
  257         m_npxlsblk(rhs.m_npxlsblk),
 
  258         m_nblocksx(rhs.m_nblocksx),
 
  259         m_nblocksy(rhs.m_nblocksy),
 
  260         m_nvblocksx(rhs.m_nvblocksx),
 
  261         m_nvblocksy(rhs.m_nvblocksy),
 
  262         m_cblock(rhs.m_cblock),
 
  266         m_lastblksize(rhs.m_lastblksize),
 
  268         m_getBuff(rhs.m_getBuff),
 
  269         m_getBuffI(rhs.m_getBuffI),
 
  270         m_setBuff(rhs.m_setBuff),
 
  271         m_setBuffI(rhs.m_setBuffI)
 
  311       return m_blky * m_blkh + (m_i - (m_i % m_blkw)) / m_blkw;
 
  316       return m_blkx * m_blkw + m_i % m_blkw;
 
  324       this->m_getBuff(this->m_i, this->m_blocks[m_cblock], &value);
 
  334       this->m_getBuff(this->getRelativeIndex(c, r), this->getBlock(c, r), &value);
 
  350       if(m_blkx < m_nblocksx)
 
  361       if(m_blky < m_nblocksy)
 
  364       if((m_blkx == m_nblocksx - 1) && (m_blky == m_nblocksy - 1))
 
  365         m_npxlsblk = m_lastblksize;
 
  375       m_i = m_npxlsblk - 1;
 
  386       m_blkx = m_nblocksx - 1;
 
  419         for (
int i = 0; i < (m_nvblocksx * m_nvblocksy); i++)
 
  420           m_blocks.push_back(
new T[m_band->getBlockSize()]);
 
  430       return (m_blky != rhs.
m_blky);
 
  451       for (
int x = (m_blkx - m_nvblocksx / 2); x <= (m_blkx + m_nvblocksx / 2); x++)
 
  452         for (
int y = (m_blky - m_nvblocksy / 2); y <= (m_blky + m_nvblocksy / 2); y++)
 
  454           if ((x >= 0) && (x < m_nblocksx))
 
  455             if ((y >= 0) && (y < m_nblocksy))
 
  457               m_band->read(x, y, m_blocks[blk]);
 
  467       int bx = (getColumn() + c) / m_blkw;
 
  469       int by = (getRow() + r) / m_blkh;
 
  471       int blk = m_cblock + (bx - m_blkx) + (by - m_blky) * m_nvblocksx;
 
  473       return m_blocks[blk];
 
  478       int cc = (getColumn() + c) % m_blkw;
 
  480       int cr = (getRow() + r) % m_blkh;
 
  482       return (cc + cr * m_blkw);
 
It describes one band (or dimension) of a raster.
 
It implements and iterator to "navigate" over a single band, optimized by a window structure (e....
 
int m_cblock
The index of the central block;.
 
int m_nblocksy
The number of blocks in Y direction.
 
BandIteratorWindow & operator=(const BandIteratorWindow &rhs)
Assignment operator.
 
static BandIteratorWindow begin(Band const *const b, std::size_t w, const std::size_t h)
Returns an iterator referring to the first value of the band.
 
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...
 
int m_nvblocksy
The amount of blocks in direction Y in vector of internal blocks.
 
te::rst::GetBufferValueFPtr m_getBuffI
A pointer to a function that helps to extract the imaginary part value from a specific buffer data ty...
 
unsigned int getColumn() const
Returns the current column in iterator.
 
int m_npxlsblk
The maximum number of pixels 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...
 
int m_blkx
The position in X of the current block.
 
static BandIteratorWindow end(Band const *const b, std::size_t w, const std::size_t h)
Returns an iterator referring to after the end of the iterator.
 
std::vector< T * > m_blocks
A vector of internal blocks, to provide fast access to window elements.
 
BandIteratorWindow()
Constructor.
 
Band const  * m_band
The band from where to get the values.
 
int m_w
The width of the window to iterate.
 
void replaceBlocks()
Replaces the current bufferized blocks.
 
int m_h
The height of the window to iterate.
 
int m_i
The actual position inside the block.
 
int m_nvblocksx
The amount of blocks in direction X in vector of internal blocks.
 
bool operator!=(const BandIteratorWindow &rhs) const
Differece operator.
 
void operator++()
Advances to the next position.
 
T * getBlock(int c, int r) const
Returns the correct block where relative value is used.
 
int m_blky
The position in Y of the current block.
 
unsigned int getRow() const
Returns the current row in iterator.
 
int m_blkw
The internal block width.
 
BandIteratorWindow operator*()
 
T getValue() const
Returns the value in current position (column, row) from iterator.
 
int m_lastblksize
The number of pixels inside the last block.
 
void operator--()
Returns to the previous position.
 
int getRelativeIndex(int c, int r) const
Returns the correct index where the relative value is in the relative block.
 
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...
 
int m_nblocksx
The number of blocks in X direction.
 
~BandIteratorWindow()
Destructor.
 
int m_blkh
The internal block height.
 
int getType() const
It returns the data type of the elements in the band.
 
int m_nblocksy
The number of blocks in y.
 
A raster band description.
 
virtual int getBlockSize() const
It returns the number of bytes ocuppied by a data block.
 
BandProperty * getProperty()
Returns the band property.
 
virtual Raster * getRaster() const =0
Returns the associated raster.
 
unsigned int getNumberOfRows() const
Returns the raster number of rows.
 
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
 
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map.
 
void(* SetBufferValueFPtr)(int index, void *buffer, const double *value)
The type of function used to extract data from a buffer.
 
void(* GetBufferValueFPtr)(int index, void *buffer, double *value)
The type of function used to extract data from a buffer.
 
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...
 
Band implementation for TerraLib 4.x.