PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ testRasterIterator4_callback()

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

Definition at line 256 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().

256  {
257  _callback_userargs _userarg = (_callback_userargs) userarg;
258 
259  /* check that we're getting what we expect from userarg */
260  CU_ASSERT_EQUAL(arg->rasters, _userarg->rasters);
261  CU_ASSERT_EQUAL(arg->rows, _userarg->rows);
262  CU_ASSERT_EQUAL(arg->columns, _userarg->columns);
263 
264  /* 0,0 */
265  if (
266  arg->dst_pixel[0] == 0 &&
267  arg->dst_pixel[1] == 0
268  ) {
269  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 0, DBL_EPSILON);
270  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
271 
272  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 1);
273  }
274  /* 4,4 */
275  else if (
276  arg->dst_pixel[0] == 4 &&
277  arg->dst_pixel[1] == 4
278  ) {
279  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 24, DBL_EPSILON);
280  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
281 
282  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 118, DBL_EPSILON);
283  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
284  }
285  /* 4,1 */
286  else if (
287  arg->dst_pixel[0] == 4 &&
288  arg->dst_pixel[1] == 1
289  ) {
290  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 9, DBL_EPSILON);
291  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
292 
293  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 103, DBL_EPSILON);
294  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
295  }
296  /* 4,0 */
297  else if (
298  arg->dst_pixel[0] == 4 &&
299  arg->dst_pixel[1] == 0
300  ) {
301  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 4, DBL_EPSILON);
302  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
303 
304  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 1);
305  }
306 
307  return 1;
308 }
uint32_t columns
Definition: librtcore.h:2406
uint16_t rasters
Definition: librtcore.h:2402
struct _callback_userargs_t * _callback_userargs
Definition: cu_mapalgebra.c:27
double *** values
Definition: librtcore.h:2410
Here is the caller graph for this function: