PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ lwmpolygon_unstroke()

LWGEOM * lwmpolygon_unstroke ( const LWMPOLY mpoly)

Definition at line 1091 of file lwstroke.c.

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().

1092 {
1093  LWGEOM **geoms;
1094  uint32_t i, hascurve = 0;
1095 
1096  LWDEBUG(2, "lwmpoly_unstroke called.");
1097 
1098  geoms = lwalloc(sizeof(LWGEOM *)*mpoly->ngeoms);
1099  for (i=0; i<mpoly->ngeoms; i++)
1100  {
1101  geoms[i] = lwpolygon_unstroke((LWPOLY *)mpoly->geoms[i]);
1102  if (geoms[i]->type == CURVEPOLYTYPE)
1103  {
1104  hascurve = 1;
1105  }
1106  }
1107  if (hascurve == 0)
1108  {
1109  for (i=0; i<mpoly->ngeoms; i++)
1110  {
1111  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1112  }
1113  return lwgeom_clone_deep((LWGEOM *)mpoly);
1114  }
1115  return (LWGEOM *)lwcollection_construct(MULTISURFACETYPE, mpoly->srid, NULL, mpoly->ngeoms, geoms);
1116 }
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:43
void lwfree(void *mem)
Definition: lwutil.c:244
uint32_t ngeoms
Definition: liblwgeom.h:496
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition: lwgeom.c:520
unsigned int uint32_t
Definition: uthash.h:78
LWGEOM * lwpolygon_unstroke(const LWPOLY *poly)
Definition: lwstroke.c:1034
LWPOLY ** geoms
Definition: liblwgeom.h:498
#define MULTISURFACETYPE
Definition: liblwgeom.h:95
type
Definition: ovdump.py:41
void * lwalloc(size_t size)
Definition: lwutil.c:229
int32_t srid
Definition: liblwgeom.h:495
Here is the call graph for this function:
Here is the caller graph for this function: