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

◆ lwmpolygon_unstroke()

LWGEOM * lwmpolygon_unstroke ( const LWMPOLY mpoly)

Definition at line 1203 of file lwstroke.c.

1204{
1205 LWGEOM **geoms;
1206 uint32_t i, hascurve = 0;
1207
1208 LWDEBUG(2, "lwmpoly_unstroke called.");
1209
1210 geoms = lwalloc(sizeof(LWGEOM *)*mpoly->ngeoms);
1211 for (i=0; i<mpoly->ngeoms; i++)
1212 {
1213 geoms[i] = lwpolygon_unstroke((LWPOLY *)mpoly->geoms[i]);
1214 if (geoms[i]->type == CURVEPOLYTYPE)
1215 {
1216 hascurve = 1;
1217 }
1218 }
1219 if (hascurve == 0)
1220 {
1221 for (i=0; i<mpoly->ngeoms; i++)
1222 {
1223 lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1224 }
1225 return lwgeom_clone_deep((LWGEOM *)mpoly);
1226 }
1227 return (LWGEOM *)lwcollection_construct(MULTISURFACETYPE, mpoly->srid, NULL, mpoly->ngeoms, geoms);
1228}
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
#define CURVEPOLYTYPE
Definition liblwgeom.h:125
#define MULTISURFACETYPE
Definition liblwgeom.h:127
void * lwalloc(size_t size)
Definition lwutil.c:227
void lwfree(void *mem)
Definition lwutil.c:242
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 * lwpolygon_unstroke(const LWPOLY *poly)
Definition lwstroke.c:1146
uint32_t ngeoms
Definition liblwgeom.h:552
LWPOLY ** geoms
Definition liblwgeom.h:547
int32_t srid
Definition liblwgeom.h:548

References CURVEPOLYTYPE, LWMPOLY::geoms, lwalloc(), lwcollection_construct(), LWDEBUG, lwfree(), lwgeom_clone_deep(), lwpolygon_unstroke(), MULTISURFACETYPE, LWMPOLY::ngeoms, and LWMPOLY::srid.

Referenced by lwgeom_unstroke().

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