PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ ptarray_remove_point()

int ptarray_remove_point ( POINTARRAY pa,
uint32_t  where 
)
extern

Remove a point from an existing POINTARRAY.

Zero is the index of the start of the array.

Definition at line 259 of file ptarray.c.

260{
261 /* Check for pathology */
262 if( ! pa )
263 {
264 lwerror("ptarray_remove_point: null input");
265 return LW_FAILURE;
266 }
267
268 /* Error on invalid offset value */
269 if ( where >= pa->npoints )
270 {
271 lwerror("ptarray_remove_point: offset out of range (%d)", where);
272 return LW_FAILURE;
273 }
274
275 /* If the point is any but the last, we need to copy the data back one point */
276 if (where < pa->npoints - 1)
277 memmove(getPoint_internal(pa, where),
278 getPoint_internal(pa, where + 1),
279 ptarray_point_size(pa) * (pa->npoints - where - 1));
280
281 /* We have one less point */
282 pa->npoints--;
283
284 return LW_SUCCESS;
285}
#define LW_FAILURE
Definition liblwgeom.h:96
#define LW_SUCCESS
Definition liblwgeom.h:97
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition lwinline.h:75
static size_t ptarray_point_size(const POINTARRAY *pa)
Definition lwinline.h:56
uint32_t npoints
Definition liblwgeom.h:427

References getPoint_internal(), LW_FAILURE, LW_SUCCESS, lwerror(), POINTARRAY::npoints, and ptarray_point_size().

Referenced by asgml3_gbox(), and lwarc_linearize().

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