27 #include "../common/Translator.h"
28 #include "../raster/BandProperty.h"
29 #include "../raster/Utils.h"
39 : te::rst::
Band(p, idx),
63 if(externalBuffer == 0)
67 m_buff =
static_cast<unsigned char*
>(externalBuffer);
81 m_getBuff(rhs.m_getBuff),
82 m_getBuffI(rhs.m_getBuffI),
83 m_setBuff(rhs.m_setBuff),
84 m_setBuffI(rhs.m_setBuffI),
87 m_blksize(rhs.m_blksize),
111 throw Exception(
TR_MEMORY(
"You can not assign a band to another one with different block size"));
115 memcpy(m_buff, rhs.
m_buff, m_blksize);
130 int pos = c + r * m_ncols;
132 m_getBuff(pos, m_buff, &value);
137 int pos = c + r * m_ncols;
139 m_setBuff(pos, m_buff, &value);
144 int pos = c + r * m_ncols;
146 m_getBuffI(pos, m_buff, &value);
151 int pos = c + r * m_ncols;
153 m_setBuffI(pos, m_buff, &value);
158 assert(x == 0 && y == 0);
160 memcpy(buffer, m_buff, m_blksize);
165 assert(x == 0 && y == 0);
172 assert(x == 0 && y == 0);
174 memcpy(m_buff, buffer, m_blksize);
int m_blkh
Block height (pixels).
te::rst::Raster * getRaster() const
Returns the associated raster.
int m_ncols
Buffered number of cols.
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 getBlockSize() const
It returns the number of bytes ocuppied by a data block.
int getType() const
It returns the data type of the elements in the band.
TERASTEREXPORT int Round(double val)
Round a double value to a integer value.
TERASTEREXPORT int GetPixelSize(int datatype)
Returns the byte size of a given datatype.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
void setRaster(Raster *r)
A raster class for memory.
#define TR_MEMORY(message)
int m_nrows
Buffered number of rows.
void read(int x, int y, void *buffer) const
It reads a data block to the specified buffer.
An exception class for the TerraLib In-Memory Data Access driver.
unsigned char * m_buff
A pointer to a block buffer.
void getValue(unsigned int c, unsigned int r, double &value) const
Returns the cell attribute value.
A raster class for memory.
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_blkw
Block width (pixels).
virtual Band & operator=(const Band &rhs)
Assignment operator.
~Band()
Virtual destructor.
bool m_releaseBuffer
A flag that indicates if the buffer must be released when the band goes out of scope.
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...
void setIValue(unsigned int c, unsigned int r, const double value)
Sets the imaginary attribute value in a complex band of a cell.
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
A raster band description.
void getIValue(unsigned int c, unsigned int r, double &value) const
Returns the imaginary attribute value in a complex band of a cell.
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...
void setValue(unsigned int c, unsigned int r, const double value)
Sets the cell attribute value.
An abstract class for raster data strucutures.
Band implementation for the In-Memory Raster.
te::rst::GetBufferValueFPtr m_getBuffI
A pointer to a function that helps to extract the imaginary part value from a specific buffer data ty...
void write(int x, int y, void *buffer)
It writes a data block from the specified buffer.
Band & operator=(const Band &rhs)
int m_blksize
The data block size.
BandProperty * m_property
The band information.
Band(Raster *r, te::rst::BandProperty *p, std::size_t idx, void *externalBuffer=0)