PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ test_raster_pixel_as_polygon()

static void test_raster_pixel_as_polygon ( )
static

Definition at line 531 of file cu_raster_geometry.c.

531 {
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
573 cu_free_raster(rast);
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.
@ PT_32BUI
Definition librtcore.h:197
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition rt_raster.c:52
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:1140
rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double nodataval)
void cu_free_raster(rt_raster raster)

References cu_add_band(), cu_free_raster(), lwpoly_free(), PT_32BUI, rt_band_set_pixel(), rt_raster_new(), and rt_raster_pixel_as_polygon().

Referenced by raster_geometry_suite_setup().

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