PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ ptarray_close2d()

POINTARRAY * ptarray_close2d ( POINTARRAY ring)

Definition at line 186 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().

187 {
188  POINTARRAY* newring;
189 
190  /* close the ring if not already closed (2d only) */
191  if ( ! ptarray_is_closed_2d(ring) )
192  {
193  /* close it up */
194  newring = ptarray_addPoint(ring,
195  getPoint_internal(ring, 0),
196  FLAGS_NDIMS(ring->flags),
197  ring->npoints);
198  ring = newring;
199  }
200  return ring;
201 }
int npoints
Definition: liblwgeom.h:355
int ptarray_is_closed_2d(const POINTARRAY *pa)
Definition: ptarray.c:694
POINTARRAY * ptarray_addPoint(const POINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where)
Add a point in a pointarray.
Definition: ptarray.c:509
uint8_t flags
Definition: liblwgeom.h:353
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1706
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:136
Here is the call graph for this function:
Here is the caller graph for this function: