PostGIS  2.5.7dev-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 307 of file ptarray.c.

308 {
309  POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
310 
311  pa->flags = gflags(hasz, hasm, 0);
312  pa->npoints = npoints;
313  pa->maxpoints = npoints;
314 
315  if ( npoints > 0 )
316  {
317  pa->serialized_pointlist = lwalloc(ptarray_point_size(pa) * npoints);
318  memcpy(pa->serialized_pointlist, ptlist, ptarray_point_size(pa) * npoints);
319  }
320  else
321  {
322  pa->serialized_pointlist = NULL;
323  }
324 
325  return pa;
326 }
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:145
void * lwalloc(size_t size)
Definition: lwutil.c:229
size_t ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:54
uint32_t maxpoints
Definition: liblwgeom.h:375
uint32_t npoints
Definition: liblwgeom.h:374
uint8_t * serialized_pointlist
Definition: liblwgeom.h:369
uint8_t flags
Definition: liblwgeom.h:372

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().

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