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

◆ gserialized1_from_lwcircstring()

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

Definition at line 912 of file gserialized1.c.

913{
914 uint8_t *loc;
915 int ptsize;
916 size_t size;
917 int type = CIRCSTRINGTYPE;
918
919 assert(curve);
920 assert(buf);
921
922 if (FLAGS_GET_ZM(curve->flags) != FLAGS_GET_ZM(curve->points->flags))
923 lwerror("Dimensions mismatch in lwcircstring");
924
925
926 ptsize = ptarray_point_size(curve->points);
927 loc = buf;
928
929 /* Write in the type. */
930 memcpy(loc, &type, sizeof(uint32_t));
931 loc += sizeof(uint32_t);
932
933 /* Write in the npoints. */
934 memcpy(loc, &curve->points->npoints, sizeof(uint32_t));
935 loc += sizeof(uint32_t);
936
937 /* Copy in the ordinates. */
938 if ( curve->points->npoints > 0 )
939 {
940 size = curve->points->npoints * ptsize;
941 memcpy(loc, getPoint_internal(curve->points, 0), size);
942 loc += size;
943 }
944
945 return (size_t)(loc - buf);
946}
#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 gserialized1_from_lwgeom_any().

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