PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ testRasterIterator3_callback()

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

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

190  {
191  _callback_userargs _userarg = (_callback_userargs) userarg;
192 
193  /* check that we're getting what we expect from userarg */
194  CU_ASSERT_EQUAL(arg->rasters, _userarg->rasters);
195  CU_ASSERT_EQUAL(arg->rows, _userarg->rows);
196  CU_ASSERT_EQUAL(arg->columns, _userarg->columns);
197 
198  /* 0,0 */
199  if (
200  arg->dst_pixel[0] == 0 &&
201  arg->dst_pixel[1] == 0
202  ) {
203  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 1);
204 
205  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 100, DBL_EPSILON);
206  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
207  }
208  /* 0,3 */
209  else if (
210  arg->dst_pixel[0] == 0 &&
211  arg->dst_pixel[1] == 3
212  ) {
213  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 21, DBL_EPSILON);
214  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
215 
216  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 115, DBL_EPSILON);
217  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
218  }
219  /* 3,0 */
220  else if (
221  arg->dst_pixel[0] == 3 &&
222  arg->dst_pixel[1] == 0
223  ) {
224  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 9, DBL_EPSILON);
225  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
226 
227  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 103, DBL_EPSILON);
228  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
229  }
230  /* 3,3 */
231  else if (
232  arg->dst_pixel[0] == 3 &&
233  arg->dst_pixel[1] == 3
234  ) {
235  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 24, DBL_EPSILON);
236  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
237 
238  CU_ASSERT_DOUBLE_EQUAL(arg->values[1][0][0], 118, DBL_EPSILON);
239  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 0);
240  }
241  /* 0,2 */
242  else if (
243  arg->dst_pixel[0] == 3 &&
244  arg->dst_pixel[1] == 3
245  ) {
246  CU_ASSERT_DOUBLE_EQUAL(arg->values[0][0][0], 16, DBL_EPSILON);
247  CU_ASSERT_EQUAL(arg->nodata[0][0][0], 0);
248 
249  CU_ASSERT_EQUAL(arg->nodata[1][0][0], 1);
250  }
251 
252  return 1;
253 }
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: