1557{
1559 ArrayType *array = NULL;
1561 const LWLINE *shell = NULL;
1562 const LWLINE **holes = NULL;
1564 uint32 nholes = 0;
1565 uint32 i;
1566 size_t offset = 0;
1567
1568 POSTGIS_DEBUG(2, "LWGEOM_makepoly called.");
1569
1570
1571 pglwg1 = PG_GETARG_GSERIALIZED_P(0);
1573 {
1574 lwpgerror("Shell is not a line");
1575 }
1577
1578
1579 if (PG_NARGS() > 1)
1580 {
1581 array = PG_GETARG_ARRAYTYPE_P(1);
1582 nholes = ArrayGetNItems(ARR_NDIM(array), ARR_DIMS(array));
1584 for (i = 0; i < nholes; i++)
1585 {
1586#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
1587#pragma GCC diagnostic push
1588#pragma GCC diagnostic ignored "-Wsign-compare"
1589#endif
1591#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
1592#pragma GCC diagnostic pop
1593#endif
1595 offset += INTALIGN(VARSIZE(g));
1597 {
1598 lwpgerror("Hole %d is not a line", i);
1599 }
1601 holes[i] = hole;
1602 }
1603 }
1604
1608
1610 PG_FREE_IF_COPY(pglwg1, 0);
1611
1612 for (i = 0; i < nholes; i++)
1613 {
1615 }
1616
1617 PG_RETURN_POINTER(
result);
1618}
char result[OUT_DOUBLE_BUFFER_SIZE]
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
char * lwgeom_summary(const LWGEOM *lwgeom, int offset)
LWPOLY * lwpoly_from_lwlines(const LWLINE *shell, uint32_t nholes, const LWLINE **holes)
void * lwalloc(size_t size)
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
void lwline_free(LWLINE *line)