PostGIS  2.1.10dev-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 294 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().

295 {
296  POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
297 
298  pa->flags = gflags(hasz, hasm, 0);
299  pa->npoints = npoints;
300  pa->maxpoints = npoints;
301 
302  if ( npoints > 0 )
303  {
304  pa->serialized_pointlist = lwalloc(ptarray_point_size(pa) * npoints);
305  memcpy(pa->serialized_pointlist, ptlist, ptarray_point_size(pa) * npoints);
306  }
307  else
308  {
309  pa->serialized_pointlist = NULL;
310  }
311 
312  return pa;
313 }
uint8_t * serialized_pointlist
Definition: liblwgeom.h:322
int ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:41
int npoints
Definition: liblwgeom.h:327
uint8_t flags
Definition: liblwgeom.h:325
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:131
int maxpoints
Definition: liblwgeom.h:328
void * lwalloc(size_t size)
Definition: lwutil.c:175

Here is the call graph for this function:

Here is the caller graph for this function: