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

◆ lwpolygon_unstroke()

LWGEOM * lwpolygon_unstroke ( const LWPOLY poly)

Definition at line 1146 of file lwstroke.c.

1147{
1148 LWGEOM **geoms;
1149 uint32_t i, hascurve = 0;
1150
1151 LWDEBUG(2, "lwpolygon_unstroke called.");
1152
1153 geoms = lwalloc(sizeof(LWGEOM *)*poly->nrings);
1154 for (i=0; i<poly->nrings; i++)
1155 {
1156 geoms[i] = pta_unstroke(poly->rings[i], poly->srid);
1157 if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
1158 {
1159 hascurve = 1;
1160 }
1161 }
1162 if (hascurve == 0)
1163 {
1164 for (i=0; i<poly->nrings; i++)
1165 {
1166 lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1167 }
1168 return lwgeom_clone_deep((LWGEOM *)poly);
1169 }
1170
1171 return (LWGEOM *)lwcollection_construct(CURVEPOLYTYPE, poly->srid, NULL, poly->nrings, geoms);
1172}
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
#define COMPOUNDTYPE
Definition liblwgeom.h:124
#define CURVEPOLYTYPE
Definition liblwgeom.h:125
void * lwalloc(size_t size)
Definition lwutil.c:227
void lwfree(void *mem)
Definition lwutil.c:242
#define CIRCSTRINGTYPE
Definition liblwgeom.h:123
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition lwgeom.c:511
#define LWDEBUG(level, msg)
Definition lwgeom_log.h:83
LWGEOM * pta_unstroke(const POINTARRAY *points, int32_t srid)
Definition lwstroke.c:975
POINTARRAY ** rings
Definition liblwgeom.h:505
uint32_t nrings
Definition liblwgeom.h:510
int32_t srid
Definition liblwgeom.h:506

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: