PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ gserialized1_from_lwpoint()

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

Definition at line 744 of file gserialized1.c.

745 {
746  uint8_t *loc;
747  int ptsize = ptarray_point_size(point->point);
748  int type = POINTTYPE;
749 
750  assert(point);
751  assert(buf);
752 
753  if ( FLAGS_GET_ZM(point->flags) != FLAGS_GET_ZM(point->point->flags) )
754  lwerror("Dimensions mismatch in lwpoint");
755 
756  LWDEBUGF(2, "%s (%p, %p) called", __func__, point, buf);
757 
758  loc = buf;
759 
760  /* Write in the type. */
761  memcpy(loc, &type, sizeof(uint32_t));
762  loc += sizeof(uint32_t);
763  /* Write in the number of points (0 => empty). */
764  memcpy(loc, &(point->point->npoints), sizeof(uint32_t));
765  loc += sizeof(uint32_t);
766 
767  /* Copy in the ordinates. */
768  if ( point->point->npoints > 0 )
769  {
770  memcpy(loc, getPoint_internal(point->point, 0), ptsize);
771  loc += ptsize;
772  }
773 
774  return (size_t)(loc - buf);
775 }
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:102
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:180
#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:190
static size_t ptarray_point_size(const POINTARRAY *pa)
Definition: lwinline.h:58
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: lwinline.h:77
type
Definition: ovdump.py:42
POINTARRAY * point
Definition: liblwgeom.h:471
lwflags_t flags
Definition: liblwgeom.h:473
lwflags_t flags
Definition: liblwgeom.h:431
uint32_t npoints
Definition: liblwgeom.h:427

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

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