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

◆ lwpolygon_unstroke()

LWGEOM * lwpolygon_unstroke ( const LWPOLY poly)

Definition at line 1158 of file lwstroke.c.

1159{
1160 LWGEOM **geoms;
1161 uint32_t i, hascurve = 0;
1162
1163 LWDEBUG(2, "lwpolygon_unstroke called.");
1164
1165 geoms = lwalloc(sizeof(LWGEOM *)*poly->nrings);
1166 for (i=0; i<poly->nrings; i++)
1167 {
1168 geoms[i] = pta_unstroke(poly->rings[i], poly->srid);
1169 if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
1170 {
1171 hascurve = 1;
1172 }
1173 }
1174 if (hascurve == 0)
1175 {
1176 for (i=0; i<poly->nrings; i++)
1177 {
1178 lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1179 }
1180 return lwgeom_clone_deep((LWGEOM *)poly);
1181 }
1182
1183 return (LWGEOM *)lwcollection_construct(CURVEPOLYTYPE, poly->srid, NULL, poly->nrings, geoms);
1184}
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
#define COMPOUNDTYPE
Definition liblwgeom.h:110
#define CURVEPOLYTYPE
Definition liblwgeom.h:111
void * lwalloc(size_t size)
Definition lwutil.c:227
void lwfree(void *mem)
Definition lwutil.c:248
#define CIRCSTRINGTYPE
Definition liblwgeom.h:109
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition lwgeom.c:557
#define LWDEBUG(level, msg)
Definition lwgeom_log.h:101
LWGEOM * pta_unstroke(const POINTARRAY *points, int32_t srid)
Definition lwstroke.c:987
POINTARRAY ** rings
Definition liblwgeom.h:519
uint32_t nrings
Definition liblwgeom.h:524
int32_t srid
Definition liblwgeom.h:520

References CIRCSTRINGTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, lwalloc(), lwcollection_construct(), LWDEBUG, lwfree(), lwgeom_clone_deep(), LWPOLY::nrings, pta_unstroke(), LWPOLY::rings, and LWPOLY::srid.

Referenced by lwgeom_unstroke(), and lwmpolygon_unstroke().

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