PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ ptarray_close2d()

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 lwgeom_make_geos_friendly(), and 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 npoints
Definition: liblwgeom.h:371
int ptarray_is_closed_2d(const POINTARRAY *pa)
Definition: ptarray.c:697
POINTARRAY * ptarray_addPoint(const POINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where)
Add a point in a pointarray.
Definition: ptarray.c:504
uint8_t flags
Definition: liblwgeom.h:369
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1753
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:152
Here is the call graph for this function:
Here is the caller graph for this function: