PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ testRasterIterator2_callback()

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

Definition at line 95 of file cu_mapalgebra.c.

95  {
96  _callback_userargs _userarg = (_callback_userargs) userarg;
97 
98  /* check that we're getting what we expect from userarg */
99  CU_ASSERT_EQUAL(arg->rasters, _userarg->rasters);
100  CU_ASSERT_EQUAL(arg->rows, _userarg->rows);
101  CU_ASSERT_EQUAL(arg->columns, _userarg->columns);
102 
103  /* 0,0 */
104  if (
105  arg->dst_pixel[0] == 0 &&
106  arg->dst_pixel[1] == 0
107  ) {
108  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 0, DBL_EPSILON);
109  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
110 
111  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 1);
112  }
113  /* 4,4 */
114  else if (
115  arg->dst_pixel[0] == 4 &&
116  arg->dst_pixel[1] == 4
117  ) {
118  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 24, DBL_EPSILON);
119  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
120 
121  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 118, DBL_EPSILON);
122  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
123  }
124  /* 1,1 */
125  else if (
126  arg->dst_pixel[0] == 1 &&
127  arg->dst_pixel[1] == 1
128  ) {
129  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 1);
130 
131  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 100, DBL_EPSILON);
132  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
133  }
134  /* 2,2 */
135  else if (
136  arg->dst_pixel[0] == 2 &&
137  arg->dst_pixel[1] == 2
138  ) {
139  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 12, DBL_EPSILON);
140  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
141 
142  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 106, DBL_EPSILON);
143  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
144  }
145  /* 3,1 */
146  else if (
147  arg->dst_pixel[0] == 3 &&
148  arg->dst_pixel[1] == 1
149  ) {
150  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 8, DBL_EPSILON);
151  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
152 
153  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 102, DBL_EPSILON);
154  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
155  }
156  /* 1,0 */
157  else if (
158  arg->dst_pixel[0] == 1 &&
159  arg->dst_pixel[1] == 0
160  ) {
161  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 1, DBL_EPSILON);
162  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
163 
164  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 1);
165  }
166  /* 1,3 */
167  else if (
168  arg->dst_pixel[0] == 1 &&
169  arg->dst_pixel[1] == 3
170  ) {
171  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 16, DBL_EPSILON);
172  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
173 
174  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 1);
175  }
176  /* 5,0 */
177  else if (
178  arg->dst_pixel[0] == 5 &&
179  arg->dst_pixel[1] == 0
180  ) {
181  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 1);
182 
183  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 1);
184  }
185 
186  return 1;
187 }
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: