PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwmline_unstroke()

LWGEOM * lwmline_unstroke ( const LWMLINE mline)

Definition at line 1175 of file lwstroke.c.

1176 {
1177  LWGEOM **geoms;
1178  uint32_t i, hascurve = 0;
1179 
1180  LWDEBUG(2, "lwmline_unstroke called.");
1181 
1182  geoms = lwalloc(sizeof(LWGEOM *)*mline->ngeoms);
1183  for (i=0; i<mline->ngeoms; i++)
1184  {
1185  geoms[i] = lwline_unstroke((LWLINE *)mline->geoms[i]);
1186  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
1187  {
1188  hascurve = 1;
1189  }
1190  }
1191  if (hascurve == 0)
1192  {
1193  for (i=0; i<mline->ngeoms; i++)
1194  {
1195  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1196  }
1197  return lwgeom_clone_deep((LWGEOM *)mline);
1198  }
1199  return (LWGEOM *)lwcollection_construct(MULTICURVETYPE, mline->srid, NULL, mline->ngeoms, geoms);
1200 }
#define COMPOUNDTYPE
Definition: liblwgeom.h:124
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition: lwgeom.c:511
void lwfree(void *mem)
Definition: lwutil.c:242
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:123
#define MULTICURVETYPE
Definition: liblwgeom.h:126
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:1137
type
Definition: ovdump.py:42
int32_t srid
Definition: liblwgeom.h:534
LWLINE ** geoms
Definition: liblwgeom.h:533
uint32_t ngeoms
Definition: liblwgeom.h:538

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: