PostGIS  2.5.0dev-r@@SVN_REVISION@@
LWGEOM * lwmline_unstroke ( const LWMLINE mline)

Definition at line 1030 of file lwstroke.c.

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

Referenced by lwgeom_unstroke().

1031 {
1032  LWGEOM **geoms;
1033  uint32_t i, hascurve = 0;
1034 
1035  LWDEBUG(2, "lwmline_unstroke called.");
1036 
1037  geoms = lwalloc(sizeof(LWGEOM *)*mline->ngeoms);
1038  for (i=0; i<mline->ngeoms; i++)
1039  {
1040  geoms[i] = lwline_unstroke((LWLINE *)mline->geoms[i]);
1041  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
1042  {
1043  hascurve = 1;
1044  }
1045  }
1046  if (hascurve == 0)
1047  {
1048  for (i=0; i<mline->ngeoms; i++)
1049  {
1050  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1051  }
1052  return lwgeom_clone((LWGEOM *)mline);
1053  }
1054  return (LWGEOM *)lwcollection_construct(MULTICURVETYPE, mline->srid, NULL, mline->ngeoms, geoms);
1055 }
#define MULTICURVETYPE
Definition: liblwgeom.h:94
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 COMPOUNDTYPE
Definition: liblwgeom.h:92
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
unsigned int uint32_t
Definition: uthash.h:78
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:475
uint32_t ngeoms
Definition: liblwgeom.h:480
LWLINE ** geoms
Definition: liblwgeom.h:482
LWGEOM * lwline_unstroke(const LWLINE *line)
Definition: lwstroke.c:992
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
void * lwalloc(size_t size)
Definition: lwutil.c:229
int32_t srid
Definition: liblwgeom.h:479

Here is the call graph for this function:

Here is the caller graph for this function: