PostGIS  2.4.9dev-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 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:366
int ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:54
int npoints
Definition: liblwgeom.h:371
uint8_t flags
Definition: liblwgeom.h:369
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:145
int maxpoints
Definition: liblwgeom.h:372
void * lwalloc(size_t size)
Definition: lwutil.c:229
Here is the call graph for this function:
Here is the caller graph for this function: