PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwmline_unstroke()

LWGEOM * lwmline_unstroke ( const LWMLINE mline)

Definition at line 1084 of file lwstroke.c.

1085 {
1086  LWGEOM **geoms;
1087  uint32_t i, hascurve = 0;
1088 
1089  LWDEBUG(2, "lwmline_unstroke called.");
1090 
1091  geoms = lwalloc(sizeof(LWGEOM *)*mline->ngeoms);
1092  for (i=0; i<mline->ngeoms; i++)
1093  {
1094  geoms[i] = lwline_unstroke((LWLINE *)mline->geoms[i]);
1095  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
1096  {
1097  hascurve = 1;
1098  }
1099  }
1100  if (hascurve == 0)
1101  {
1102  for (i=0; i<mline->ngeoms; i++)
1103  {
1104  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1105  }
1106  return lwgeom_clone_deep((LWGEOM *)mline);
1107  }
1108  return (LWGEOM *)lwcollection_construct(MULTICURVETYPE, mline->srid, NULL, mline->ngeoms, geoms);
1109 }
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition: lwgeom.c:520
void lwfree(void *mem)
Definition: lwutil.c:244
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:43
#define MULTICURVETYPE
Definition: liblwgeom.h:95
void * lwalloc(size_t size)
Definition: lwutil.c:229
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
LWGEOM * lwline_unstroke(const LWLINE *line)
Definition: lwstroke.c:1046
type
Definition: ovdump.py:41
int32_t srid
Definition: liblwgeom.h:483
LWLINE ** geoms
Definition: liblwgeom.h:486
uint32_t ngeoms
Definition: liblwgeom.h:484
unsigned int uint32_t
Definition: uthash.h:78

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: