PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwpolygon_unstroke()

LWGEOM * lwpolygon_unstroke ( const LWPOLY poly)

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

1055 {
1056  LWGEOM **geoms;
1057  int i, hascurve = 0;
1058 
1059  LWDEBUG(2, "lwpolygon_unstroke called.");
1060 
1061  geoms = lwalloc(sizeof(LWGEOM *)*poly->nrings);
1062  for (i=0; i<poly->nrings; i++)
1063  {
1064  geoms[i] = pta_unstroke(poly->rings[i], poly->flags, poly->srid);
1065  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
1066  {
1067  hascurve = 1;
1068  }
1069  }
1070  if (hascurve == 0)
1071  {
1072  for (i=0; i<poly->nrings; i++)
1073  {
1074  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1075  }
1076  return lwgeom_clone((LWGEOM *)poly);
1077  }
1078 
1079  return (LWGEOM *)lwcollection_construct(CURVEPOLYTYPE, poly->srid, NULL, poly->nrings, geoms);
1080 }
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:94
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
LWGEOM * pta_unstroke(const POINTARRAY *points, int type, int srid)
Definition: lwstroke.c:883
POINTARRAY ** rings
Definition: liblwgeom.h:457
int nrings
Definition: liblwgeom.h:455
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:444
int32_t srid
Definition: liblwgeom.h:454
type
Definition: ovdump.py:41
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
uint8_t flags
Definition: liblwgeom.h:452
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: