PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwmpolygon_unstroke()

LWGEOM * lwmpolygon_unstroke ( const LWMPOLY mpoly)

Definition at line 1111 of file lwstroke.c.

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

Referenced by lwgeom_unstroke().

1112 {
1113  LWGEOM **geoms;
1114  int i, hascurve = 0;
1115 
1116  LWDEBUG(2, "lwmpoly_unstroke called.");
1117 
1118  geoms = lwalloc(sizeof(LWGEOM *)*mpoly->ngeoms);
1119  for (i=0; i<mpoly->ngeoms; i++)
1120  {
1121  geoms[i] = lwpolygon_unstroke((LWPOLY *)mpoly->geoms[i]);
1122  if (geoms[i]->type == CURVEPOLYTYPE)
1123  {
1124  hascurve = 1;
1125  }
1126  }
1127  if (hascurve == 0)
1128  {
1129  for (i=0; i<mpoly->ngeoms; i++)
1130  {
1131  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1132  }
1133  return lwgeom_clone((LWGEOM *)mpoly);
1134  }
1135  return (LWGEOM *)lwcollection_construct(MULTISURFACETYPE, mpoly->srid, NULL, mpoly->ngeoms, geoms);
1136 }
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 LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
LWGEOM * lwpolygon_unstroke(const LWPOLY *poly)
Definition: lwstroke.c:1054
LWPOLY ** geoms
Definition: liblwgeom.h:496
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:444
int ngeoms
Definition: liblwgeom.h:494
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
type
Definition: ovdump.py:41
void * lwalloc(size_t size)
Definition: lwutil.c:229
int32_t srid
Definition: liblwgeom.h:493
Here is the call graph for this function:
Here is the caller graph for this function: