PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwmline_unstroke()

LWGEOM * lwmline_unstroke ( const LWMLINE mline)

Definition at line 1083 of file lwstroke.c.

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

Referenced by lwgeom_unstroke().

1084 {
1085  LWGEOM **geoms;
1086  int i, hascurve = 0;
1087 
1088  LWDEBUG(2, "lwmline_unstroke called.");
1089 
1090  geoms = lwalloc(sizeof(LWGEOM *)*mline->ngeoms);
1091  for (i=0; i<mline->ngeoms; i++)
1092  {
1093  geoms[i] = lwline_unstroke((LWLINE *)mline->geoms[i]);
1094  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
1095  {
1096  hascurve = 1;
1097  }
1098  }
1099  if (hascurve == 0)
1100  {
1101  for (i=0; i<mline->ngeoms; i++)
1102  {
1103  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
1104  }
1105  return lwgeom_clone((LWGEOM *)mline);
1106  }
1107  return (LWGEOM *)lwcollection_construct(MULTICURVETYPE, mline->srid, NULL, mline->ngeoms, geoms);
1108 }
#define MULTICURVETYPE
Definition: liblwgeom.h:95
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:93
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
int ngeoms
Definition: liblwgeom.h:481
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:444
LWLINE ** geoms
Definition: liblwgeom.h:483
LWGEOM * lwline_unstroke(const LWLINE *line)
Definition: lwstroke.c:1045
type
Definition: ovdump.py:41
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
void * lwalloc(size_t size)
Definition: lwutil.c:229
int32_t srid
Definition: liblwgeom.h:480
Here is the call graph for this function:
Here is the caller graph for this function: