28 #ifndef __TERRALIB_RASTER_INTERNAL_BANDITERATORWINDOW_H 
   29 #define __TERRALIB_RASTER_INTERNAL_BANDITERATORWINDOW_H 
   32 #include "../common/STLUtils.h" 
   80         unsigned int getRow() 
const;
 
  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);
 
  488 #endif  // __TERRALIB_RASTER_INTERNAL_BANDITERATORWINDOW_H 
It describes one band (or dimension) of a raster. 
 
BandIteratorWindow()
Constructor. 
 
int m_blkw
The internal block width. 
 
unsigned int getNumberOfColumns() const 
Returns the raster number of columns. 
 
unsigned int getColumn() const 
Returns the current column in iterator. 
 
int m_nblocksy
The number of blocks in Y direction. 
 
int m_nblocksy
The number of blocks in y. 
 
~BandIteratorWindow()
Destructor. 
 
Band const * m_band
The band from where to get the values. 
 
void(* SetBufferValueFPtr)(int index, void *buffer, const double *value)
The type of function used to extract data from a buffer. 
 
unsigned int getRow() const 
Returns the current row in iterator. 
 
BandIteratorWindow & operator=(const BandIteratorWindow &rhs)
Assignment operator. 
 
void operator++()
Advances to the next position. 
 
int m_blky
The position in Y of the current block. 
 
void(* GetBufferValueFPtr)(int index, void *buffer, double *value)
The type of function used to extract data from a buffer. 
 
int m_blkx
The position in X of the current block. 
 
BandProperty * getProperty()
Returns the band property. 
 
int m_blkh
The internal block height. 
 
bool operator!=(const BandIteratorWindow &rhs) const 
Differece operator. 
 
unsigned int getNumberOfRows() const 
Returns the raster number of rows. 
 
te::rst::GetBufferValueFPtr m_getBuffI
A pointer to a function that helps to extract the imaginary part value from a specific buffer data ty...
 
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_h
The height of the window to iterate. 
 
T * getBlock(int c, int r) const 
Returns the correct block where relative value is used. 
 
virtual Raster * getRaster() const =0
Returns the associated raster. 
 
int m_npxlsblk
The maximum number of pixels inside the block. 
 
int m_i
The actual position inside the block. 
 
It gives access to values in one band (dimension) of a raster. 
 
int m_nvblocksy
The amount of blocks in direction Y in vector of internal blocks. 
 
A raster band description. 
 
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...
 
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. 
 
void replaceBlocks()
Replaces the current bufferized blocks. 
 
int m_cblock
The index of the central block;. 
 
BandIteratorWindow operator*()
 
int m_w
The width of the window to iterate. 
 
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_nvblocksx
The amount of blocks in direction X in vector of internal blocks. 
 
void operator--()
Returns to the previous position. 
 
int m_nblocksx
The number of blocks in X direction. 
 
int getType() const 
It returns the data type of the elements in the band. 
 
int m_lastblksize
The number of pixels inside the last block. 
 
virtual int getBlockSize() const 
It returns the number of bytes ocuppied by a data block. 
 
It implements and iterator to "navigate" over a single band, optimized by a window structure (e...
 
std::vector< T * > m_blocks
A vector of internal blocks, to provide fast access to window elements. 
 
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. 
 
T getValue() const 
Returns the value in current position (column, row) from iterator. 
 
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...
 
int getRelativeIndex(int c, int r) const 
Returns the correct index where the relative value is in the relative 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...