PostGIS  2.1.10dev-r@@SVN_REVISION@@
POINTARRAY * ring_make_geos_friendly ( POINTARRAY ring)

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

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

Referenced by lwpoly_make_geos_friendly().

207 {
208  POINTARRAY* closedring;
209 
210  /* close the ring if not already closed (2d only) */
211  closedring = ptarray_close2d(ring);
212  if (closedring != ring )
213  {
214  ptarray_free(ring); /* should we do this ? */
215  ring = closedring;
216  }
217 
218  /* return 0 for collapsed ring (after closeup) */
219 
220  while ( ring->npoints < 4 )
221  {
222  LWDEBUGF(4, "ring has %d points, adding another", ring->npoints);
223  /* let's add another... */
224  ring = ptarray_addPoint(ring,
225  getPoint_internal(ring, 0),
226  FLAGS_NDIMS(ring->flags),
227  ring->npoints);
228  }
229 
230 
231  return ring;
232 }
POINTARRAY * ptarray_close2d(POINTARRAY *ring)
int npoints
Definition: liblwgeom.h:327
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:315
POINTARRAY * ptarray_addPoint(const POINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where)
Add a point in a pointarray.
Definition: ptarray.c:481
uint8_t flags
Definition: liblwgeom.h:325
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1645
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:118

Here is the call graph for this function:

Here is the caller graph for this function: