PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ ring_make_geos_friendly()

POINTARRAY * ring_make_geos_friendly ( POINTARRAY ring)

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

223 {
224  POINTARRAY* closedring;
225  POINTARRAY* ring_in = ring;
226 
228 
229  /* close the ring if not already closed (2d only) */
230  closedring = ptarray_close2d(ring);
231  if (closedring != ring) ring = closedring;
232 
233  /* return 0 for collapsed ring (after closeup) */
234 
235  while (ring->npoints < 4)
236  {
237  POINTARRAY* oring = ring;
238  LWDEBUGF(4, "ring has %d points, adding another", ring->npoints);
239  /* let's add another... */
240  ring = ptarray_addPoint(ring, getPoint_internal(ring, 0), FLAGS_NDIMS(ring->flags), ring->npoints);
241  if (oring != ring_in) ptarray_free(oring);
242  }
243 
244  return ring;
245 }
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:522
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:179
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:319
#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:431
uint32_t npoints
Definition: liblwgeom.h:427

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: