PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void test_raster_pixel_as_polygon ( )
static

Definition at line 390 of file cu_raster_geometry.c.

References ovdump::band, cu_add_band(), cu_free_raster(), lwpoly_free(), PT_32BUI, rtpixdump::rast, rt_band_set_pixel(), rt_raster_new(), rt_raster_pixel_as_polygon(), pixval::x, and pixval::y.

Referenced by raster_geometry_suite_setup().

390  {
391  rt_raster rast;
392  rt_band band;
393  uint32_t x, y;
394  const int maxX = 10;
395  const int maxY = 10;
396  LWPOLY *poly = NULL;
397 
398  rast = rt_raster_new(maxX, maxY);
399  CU_ASSERT(rast != NULL);
400 
401  band = cu_add_band(rast, PT_32BUI, 1, 0);
402  CU_ASSERT(band != NULL);
403 
404  for (x = 0; x < maxX; x++) {
405  for (y = 0; y < maxY; y++) {
406  rt_band_set_pixel(band, x, y, 1, NULL);
407  }
408  }
409 
410  rt_band_set_pixel(band, 0, 0, 0, NULL);
411  rt_band_set_pixel(band, 3, 0, 0, NULL);
412  rt_band_set_pixel(band, 6, 0, 0, NULL);
413  rt_band_set_pixel(band, 9, 0, 0, NULL);
414  rt_band_set_pixel(band, 1, 2, 0, NULL);
415  rt_band_set_pixel(band, 4, 2, 0, NULL);
416  rt_band_set_pixel(band, 7, 2, 0, NULL);
417  rt_band_set_pixel(band, 2, 4, 0, NULL);
418  rt_band_set_pixel(band, 5, 4, 0, NULL);
419  rt_band_set_pixel(band, 8, 4, 0, NULL);
420  rt_band_set_pixel(band, 0, 6, 0, NULL);
421  rt_band_set_pixel(band, 3, 6, 0, NULL);
422  rt_band_set_pixel(band, 6, 6, 0, NULL);
423  rt_band_set_pixel(band, 9, 6, 0, NULL);
424  rt_band_set_pixel(band, 1, 8, 0, NULL);
425  rt_band_set_pixel(band, 4, 8, 0, NULL);
426  rt_band_set_pixel(band, 7, 8, 0, NULL);
427 
428  poly = rt_raster_pixel_as_polygon(rast, 1, 1);
429  CU_ASSERT(poly != NULL);
430  lwpoly_free(poly);
431 
432  cu_free_raster(rast);
433 }
LWPOLY * rt_raster_pixel_as_polygon(rt_raster rast, int x, int y)
Get a raster pixel as a polygon.
Definition: rt_api.c:13182
tuple band
Definition: ovdump.py:57
tuple rast
Definition: rtpixdump.py:62
void cu_free_raster(rt_raster raster)
rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double nodataval)
void lwpoly_free(LWPOLY *poly)
Definition: lwpoly.c:79
tuple x
Definition: pixval.py:53
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition: rt_api.c:5353
tuple y
Definition: pixval.py:54
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel's value.
Definition: rt_api.c:2302

Here is the call graph for this function:

Here is the caller graph for this function: