PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lwmpolygon_unstroke()

LWGEOM * lwmpolygon_unstroke ( const LWMPOLY mpoly)

Definition at line 1215 of file lwstroke.c.

1216 {
1217  LWGEOM **geoms;
1218  uint32_t i, hascurve = 0;
1219 
1220  LWDEBUG(2, "lwmpoly_unstroke called.");
1221 
1222  geoms = lwalloc(sizeof(LWGEOM *)*mpoly->ngeoms);
1223  for (i=0; i<mpoly->ngeoms; i++)
1224  {
1225  geoms[i] = lwpolygon_unstroke((LWPOLY *)mpoly->geoms[i]);
1226  if (geoms[i]->type == CURVEPOLYTYPE)
1227  {
1228  hascurve = 1;
1229  }
1230  }
1231  if (hascurve == 0)
1232  {
1233  for (i=0; i<mpoly->ngeoms; i++)
1234  {
1235  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1236  }
1237  return lwgeom_clone_deep((LWGEOM *)mpoly);
1238  }
1239  return (LWGEOM *)lwcollection_construct(MULTISURFACETYPE, mpoly->srid, NULL, mpoly->ngeoms, geoms);
1240 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:111
#define MULTISURFACETYPE
Definition: liblwgeom.h:113
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition: lwgeom.c:529
void lwfree(void *mem)
Definition: lwutil.c:242
void * lwalloc(size_t size)
Definition: lwutil.c:227
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:42
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
LWGEOM * lwpolygon_unstroke(const LWPOLY *poly)
Definition: lwstroke.c:1158
type
Definition: ovdump.py:42
uint32_t ngeoms
Definition: liblwgeom.h:566
LWPOLY ** geoms
Definition: liblwgeom.h:561
int32_t srid
Definition: liblwgeom.h:562

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

Referenced by lwgeom_unstroke().

Here is the call graph for this function:
Here is the caller graph for this function: