PostGIS  2.1.10dev-r@@SVN_REVISION@@
LWGEOM * lwmpolygon_desegmentize ( LWMPOLY mpoly)

Definition at line 813 of file lwsegmentize.c.

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

Referenced by lwgeom_desegmentize().

814 {
815  LWGEOM **geoms;
816  int i, hascurve = 0;
817 
818  LWDEBUG(2, "lwmpoly_desegmentize called.");
819 
820  geoms = lwalloc(sizeof(LWGEOM *)*mpoly->ngeoms);
821  for (i=0; i<mpoly->ngeoms; i++)
822  {
823  geoms[i] = lwpolygon_desegmentize((LWPOLY *)mpoly->geoms[i]);
824  if (geoms[i]->type == CURVEPOLYTYPE)
825  {
826  hascurve = 1;
827  }
828  }
829  if (hascurve == 0)
830  {
831  for (i=0; i<mpoly->ngeoms; i++)
832  {
833  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
834  }
835  return lwgeom_clone((LWGEOM *)mpoly);
836  }
837  return (LWGEOM *)lwcollection_construct(MULTISURFACETYPE, mpoly->srid, NULL, mpoly->ngeoms, geoms);
838 }
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:190
#define CURVEPOLYTYPE
Definition: liblwgeom.h:69
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
LWGEOM * lwpolygon_desegmentize(LWPOLY *poly)
Definition: lwsegmentize.c:756
LWPOLY ** geoms
Definition: liblwgeom.h:452
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:351
int ngeoms
Definition: liblwgeom.h:450
#define MULTISURFACETYPE
Definition: liblwgeom.h:71
void * lwalloc(size_t size)
Definition: lwutil.c:175
int32_t srid
Definition: liblwgeom.h:449

Here is the call graph for this function:

Here is the caller graph for this function: