PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ testRasterIterator6_callback()

static int testRasterIterator6_callback ( rt_iterator_arg  arg,
void *  userarg,
double *  value,
int *  nodata 
)
static

Definition at line 364 of file cu_mapalgebra.c.

364  {
365  _callback_userargs _userarg = (_callback_userargs) userarg;
366 
367  /* check that we're getting what we expect from userarg */
368  CU_ASSERT_EQUAL(arg->rasters, _userarg->rasters);
369  CU_ASSERT_EQUAL(arg->rows, _userarg->rows);
370  CU_ASSERT_EQUAL(arg->columns, _userarg->columns);
371 
372  /* 0,0 */
373  if (
374  arg->dst_pixel[0] == 0 &&
375  arg->dst_pixel[1] == 0
376  ) {
377  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 16, DBL_EPSILON);
378  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
379 
380  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 1);
381  }
382  /* 1,0 */
383  else if (
384  arg->dst_pixel[0] == 1 &&
385  arg->dst_pixel[1] == 0
386  ) {
387  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 17, DBL_EPSILON);
388  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
389 
390  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 111, DBL_EPSILON);
391  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
392  }
393  /* 0,1 */
394  else if (
395  arg->dst_pixel[0] == 0 &&
396  arg->dst_pixel[1] == 1
397  ) {
398  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 21, DBL_EPSILON);
399  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
400 
401  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 115, DBL_EPSILON);
402  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
403  }
404  /* 1,1 */
405  else if (
406  arg->dst_pixel[0] == 1 &&
407  arg->dst_pixel[1] == 1
408  ) {
409  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 22, DBL_EPSILON);
410  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
411 
412  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 116, DBL_EPSILON);
413  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
414  }
415 
416  return 1;
417 }
struct _callback_userargs_t * _callback_userargs
Definition: cu_mapalgebra.c:27
double *** values
Definition: librtcore.h:2459
uint32_t columns
Definition: librtcore.h:2455
uint16_t rasters
Definition: librtcore.h:2451

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

Referenced by test_raster_iterator().

Here is the caller graph for this function: