PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ testRasterIterator7_callback()

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

Definition at line 420 of file cu_mapalgebra.c.

420  {
421  _callback_userargs _userarg = (_callback_userargs) userarg;
422 
423  /* check that we're getting what we expect from userarg */
424  CU_ASSERT_EQUAL(arg->rasters, _userarg->rasters);
425  CU_ASSERT_EQUAL(arg->rows, _userarg->rows);
426  CU_ASSERT_EQUAL(arg->columns, _userarg->columns);
427 
428  /* 0,0 */
429  if (
430  arg->dst_pixel[0] == 0 &&
431  arg->dst_pixel[1] == 0
432  ) {
433  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][1][1], 16, DBL_EPSILON);
434  CU_ASSERT_EQUAL(arg->nodata[0][1][1], 0);
435 
436  CU_ASSERT_EQUAL(arg->nodata[1][1][1], 1);
437 
438  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 10, DBL_EPSILON);
439  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
440 
441  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 1);
442  }
443  /* 1,0 */
444  else if (
445  arg->dst_pixel[0] == 1 &&
446  arg->dst_pixel[1] == 0
447  ) {
448  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][1][1], 17, DBL_EPSILON);
449  CU_ASSERT_EQUAL(arg->nodata[0][1][1], 0);
450 
451  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][1][1], 111, DBL_EPSILON);
452  CU_ASSERT_EQUAL(arg->nodata[1][1][1], 0);
453 
454  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][2][2], 23, DBL_EPSILON);
455  CU_ASSERT_EQUAL(arg->nodata[0][2][2], 0);
456 
457  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][2][2], 117, DBL_EPSILON);
458  CU_ASSERT_EQUAL(arg->nodata[1][2][2], 0);
459  }
460  /* 0,1 */
461  else if (
462  arg->dst_pixel[0] == 0 &&
463  arg->dst_pixel[1] == 1
464  ) {
465  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][1][1], 21, DBL_EPSILON);
466  CU_ASSERT_EQUAL(arg->nodata[0][1][1], 0);
467 
468  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][1][1], 115, DBL_EPSILON);
469  CU_ASSERT_EQUAL(arg->nodata[1][1][1], 0);
470 
471  CU_ASSERT_EQUAL(arg->nodata[0][2][0], 1);
472 
473  CU_ASSERT_EQUAL(arg->nodata[1][2][0], 1);
474  }
475  /* 1,1 */
476  else if (
477  arg->dst_pixel[0] == 1 &&
478  arg->dst_pixel[1] == 1
479  ) {
480  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][1][1], 22, DBL_EPSILON);
481  CU_ASSERT_EQUAL(arg->nodata[0][1][1], 0);
482 
483  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][1][1], 116, DBL_EPSILON);
484  CU_ASSERT_EQUAL(arg->nodata[1][1][1], 0);
485 
486  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 16, DBL_EPSILON);
487  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
488 
489  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 1);
490  }
491 
492  return 1;
493 }
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: