PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwpolygon_unstroke()

LWGEOM * lwpolygon_unstroke ( const LWPOLY poly)

Definition at line 757 of file lwstroke.c.

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

Referenced by lwgeom_unstroke(), and lwmpolygon_unstroke().

758 {
759  LWGEOM **geoms;
760  int i, hascurve = 0;
761 
762  LWDEBUG(2, "lwpolygon_unstroke called.");
763 
764  geoms = lwalloc(sizeof(LWGEOM *)*poly->nrings);
765  for (i=0; i<poly->nrings; i++)
766  {
767  geoms[i] = pta_unstroke(poly->rings[i], poly->flags, poly->srid);
768  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
769  {
770  hascurve = 1;
771  }
772  }
773  if (hascurve == 0)
774  {
775  for (i=0; i<poly->nrings; i++)
776  {
777  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
778  }
779  return lwgeom_clone((LWGEOM *)poly);
780  }
781 
782  return (LWGEOM *)lwcollection_construct(CURVEPOLYTYPE, poly->srid, NULL, poly->nrings, geoms);
783 }
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 COMPOUNDTYPE
Definition: liblwgeom.h:78
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
LWGEOM * pta_unstroke(const POINTARRAY *points, int type, int srid)
Definition: lwstroke.c:586
POINTARRAY ** rings
Definition: liblwgeom.h:441
int nrings
Definition: liblwgeom.h:439
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:395
int32_t srid
Definition: liblwgeom.h:438
type
Definition: ovdump.py:41
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
uint8_t flags
Definition: liblwgeom.h:436
void * lwalloc(size_t size)
Definition: lwutil.c:199
Here is the call graph for this function:
Here is the caller graph for this function: