PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ gserialized_from_lwpoint()

static size_t gserialized_from_lwpoint ( const LWPOINT point,
uint8_t *  buf 
)
static

Definition at line 588 of file g_serialized.c.

References POINTARRAY::flags, LWPOINT::flags, FLAGS_GET_ZM, getPoint_internal(), LWDEBUGF, lwerror(), POINTARRAY::npoints, LWPOINT::point, POINTTYPE, ptarray_point_size(), and ovdump::type.

Referenced by gserialized_from_lwgeom_any().

589 {
590  uint8_t *loc;
591  int ptsize = ptarray_point_size(point->point);
592  int type = POINTTYPE;
593 
594  assert(point);
595  assert(buf);
596 
597  if ( FLAGS_GET_ZM(point->flags) != FLAGS_GET_ZM(point->point->flags) )
598  lwerror("Dimensions mismatch in lwpoint");
599 
600  LWDEBUGF(2, "lwpoint_to_gserialized(%p, %p) called", point, buf);
601 
602  loc = buf;
603 
604  /* Write in the type. */
605  memcpy(loc, &type, sizeof(uint32_t));
606  loc += sizeof(uint32_t);
607  /* Write in the number of points (0 => empty). */
608  memcpy(loc, &(point->point->npoints), sizeof(uint32_t));
609  loc += sizeof(uint32_t);
610 
611  /* Copy in the ordinates. */
612  if ( point->point->npoints > 0 )
613  {
614  memcpy(loc, getPoint_internal(point->point, 0), ptsize);
615  loc += ptsize;
616  }
617 
618  return (size_t)(loc - buf);
619 }
int npoints
Definition: liblwgeom.h:370
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:152
POINTARRAY * point
Definition: liblwgeom.h:410
uint8_t flags
Definition: liblwgeom.h:368
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1713
int ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:54
uint8_t flags
Definition: liblwgeom.h:407
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
type
Definition: ovdump.py:41
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102
Here is the call graph for this function:
Here is the caller graph for this function: