PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ testRasterIterator1_callback()

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

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

35  {
36  _callback_userargs _userarg = (_callback_userargs) userarg;
37 
38  /* check that we're getting what we expect from userarg */
39  CU_ASSERT_EQUAL(arg->rasters, _userarg->rasters);
40  CU_ASSERT_EQUAL(arg->rows, _userarg->rows);
41  CU_ASSERT_EQUAL(arg->columns, _userarg->columns);
42 
43  /* 0,0 */
44  if (
45  arg->dst_pixel[0] == 0 &&
46  arg->dst_pixel[1] == 0
47  ) {
48  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 0, DBL_EPSILON);
49  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
50  }
51  /* 4,4 */
52  else if (
53  arg->dst_pixel[0] == 4 &&
54  arg->dst_pixel[1] == 4
55  ) {
56  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 24, DBL_EPSILON);
57  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
58  }
59  /* 1,1 */
60  else if (
61  arg->dst_pixel[0] == 1 &&
62  arg->dst_pixel[1] == 1
63  ) {
64  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 1);
65  }
66  /* 2,2 */
67  else if (
68  arg->dst_pixel[0] == 2 &&
69  arg->dst_pixel[1] == 2
70  ) {
71  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 12, DBL_EPSILON);
72  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
73  }
74  /* 3,1 */
75  else if (
76  arg->dst_pixel[0] == 3 &&
77  arg->dst_pixel[1] == 1
78  ) {
79  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 8, DBL_EPSILON);
80  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
81  }
82  /* 1,0 */
83  else if (
84  arg->dst_pixel[0] == 1 &&
85  arg->dst_pixel[1] == 0
86  ) {
87  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 1, DBL_EPSILON);
88  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
89  }
90 
91  return 1;
92 }
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: