PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ ring_make_geos_friendly()

POINTARRAY * ring_make_geos_friendly ( POINTARRAY ring)

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

192 {
193  POINTARRAY* closedring;
194  POINTARRAY* ring_in = ring;
195 
196  /* close the ring if not already closed (2d only) */
197  closedring = ptarray_close2d(ring);
198  if (closedring != ring) ring = closedring;
199 
200  /* return 0 for collapsed ring (after closeup) */
201 
202  while (ring->npoints < 4)
203  {
204  POINTARRAY* oring = ring;
205  LWDEBUGF(4, "ring has %d points, adding another", ring->npoints);
206  /* let's add another... */
207  ring = ptarray_addPoint(ring, getPoint_internal(ring, 0), FLAGS_NDIMS(ring->flags), ring->npoints);
208  if (oring != ring_in) ptarray_free(oring);
209  }
210 
211  return ring;
212 }
POINTARRAY * ptarray_close2d(POINTARRAY *ring)
uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: ptarray.c:1750
POINTARRAY * ptarray_addPoint(const POINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where)
Add a point in a pointarray.
Definition: ptarray.c:503
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:152
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:328
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
uint32_t npoints
Definition: liblwgeom.h:374
uint8_t flags
Definition: liblwgeom.h:372

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

Referenced by lwpoly_make_geos_friendly().

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