PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lwmline_unstroke()

LWGEOM * lwmline_unstroke ( const LWMLINE mline)

Definition at line 1187 of file lwstroke.c.

1188 {
1189  LWGEOM **geoms;
1190  uint32_t i, hascurve = 0;
1191 
1192  LWDEBUG(2, "lwmline_unstroke called.");
1193 
1194  geoms = lwalloc(sizeof(LWGEOM *)*mline->ngeoms);
1195  for (i=0; i<mline->ngeoms; i++)
1196  {
1197  geoms[i] = lwline_unstroke((LWLINE *)mline->geoms[i]);
1198  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
1199  {
1200  hascurve = 1;
1201  }
1202  }
1203  if (hascurve == 0)
1204  {
1205  for (i=0; i<mline->ngeoms; i++)
1206  {
1207  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1208  }
1209  return lwgeom_clone_deep((LWGEOM *)mline);
1210  }
1211  return (LWGEOM *)lwcollection_construct(MULTICURVETYPE, mline->srid, NULL, mline->ngeoms, geoms);
1212 }
#define COMPOUNDTYPE
Definition: liblwgeom.h:110
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
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:109
#define MULTICURVETYPE
Definition: liblwgeom.h:112
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 * lwline_unstroke(const LWLINE *line)
Definition: lwstroke.c:1149
type
Definition: ovdump.py:42
int32_t srid
Definition: liblwgeom.h:548
LWLINE ** geoms
Definition: liblwgeom.h:547
uint32_t ngeoms
Definition: liblwgeom.h:552

References CIRCSTRINGTYPE, COMPOUNDTYPE, LWMLINE::geoms, lwalloc(), lwcollection_construct(), LWDEBUG, lwfree(), lwgeom_clone_deep(), lwline_unstroke(), MULTICURVETYPE, LWMLINE::ngeoms, LWMLINE::srid, and ovdump::type.

Referenced by lwgeom_unstroke().

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