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

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

831 {
832  LWGEOM **geoms;
833  int i, hascurve = 0;
834 
835  LWDEBUG(2, "lwmpoly_unstroke called.");
836 
837  geoms = lwalloc(sizeof(LWGEOM *)*mpoly->ngeoms);
838  for (i=0; i<mpoly->ngeoms; i++)
839  {
840  geoms[i] = lwpolygon_unstroke((LWPOLY *)mpoly->geoms[i]);
841  if (geoms[i]->type == CURVEPOLYTYPE)
842  {
843  hascurve = 1;
844  }
845  }
846  if (hascurve == 0)
847  {
848  for (i=0; i<mpoly->ngeoms; i++)
849  {
850  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
851  }
852  return lwgeom_clone((LWGEOM *)mpoly);
853  }
854  return (LWGEOM *)lwcollection_construct(MULTISURFACETYPE, mpoly->srid, NULL, mpoly->ngeoms, geoms);
855 }
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:242
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
LWGEOM * lwpolygon_unstroke(const LWPOLY *poly)
Definition: lwstroke.c:773
LWPOLY ** geoms
Definition: liblwgeom.h:495
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:408
int ngeoms
Definition: liblwgeom.h:493
#define MULTISURFACETYPE
Definition: liblwgeom.h:95
void * lwalloc(size_t size)
Definition: lwutil.c:227
int32_t srid
Definition: liblwgeom.h:492

Here is the call graph for this function:

Here is the caller graph for this function: