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(
TE_TR(
"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);
void getIValue(unsigned int c, unsigned int r, double &value) const
Returns the imaginary attribute value in a complex band of a cell.
A raster class for memory.
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 setIValue(unsigned int c, unsigned int r, const double value)
Sets the imaginary attribute value in a complex band of a cell.
A raster band description.
int m_nrows
Buffered number of rows.
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
virtual Band & operator=(const Band &rhs)
Assignment operator.
int m_blksize
The data block size.
~Band()
Virtual destructor.
void setRaster(Raster *r)
int getBlockSize() const
It returns the number of bytes ocuppied by a data block.
#define TE_TR(message)
It marks a string in order to get translated.
An exception class for the TerraLib In-Memory Data Access driver.
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...
Band(Raster *r, te::rst::BandProperty *p, std::size_t idx, void *externalBuffer=0)
void read(int x, int y, void *buffer) const
It reads a data block to the specified buffer.
void setValue(unsigned int c, unsigned int r, const double value)
Sets the cell attribute value.
TERASTEREXPORT int Round(double val)
Round a double value to a integer value.
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...
te::rst::Raster * getRaster() const
Returns the associated raster.
Band & operator=(const Band &rhs)
An abstract class for raster data strucutures.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
int m_blkw
Block width (pixels).
bool m_releaseBuffer
A flag that indicates if the buffer must be released when the band goes out of scope.
A raster class for memory.
TERASTEREXPORT int GetPixelSize(int datatype)
Returns the byte size of a given datatype.
Band implementation for the In-Memory Raster.
int m_ncols
Buffered number of cols.
int getType() const
It returns the data type of the elements in the band.
unsigned char * m_buff
A pointer to a block buffer.
int m_blkh
Block height (pixels).
void getValue(unsigned int c, unsigned int r, double &value) const
Returns the cell attribute value.
void write(int x, int y, void *buffer)
It writes a data block from the specified 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...
BandProperty * m_property
The band information.