PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ ptarray_close2d()

POINTARRAY * ptarray_close2d ( POINTARRAY ring)

Definition at line 173 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 lwgeom_make_geos_friendly(), and ring_make_geos_friendly().

174 {
175  POINTARRAY* newring;
176 
177  /* close the ring if not already closed (2d only) */
178  if (!ptarray_is_closed_2d(ring))
179  {
180  /* close it up */
181  newring = ptarray_addPoint(ring, getPoint_internal(ring, 0), FLAGS_NDIMS(ring->flags), ring->npoints);
182  ring = newring;
183  }
184  return ring;
185 }
int ptarray_is_closed_2d(const POINTARRAY *pa)
Definition: ptarray.c:688
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
uint8_t flags
Definition: liblwgeom.h:371
uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: ptarray.c:1743
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:151
uint32_t npoints
Definition: liblwgeom.h:373
Here is the call graph for this function:
Here is the caller graph for this function: