PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwcurvepoly_stroke()

LWPOLY* lwcurvepoly_stroke ( const LWCURVEPOLY curvepoly,
uint32_t  perQuad 
)

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

290 {
291  LWPOLY *ogeom;
292  LWGEOM *tmp;
293  LWLINE *line;
294  POINTARRAY **ptarray;
295  int i;
296 
297  LWDEBUG(2, "lwcurvepoly_stroke called.");
298 
299  ptarray = lwalloc(sizeof(POINTARRAY *)*curvepoly->nrings);
300 
301  for (i = 0; i < curvepoly->nrings; i++)
302  {
303  tmp = curvepoly->rings[i];
304  if (tmp->type == CIRCSTRINGTYPE)
305  {
306  line = lwcircstring_stroke((LWCIRCSTRING *)tmp, perQuad);
307  ptarray[i] = ptarray_clone_deep(line->points);
308  lwline_free(line);
309  }
310  else if (tmp->type == LINETYPE)
311  {
312  line = (LWLINE *)tmp;
313  ptarray[i] = ptarray_clone_deep(line->points);
314  }
315  else if (tmp->type == COMPOUNDTYPE)
316  {
317  line = lwcompound_stroke((LWCOMPOUND *)tmp, perQuad);
318  ptarray[i] = ptarray_clone_deep(line->points);
319  lwline_free(line);
320  }
321  else
322  {
323  lwerror("Invalid ring type found in CurvePoly.");
324  return NULL;
325  }
326  }
327 
328  ogeom = lwpoly_construct(curvepoly->srid, NULL, curvepoly->nrings, ptarray);
329  return ogeom;
330 }
#define LINETYPE
Definition: liblwgeom.h:71
LWGEOM ** rings
Definition: liblwgeom.h:519
#define COMPOUNDTYPE
Definition: liblwgeom.h:78
void lwline_free(LWLINE *line)
Definition: lwline.c:63
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
LWLINE * lwcircstring_stroke(const LWCIRCSTRING *icurve, uint32_t perQuad)
Definition: lwstroke.c:190
int32_t srid
Definition: liblwgeom.h:516
LWPOLY * lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
Definition: lwpoly.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
uint8_t type
Definition: liblwgeom.h:380
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
void * lwalloc(size_t size)
Definition: lwutil.c:199
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
POINTARRAY * points
Definition: liblwgeom.h:406
Here is the call graph for this function:
Here is the caller graph for this function: