PostGIS  2.1.10dev-r@@SVN_REVISION@@
LWGEOM * lwpolygon_desegmentize ( LWPOLY poly)

Definition at line 756 of file lwsegmentize.c.

References CIRCSTRINGTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LWPOLY::flags, lwalloc(), lwcollection_construct(), LWDEBUG, lwfree(), lwgeom_clone(), LWPOLY::nrings, pta_desegmentize(), LWPOLY::rings, and LWPOLY::srid.

Referenced by lwgeom_desegmentize(), and lwmpolygon_desegmentize().

757 {
758  LWGEOM **geoms;
759  int i, hascurve = 0;
760 
761  LWDEBUG(2, "lwpolygon_desegmentize called.");
762 
763  geoms = lwalloc(sizeof(LWGEOM *)*poly->nrings);
764  for (i=0; i<poly->nrings; i++)
765  {
766  geoms[i] = pta_desegmentize(poly->rings[i], poly->flags, poly->srid);
767  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
768  {
769  hascurve = 1;
770  }
771  }
772  if (hascurve == 0)
773  {
774  for (i=0; i<poly->nrings; i++)
775  {
776  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
777  }
778  return lwgeom_clone((LWGEOM *)poly);
779  }
780 
781  return (LWGEOM *)lwcollection_construct(CURVEPOLYTYPE, poly->srid, NULL, poly->nrings, geoms);
782 }
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 COMPOUNDTYPE
Definition: liblwgeom.h:68
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
LWGEOM * pta_desegmentize(POINTARRAY *points, int type, int srid)
Definition: lwsegmentize.c:586
POINTARRAY ** rings
Definition: liblwgeom.h:413
int nrings
Definition: liblwgeom.h:411
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:351
int32_t srid
Definition: liblwgeom.h:410
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67
uint8_t flags
Definition: liblwgeom.h:408
void * lwalloc(size_t size)
Definition: lwutil.c:175

Here is the call graph for this function:

Here is the caller graph for this function: