PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ gserialized_from_lwcircstring()

static size_t gserialized_from_lwcircstring ( const LWCIRCSTRING curve,
uint8_t buf 
)
static

Definition at line 1001 of file g_serialized.c.

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

Referenced by gserialized_from_lwgeom_any().

1002 {
1003  uint8_t *loc;
1004  int ptsize;
1005  size_t size;
1006  int type = CIRCSTRINGTYPE;
1007 
1008  assert(curve);
1009  assert(buf);
1010 
1011  if (FLAGS_GET_ZM(curve->flags) != FLAGS_GET_ZM(curve->points->flags))
1012  lwerror("Dimensions mismatch in lwcircstring");
1013 
1014 
1015  ptsize = ptarray_point_size(curve->points);
1016  loc = buf;
1017 
1018  /* Write in the type. */
1019  memcpy(loc, &type, sizeof(uint32_t));
1020  loc += sizeof(uint32_t);
1021 
1022  /* Write in the npoints. */
1023  memcpy(loc, &curve->points->npoints, sizeof(uint32_t));
1024  loc += sizeof(uint32_t);
1025 
1026  /* Copy in the ordinates. */
1027  if ( curve->points->npoints > 0 )
1028  {
1029  size = curve->points->npoints * ptsize;
1030  memcpy(loc, getPoint_internal(curve->points, 0), size);
1031  loc += size;
1032  }
1033 
1034  return (size_t)(loc - buf);
1035 }
uint8_t flags
Definition: liblwgeom.h:441
int npoints
Definition: liblwgeom.h:371
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:153
unsigned int uint32_t
Definition: uthash.h:78
uint8_t flags
Definition: liblwgeom.h:369
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1753
int ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:54
type
Definition: ovdump.py:41
POINTARRAY * points
Definition: liblwgeom.h:444
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
unsigned char uint8_t
Definition: uthash.h:79
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
Here is the call graph for this function:
Here is the caller graph for this function: