PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ ptarray_removePoint()

POINTARRAY* ptarray_removePoint ( POINTARRAY pa,
uint32_t  where 
)

Remove a point from a pointarray.

Parameters
where- is the offset (starting at 0)
Returns
POINTARRAY is newly allocated

Definition at line 582 of file ptarray.c.

583 {
584  POINTARRAY *ret;
585  size_t ptsize = ptarray_point_size(pa);
586 
587  LWDEBUGF(3, "pa %p which %u", pa, which);
588 
589  assert(which <= pa->npoints-1);
590  assert(pa->npoints >= 3);
591 
593  FLAGS_GET_M(pa->flags), pa->npoints-1);
594 
595  /* copy initial part */
596  if ( which )
597  {
598  memcpy(getPoint_internal(ret, 0), getPoint_internal(pa, 0), ptsize*which);
599  }
600 
601  /* copy final part */
602  if ( which < pa->npoints-1 )
603  {
604  memcpy(getPoint_internal(ret, which), getPoint_internal(pa, which+1),
605  ptsize*(pa->npoints-which-1));
606  }
607 
608  return ret;
609 }
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:165
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:166
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:106
static size_t ptarray_point_size(const POINTARRAY *pa)
Definition: lwinline.h:56
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: lwinline.h:75
POINTARRAY * ptarray_construct(char hasz, char hasm, uint32_t npoints)
Construct an empty pointarray, allocating storage and setting the npoints, but not filling in any inf...
Definition: ptarray.c:51
lwflags_t flags
Definition: liblwgeom.h:431
uint32_t npoints
Definition: liblwgeom.h:427

References POINTARRAY::flags, FLAGS_GET_M, FLAGS_GET_Z, getPoint_internal(), LWDEBUGF, POINTARRAY::npoints, ptarray_construct(), and ptarray_point_size().

Referenced by lwcircstring_removepoint(), and lwline_removepoint().

Here is the call graph for this function:
Here is the caller graph for this function: