27 #include "../common/Translator.h" 
   28 #include "../raster/BandProperty.h" 
   29 #include "../datatype/Enums.h" 
   38 #include <boost/format.hpp> 
   41   : te::rst::
Band(0, idx),
 
   52   int err = grib_get_size(
m_handle, 
"values", &size);
 
   70   throw Exception(
TR_GRIB(
"Not implemented yet!"));
 
   78     grib_handle_delete(m_handle);
 
   90   throw Exception(
TR_GRIB(
"Not implemented yet!"));
 
   95   unsigned int pos = r * m_property->m_blkw + c;
 
  102   unsigned int pos = r * m_property->m_blkw + c;
 
  109   throw Exception(
TR_GRIB(
"Complex data not supported by GRIB format!"));
 
  114   throw Exception(
TR_GRIB(
"Complex data not supported by GRIB format!"));
 
  119   assert(x == 0 && y == 0);
 
  121   memcpy(buffer, m_data, getBlockSize());
 
  126   assert(x == 0 && y == 0);
 
  133   assert(x == 0 && y == 0);
 
  135   memcpy(m_data, buffer, getBlockSize());
 
  147   int err = grib_get_long(m_handle, key, &val);
 
  150     throw Exception((boost::format(
TR_GRIB(
"Can not get key: %1%, due to: %2%.")) % key % getErrMsg(err)).str());
 
  159   int err = grib_get_double(m_handle, key, &val);
 
  162     throw Exception((boost::format(
TR_GRIB(
"Can not get key: %1%, due to: %2%.")) % key % getErrMsg(err)).str());
 
  171   std::size_t length = 0;
 
  173   int err = grib_get_string(m_handle, key, val, &length);
 
  176     throw Exception((boost::format(
TR_GRIB(
"Can not get key: %1%, due to: %2%.")) % key % getErrMsg(err)).str());
 
  178   return std::string(val);
 
  183   const char* errmsg = grib_get_error_message(errCode);
 
  187   return std::string(errmsg);
 
int m_blkh
Block height (pixels). 
 
Band implemntatin for GRIB. 
 
double * m_data
The matrix data. 
 
A raster class for GRIB format. 
 
te::rst::Raster * getRaster() const 
Returns the associated raster. 
 
std::string getString(const char *key) const 
 
int m_nblocksy
The number of blocks in y. 
 
void getValue(unsigned int c, unsigned int r, double &value) const 
Returns the cell attribute value. 
 
static std::string getErrMsg(int errCode)
 
Band(Raster *r, std::size_t idx, grib_handle *handle)
 
int m_blkw
Block width (pixels). 
 
double getDouble(const char *key) const 
 
An exception class for GRIB. 
 
A raster class for GRIB format. 
 
long getLong(const char *key) const 
 
void write(int x, int y, void *buffer)
It writes a data block from the specified buffer. 
 
grib_handle * getHandle() const 
 
void read(int x, int y, void *buffer) const 
It reads a data block to the specified buffer. 
 
A raster band description. 
 
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits<double>::max(). 
 
void setIValue(unsigned int c, unsigned int r, const double value)
Sets the imaginary attribute value in a complex band of a cell. 
 
~Band()
Virtual destructor. 
 
void getIValue(unsigned int c, unsigned int r, double &value) const 
Returns the imaginary attribute value in a complex band of a cell. 
 
int m_nblocksx
The number of blocks in x. 
 
Band & operator=(const Band &rhs)
 
An abstract class for raster data strucutures. 
 
#define TR_GRIB(message)
It marks a string in order to get translated. This is a special mark used in the DataAccess module of...
 
grib_handle * m_handle
The grib handle. 
 
void setValue(unsigned int c, unsigned int r, const double value)
Sets the cell attribute value. 
 
BandProperty * m_property
The band information. 
 
Band implemntatin for GRIB.