Insert a point into an existing POINTARRAY.
Zero is the index of the start of the array.
Definition at line 96 of file ptarray.c.
References POINTARRAY::flags, FLAGS_GET_READONLY, getPoint_internal(), LW_FAILURE, LW_SUCCESS, lwalloc(), LWDEBUGF, lwerror(), lwrealloc(), POINTARRAY::maxpoints, POINTARRAY::npoints, ptarray_point_size(), ptarray_set_point4d(), and POINTARRAY::serialized_pointlist.
Referenced by geography_centroid_from_mpoly(), lwline_add_lwpoint(), lwt_AddPoint(), ptarray_append_point(), and test_ptarray_insert_point().
99 LWDEBUGF(5,
"pa = %p; p = %p; where = %d", pa, p, where);
104 lwerror(
"ptarray_insert_point: called on read-only point array");
109 if ( where > pa->
npoints || where < 0)
111 lwerror(
"ptarray_insert_point: offset out of range (%d)", where);
138 if( where < pa->npoints )
140 size_t copy_size = point_size * (pa->
npoints - where);
142 LWDEBUGF(5,
"copying %d bytes to start vertex %d from start vertex %d", copy_size, where+1, where);
150 LWDEBUGF(5,
"copying new point to start vertex %d", point_size, where);
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
uint8_t * serialized_pointlist
int ptarray_point_size(const POINTARRAY *pa)
#define FLAGS_GET_READONLY(flags)
void * lwrealloc(void *mem, size_t size)
void * lwalloc(size_t size)
#define LWDEBUGF(level, msg,...)
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.