PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ lwmline_unstroke()

LWGEOM * lwmline_unstroke ( const LWMLINE mline)

Definition at line 1076 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().

1077 {
1078  LWGEOM **geoms;
1079  uint32_t i, hascurve = 0;
1080 
1081  LWDEBUG(2, "lwmline_unstroke called.");
1082 
1083  geoms = lwalloc(sizeof(LWGEOM *)*mline->ngeoms);
1084  for (i=0; i<mline->ngeoms; i++)
1085  {
1086  geoms[i] = lwline_unstroke((LWLINE *)mline->geoms[i]);
1087  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
1088  {
1089  hascurve = 1;
1090  }
1091  }
1092  if (hascurve == 0)
1093  {
1094  for (i=0; i<mline->ngeoms; i++)
1095  {
1096  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1097  }
1098  return lwgeom_clone_deep((LWGEOM *)mline);
1099  }
1100  return (LWGEOM *)lwcollection_construct(MULTICURVETYPE, mline->srid, NULL, mline->ngeoms, geoms);
1101 }
#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:1038
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: