PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_raster_pixel_as_polygon()

static void test_raster_pixel_as_polygon ( )
static

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

525  {
526  rt_raster rast;
527  rt_band band;
528  uint32_t x, y;
529  const int maxX = 10;
530  const int maxY = 10;
531  LWPOLY *poly = NULL;
532 
533  rast = rt_raster_new(maxX, maxY);
534  CU_ASSERT(rast != NULL);
535 
536  band = cu_add_band(rast, PT_32BUI, 1, 0);
537  CU_ASSERT(band != NULL);
538 
539  for (x = 0; x < maxX; x++) {
540  for (y = 0; y < maxY; y++) {
541  rt_band_set_pixel(band, x, y, 1, NULL);
542  }
543  }
544 
545  rt_band_set_pixel(band, 0, 0, 0, NULL);
546  rt_band_set_pixel(band, 3, 0, 0, NULL);
547  rt_band_set_pixel(band, 6, 0, 0, NULL);
548  rt_band_set_pixel(band, 9, 0, 0, NULL);
549  rt_band_set_pixel(band, 1, 2, 0, NULL);
550  rt_band_set_pixel(band, 4, 2, 0, NULL);
551  rt_band_set_pixel(band, 7, 2, 0, NULL);
552  rt_band_set_pixel(band, 2, 4, 0, NULL);
553  rt_band_set_pixel(band, 5, 4, 0, NULL);
554  rt_band_set_pixel(band, 8, 4, 0, NULL);
555  rt_band_set_pixel(band, 0, 6, 0, NULL);
556  rt_band_set_pixel(band, 3, 6, 0, NULL);
557  rt_band_set_pixel(band, 6, 6, 0, NULL);
558  rt_band_set_pixel(band, 9, 6, 0, NULL);
559  rt_band_set_pixel(band, 1, 8, 0, NULL);
560  rt_band_set_pixel(band, 4, 8, 0, NULL);
561  rt_band_set_pixel(band, 7, 8, 0, NULL);
562 
563  poly = rt_raster_pixel_as_polygon(rast, 1, 1);
564  CU_ASSERT(poly != NULL);
565  lwpoly_free(poly);
566 
567  cu_free_raster(rast);
568 }
band
Definition: ovdump.py:57
unsigned int uint32_t
Definition: uthash.h:78
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:174
LWPOLY * rt_raster_pixel_as_polygon(rt_raster raster, int x, int y)
Get a raster pixel as a polygon.
Definition: rt_geometry.c:610
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: