PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ ring_make_geos_friendly()

POINTARRAY * ring_make_geos_friendly ( POINTARRAY ring)

Definition at line 221 of file liblwgeom/lwgeom_geos_clean.c.

222 {
223  POINTARRAY* closedring;
224  POINTARRAY* ring_in = ring;
225 
227 
228  /* close the ring if not already closed (2d only) */
229  closedring = ptarray_close2d(ring);
230  if (closedring != ring) ring = closedring;
231 
232  /* return 0 for collapsed ring (after closeup) */
233 
234  while (ring->npoints < 4)
235  {
236  POINTARRAY* oring = ring;
237  LWDEBUGF(4, "ring has %d points, adding another", ring->npoints);
238  /* let's add another... */
239  ring = ptarray_addPoint(ring, getPoint_internal(ring, 0), FLAGS_NDIMS(ring->flags), ring->npoints);
240  if (oring != ring_in) ptarray_free(oring);
241  }
242 
243  return ring;
244 }
static POINTARRAY * ptarray_close2d(POINTARRAY *ring)
static void ptarray_strip_nan_coords_in_place(POINTARRAY *pa)
POINTARRAY * ptarray_addPoint(const POINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where)
Add a point in a pointarray.
Definition: ptarray.c:509
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:193
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:327
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: lwinline.h:77
lwflags_t flags
Definition: liblwgeom.h:445
uint32_t npoints
Definition: liblwgeom.h:441

References POINTARRAY::flags, FLAGS_NDIMS, getPoint_internal(), LWDEBUGF, POINTARRAY::npoints, ptarray_addPoint(), ptarray_close2d(), ptarray_free(), and ptarray_strip_nan_coords_in_place().

Referenced by lwpoly_make_geos_friendly().

Here is the call graph for this function:
Here is the caller graph for this function: