PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ test_raster_pixel_as_polygon()

static void test_raster_pixel_as_polygon ( )
static

Definition at line 531 of file cu_raster_geometry.c.

531  {
532  rt_raster rast;
533  rt_band band;
534  uint32_t x, y;
535  const uint32_t maxX = 10;
536  const uint32_t maxY = 10;
537  LWPOLY *poly = NULL;
538 
539  rast = rt_raster_new(maxX, maxY);
540  CU_ASSERT(rast != NULL);
541 
542  band = cu_add_band(rast, PT_32BUI, 1, 0);
543  CU_ASSERT(band != NULL);
544 
545  for (x = 0; x < maxX; x++) {
546  for (y = 0; y < maxY; y++) {
547  rt_band_set_pixel(band, x, y, 1, NULL);
548  }
549  }
550 
551  rt_band_set_pixel(band, 0, 0, 0, NULL);
552  rt_band_set_pixel(band, 3, 0, 0, NULL);
553  rt_band_set_pixel(band, 6, 0, 0, NULL);
554  rt_band_set_pixel(band, 9, 0, 0, NULL);
555  rt_band_set_pixel(band, 1, 2, 0, NULL);
556  rt_band_set_pixel(band, 4, 2, 0, NULL);
557  rt_band_set_pixel(band, 7, 2, 0, NULL);
558  rt_band_set_pixel(band, 2, 4, 0, NULL);
559  rt_band_set_pixel(band, 5, 4, 0, NULL);
560  rt_band_set_pixel(band, 8, 4, 0, NULL);
561  rt_band_set_pixel(band, 0, 6, 0, NULL);
562  rt_band_set_pixel(band, 3, 6, 0, NULL);
563  rt_band_set_pixel(band, 6, 6, 0, NULL);
564  rt_band_set_pixel(band, 9, 6, 0, NULL);
565  rt_band_set_pixel(band, 1, 8, 0, NULL);
566  rt_band_set_pixel(band, 4, 8, 0, NULL);
567  rt_band_set_pixel(band, 7, 8, 0, NULL);
568 
569  poly = rt_raster_pixel_as_polygon(rast, 1, 1);
570  CU_ASSERT(poly != NULL);
571  lwpoly_free(poly);
572 
574 }
void lwpoly_free(LWPOLY *poly)
Definition: lwpoly.c:175
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
@ PT_32BUI
Definition: librtcore.h:194
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's value.
Definition: rt_band.c:974
band
Definition: ovdump.py:57
rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double nodataval)
void cu_free_raster(rt_raster raster)
unsigned int uint32_t
Definition: uthash.h:78

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().

Here is the call graph for this function:
Here is the caller graph for this function: