PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ getPoint4d_cp()

const POINT4D* getPoint4d_cp ( const POINTARRAY pa,
uint32_t  n 
)

Returns a POINT4D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.

This is very high performance and declared const because you aren't allowed to muck with the values, only read them.

Definition at line 398 of file lwgeom_api.c.

References POINTARRAY::flags, FLAGS_GET_M, FLAGS_GET_Z, getPoint_internal(), lwerror(), and POINTARRAY::npoints.

399 {
400  if (!pa) return 0;
401 
402  if (!(FLAGS_GET_Z(pa->flags) && FLAGS_GET_M(pa->flags)))
403  {
404  lwerror("getPoint4d_cp: no Z and M coordinates in point array");
405  return 0; /*error */
406  }
407 
408  if (n >= pa->npoints)
409  {
410  lwerror("getPoint4d_cp: point offset out of range");
411  return 0; /*error */
412  }
413 
414  return (const POINT4D*)getPoint_internal(pa, n);
415 }
uint8_t flags
Definition: liblwgeom.h:371
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:139
uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: ptarray.c:1743
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:140
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
uint32_t npoints
Definition: liblwgeom.h:373
Here is the call graph for this function: