PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ gserialized_from_lwpoint()

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

Definition at line 561 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().

562 {
563  uint8_t *loc;
564  int ptsize = ptarray_point_size(point->point);
565  int type = POINTTYPE;
566 
567  assert(point);
568  assert(buf);
569 
570  if ( FLAGS_GET_ZM(point->flags) != FLAGS_GET_ZM(point->point->flags) )
571  lwerror("Dimensions mismatch in lwpoint");
572 
573  LWDEBUGF(2, "lwpoint_to_gserialized(%p, %p) called", point, buf);
574 
575  loc = buf;
576 
577  /* Write in the type. */
578  memcpy(loc, &type, sizeof(uint32_t));
579  loc += sizeof(uint32_t);
580  /* Write in the number of points (0 => empty). */
581  memcpy(loc, &(point->point->npoints), sizeof(uint32_t));
582  loc += sizeof(uint32_t);
583 
584  /* Copy in the ordinates. */
585  if ( point->point->npoints > 0 )
586  {
587  memcpy(loc, getPoint_internal(point->point, 0), ptsize);
588  loc += ptsize;
589  }
590 
591  return (size_t)(loc - buf);
592 }
int npoints
Definition: liblwgeom.h:355
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:137
POINTARRAY * point
Definition: liblwgeom.h:395
uint8_t flags
Definition: liblwgeom.h:353
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1706
int ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:54
uint8_t flags
Definition: liblwgeom.h:392
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
type
Definition: ovdump.py:41
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
Here is the call graph for this function:
Here is the caller graph for this function: