PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ lwmpolygon_unstroke()

LWGEOM * lwmpolygon_unstroke ( const LWMPOLY mpoly)

Definition at line 1104 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().

1105 {
1106  LWGEOM **geoms;
1107  uint32_t i, hascurve = 0;
1108 
1109  LWDEBUG(2, "lwmpoly_unstroke called.");
1110 
1111  geoms = lwalloc(sizeof(LWGEOM *)*mpoly->ngeoms);
1112  for (i=0; i<mpoly->ngeoms; i++)
1113  {
1114  geoms[i] = lwpolygon_unstroke((LWPOLY *)mpoly->geoms[i]);
1115  if (geoms[i]->type == CURVEPOLYTYPE)
1116  {
1117  hascurve = 1;
1118  }
1119  }
1120  if (hascurve == 0)
1121  {
1122  for (i=0; i<mpoly->ngeoms; i++)
1123  {
1124  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1125  }
1126  return lwgeom_clone_deep((LWGEOM *)mpoly);
1127  }
1128  return (LWGEOM *)lwcollection_construct(MULTISURFACETYPE, mpoly->srid, NULL, mpoly->ngeoms, geoms);
1129 }
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:1047
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: