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

◆ gserialized2_from_lwcircstring()

static size_t gserialized2_from_lwcircstring ( const LWCIRCSTRING curve,
uint8_t *  buf 
)
static

Definition at line 1003 of file gserialized2.c.

1004{
1005 uint8_t *loc;
1006 int ptsize;
1007 size_t size;
1008 int type = CIRCSTRINGTYPE;
1009
1010 assert(curve);
1011 assert(buf);
1012
1013 if (FLAGS_GET_ZM(curve->flags) != FLAGS_GET_ZM(curve->points->flags))
1014 lwerror("Dimensions mismatch in lwcircstring");
1015
1016
1017 ptsize = ptarray_point_size(curve->points);
1018 loc = buf;
1019
1020 /* Write in the type. */
1021 memcpy(loc, &type, sizeof(uint32_t));
1022 loc += sizeof(uint32_t);
1023
1024 /* Write in the npoints. */
1025 memcpy(loc, &curve->points->npoints, sizeof(uint32_t));
1026 loc += sizeof(uint32_t);
1027
1028 /* Copy in the ordinates. */
1029 if (curve->points->npoints > 0)
1030 {
1031 size = curve->points->npoints * ptsize;
1032 memcpy(loc, getPoint_internal(curve->points, 0), size);
1033 loc += size;
1034 }
1035
1036 return (size_t)(loc - buf);
1037}
#define CIRCSTRINGTYPE
Definition liblwgeom.h:123
#define FLAGS_GET_ZM(flags)
Definition liblwgeom.h:194
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
lwflags_t flags
Definition liblwgeom.h:495
POINTARRAY * points
Definition liblwgeom.h:493
lwflags_t flags
Definition liblwgeom.h:417
uint32_t npoints
Definition liblwgeom.h:413

References CIRCSTRINGTYPE, POINTARRAY::flags, LWCIRCSTRING::flags, FLAGS_GET_ZM, getPoint_internal(), lwerror(), POINTARRAY::npoints, LWCIRCSTRING::points, and ptarray_point_size().

Referenced by gserialized2_from_lwgeom_any().

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