PostGIS  2.2.7dev-r@@SVN_REVISION@@
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 309 of file ptarray.c.

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

Referenced by lwpoint_from_wkb_state(), and ptarray_from_wkb_state().

310 {
311  POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
312 
313  pa->flags = gflags(hasz, hasm, 0);
314  pa->npoints = npoints;
315  pa->maxpoints = npoints;
316 
317  if ( npoints > 0 )
318  {
319  pa->serialized_pointlist = lwalloc(ptarray_point_size(pa) * npoints);
320  memcpy(pa->serialized_pointlist, ptlist, ptarray_point_size(pa) * npoints);
321  }
322  else
323  {
324  pa->serialized_pointlist = NULL;
325  }
326 
327  return pa;
328 }
uint8_t * serialized_pointlist
Definition: liblwgeom.h:350
int ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:54
int npoints
Definition: liblwgeom.h:355
uint8_t flags
Definition: liblwgeom.h:353
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:130
int maxpoints
Definition: liblwgeom.h:356
void * lwalloc(size_t size)
Definition: lwutil.c:199

Here is the call graph for this function:

Here is the caller graph for this function: