PostGIS  2.5.0dev-r@@SVN_REVISION@@
POINTARRAY * ptarray_close2d ( POINTARRAY ring)

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

References POINTARRAY::flags, FLAGS_NDIMS, getPoint_internal(), POINTARRAY::npoints, ptarray_addPoint(), and ptarray_is_closed_2d().

Referenced by ring_make_geos_friendly().

177 {
178  POINTARRAY* newring;
179 
180  /* close the ring if not already closed (2d only) */
181  if ( ! ptarray_is_closed_2d(ring) )
182  {
183  /* close it up */
184  newring = ptarray_addPoint(ring,
185  getPoint_internal(ring, 0),
186  FLAGS_NDIMS(ring->flags),
187  ring->npoints);
188  ring = newring;
189  }
190  return ring;
191 }
int ptarray_is_closed_2d(const POINTARRAY *pa)
Definition: ptarray.c:690
POINTARRAY * ptarray_addPoint(const POINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where)
Add a point in a pointarray.
Definition: ptarray.c:505
uint8_t flags
Definition: liblwgeom.h:368
uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: ptarray.c:1745
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:151
uint32_t npoints
Definition: liblwgeom.h:370

Here is the call graph for this function:

Here is the caller graph for this function: