PostGIS  2.5.0dev-r@@SVN_REVISION@@
LWPOLY* lwpoly_segmentize2d ( const LWPOLY poly,
double  dist 
)

Definition at line 310 of file lwpoly.c.

References lwalloc(), lwfree(), lwpoly_construct(), LWPOLY::nrings, ptarray_free(), ptarray_segmentize2d(), LWPOLY::rings, and LWPOLY::srid.

Referenced by lwgeom_segmentize2d().

311 {
312  POINTARRAY **newrings;
313  uint32_t i;
314 
315  newrings = lwalloc(sizeof(POINTARRAY *)*poly->nrings);
316  for (i=0; i<poly->nrings; i++)
317  {
318  newrings[i] = ptarray_segmentize2d(poly->rings[i], dist);
319  if ( ! newrings[i] )
320  {
321  uint32_t j = 0;
322  for (j = 0; j < i; j++)
323  ptarray_free(newrings[j]);
324  lwfree(newrings);
325  return NULL;
326  }
327  }
328  return lwpoly_construct(poly->srid, NULL,
329  poly->nrings, newrings);
330 }
void lwfree(void *mem)
Definition: lwutil.c:244
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:328
POINTARRAY * ptarray_segmentize2d(const POINTARRAY *ipa, double dist)
Returns a modified POINTARRAY so that no segment is longer than the given distance (computed using 2d...
Definition: ptarray.c:414
uint32_t nrings
Definition: liblwgeom.h:454
unsigned int uint32_t
Definition: uthash.h:78
LWPOLY * lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
Definition: lwpoly.c:43
POINTARRAY ** rings
Definition: liblwgeom.h:456
int32_t srid
Definition: liblwgeom.h:453
void * lwalloc(size_t size)
Definition: lwutil.c:229

Here is the call graph for this function:

Here is the caller graph for this function: