PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ gserialized1_from_lwpoint()

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

Definition at line 743 of file gserialized1.c.

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

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

Referenced by gserialized1_from_lwgeom_any().

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