PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwpolygon_unstroke()

LWGEOM * lwpolygon_unstroke ( const LWPOLY poly)

Definition at line 1055 of file lwstroke.c.

1056 {
1057  LWGEOM **geoms;
1058  uint32_t i, hascurve = 0;
1059 
1060  LWDEBUG(2, "lwpolygon_unstroke called.");
1061 
1062  geoms = lwalloc(sizeof(LWGEOM *)*poly->nrings);
1063  for (i=0; i<poly->nrings; i++)
1064  {
1065  geoms[i] = pta_unstroke(poly->rings[i], poly->srid);
1066  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
1067  {
1068  hascurve = 1;
1069  }
1070  }
1071  if (hascurve == 0)
1072  {
1073  for (i=0; i<poly->nrings; i++)
1074  {
1075  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1076  }
1077  return lwgeom_clone_deep((LWGEOM *)poly);
1078  }
1079 
1080  return (LWGEOM *)lwcollection_construct(CURVEPOLYTYPE, poly->srid, NULL, poly->nrings, geoms);
1081 }
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition: lwgeom.c:520
void lwfree(void *mem)
Definition: lwutil.c:244
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:43
void * lwalloc(size_t size)
Definition: lwutil.c:229
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
LWGEOM * pta_unstroke(const POINTARRAY *points, int srid)
Definition: lwstroke.c:884
type
Definition: ovdump.py:41
POINTARRAY ** rings
Definition: liblwgeom.h:460
uint32_t nrings
Definition: liblwgeom.h:458
int32_t srid
Definition: liblwgeom.h:457
unsigned int uint32_t
Definition: uthash.h:78

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

Referenced by lwgeom_unstroke(), and lwmpolygon_unstroke().

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