PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ 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}
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
#define COMPOUNDTYPE
Definition liblwgeom.h:124
void * lwalloc(size_t size)
Definition lwutil.c:227
void lwfree(void *mem)
Definition lwutil.c:242
#define CIRCSTRINGTYPE
Definition liblwgeom.h:123
#define MULTICURVETYPE
Definition liblwgeom.h:126
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition lwgeom.c:511
#define LWDEBUG(level, msg)
Definition lwgeom_log.h:83
LWGEOM * lwline_unstroke(const LWLINE *line)
Definition lwstroke.c:1137
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, and LWMLINE::srid.

Referenced by lwgeom_unstroke().

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