PostGIS  2.5.0dev-r@@SVN_REVISION@@
LWGEOM * lwpolygon_unstroke ( const LWPOLY poly)

Definition at line 1001 of file lwstroke.c.

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

Referenced by lwgeom_unstroke(), and lwmpolygon_unstroke().

1002 {
1003  LWGEOM **geoms;
1004  uint32_t i, hascurve = 0;
1005 
1006  LWDEBUG(2, "lwpolygon_unstroke called.");
1007 
1008  geoms = lwalloc(sizeof(LWGEOM *)*poly->nrings);
1009  for (i=0; i<poly->nrings; i++)
1010  {
1011  geoms[i] = pta_unstroke(poly->rings[i], poly->flags, poly->srid);
1012  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
1013  {
1014  hascurve = 1;
1015  }
1016  }
1017  if (hascurve == 0)
1018  {
1019  for (i=0; i<poly->nrings; i++)
1020  {
1021  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1022  }
1023  return lwgeom_clone((LWGEOM *)poly);
1024  }
1025 
1026  return (LWGEOM *)lwcollection_construct(CURVEPOLYTYPE, poly->srid, NULL, poly->nrings, geoms);
1027 }
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:244
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define COMPOUNDTYPE
Definition: liblwgeom.h:92
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
LWGEOM * pta_unstroke(const POINTARRAY *points, int type, int srid)
Definition: lwstroke.c:830
uint32_t nrings
Definition: liblwgeom.h:454
unsigned int uint32_t
Definition: uthash.h:78
POINTARRAY ** rings
Definition: liblwgeom.h:456
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:475
int32_t srid
Definition: liblwgeom.h:453
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
uint8_t flags
Definition: liblwgeom.h:451
void * lwalloc(size_t size)
Definition: lwutil.c:229

Here is the call graph for this function:

Here is the caller graph for this function: