PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ lwmline_unstroke()

LWGEOM * lwmline_unstroke ( const LWMLINE mline)

Definition at line 1063 of file lwstroke.c.

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().

1064 {
1065  LWGEOM **geoms;
1066  uint32_t i, hascurve = 0;
1067 
1068  LWDEBUG(2, "lwmline_unstroke called.");
1069 
1070  geoms = lwalloc(sizeof(LWGEOM *)*mline->ngeoms);
1071  for (i=0; i<mline->ngeoms; i++)
1072  {
1073  geoms[i] = lwline_unstroke((LWLINE *)mline->geoms[i]);
1074  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
1075  {
1076  hascurve = 1;
1077  }
1078  }
1079  if (hascurve == 0)
1080  {
1081  for (i=0; i<mline->ngeoms; i++)
1082  {
1083  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1084  }
1085  return lwgeom_clone_deep((LWGEOM *)mline);
1086  }
1087  return (LWGEOM *)lwcollection_construct(MULTICURVETYPE, mline->srid, NULL, mline->ngeoms, geoms);
1088 }
#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
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition: lwgeom.c:520
unsigned int uint32_t
Definition: uthash.h:78
uint32_t ngeoms
Definition: liblwgeom.h:483
LWLINE ** geoms
Definition: liblwgeom.h:485
LWGEOM * lwline_unstroke(const LWLINE *line)
Definition: lwstroke.c:1025
type
Definition: ovdump.py:41
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
void * lwalloc(size_t size)
Definition: lwutil.c:229
int32_t srid
Definition: liblwgeom.h:482
Here is the call graph for this function:
Here is the caller graph for this function: