PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ test_raster_pixel_as_polygon()

static void test_raster_pixel_as_polygon ( )
static

Definition at line 529 of file cu_raster_geometry.c.

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

Referenced by raster_geometry_suite_setup().

529  {
530  rt_raster rast;
531  rt_band band;
532  uint32_t x, y;
533  const int maxX = 10;
534  const int maxY = 10;
535  LWPOLY *poly = NULL;
536 
537  rast = rt_raster_new(maxX, maxY);
538  CU_ASSERT(rast != NULL);
539 
540  band = cu_add_band(rast, PT_32BUI, 1, 0);
541  CU_ASSERT(band != NULL);
542 
543  for (x = 0; x < maxX; x++) {
544  for (y = 0; y < maxY; y++) {
545  rt_band_set_pixel(band, x, y, 1, NULL);
546  }
547  }
548 
549  rt_band_set_pixel(band, 0, 0, 0, NULL);
550  rt_band_set_pixel(band, 3, 0, 0, NULL);
551  rt_band_set_pixel(band, 6, 0, 0, NULL);
552  rt_band_set_pixel(band, 9, 0, 0, NULL);
553  rt_band_set_pixel(band, 1, 2, 0, NULL);
554  rt_band_set_pixel(band, 4, 2, 0, NULL);
555  rt_band_set_pixel(band, 7, 2, 0, NULL);
556  rt_band_set_pixel(band, 2, 4, 0, NULL);
557  rt_band_set_pixel(band, 5, 4, 0, NULL);
558  rt_band_set_pixel(band, 8, 4, 0, NULL);
559  rt_band_set_pixel(band, 0, 6, 0, NULL);
560  rt_band_set_pixel(band, 3, 6, 0, NULL);
561  rt_band_set_pixel(band, 6, 6, 0, NULL);
562  rt_band_set_pixel(band, 9, 6, 0, NULL);
563  rt_band_set_pixel(band, 1, 8, 0, NULL);
564  rt_band_set_pixel(band, 4, 8, 0, NULL);
565  rt_band_set_pixel(band, 7, 8, 0, NULL);
566 
567  poly = rt_raster_pixel_as_polygon(rast, 1, 1);
568  CU_ASSERT(poly != NULL);
569  lwpoly_free(poly);
570 
571  cu_free_raster(rast);
572 }
band
Definition: ovdump.py:57
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
LWPOLY * rt_raster_pixel_as_polygon(rt_raster raster, int x, int y)
Get a raster pixel as a polygon.
Definition: rt_geometry.c:629
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition: rt_raster.c:48
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel&#39;s value.
Definition: rt_band.c:841
Here is the call graph for this function:
Here is the caller graph for this function: