PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ ptarray_construct_reference_data()

POINTARRAY* ptarray_construct_reference_data ( char  hasz,
char  hasm,
uint32_t  npoints,
uint8_t ptlist 
)

Build a new POINTARRAY, but on top of someone else's ordinate array.

Construct a new POINTARRAY, referencing to the data from ptlist.

Flag as read-only, so that ptarray_free() does not free the serialized_ptlist

Definition at line 293 of file ptarray.c.

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

Referenced by lwcircstring_from_gserialized_buffer(), lwcircstring_from_lwmpoint(), lwcircstring_from_lwpointarray(), lwline_from_gserialized_buffer(), lwpoint_from_gserialized_buffer(), lwpoly_from_gserialized_buffer(), lwtriangle_from_gserialized_buffer(), and test_gbox_from_spherical_coordinates().

294 {
295  POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
296  LWDEBUGF(5, "hasz = %d, hasm = %d, npoints = %d, ptlist = %p", hasz, hasm, npoints, ptlist);
297  pa->flags = gflags(hasz, hasm, 0);
298  FLAGS_SET_READONLY(pa->flags, 1); /* We don't own this memory, so we can't alter or free it. */
299  pa->npoints = npoints;
300  pa->maxpoints = npoints;
301  pa->serialized_pointlist = ptlist;
302  return pa;
303 }
uint8_t * serialized_pointlist
Definition: liblwgeom.h:368
uint32_t maxpoints
Definition: liblwgeom.h:374
uint8_t flags
Definition: liblwgeom.h:371
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
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
#define FLAGS_SET_READONLY(flags, value)
Definition: liblwgeom.h:149
uint32_t npoints
Definition: liblwgeom.h:373
Here is the call graph for this function:
Here is the caller graph for this function: