PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int _rti_iterator_arg_callback_init ( _rti_iterator_arg  _param)
static

Definition at line 13816 of file rt_api.c.

References _rti_iterator_arg_t::arg, rt_iterator_arg_t::columns, _rti_iterator_arg_t::columns, _rti_iterator_arg_t::count, _rti_iterator_arg_t::dimension, rt_iterator_arg_t::dst_pixel, rt_iterator_arg_t::nodata, rt_iterator_arg_t::rasters, rt_iterator_arg_t::rows, _rti_iterator_arg_t::rows, rtalloc(), rterror(), rt_iterator_arg_t::src_pixel, and rt_iterator_arg_t::values.

Referenced by rt_raster_iterator().

13816  {
13817  int i = 0;
13818 
13819  _param->arg = rtalloc(sizeof(struct rt_iterator_arg_t));
13820  if (_param->arg == NULL) {
13821  rterror("_rti_iterator_arg_callback_init: Could not allocate memory for rt_iterator_arg");
13822  return 0;
13823  }
13824 
13825  _param->arg->values = NULL;
13826  _param->arg->nodata = NULL;
13827  _param->arg->src_pixel = NULL;
13828 
13829  /* initialize argument components */
13830  _param->arg->values = rtalloc(sizeof(double **) * _param->count);
13831  _param->arg->nodata = rtalloc(sizeof(int **) * _param->count);
13832  _param->arg->src_pixel = rtalloc(sizeof(int *) * _param->count);
13833  if (_param->arg->values == NULL || _param->arg->nodata == NULL || _param->arg->src_pixel == NULL) {
13834  rterror("_rti_iterator_arg_callback_init: Could not allocate memory for element of rt_iterator_arg");
13835  return 0;
13836  }
13837  memset(_param->arg->values, 0, sizeof(double **) * _param->count);
13838  memset(_param->arg->nodata, 0, sizeof(int **) * _param->count);
13839 
13840  /* initialize pos */
13841  for (i = 0; i < _param->count; i++) {
13842 
13843  _param->arg->src_pixel[i] = rtalloc(sizeof(int) * 2);
13844  if (_param->arg->src_pixel[i] == NULL) {
13845  rterror("_rti_iterator_arg_callback_init: Could not allocate memory for position elements of rt_iterator_arg");
13846  return 0;
13847  }
13848  memset(_param->arg->src_pixel[i], 0, sizeof(int) * 2);
13849  }
13850 
13851  _param->arg->rasters = _param->count;
13852  _param->arg->rows = _param->dimension.rows;
13853  _param->arg->columns = _param->dimension.columns;
13854 
13855  _param->arg->dst_pixel[0] = 0;
13856  _param->arg->dst_pixel[1] = 0;
13857 
13858  return 1;
13859 }
int ** src_pixel
Definition: rt_api.h:2381
rt_iterator_arg arg
Definition: rt_api.c:13534
uint32_t rows
Definition: rt_api.h:2370
uint32_t columns
Definition: rt_api.h:2372
uint16_t rasters
Definition: rt_api.h:2368
uint32_t columns
Definition: rt_api.c:13526
void * rtalloc(size_t size)
Raster core memory management functions.
Definition: rt_api.c:867
void rterror(const char *fmt,...)
Raster core error and info handlers.
Definition: rt_api.c:895
double *** values
Definition: rt_api.h:2376
struct _rti_iterator_arg_t::@12 dimension
int *** nodata
Definition: rt_api.h:2378
int dst_pixel[2]
Definition: rt_api.h:2384

Here is the call graph for this function:

Here is the caller graph for this function: