PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ gserialized_from_lwcircstring()

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

Definition at line 999 of file g_serialized.c.

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

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

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