PostGIS  3.1.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 305 of file ptarray.c.

306 {
307  POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
308 
309  pa->flags = lwflags(hasz, hasm, 0);
310  pa->npoints = npoints;
311  pa->maxpoints = npoints;
312 
313  if ( npoints > 0 )
314  {
315  pa->serialized_pointlist = lwalloc(ptarray_point_size(pa) * npoints);
316  memcpy(pa->serialized_pointlist, ptlist, ptarray_point_size(pa) * npoints);
317  }
318  else
319  {
320  pa->serialized_pointlist = NULL;
321  }
322 
323  return pa;
324 }
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:58
lwflags_t flags
Definition: liblwgeom.h:445
uint32_t maxpoints
Definition: liblwgeom.h:442
uint32_t npoints
Definition: liblwgeom.h:441
uint8_t * serialized_pointlist
Definition: liblwgeom.h:448

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: