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