PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int testRasterIterator5_callback ( rt_iterator_arg  arg,
void *  userarg,
double *  value,
int *  nodata 
)
static

Definition at line 311 of file cu_mapalgebra.c.

References _callback_userargs_t::columns, rt_iterator_arg_t::columns, rt_iterator_arg_t::dst_pixel, rt_iterator_arg_t::nodata, _callback_userargs_t::rasters, rt_iterator_arg_t::rasters, _callback_userargs_t::rows, rt_iterator_arg_t::rows, and rt_iterator_arg_t::values.

Referenced by test_raster_iterator().

311  {
312  _callback_userargs _userarg = (_callback_userargs) userarg;
313 
314  /* check that we're getting what we expect from userarg */
315  CU_ASSERT_EQUAL(arg->rasters, _userarg->rasters);
316  CU_ASSERT_EQUAL(arg->rows, _userarg->rows);
317  CU_ASSERT_EQUAL(arg->columns, _userarg->columns);
318 
319  /* 0,0 */
320  if (
321  arg->dst_pixel[0] == 0 &&
322  arg->dst_pixel[1] == 0
323  ) {
324  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 1);
325 
326  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 100, DBL_EPSILON);
327  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
328  }
329  /* 4,4 */
330  else if (
331  arg->dst_pixel[0] == 4 &&
332  arg->dst_pixel[1] == 4
333  ) {
334  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 1);
335 
336  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 124, DBL_EPSILON);
337  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
338  }
339  /* 4,1 */
340  else if (
341  arg->dst_pixel[0] == 4 &&
342  arg->dst_pixel[1] == 1
343  ) {
344  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 1);
345 
346  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 109, DBL_EPSILON);
347  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
348  }
349  /* 0,2 */
350  else if (
351  arg->dst_pixel[0] == 0 &&
352  arg->dst_pixel[1] == 2
353  ) {
354  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 16, DBL_EPSILON);
355  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
356 
357  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 1);
358  }
359 
360  return 1;
361 }
uint32_t rows
Definition: rt_api.h:2370
uint32_t columns
Definition: rt_api.h:2372
uint16_t rasters
Definition: rt_api.h:2368
struct _callback_userargs_t * _callback_userargs
Definition: cu_mapalgebra.c:27
double *** values
Definition: rt_api.h:2376
int *** nodata
Definition: rt_api.h:2378
int dst_pixel[2]
Definition: rt_api.h:2384

Here is the caller graph for this function: