PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwmpolygon_unstroke()

LWGEOM * lwmpolygon_unstroke ( const LWMPOLY mpoly)

Definition at line 1112 of file lwstroke.c.

1113 {
1114  LWGEOM **geoms;
1115  uint32_t i, hascurve = 0;
1116 
1117  LWDEBUG(2, "lwmpoly_unstroke called.");
1118 
1119  geoms = lwalloc(sizeof(LWGEOM *)*mpoly->ngeoms);
1120  for (i=0; i<mpoly->ngeoms; i++)
1121  {
1122  geoms[i] = lwpolygon_unstroke((LWPOLY *)mpoly->geoms[i]);
1123  if (geoms[i]->type == CURVEPOLYTYPE)
1124  {
1125  hascurve = 1;
1126  }
1127  }
1128  if (hascurve == 0)
1129  {
1130  for (i=0; i<mpoly->ngeoms; i++)
1131  {
1132  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1133  }
1134  return lwgeom_clone_deep((LWGEOM *)mpoly);
1135  }
1136  return (LWGEOM *)lwcollection_construct(MULTISURFACETYPE, mpoly->srid, NULL, mpoly->ngeoms, geoms);
1137 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
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
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 * lwpolygon_unstroke(const LWPOLY *poly)
Definition: lwstroke.c:1055
type
Definition: ovdump.py:41
uint32_t ngeoms
Definition: liblwgeom.h:497
LWPOLY ** geoms
Definition: liblwgeom.h:499
int32_t srid
Definition: liblwgeom.h:496
unsigned int uint32_t
Definition: uthash.h:78

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

Referenced by lwgeom_unstroke().

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