PostGIS  2.5.0dev-r@@SVN_REVISION@@
LWGEOM * lwmpolygon_unstroke ( const LWMPOLY mpoly)

Definition at line 1058 of file lwstroke.c.

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

Referenced by lwgeom_unstroke().

1059 {
1060  LWGEOM **geoms;
1061  uint32_t i, hascurve = 0;
1062 
1063  LWDEBUG(2, "lwmpoly_unstroke called.");
1064 
1065  geoms = lwalloc(sizeof(LWGEOM *)*mpoly->ngeoms);
1066  for (i=0; i<mpoly->ngeoms; i++)
1067  {
1068  geoms[i] = lwpolygon_unstroke((LWPOLY *)mpoly->geoms[i]);
1069  if (geoms[i]->type == CURVEPOLYTYPE)
1070  {
1071  hascurve = 1;
1072  }
1073  }
1074  if (hascurve == 0)
1075  {
1076  for (i=0; i<mpoly->ngeoms; i++)
1077  {
1078  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1079  }
1080  return lwgeom_clone((LWGEOM *)mpoly);
1081  }
1082  return (LWGEOM *)lwcollection_construct(MULTISURFACETYPE, mpoly->srid, NULL, mpoly->ngeoms, geoms);
1083 }
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:493
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
unsigned int uint32_t
Definition: uthash.h:78
LWGEOM * lwpolygon_unstroke(const LWPOLY *poly)
Definition: lwstroke.c:1001
LWPOLY ** geoms
Definition: liblwgeom.h:495
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:475
#define MULTISURFACETYPE
Definition: liblwgeom.h:95
void * lwalloc(size_t size)
Definition: lwutil.c:229
int32_t srid
Definition: liblwgeom.h:492

Here is the call graph for this function:

Here is the caller graph for this function: