PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ ptarray_construct_copy_data()

POINTARRAY* ptarray_construct_copy_data ( char  hasz,
char  hasm,
uint32_t  npoints,
const uint8_t *  ptlist 
)

Construct a new POINTARRAY, copying in the data from ptlist.

Definition at line 297 of file ptarray.c.

298 {
299  POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
300 
301  pa->flags = lwflags(hasz, hasm, 0);
302  pa->npoints = npoints;
303  pa->maxpoints = npoints;
304 
305  if ( npoints > 0 )
306  {
307  pa->serialized_pointlist = lwalloc(ptarray_point_size(pa) * npoints);
308  memcpy(pa->serialized_pointlist, ptlist, ptarray_point_size(pa) * npoints);
309  }
310  else
311  {
312  pa->serialized_pointlist = NULL;
313  }
314 
315  return pa;
316 }
void * lwalloc(size_t size)
Definition: lwutil.c:227
lwflags_t lwflags(int hasz, int hasm, int geodetic)
Construct a new flags bitmask.
Definition: lwutil.c:471
static size_t ptarray_point_size(const POINTARRAY *pa)
Definition: lwinline.h:48
lwflags_t flags
Definition: liblwgeom.h:417
uint32_t maxpoints
Definition: liblwgeom.h:414
uint32_t npoints
Definition: liblwgeom.h:413
uint8_t * serialized_pointlist
Definition: liblwgeom.h:420

References POINTARRAY::flags, lwalloc(), lwflags(), POINTARRAY::maxpoints, POINTARRAY::npoints, ptarray_point_size(), and POINTARRAY::serialized_pointlist.

Referenced by lwpoint_from_wkb_state(), and ptarray_from_wkb_state().

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