PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ testRasterIterator5_callback()

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

Definition at line 311 of file cu_mapalgebra.c.

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 }
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: