PostGIS  2.2.7dev-r@@SVN_REVISION@@
LWMLINE * lwmcurve_stroke ( const LWMCURVE mcurve,
uint32_t  perQuad 
)

Definition at line 333 of file lwstroke.c.

References CIRCSTRINGTYPE, COMPOUNDTYPE, LWMCURVE::flags, FLAGS_NDIMS, LWMCURVE::geoms, LINETYPE, lwalloc(), lwcircstring_stroke(), lwcollection_construct(), lwcompound_stroke(), LWDEBUGF, lwerror(), lwline_construct(), MULTILINETYPE, LWMCURVE::ngeoms, ptarray_clone_deep(), LWMCURVE::srid, and LWGEOM::type.

Referenced by lwgeom_stroke().

334 {
335  LWMLINE *ogeom;
336  LWGEOM **lines;
337  int i;
338 
339  LWDEBUGF(2, "lwmcurve_stroke called, geoms=%d, dim=%d.", mcurve->ngeoms, FLAGS_NDIMS(mcurve->flags));
340 
341  lines = lwalloc(sizeof(LWGEOM *)*mcurve->ngeoms);
342 
343  for (i = 0; i < mcurve->ngeoms; i++)
344  {
345  const LWGEOM *tmp = mcurve->geoms[i];
346  if (tmp->type == CIRCSTRINGTYPE)
347  {
348  lines[i] = (LWGEOM *)lwcircstring_stroke((LWCIRCSTRING *)tmp, perQuad);
349  }
350  else if (tmp->type == LINETYPE)
351  {
352  lines[i] = (LWGEOM *)lwline_construct(mcurve->srid, NULL, ptarray_clone_deep(((LWLINE *)tmp)->points));
353  }
354  else if (tmp->type == COMPOUNDTYPE)
355  {
356  lines[i] = (LWGEOM *)lwcompound_stroke((LWCOMPOUND *)tmp, perQuad);
357  }
358  else
359  {
360  lwerror("Unsupported geometry found in MultiCurve.");
361  return NULL;
362  }
363  }
364 
365  ogeom = (LWMLINE *)lwcollection_construct(MULTILINETYPE, mcurve->srid, NULL, mcurve->ngeoms, lines);
366  return ogeom;
367 }
int ngeoms
Definition: liblwgeom.h:530
#define LINETYPE
Definition: liblwgeom.h:71
uint8_t flags
Definition: liblwgeom.h:527
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:30
#define COMPOUNDTYPE
Definition: liblwgeom.h:78
int32_t srid
Definition: liblwgeom.h:529
LWLINE * lwcircstring_stroke(const LWCIRCSTRING *icurve, uint32_t perQuad)
Definition: lwstroke.c:190
LWLINE * lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
Definition: lwline.c:29
LWLINE * lwcompound_stroke(const LWCOMPOUND *icompound, uint32_t perQuad)
Definition: lwstroke.c:242
POINTARRAY * ptarray_clone_deep(const POINTARRAY *ptarray)
Deep clone a pointarray (also clones serialized pointlist)
Definition: ptarray.c:634
LWGEOM ** geoms
Definition: liblwgeom.h:532
uint8_t type
Definition: liblwgeom.h:380
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
void * lwalloc(size_t size)
Definition: lwutil.c:199
#define MULTILINETYPE
Definition: liblwgeom.h:74
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:136
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74

Here is the call graph for this function:

Here is the caller graph for this function: