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

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

815 {
816  LWGEOM **geoms;
817  int i, hascurve = 0;
818 
819  LWDEBUG(2, "lwmpoly_unstroke called.");
820 
821  geoms = lwalloc(sizeof(LWGEOM *)*mpoly->ngeoms);
822  for (i=0; i<mpoly->ngeoms; i++)
823  {
824  geoms[i] = lwpolygon_unstroke((LWPOLY *)mpoly->geoms[i]);
825  if (geoms[i]->type == CURVEPOLYTYPE)
826  {
827  hascurve = 1;
828  }
829  }
830  if (hascurve == 0)
831  {
832  for (i=0; i<mpoly->ngeoms; i++)
833  {
834  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
835  }
836  return lwgeom_clone((LWGEOM *)mpoly);
837  }
838  return (LWGEOM *)lwcollection_construct(MULTISURFACETYPE, mpoly->srid, NULL, mpoly->ngeoms, geoms);
839 }
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:30
void lwfree(void *mem)
Definition: lwutil.c:214
#define CURVEPOLYTYPE
Definition: liblwgeom.h:79
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
LWGEOM * lwpolygon_unstroke(const LWPOLY *poly)
Definition: lwstroke.c:757
LWPOLY ** geoms
Definition: liblwgeom.h:480
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:395
int ngeoms
Definition: liblwgeom.h:478
#define MULTISURFACETYPE
Definition: liblwgeom.h:81
void * lwalloc(size_t size)
Definition: lwutil.c:199
int32_t srid
Definition: liblwgeom.h:477

Here is the call graph for this function:

Here is the caller graph for this function: