PostGIS  2.3.7dev-r@@SVN_REVISION@@
LWPOLY* lwcurvepoly_stroke ( const LWCURVEPOLY curvepoly,
uint32_t  perQuad 
)

Definition at line 305 of file lwstroke.c.

References CIRCSTRINGTYPE, COMPOUNDTYPE, LINETYPE, lwalloc(), lwcircstring_stroke(), lwcompound_stroke(), LWDEBUG, lwerror(), lwline_free(), lwpoly_construct(), LWCURVEPOLY::nrings, LWLINE::points, ptarray_clone_deep(), LWCURVEPOLY::rings, LWCURVEPOLY::srid, and LWGEOM::type.

Referenced by lwcollection_stroke(), lwcurvepoly_area(), lwgeom_stroke(), and lwmsurface_stroke().

306 {
307  LWPOLY *ogeom;
308  LWGEOM *tmp;
309  LWLINE *line;
310  POINTARRAY **ptarray;
311  int i;
312 
313  LWDEBUG(2, "lwcurvepoly_stroke called.");
314 
315  ptarray = lwalloc(sizeof(POINTARRAY *)*curvepoly->nrings);
316 
317  for (i = 0; i < curvepoly->nrings; i++)
318  {
319  tmp = curvepoly->rings[i];
320  if (tmp->type == CIRCSTRINGTYPE)
321  {
322  line = lwcircstring_stroke((LWCIRCSTRING *)tmp, perQuad);
323  ptarray[i] = ptarray_clone_deep(line->points);
324  lwline_free(line);
325  }
326  else if (tmp->type == LINETYPE)
327  {
328  line = (LWLINE *)tmp;
329  ptarray[i] = ptarray_clone_deep(line->points);
330  }
331  else if (tmp->type == COMPOUNDTYPE)
332  {
333  line = lwcompound_stroke((LWCOMPOUND *)tmp, perQuad);
334  ptarray[i] = ptarray_clone_deep(line->points);
335  lwline_free(line);
336  }
337  else
338  {
339  lwerror("Invalid ring type found in CurvePoly.");
340  return NULL;
341  }
342  }
343 
344  ogeom = lwpoly_construct(curvepoly->srid, NULL, curvepoly->nrings, ptarray);
345  return ogeom;
346 }
#define LINETYPE
Definition: liblwgeom.h:85
LWGEOM ** rings
Definition: liblwgeom.h:534
#define COMPOUNDTYPE
Definition: liblwgeom.h:92
void lwline_free(LWLINE *line)
Definition: lwline.c:76
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
LWLINE * lwcircstring_stroke(const LWCIRCSTRING *icurve, uint32_t perQuad)
Definition: lwstroke.c:206
int32_t srid
Definition: liblwgeom.h:531
LWPOLY * lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
Definition: lwpoly.c:43
LWLINE * lwcompound_stroke(const LWCOMPOUND *icompound, uint32_t perQuad)
Definition: lwstroke.c:258
POINTARRAY * ptarray_clone_deep(const POINTARRAY *ptarray)
Deep clone a pointarray (also clones serialized pointlist)
Definition: ptarray.c:634
uint8_t type
Definition: liblwgeom.h:395
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
void * lwalloc(size_t size)
Definition: lwutil.c:227
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102
POINTARRAY * points
Definition: liblwgeom.h:421

Here is the call graph for this function:

Here is the caller graph for this function: